diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/GPBMetadata/Google/Cloud/Dataform/V1Beta1/Dataform.php b/owl-bot-staging/Dataform/v1beta1/proto/src/GPBMetadata/Google/Cloud/Dataform/V1Beta1/Dataform.php new file mode 100644 index 000000000000..6b6a0f331191 Binary files /dev/null and b/owl-bot-staging/Dataform/v1beta1/proto/src/GPBMetadata/Google/Cloud/Dataform/V1Beta1/Dataform.php differ diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/CancelWorkflowInvocationRequest.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/CancelWorkflowInvocationRequest.php new file mode 100644 index 000000000000..2e7c0859ce31 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/CancelWorkflowInvocationRequest.php @@ -0,0 +1,67 @@ +google.cloud.dataform.v1beta1.CancelWorkflowInvocationRequest + */ +class CancelWorkflowInvocationRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The workflow invocation resource's name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The workflow invocation resource's name. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + + /** + * Required. The workflow invocation resource's name. + * + * 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 workflow invocation resource's name. + * + * 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; + } + +} + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/CommitAuthor.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/CommitAuthor.php new file mode 100644 index 000000000000..90bc52fb50d3 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/CommitAuthor.php @@ -0,0 +1,101 @@ +google.cloud.dataform.v1beta1.CommitAuthor + */ +class CommitAuthor extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The commit author's name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $name = ''; + /** + * Required. The commit author's email address. + * + * Generated from protobuf field string email_address = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $email_address = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The commit author's name. + * @type string $email_address + * Required. The commit author's email address. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + + /** + * Required. The commit author's name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The commit author's name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Required. The commit author's email address. + * + * Generated from protobuf field string email_address = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getEmailAddress() + { + return $this->email_address; + } + + /** + * Required. The commit author's email address. + * + * Generated from protobuf field string email_address = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setEmailAddress($var) + { + GPBUtil::checkString($var, True); + $this->email_address = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/CommitWorkspaceChangesRequest.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/CommitWorkspaceChangesRequest.php new file mode 100644 index 000000000000..e23db1332c62 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/CommitWorkspaceChangesRequest.php @@ -0,0 +1,183 @@ +google.cloud.dataform.v1beta1.CommitWorkspaceChangesRequest + */ +class CommitWorkspaceChangesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The workspace's name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Required. The commit's author. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.CommitAuthor author = 4 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $author = null; + /** + * Optional. The commit's message. + * + * Generated from protobuf field string commit_message = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $commit_message = ''; + /** + * Optional. Full file paths to commit including filename, rooted at workspace root. If + * left empty, all files will be committed. + * + * Generated from protobuf field repeated string paths = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $paths; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The workspace's name. + * @type \Google\Cloud\Dataform\V1beta1\CommitAuthor $author + * Required. The commit's author. + * @type string $commit_message + * Optional. The commit's message. + * @type array|\Google\Protobuf\Internal\RepeatedField $paths + * Optional. Full file paths to commit including filename, rooted at workspace root. If + * left empty, all files will be committed. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + + /** + * Required. The workspace's name. + * + * 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 workspace's name. + * + * 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; + } + + /** + * Required. The commit's author. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.CommitAuthor author = 4 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Dataform\V1beta1\CommitAuthor|null + */ + public function getAuthor() + { + return $this->author; + } + + public function hasAuthor() + { + return isset($this->author); + } + + public function clearAuthor() + { + unset($this->author); + } + + /** + * Required. The commit's author. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.CommitAuthor author = 4 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Dataform\V1beta1\CommitAuthor $var + * @return $this + */ + public function setAuthor($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dataform\V1beta1\CommitAuthor::class); + $this->author = $var; + + return $this; + } + + /** + * Optional. The commit's message. + * + * Generated from protobuf field string commit_message = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getCommitMessage() + { + return $this->commit_message; + } + + /** + * Optional. The commit's message. + * + * Generated from protobuf field string commit_message = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setCommitMessage($var) + { + GPBUtil::checkString($var, True); + $this->commit_message = $var; + + return $this; + } + + /** + * Optional. Full file paths to commit including filename, rooted at workspace root. If + * left empty, all files will be committed. + * + * Generated from protobuf field repeated string paths = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getPaths() + { + return $this->paths; + } + + /** + * Optional. Full file paths to commit including filename, rooted at workspace root. If + * left empty, all files will be committed. + * + * Generated from protobuf field repeated string paths = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setPaths($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->paths = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/CompilationResult.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/CompilationResult.php new file mode 100644 index 000000000000..13e36c93fe5a --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/CompilationResult.php @@ -0,0 +1,276 @@ +google.cloud.dataform.v1beta1.CompilationResult + */ +class CompilationResult extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The compilation result's name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $name = ''; + /** + * Immutable. If set, fields of `code_compilation_overrides` override the default + * compilation settings that are specified in dataform.json. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.CompilationResult.CodeCompilationConfig code_compilation_config = 4 [(.google.api.field_behavior) = IMMUTABLE]; + */ + protected $code_compilation_config = null; + /** + * Output only. The version of `@dataform/core` that was used for compilation. + * + * Generated from protobuf field string dataform_core_version = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $dataform_core_version = ''; + /** + * Output only. Errors encountered during project compilation. + * + * Generated from protobuf field repeated .google.cloud.dataform.v1beta1.CompilationResult.CompilationError compilation_errors = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $compilation_errors; + protected $source; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Output only. The compilation result's name. + * @type string $git_commitish + * Immutable. Git commit/tag/branch name at which the repository should be compiled. + * Must exist in the remote repository. + * Examples: + * - a commit SHA: `12ade345` + * - a tag: `tag1` + * - a branch name: `branch1` + * @type string $workspace + * Immutable. The name of the workspace to compile. Must be in the format + * `projects/*/locations/*/repositories/*/workspaces/*`. + * @type \Google\Cloud\Dataform\V1beta1\CompilationResult\CodeCompilationConfig $code_compilation_config + * Immutable. If set, fields of `code_compilation_overrides` override the default + * compilation settings that are specified in dataform.json. + * @type string $dataform_core_version + * Output only. The version of `@dataform/core` that was used for compilation. + * @type array<\Google\Cloud\Dataform\V1beta1\CompilationResult\CompilationError>|\Google\Protobuf\Internal\RepeatedField $compilation_errors + * Output only. Errors encountered during project compilation. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The compilation result's name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Output only. The compilation result's name. + * + * 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; + } + + /** + * Immutable. Git commit/tag/branch name at which the repository should be compiled. + * Must exist in the remote repository. + * Examples: + * - a commit SHA: `12ade345` + * - a tag: `tag1` + * - a branch name: `branch1` + * + * Generated from protobuf field string git_commitish = 2 [(.google.api.field_behavior) = IMMUTABLE]; + * @return string + */ + public function getGitCommitish() + { + return $this->readOneof(2); + } + + public function hasGitCommitish() + { + return $this->hasOneof(2); + } + + /** + * Immutable. Git commit/tag/branch name at which the repository should be compiled. + * Must exist in the remote repository. + * Examples: + * - a commit SHA: `12ade345` + * - a tag: `tag1` + * - a branch name: `branch1` + * + * Generated from protobuf field string git_commitish = 2 [(.google.api.field_behavior) = IMMUTABLE]; + * @param string $var + * @return $this + */ + public function setGitCommitish($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * Immutable. The name of the workspace to compile. Must be in the format + * `projects/*/locations/*/repositories/*/workspaces/*`. + * + * Generated from protobuf field string workspace = 3 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.resource_reference) = { + * @return string + */ + public function getWorkspace() + { + return $this->readOneof(3); + } + + public function hasWorkspace() + { + return $this->hasOneof(3); + } + + /** + * Immutable. The name of the workspace to compile. Must be in the format + * `projects/*/locations/*/repositories/*/workspaces/*`. + * + * Generated from protobuf field string workspace = 3 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setWorkspace($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * Immutable. If set, fields of `code_compilation_overrides` override the default + * compilation settings that are specified in dataform.json. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.CompilationResult.CodeCompilationConfig code_compilation_config = 4 [(.google.api.field_behavior) = IMMUTABLE]; + * @return \Google\Cloud\Dataform\V1beta1\CompilationResult\CodeCompilationConfig|null + */ + public function getCodeCompilationConfig() + { + return $this->code_compilation_config; + } + + public function hasCodeCompilationConfig() + { + return isset($this->code_compilation_config); + } + + public function clearCodeCompilationConfig() + { + unset($this->code_compilation_config); + } + + /** + * Immutable. If set, fields of `code_compilation_overrides` override the default + * compilation settings that are specified in dataform.json. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.CompilationResult.CodeCompilationConfig code_compilation_config = 4 [(.google.api.field_behavior) = IMMUTABLE]; + * @param \Google\Cloud\Dataform\V1beta1\CompilationResult\CodeCompilationConfig $var + * @return $this + */ + public function setCodeCompilationConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dataform\V1beta1\CompilationResult\CodeCompilationConfig::class); + $this->code_compilation_config = $var; + + return $this; + } + + /** + * Output only. The version of `@dataform/core` that was used for compilation. + * + * Generated from protobuf field string dataform_core_version = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getDataformCoreVersion() + { + return $this->dataform_core_version; + } + + /** + * Output only. The version of `@dataform/core` that was used for compilation. + * + * Generated from protobuf field string dataform_core_version = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setDataformCoreVersion($var) + { + GPBUtil::checkString($var, True); + $this->dataform_core_version = $var; + + return $this; + } + + /** + * Output only. Errors encountered during project compilation. + * + * Generated from protobuf field repeated .google.cloud.dataform.v1beta1.CompilationResult.CompilationError compilation_errors = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getCompilationErrors() + { + return $this->compilation_errors; + } + + /** + * Output only. Errors encountered during project compilation. + * + * Generated from protobuf field repeated .google.cloud.dataform.v1beta1.CompilationResult.CompilationError compilation_errors = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array<\Google\Cloud\Dataform\V1beta1\CompilationResult\CompilationError>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setCompilationErrors($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dataform\V1beta1\CompilationResult\CompilationError::class); + $this->compilation_errors = $arr; + + return $this; + } + + /** + * @return string + */ + public function getSource() + { + return $this->whichOneof("source"); + } + +} + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/CompilationResult/CodeCompilationConfig.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/CompilationResult/CodeCompilationConfig.php new file mode 100644 index 000000000000..74b0e485f2f7 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/CompilationResult/CodeCompilationConfig.php @@ -0,0 +1,328 @@ +google.cloud.dataform.v1beta1.CompilationResult.CodeCompilationConfig + */ +class CodeCompilationConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. The default database (Google Cloud project ID). + * + * Generated from protobuf field string default_database = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $default_database = ''; + /** + * Optional. The default schema (BigQuery dataset ID). + * + * Generated from protobuf field string default_schema = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $default_schema = ''; + /** + * Optional. The default BigQuery location to use. Defaults to "US". + * See the BigQuery docs for a full list of locations: + * https://cloud.google.com/bigquery/docs/locations. + * + * Generated from protobuf field string default_location = 8 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $default_location = ''; + /** + * Optional. The default schema (BigQuery dataset ID) for assertions. + * + * Generated from protobuf field string assertion_schema = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $assertion_schema = ''; + /** + * Optional. User-defined variables that are made available to project code during + * compilation. + * + * Generated from protobuf field map vars = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $vars; + /** + * Optional. The suffix that should be appended to all database (Google Cloud project + * ID) names. + * + * Generated from protobuf field string database_suffix = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $database_suffix = ''; + /** + * Optional. The suffix that should be appended to all schema (BigQuery dataset ID) + * names. + * + * Generated from protobuf field string schema_suffix = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $schema_suffix = ''; + /** + * Optional. The prefix that should be prepended to all table names. + * + * Generated from protobuf field string table_prefix = 7 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $table_prefix = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $default_database + * Optional. The default database (Google Cloud project ID). + * @type string $default_schema + * Optional. The default schema (BigQuery dataset ID). + * @type string $default_location + * Optional. The default BigQuery location to use. Defaults to "US". + * See the BigQuery docs for a full list of locations: + * https://cloud.google.com/bigquery/docs/locations. + * @type string $assertion_schema + * Optional. The default schema (BigQuery dataset ID) for assertions. + * @type array|\Google\Protobuf\Internal\MapField $vars + * Optional. User-defined variables that are made available to project code during + * compilation. + * @type string $database_suffix + * Optional. The suffix that should be appended to all database (Google Cloud project + * ID) names. + * @type string $schema_suffix + * Optional. The suffix that should be appended to all schema (BigQuery dataset ID) + * names. + * @type string $table_prefix + * Optional. The prefix that should be prepended to all table names. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + + /** + * Optional. The default database (Google Cloud project ID). + * + * Generated from protobuf field string default_database = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getDefaultDatabase() + { + return $this->default_database; + } + + /** + * Optional. The default database (Google Cloud project ID). + * + * Generated from protobuf field string default_database = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setDefaultDatabase($var) + { + GPBUtil::checkString($var, True); + $this->default_database = $var; + + return $this; + } + + /** + * Optional. The default schema (BigQuery dataset ID). + * + * Generated from protobuf field string default_schema = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getDefaultSchema() + { + return $this->default_schema; + } + + /** + * Optional. The default schema (BigQuery dataset ID). + * + * Generated from protobuf field string default_schema = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setDefaultSchema($var) + { + GPBUtil::checkString($var, True); + $this->default_schema = $var; + + return $this; + } + + /** + * Optional. The default BigQuery location to use. Defaults to "US". + * See the BigQuery docs for a full list of locations: + * https://cloud.google.com/bigquery/docs/locations. + * + * Generated from protobuf field string default_location = 8 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getDefaultLocation() + { + return $this->default_location; + } + + /** + * Optional. The default BigQuery location to use. Defaults to "US". + * See the BigQuery docs for a full list of locations: + * https://cloud.google.com/bigquery/docs/locations. + * + * Generated from protobuf field string default_location = 8 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setDefaultLocation($var) + { + GPBUtil::checkString($var, True); + $this->default_location = $var; + + return $this; + } + + /** + * Optional. The default schema (BigQuery dataset ID) for assertions. + * + * Generated from protobuf field string assertion_schema = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getAssertionSchema() + { + return $this->assertion_schema; + } + + /** + * Optional. The default schema (BigQuery dataset ID) for assertions. + * + * Generated from protobuf field string assertion_schema = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setAssertionSchema($var) + { + GPBUtil::checkString($var, True); + $this->assertion_schema = $var; + + return $this; + } + + /** + * Optional. User-defined variables that are made available to project code during + * compilation. + * + * Generated from protobuf field map vars = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\MapField + */ + public function getVars() + { + return $this->vars; + } + + /** + * Optional. User-defined variables that are made available to project code during + * compilation. + * + * Generated from protobuf field map vars = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setVars($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->vars = $arr; + + return $this; + } + + /** + * Optional. The suffix that should be appended to all database (Google Cloud project + * ID) names. + * + * Generated from protobuf field string database_suffix = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getDatabaseSuffix() + { + return $this->database_suffix; + } + + /** + * Optional. The suffix that should be appended to all database (Google Cloud project + * ID) names. + * + * Generated from protobuf field string database_suffix = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setDatabaseSuffix($var) + { + GPBUtil::checkString($var, True); + $this->database_suffix = $var; + + return $this; + } + + /** + * Optional. The suffix that should be appended to all schema (BigQuery dataset ID) + * names. + * + * Generated from protobuf field string schema_suffix = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getSchemaSuffix() + { + return $this->schema_suffix; + } + + /** + * Optional. The suffix that should be appended to all schema (BigQuery dataset ID) + * names. + * + * Generated from protobuf field string schema_suffix = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setSchemaSuffix($var) + { + GPBUtil::checkString($var, True); + $this->schema_suffix = $var; + + return $this; + } + + /** + * Optional. The prefix that should be prepended to all table names. + * + * Generated from protobuf field string table_prefix = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getTablePrefix() + { + return $this->table_prefix; + } + + /** + * Optional. The prefix that should be prepended to all table names. + * + * Generated from protobuf field string table_prefix = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setTablePrefix($var) + { + GPBUtil::checkString($var, True); + $this->table_prefix = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(CodeCompilationConfig::class, \Google\Cloud\Dataform\V1beta1\CompilationResult_CodeCompilationConfig::class); + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/CompilationResult/CompilationError.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/CompilationResult/CompilationError.php new file mode 100644 index 000000000000..f80e205e1272 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/CompilationResult/CompilationError.php @@ -0,0 +1,186 @@ +google.cloud.dataform.v1beta1.CompilationResult.CompilationError + */ +class CompilationError extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The error's top level message. + * + * Generated from protobuf field string message = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $message = ''; + /** + * Output only. The error's full stack trace. + * + * Generated from protobuf field string stack = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $stack = ''; + /** + * Output only. The path of the file where this error occurred, if available, relative to + * the project root. + * + * Generated from protobuf field string path = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $path = ''; + /** + * Output only. The identifier of the action where this error occurred, if available. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.Target action_target = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $action_target = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $message + * Output only. The error's top level message. + * @type string $stack + * Output only. The error's full stack trace. + * @type string $path + * Output only. The path of the file where this error occurred, if available, relative to + * the project root. + * @type \Google\Cloud\Dataform\V1beta1\Target $action_target + * Output only. The identifier of the action where this error occurred, if available. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The error's top level message. + * + * Generated from protobuf field string message = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getMessage() + { + return $this->message; + } + + /** + * Output only. The error's top level message. + * + * Generated from protobuf field string message = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setMessage($var) + { + GPBUtil::checkString($var, True); + $this->message = $var; + + return $this; + } + + /** + * Output only. The error's full stack trace. + * + * Generated from protobuf field string stack = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getStack() + { + return $this->stack; + } + + /** + * Output only. The error's full stack trace. + * + * Generated from protobuf field string stack = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setStack($var) + { + GPBUtil::checkString($var, True); + $this->stack = $var; + + return $this; + } + + /** + * Output only. The path of the file where this error occurred, if available, relative to + * the project root. + * + * Generated from protobuf field string path = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getPath() + { + return $this->path; + } + + /** + * Output only. The path of the file where this error occurred, if available, relative to + * the project root. + * + * Generated from protobuf field string path = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setPath($var) + { + GPBUtil::checkString($var, True); + $this->path = $var; + + return $this; + } + + /** + * Output only. The identifier of the action where this error occurred, if available. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.Target action_target = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\Dataform\V1beta1\Target|null + */ + public function getActionTarget() + { + return $this->action_target; + } + + public function hasActionTarget() + { + return isset($this->action_target); + } + + public function clearActionTarget() + { + unset($this->action_target); + } + + /** + * Output only. The identifier of the action where this error occurred, if available. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.Target action_target = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\Dataform\V1beta1\Target $var + * @return $this + */ + public function setActionTarget($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dataform\V1beta1\Target::class); + $this->action_target = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(CompilationError::class, \Google\Cloud\Dataform\V1beta1\CompilationResult_CompilationError::class); + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/CompilationResultAction.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/CompilationResultAction.php new file mode 100644 index 000000000000..0a727609866c --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/CompilationResultAction.php @@ -0,0 +1,304 @@ +google.cloud.dataform.v1beta1.CompilationResultAction + */ +class CompilationResultAction extends \Google\Protobuf\Internal\Message +{ + /** + * This action's identifier. Unique within the compilation result. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.Target target = 1; + */ + protected $target = null; + /** + * The action's identifier if the project had been compiled without any + * overrides configured. Unique within the compilation result. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.Target canonical_target = 2; + */ + protected $canonical_target = null; + /** + * The full path including filename in which this action is located, relative + * to the workspace root. + * + * Generated from protobuf field string file_path = 3; + */ + protected $file_path = ''; + protected $compiled_object; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Dataform\V1beta1\Target $target + * This action's identifier. Unique within the compilation result. + * @type \Google\Cloud\Dataform\V1beta1\Target $canonical_target + * The action's identifier if the project had been compiled without any + * overrides configured. Unique within the compilation result. + * @type string $file_path + * The full path including filename in which this action is located, relative + * to the workspace root. + * @type \Google\Cloud\Dataform\V1beta1\CompilationResultAction\Relation $relation + * The database relation created/updated by this action. + * @type \Google\Cloud\Dataform\V1beta1\CompilationResultAction\Operations $operations + * The database operations executed by this action. + * @type \Google\Cloud\Dataform\V1beta1\CompilationResultAction\Assertion $assertion + * The assertion executed by this action. + * @type \Google\Cloud\Dataform\V1beta1\CompilationResultAction\Declaration $declaration + * The declaration declared by this action. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + + /** + * This action's identifier. Unique within the compilation result. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.Target target = 1; + * @return \Google\Cloud\Dataform\V1beta1\Target|null + */ + public function getTarget() + { + return $this->target; + } + + public function hasTarget() + { + return isset($this->target); + } + + public function clearTarget() + { + unset($this->target); + } + + /** + * This action's identifier. Unique within the compilation result. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.Target target = 1; + * @param \Google\Cloud\Dataform\V1beta1\Target $var + * @return $this + */ + public function setTarget($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dataform\V1beta1\Target::class); + $this->target = $var; + + return $this; + } + + /** + * The action's identifier if the project had been compiled without any + * overrides configured. Unique within the compilation result. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.Target canonical_target = 2; + * @return \Google\Cloud\Dataform\V1beta1\Target|null + */ + public function getCanonicalTarget() + { + return $this->canonical_target; + } + + public function hasCanonicalTarget() + { + return isset($this->canonical_target); + } + + public function clearCanonicalTarget() + { + unset($this->canonical_target); + } + + /** + * The action's identifier if the project had been compiled without any + * overrides configured. Unique within the compilation result. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.Target canonical_target = 2; + * @param \Google\Cloud\Dataform\V1beta1\Target $var + * @return $this + */ + public function setCanonicalTarget($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dataform\V1beta1\Target::class); + $this->canonical_target = $var; + + return $this; + } + + /** + * The full path including filename in which this action is located, relative + * to the workspace root. + * + * Generated from protobuf field string file_path = 3; + * @return string + */ + public function getFilePath() + { + return $this->file_path; + } + + /** + * The full path including filename in which this action is located, relative + * to the workspace root. + * + * Generated from protobuf field string file_path = 3; + * @param string $var + * @return $this + */ + public function setFilePath($var) + { + GPBUtil::checkString($var, True); + $this->file_path = $var; + + return $this; + } + + /** + * The database relation created/updated by this action. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.CompilationResultAction.Relation relation = 4; + * @return \Google\Cloud\Dataform\V1beta1\CompilationResultAction\Relation|null + */ + public function getRelation() + { + return $this->readOneof(4); + } + + public function hasRelation() + { + return $this->hasOneof(4); + } + + /** + * The database relation created/updated by this action. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.CompilationResultAction.Relation relation = 4; + * @param \Google\Cloud\Dataform\V1beta1\CompilationResultAction\Relation $var + * @return $this + */ + public function setRelation($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dataform\V1beta1\CompilationResultAction\Relation::class); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * The database operations executed by this action. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.CompilationResultAction.Operations operations = 5; + * @return \Google\Cloud\Dataform\V1beta1\CompilationResultAction\Operations|null + */ + public function getOperations() + { + return $this->readOneof(5); + } + + public function hasOperations() + { + return $this->hasOneof(5); + } + + /** + * The database operations executed by this action. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.CompilationResultAction.Operations operations = 5; + * @param \Google\Cloud\Dataform\V1beta1\CompilationResultAction\Operations $var + * @return $this + */ + public function setOperations($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dataform\V1beta1\CompilationResultAction\Operations::class); + $this->writeOneof(5, $var); + + return $this; + } + + /** + * The assertion executed by this action. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.CompilationResultAction.Assertion assertion = 6; + * @return \Google\Cloud\Dataform\V1beta1\CompilationResultAction\Assertion|null + */ + public function getAssertion() + { + return $this->readOneof(6); + } + + public function hasAssertion() + { + return $this->hasOneof(6); + } + + /** + * The assertion executed by this action. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.CompilationResultAction.Assertion assertion = 6; + * @param \Google\Cloud\Dataform\V1beta1\CompilationResultAction\Assertion $var + * @return $this + */ + public function setAssertion($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dataform\V1beta1\CompilationResultAction\Assertion::class); + $this->writeOneof(6, $var); + + return $this; + } + + /** + * The declaration declared by this action. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.CompilationResultAction.Declaration declaration = 7; + * @return \Google\Cloud\Dataform\V1beta1\CompilationResultAction\Declaration|null + */ + public function getDeclaration() + { + return $this->readOneof(7); + } + + public function hasDeclaration() + { + return $this->hasOneof(7); + } + + /** + * The declaration declared by this action. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.CompilationResultAction.Declaration declaration = 7; + * @param \Google\Cloud\Dataform\V1beta1\CompilationResultAction\Declaration $var + * @return $this + */ + public function setDeclaration($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dataform\V1beta1\CompilationResultAction\Declaration::class); + $this->writeOneof(7, $var); + + return $this; + } + + /** + * @return string + */ + public function getCompiledObject() + { + return $this->whichOneof("compiled_object"); + } + +} + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/CompilationResultAction/Assertion.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/CompilationResultAction/Assertion.php new file mode 100644 index 000000000000..22202f67b388 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/CompilationResultAction/Assertion.php @@ -0,0 +1,273 @@ +google.cloud.dataform.v1beta1.CompilationResultAction.Assertion + */ +class Assertion extends \Google\Protobuf\Internal\Message +{ + /** + * A list of actions that this action depends on. + * + * Generated from protobuf field repeated .google.cloud.dataform.v1beta1.Target dependency_targets = 1; + */ + private $dependency_targets; + /** + * The parent action of this assertion. Only set if this assertion was + * automatically generated. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.Target parent_action = 5; + */ + protected $parent_action = null; + /** + * Whether this action is disabled (i.e. should not be run). + * + * Generated from protobuf field bool disabled = 2; + */ + protected $disabled = false; + /** + * Arbitrary, user-defined tags on this action. + * + * Generated from protobuf field repeated string tags = 3; + */ + private $tags; + /** + * The SELECT query which must return zero rows in order for this assertion + * to succeed. + * + * Generated from protobuf field string select_query = 4; + */ + protected $select_query = ''; + /** + * Descriptor for the assertion's automatically-generated view and its + * columns. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.RelationDescriptor relation_descriptor = 6; + */ + protected $relation_descriptor = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Dataform\V1beta1\Target>|\Google\Protobuf\Internal\RepeatedField $dependency_targets + * A list of actions that this action depends on. + * @type \Google\Cloud\Dataform\V1beta1\Target $parent_action + * The parent action of this assertion. Only set if this assertion was + * automatically generated. + * @type bool $disabled + * Whether this action is disabled (i.e. should not be run). + * @type array|\Google\Protobuf\Internal\RepeatedField $tags + * Arbitrary, user-defined tags on this action. + * @type string $select_query + * The SELECT query which must return zero rows in order for this assertion + * to succeed. + * @type \Google\Cloud\Dataform\V1beta1\RelationDescriptor $relation_descriptor + * Descriptor for the assertion's automatically-generated view and its + * columns. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + + /** + * A list of actions that this action depends on. + * + * Generated from protobuf field repeated .google.cloud.dataform.v1beta1.Target dependency_targets = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDependencyTargets() + { + return $this->dependency_targets; + } + + /** + * A list of actions that this action depends on. + * + * Generated from protobuf field repeated .google.cloud.dataform.v1beta1.Target dependency_targets = 1; + * @param array<\Google\Cloud\Dataform\V1beta1\Target>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDependencyTargets($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dataform\V1beta1\Target::class); + $this->dependency_targets = $arr; + + return $this; + } + + /** + * The parent action of this assertion. Only set if this assertion was + * automatically generated. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.Target parent_action = 5; + * @return \Google\Cloud\Dataform\V1beta1\Target|null + */ + public function getParentAction() + { + return $this->parent_action; + } + + public function hasParentAction() + { + return isset($this->parent_action); + } + + public function clearParentAction() + { + unset($this->parent_action); + } + + /** + * The parent action of this assertion. Only set if this assertion was + * automatically generated. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.Target parent_action = 5; + * @param \Google\Cloud\Dataform\V1beta1\Target $var + * @return $this + */ + public function setParentAction($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dataform\V1beta1\Target::class); + $this->parent_action = $var; + + return $this; + } + + /** + * Whether this action is disabled (i.e. should not be run). + * + * Generated from protobuf field bool disabled = 2; + * @return bool + */ + public function getDisabled() + { + return $this->disabled; + } + + /** + * Whether this action is disabled (i.e. should not be run). + * + * Generated from protobuf field bool disabled = 2; + * @param bool $var + * @return $this + */ + public function setDisabled($var) + { + GPBUtil::checkBool($var); + $this->disabled = $var; + + return $this; + } + + /** + * Arbitrary, user-defined tags on this action. + * + * Generated from protobuf field repeated string tags = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTags() + { + return $this->tags; + } + + /** + * Arbitrary, user-defined tags on this action. + * + * Generated from protobuf field repeated string tags = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTags($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->tags = $arr; + + return $this; + } + + /** + * The SELECT query which must return zero rows in order for this assertion + * to succeed. + * + * Generated from protobuf field string select_query = 4; + * @return string + */ + public function getSelectQuery() + { + return $this->select_query; + } + + /** + * The SELECT query which must return zero rows in order for this assertion + * to succeed. + * + * Generated from protobuf field string select_query = 4; + * @param string $var + * @return $this + */ + public function setSelectQuery($var) + { + GPBUtil::checkString($var, True); + $this->select_query = $var; + + return $this; + } + + /** + * Descriptor for the assertion's automatically-generated view and its + * columns. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.RelationDescriptor relation_descriptor = 6; + * @return \Google\Cloud\Dataform\V1beta1\RelationDescriptor|null + */ + public function getRelationDescriptor() + { + return $this->relation_descriptor; + } + + public function hasRelationDescriptor() + { + return isset($this->relation_descriptor); + } + + public function clearRelationDescriptor() + { + unset($this->relation_descriptor); + } + + /** + * Descriptor for the assertion's automatically-generated view and its + * columns. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.RelationDescriptor relation_descriptor = 6; + * @param \Google\Cloud\Dataform\V1beta1\RelationDescriptor $var + * @return $this + */ + public function setRelationDescriptor($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dataform\V1beta1\RelationDescriptor::class); + $this->relation_descriptor = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Assertion::class, \Google\Cloud\Dataform\V1beta1\CompilationResultAction_Assertion::class); + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/CompilationResultAction/Declaration.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/CompilationResultAction/Declaration.php new file mode 100644 index 000000000000..1d20d7b3f3c2 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/CompilationResultAction/Declaration.php @@ -0,0 +1,85 @@ +google.cloud.dataform.v1beta1.CompilationResultAction.Declaration + */ +class Declaration extends \Google\Protobuf\Internal\Message +{ + /** + * Descriptor for the relation and its columns. Used as documentation only, + * i.e. values here will result in no changes to the relation's metadata. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.RelationDescriptor relation_descriptor = 1; + */ + protected $relation_descriptor = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Dataform\V1beta1\RelationDescriptor $relation_descriptor + * Descriptor for the relation and its columns. Used as documentation only, + * i.e. values here will result in no changes to the relation's metadata. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + + /** + * Descriptor for the relation and its columns. Used as documentation only, + * i.e. values here will result in no changes to the relation's metadata. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.RelationDescriptor relation_descriptor = 1; + * @return \Google\Cloud\Dataform\V1beta1\RelationDescriptor|null + */ + public function getRelationDescriptor() + { + return $this->relation_descriptor; + } + + public function hasRelationDescriptor() + { + return isset($this->relation_descriptor); + } + + public function clearRelationDescriptor() + { + unset($this->relation_descriptor); + } + + /** + * Descriptor for the relation and its columns. Used as documentation only, + * i.e. values here will result in no changes to the relation's metadata. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.RelationDescriptor relation_descriptor = 1; + * @param \Google\Cloud\Dataform\V1beta1\RelationDescriptor $var + * @return $this + */ + public function setRelationDescriptor($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dataform\V1beta1\RelationDescriptor::class); + $this->relation_descriptor = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Declaration::class, \Google\Cloud\Dataform\V1beta1\CompilationResultAction_Declaration::class); + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/CompilationResultAction/Operations.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/CompilationResultAction/Operations.php new file mode 100644 index 000000000000..4c5726990cf5 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/CompilationResultAction/Operations.php @@ -0,0 +1,258 @@ +google.cloud.dataform.v1beta1.CompilationResultAction.Operations + */ +class Operations extends \Google\Protobuf\Internal\Message +{ + /** + * A list of actions that this action depends on. + * + * Generated from protobuf field repeated .google.cloud.dataform.v1beta1.Target dependency_targets = 1; + */ + private $dependency_targets; + /** + * Whether this action is disabled (i.e. should not be run). + * + * Generated from protobuf field bool disabled = 2; + */ + protected $disabled = false; + /** + * Arbitrary, user-defined tags on this action. + * + * Generated from protobuf field repeated string tags = 3; + */ + private $tags; + /** + * Descriptor for any output relation and its columns. Only set if + * `has_output` is true. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.RelationDescriptor relation_descriptor = 6; + */ + protected $relation_descriptor = null; + /** + * A list of arbitrary SQL statements that will be executed without + * alteration. + * + * Generated from protobuf field repeated string queries = 4; + */ + private $queries; + /** + * Whether these operations produce an output relation. + * + * Generated from protobuf field bool has_output = 5; + */ + protected $has_output = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Dataform\V1beta1\Target>|\Google\Protobuf\Internal\RepeatedField $dependency_targets + * A list of actions that this action depends on. + * @type bool $disabled + * Whether this action is disabled (i.e. should not be run). + * @type array|\Google\Protobuf\Internal\RepeatedField $tags + * Arbitrary, user-defined tags on this action. + * @type \Google\Cloud\Dataform\V1beta1\RelationDescriptor $relation_descriptor + * Descriptor for any output relation and its columns. Only set if + * `has_output` is true. + * @type array|\Google\Protobuf\Internal\RepeatedField $queries + * A list of arbitrary SQL statements that will be executed without + * alteration. + * @type bool $has_output + * Whether these operations produce an output relation. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + + /** + * A list of actions that this action depends on. + * + * Generated from protobuf field repeated .google.cloud.dataform.v1beta1.Target dependency_targets = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDependencyTargets() + { + return $this->dependency_targets; + } + + /** + * A list of actions that this action depends on. + * + * Generated from protobuf field repeated .google.cloud.dataform.v1beta1.Target dependency_targets = 1; + * @param array<\Google\Cloud\Dataform\V1beta1\Target>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDependencyTargets($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dataform\V1beta1\Target::class); + $this->dependency_targets = $arr; + + return $this; + } + + /** + * Whether this action is disabled (i.e. should not be run). + * + * Generated from protobuf field bool disabled = 2; + * @return bool + */ + public function getDisabled() + { + return $this->disabled; + } + + /** + * Whether this action is disabled (i.e. should not be run). + * + * Generated from protobuf field bool disabled = 2; + * @param bool $var + * @return $this + */ + public function setDisabled($var) + { + GPBUtil::checkBool($var); + $this->disabled = $var; + + return $this; + } + + /** + * Arbitrary, user-defined tags on this action. + * + * Generated from protobuf field repeated string tags = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTags() + { + return $this->tags; + } + + /** + * Arbitrary, user-defined tags on this action. + * + * Generated from protobuf field repeated string tags = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTags($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->tags = $arr; + + return $this; + } + + /** + * Descriptor for any output relation and its columns. Only set if + * `has_output` is true. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.RelationDescriptor relation_descriptor = 6; + * @return \Google\Cloud\Dataform\V1beta1\RelationDescriptor|null + */ + public function getRelationDescriptor() + { + return $this->relation_descriptor; + } + + public function hasRelationDescriptor() + { + return isset($this->relation_descriptor); + } + + public function clearRelationDescriptor() + { + unset($this->relation_descriptor); + } + + /** + * Descriptor for any output relation and its columns. Only set if + * `has_output` is true. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.RelationDescriptor relation_descriptor = 6; + * @param \Google\Cloud\Dataform\V1beta1\RelationDescriptor $var + * @return $this + */ + public function setRelationDescriptor($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dataform\V1beta1\RelationDescriptor::class); + $this->relation_descriptor = $var; + + return $this; + } + + /** + * A list of arbitrary SQL statements that will be executed without + * alteration. + * + * Generated from protobuf field repeated string queries = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getQueries() + { + return $this->queries; + } + + /** + * A list of arbitrary SQL statements that will be executed without + * alteration. + * + * Generated from protobuf field repeated string queries = 4; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setQueries($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->queries = $arr; + + return $this; + } + + /** + * Whether these operations produce an output relation. + * + * Generated from protobuf field bool has_output = 5; + * @return bool + */ + public function getHasOutput() + { + return $this->has_output; + } + + /** + * Whether these operations produce an output relation. + * + * Generated from protobuf field bool has_output = 5; + * @param bool $var + * @return $this + */ + public function setHasOutput($var) + { + GPBUtil::checkBool($var); + $this->has_output = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Operations::class, \Google\Cloud\Dataform\V1beta1\CompilationResultAction_Operations::class); + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/CompilationResultAction/Relation.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/CompilationResultAction/Relation.php new file mode 100644 index 000000000000..89200a6f3a15 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/CompilationResultAction/Relation.php @@ -0,0 +1,552 @@ +google.cloud.dataform.v1beta1.CompilationResultAction.Relation + */ +class Relation extends \Google\Protobuf\Internal\Message +{ + /** + * A list of actions that this action depends on. + * + * Generated from protobuf field repeated .google.cloud.dataform.v1beta1.Target dependency_targets = 1; + */ + private $dependency_targets; + /** + * Whether this action is disabled (i.e. should not be run). + * + * Generated from protobuf field bool disabled = 2; + */ + protected $disabled = false; + /** + * Arbitrary, user-defined tags on this action. + * + * Generated from protobuf field repeated string tags = 3; + */ + private $tags; + /** + * Descriptor for the relation and its columns. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.RelationDescriptor relation_descriptor = 4; + */ + protected $relation_descriptor = null; + /** + * The type of this relation. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.CompilationResultAction.Relation.RelationType relation_type = 5; + */ + protected $relation_type = 0; + /** + * The SELECT query which returns rows which this relation should contain. + * + * Generated from protobuf field string select_query = 6; + */ + protected $select_query = ''; + /** + * SQL statements to be executed before creating the relation. + * + * Generated from protobuf field repeated string pre_operations = 7; + */ + private $pre_operations; + /** + * SQL statements to be executed after creating the relation. + * + * Generated from protobuf field repeated string post_operations = 8; + */ + private $post_operations; + /** + * Configures `INCREMENTAL_TABLE` settings for this relation. Only set if + * `relation_type` is `INCREMENTAL_TABLE`. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.CompilationResultAction.Relation.IncrementalTableConfig incremental_table_config = 9; + */ + protected $incremental_table_config = null; + /** + * The SQL expression used to partition the relation. + * + * Generated from protobuf field string partition_expression = 10; + */ + protected $partition_expression = ''; + /** + * A list of columns or SQL expressions used to cluster the table. + * + * Generated from protobuf field repeated string cluster_expressions = 11; + */ + private $cluster_expressions; + /** + * Sets the partition expiration in days. + * + * Generated from protobuf field int32 partition_expiration_days = 12; + */ + protected $partition_expiration_days = 0; + /** + * Specifies whether queries on this table must include a predicate filter + * that filters on the partitioning column. + * + * Generated from protobuf field bool require_partition_filter = 13; + */ + protected $require_partition_filter = false; + /** + * Additional options that will be provided as key/value pairs into the + * options clause of a create table/view statement. See + * https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language + * for more information on which options are supported. + * + * Generated from protobuf field map additional_options = 14; + */ + private $additional_options; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Dataform\V1beta1\Target>|\Google\Protobuf\Internal\RepeatedField $dependency_targets + * A list of actions that this action depends on. + * @type bool $disabled + * Whether this action is disabled (i.e. should not be run). + * @type array|\Google\Protobuf\Internal\RepeatedField $tags + * Arbitrary, user-defined tags on this action. + * @type \Google\Cloud\Dataform\V1beta1\RelationDescriptor $relation_descriptor + * Descriptor for the relation and its columns. + * @type int $relation_type + * The type of this relation. + * @type string $select_query + * The SELECT query which returns rows which this relation should contain. + * @type array|\Google\Protobuf\Internal\RepeatedField $pre_operations + * SQL statements to be executed before creating the relation. + * @type array|\Google\Protobuf\Internal\RepeatedField $post_operations + * SQL statements to be executed after creating the relation. + * @type \Google\Cloud\Dataform\V1beta1\CompilationResultAction\Relation\IncrementalTableConfig $incremental_table_config + * Configures `INCREMENTAL_TABLE` settings for this relation. Only set if + * `relation_type` is `INCREMENTAL_TABLE`. + * @type string $partition_expression + * The SQL expression used to partition the relation. + * @type array|\Google\Protobuf\Internal\RepeatedField $cluster_expressions + * A list of columns or SQL expressions used to cluster the table. + * @type int $partition_expiration_days + * Sets the partition expiration in days. + * @type bool $require_partition_filter + * Specifies whether queries on this table must include a predicate filter + * that filters on the partitioning column. + * @type array|\Google\Protobuf\Internal\MapField $additional_options + * Additional options that will be provided as key/value pairs into the + * options clause of a create table/view statement. See + * https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language + * for more information on which options are supported. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + + /** + * A list of actions that this action depends on. + * + * Generated from protobuf field repeated .google.cloud.dataform.v1beta1.Target dependency_targets = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDependencyTargets() + { + return $this->dependency_targets; + } + + /** + * A list of actions that this action depends on. + * + * Generated from protobuf field repeated .google.cloud.dataform.v1beta1.Target dependency_targets = 1; + * @param array<\Google\Cloud\Dataform\V1beta1\Target>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDependencyTargets($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dataform\V1beta1\Target::class); + $this->dependency_targets = $arr; + + return $this; + } + + /** + * Whether this action is disabled (i.e. should not be run). + * + * Generated from protobuf field bool disabled = 2; + * @return bool + */ + public function getDisabled() + { + return $this->disabled; + } + + /** + * Whether this action is disabled (i.e. should not be run). + * + * Generated from protobuf field bool disabled = 2; + * @param bool $var + * @return $this + */ + public function setDisabled($var) + { + GPBUtil::checkBool($var); + $this->disabled = $var; + + return $this; + } + + /** + * Arbitrary, user-defined tags on this action. + * + * Generated from protobuf field repeated string tags = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTags() + { + return $this->tags; + } + + /** + * Arbitrary, user-defined tags on this action. + * + * Generated from protobuf field repeated string tags = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTags($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->tags = $arr; + + return $this; + } + + /** + * Descriptor for the relation and its columns. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.RelationDescriptor relation_descriptor = 4; + * @return \Google\Cloud\Dataform\V1beta1\RelationDescriptor|null + */ + public function getRelationDescriptor() + { + return $this->relation_descriptor; + } + + public function hasRelationDescriptor() + { + return isset($this->relation_descriptor); + } + + public function clearRelationDescriptor() + { + unset($this->relation_descriptor); + } + + /** + * Descriptor for the relation and its columns. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.RelationDescriptor relation_descriptor = 4; + * @param \Google\Cloud\Dataform\V1beta1\RelationDescriptor $var + * @return $this + */ + public function setRelationDescriptor($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dataform\V1beta1\RelationDescriptor::class); + $this->relation_descriptor = $var; + + return $this; + } + + /** + * The type of this relation. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.CompilationResultAction.Relation.RelationType relation_type = 5; + * @return int + */ + public function getRelationType() + { + return $this->relation_type; + } + + /** + * The type of this relation. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.CompilationResultAction.Relation.RelationType relation_type = 5; + * @param int $var + * @return $this + */ + public function setRelationType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Dataform\V1beta1\CompilationResultAction\Relation\RelationType::class); + $this->relation_type = $var; + + return $this; + } + + /** + * The SELECT query which returns rows which this relation should contain. + * + * Generated from protobuf field string select_query = 6; + * @return string + */ + public function getSelectQuery() + { + return $this->select_query; + } + + /** + * The SELECT query which returns rows which this relation should contain. + * + * Generated from protobuf field string select_query = 6; + * @param string $var + * @return $this + */ + public function setSelectQuery($var) + { + GPBUtil::checkString($var, True); + $this->select_query = $var; + + return $this; + } + + /** + * SQL statements to be executed before creating the relation. + * + * Generated from protobuf field repeated string pre_operations = 7; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getPreOperations() + { + return $this->pre_operations; + } + + /** + * SQL statements to be executed before creating the relation. + * + * Generated from protobuf field repeated string pre_operations = 7; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setPreOperations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->pre_operations = $arr; + + return $this; + } + + /** + * SQL statements to be executed after creating the relation. + * + * Generated from protobuf field repeated string post_operations = 8; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getPostOperations() + { + return $this->post_operations; + } + + /** + * SQL statements to be executed after creating the relation. + * + * Generated from protobuf field repeated string post_operations = 8; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setPostOperations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->post_operations = $arr; + + return $this; + } + + /** + * Configures `INCREMENTAL_TABLE` settings for this relation. Only set if + * `relation_type` is `INCREMENTAL_TABLE`. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.CompilationResultAction.Relation.IncrementalTableConfig incremental_table_config = 9; + * @return \Google\Cloud\Dataform\V1beta1\CompilationResultAction\Relation\IncrementalTableConfig|null + */ + public function getIncrementalTableConfig() + { + return $this->incremental_table_config; + } + + public function hasIncrementalTableConfig() + { + return isset($this->incremental_table_config); + } + + public function clearIncrementalTableConfig() + { + unset($this->incremental_table_config); + } + + /** + * Configures `INCREMENTAL_TABLE` settings for this relation. Only set if + * `relation_type` is `INCREMENTAL_TABLE`. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.CompilationResultAction.Relation.IncrementalTableConfig incremental_table_config = 9; + * @param \Google\Cloud\Dataform\V1beta1\CompilationResultAction\Relation\IncrementalTableConfig $var + * @return $this + */ + public function setIncrementalTableConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dataform\V1beta1\CompilationResultAction\Relation\IncrementalTableConfig::class); + $this->incremental_table_config = $var; + + return $this; + } + + /** + * The SQL expression used to partition the relation. + * + * Generated from protobuf field string partition_expression = 10; + * @return string + */ + public function getPartitionExpression() + { + return $this->partition_expression; + } + + /** + * The SQL expression used to partition the relation. + * + * Generated from protobuf field string partition_expression = 10; + * @param string $var + * @return $this + */ + public function setPartitionExpression($var) + { + GPBUtil::checkString($var, True); + $this->partition_expression = $var; + + return $this; + } + + /** + * A list of columns or SQL expressions used to cluster the table. + * + * Generated from protobuf field repeated string cluster_expressions = 11; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getClusterExpressions() + { + return $this->cluster_expressions; + } + + /** + * A list of columns or SQL expressions used to cluster the table. + * + * Generated from protobuf field repeated string cluster_expressions = 11; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setClusterExpressions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->cluster_expressions = $arr; + + return $this; + } + + /** + * Sets the partition expiration in days. + * + * Generated from protobuf field int32 partition_expiration_days = 12; + * @return int + */ + public function getPartitionExpirationDays() + { + return $this->partition_expiration_days; + } + + /** + * Sets the partition expiration in days. + * + * Generated from protobuf field int32 partition_expiration_days = 12; + * @param int $var + * @return $this + */ + public function setPartitionExpirationDays($var) + { + GPBUtil::checkInt32($var); + $this->partition_expiration_days = $var; + + return $this; + } + + /** + * Specifies whether queries on this table must include a predicate filter + * that filters on the partitioning column. + * + * Generated from protobuf field bool require_partition_filter = 13; + * @return bool + */ + public function getRequirePartitionFilter() + { + return $this->require_partition_filter; + } + + /** + * Specifies whether queries on this table must include a predicate filter + * that filters on the partitioning column. + * + * Generated from protobuf field bool require_partition_filter = 13; + * @param bool $var + * @return $this + */ + public function setRequirePartitionFilter($var) + { + GPBUtil::checkBool($var); + $this->require_partition_filter = $var; + + return $this; + } + + /** + * Additional options that will be provided as key/value pairs into the + * options clause of a create table/view statement. See + * https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language + * for more information on which options are supported. + * + * Generated from protobuf field map additional_options = 14; + * @return \Google\Protobuf\Internal\MapField + */ + public function getAdditionalOptions() + { + return $this->additional_options; + } + + /** + * Additional options that will be provided as key/value pairs into the + * options clause of a create table/view statement. See + * https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language + * for more information on which options are supported. + * + * Generated from protobuf field map additional_options = 14; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setAdditionalOptions($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->additional_options = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Relation::class, \Google\Cloud\Dataform\V1beta1\CompilationResultAction_Relation::class); + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/CompilationResultAction/Relation/IncrementalTableConfig.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/CompilationResultAction/Relation/IncrementalTableConfig.php new file mode 100644 index 000000000000..56ef96d5f042 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/CompilationResultAction/Relation/IncrementalTableConfig.php @@ -0,0 +1,272 @@ +google.cloud.dataform.v1beta1.CompilationResultAction.Relation.IncrementalTableConfig + */ +class IncrementalTableConfig extends \Google\Protobuf\Internal\Message +{ + /** + * The SELECT query which returns rows which should be inserted into the + * relation if it already exists and is not being refreshed. + * + * Generated from protobuf field string incremental_select_query = 1; + */ + protected $incremental_select_query = ''; + /** + * Whether this table should be protected from being refreshed. + * + * Generated from protobuf field bool refresh_disabled = 2; + */ + protected $refresh_disabled = false; + /** + * A set of columns or SQL expressions used to define row uniqueness. + * If any duplicates are discovered (as defined by `unique_key_parts`), + * only the newly selected rows (as defined by `incremental_select_query`) + * will be included in the relation. + * + * Generated from protobuf field repeated string unique_key_parts = 3; + */ + private $unique_key_parts; + /** + * A SQL expression conditional used to limit the set of existing rows + * considered for a merge operation (see `unique_key_parts` for more + * information). + * + * Generated from protobuf field string update_partition_filter = 4; + */ + protected $update_partition_filter = ''; + /** + * SQL statements to be executed before inserting new rows into the + * relation. + * + * Generated from protobuf field repeated string incremental_pre_operations = 5; + */ + private $incremental_pre_operations; + /** + * SQL statements to be executed after inserting new rows into the + * relation. + * + * Generated from protobuf field repeated string incremental_post_operations = 6; + */ + private $incremental_post_operations; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $incremental_select_query + * The SELECT query which returns rows which should be inserted into the + * relation if it already exists and is not being refreshed. + * @type bool $refresh_disabled + * Whether this table should be protected from being refreshed. + * @type array|\Google\Protobuf\Internal\RepeatedField $unique_key_parts + * A set of columns or SQL expressions used to define row uniqueness. + * If any duplicates are discovered (as defined by `unique_key_parts`), + * only the newly selected rows (as defined by `incremental_select_query`) + * will be included in the relation. + * @type string $update_partition_filter + * A SQL expression conditional used to limit the set of existing rows + * considered for a merge operation (see `unique_key_parts` for more + * information). + * @type array|\Google\Protobuf\Internal\RepeatedField $incremental_pre_operations + * SQL statements to be executed before inserting new rows into the + * relation. + * @type array|\Google\Protobuf\Internal\RepeatedField $incremental_post_operations + * SQL statements to be executed after inserting new rows into the + * relation. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + + /** + * The SELECT query which returns rows which should be inserted into the + * relation if it already exists and is not being refreshed. + * + * Generated from protobuf field string incremental_select_query = 1; + * @return string + */ + public function getIncrementalSelectQuery() + { + return $this->incremental_select_query; + } + + /** + * The SELECT query which returns rows which should be inserted into the + * relation if it already exists and is not being refreshed. + * + * Generated from protobuf field string incremental_select_query = 1; + * @param string $var + * @return $this + */ + public function setIncrementalSelectQuery($var) + { + GPBUtil::checkString($var, True); + $this->incremental_select_query = $var; + + return $this; + } + + /** + * Whether this table should be protected from being refreshed. + * + * Generated from protobuf field bool refresh_disabled = 2; + * @return bool + */ + public function getRefreshDisabled() + { + return $this->refresh_disabled; + } + + /** + * Whether this table should be protected from being refreshed. + * + * Generated from protobuf field bool refresh_disabled = 2; + * @param bool $var + * @return $this + */ + public function setRefreshDisabled($var) + { + GPBUtil::checkBool($var); + $this->refresh_disabled = $var; + + return $this; + } + + /** + * A set of columns or SQL expressions used to define row uniqueness. + * If any duplicates are discovered (as defined by `unique_key_parts`), + * only the newly selected rows (as defined by `incremental_select_query`) + * will be included in the relation. + * + * Generated from protobuf field repeated string unique_key_parts = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUniqueKeyParts() + { + return $this->unique_key_parts; + } + + /** + * A set of columns or SQL expressions used to define row uniqueness. + * If any duplicates are discovered (as defined by `unique_key_parts`), + * only the newly selected rows (as defined by `incremental_select_query`) + * will be included in the relation. + * + * Generated from protobuf field repeated string unique_key_parts = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUniqueKeyParts($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->unique_key_parts = $arr; + + return $this; + } + + /** + * A SQL expression conditional used to limit the set of existing rows + * considered for a merge operation (see `unique_key_parts` for more + * information). + * + * Generated from protobuf field string update_partition_filter = 4; + * @return string + */ + public function getUpdatePartitionFilter() + { + return $this->update_partition_filter; + } + + /** + * A SQL expression conditional used to limit the set of existing rows + * considered for a merge operation (see `unique_key_parts` for more + * information). + * + * Generated from protobuf field string update_partition_filter = 4; + * @param string $var + * @return $this + */ + public function setUpdatePartitionFilter($var) + { + GPBUtil::checkString($var, True); + $this->update_partition_filter = $var; + + return $this; + } + + /** + * SQL statements to be executed before inserting new rows into the + * relation. + * + * Generated from protobuf field repeated string incremental_pre_operations = 5; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getIncrementalPreOperations() + { + return $this->incremental_pre_operations; + } + + /** + * SQL statements to be executed before inserting new rows into the + * relation. + * + * Generated from protobuf field repeated string incremental_pre_operations = 5; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setIncrementalPreOperations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->incremental_pre_operations = $arr; + + return $this; + } + + /** + * SQL statements to be executed after inserting new rows into the + * relation. + * + * Generated from protobuf field repeated string incremental_post_operations = 6; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getIncrementalPostOperations() + { + return $this->incremental_post_operations; + } + + /** + * SQL statements to be executed after inserting new rows into the + * relation. + * + * Generated from protobuf field repeated string incremental_post_operations = 6; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setIncrementalPostOperations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->incremental_post_operations = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(IncrementalTableConfig::class, \Google\Cloud\Dataform\V1beta1\CompilationResultAction_Relation_IncrementalTableConfig::class); + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/CompilationResultAction/Relation/RelationType.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/CompilationResultAction/Relation/RelationType.php new file mode 100644 index 000000000000..5b0816a5700d --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/CompilationResultAction/Relation/RelationType.php @@ -0,0 +1,78 @@ +google.cloud.dataform.v1beta1.CompilationResultAction.Relation.RelationType + */ +class RelationType +{ + /** + * Default value. This value is unused. + * + * Generated from protobuf enum RELATION_TYPE_UNSPECIFIED = 0; + */ + const RELATION_TYPE_UNSPECIFIED = 0; + /** + * The relation is a table. + * + * Generated from protobuf enum TABLE = 1; + */ + const TABLE = 1; + /** + * The relation is a view. + * + * Generated from protobuf enum VIEW = 2; + */ + const VIEW = 2; + /** + * The relation is an incrementalized table. + * + * Generated from protobuf enum INCREMENTAL_TABLE = 3; + */ + const INCREMENTAL_TABLE = 3; + /** + * The relation is a materialized view. + * + * Generated from protobuf enum MATERIALIZED_VIEW = 4; + */ + const MATERIALIZED_VIEW = 4; + + private static $valueToName = [ + self::RELATION_TYPE_UNSPECIFIED => 'RELATION_TYPE_UNSPECIFIED', + self::TABLE => 'TABLE', + self::VIEW => 'VIEW', + self::INCREMENTAL_TABLE => 'INCREMENTAL_TABLE', + self::MATERIALIZED_VIEW => 'MATERIALIZED_VIEW', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(RelationType::class, \Google\Cloud\Dataform\V1beta1\CompilationResultAction_Relation_RelationType::class); + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/CompilationResultAction_Assertion.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/CompilationResultAction_Assertion.php new file mode 100644 index 000000000000..1ab8a7a34fda --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/CompilationResultAction_Assertion.php @@ -0,0 +1,16 @@ +google.cloud.dataform.v1beta1.CreateCompilationResultRequest + */ +class CreateCompilationResultRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The repository in which to create the compilation result. Must be in the + * format `projects/*/locations/*/repositories/*`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The compilation result to create. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.CompilationResult compilation_result = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $compilation_result = null; + + /** + * @param string $parent Required. The repository in which to create the compilation result. Must be in the + * format `projects/*/locations/*/repositories/*`. Please see + * {@see DataformClient::repositoryName()} for help formatting this field. + * @param \Google\Cloud\Dataform\V1beta1\CompilationResult $compilationResult Required. The compilation result to create. + * + * @return \Google\Cloud\Dataform\V1beta1\CreateCompilationResultRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\Dataform\V1beta1\CompilationResult $compilationResult): self + { + return (new self()) + ->setParent($parent) + ->setCompilationResult($compilationResult); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The repository in which to create the compilation result. Must be in the + * format `projects/*/locations/*/repositories/*`. + * @type \Google\Cloud\Dataform\V1beta1\CompilationResult $compilation_result + * Required. The compilation result to create. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + + /** + * Required. The repository in which to create the compilation result. Must be in the + * format `projects/*/locations/*/repositories/*`. + * + * 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. The repository in which to create the compilation result. Must be in the + * format `projects/*/locations/*/repositories/*`. + * + * 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. The compilation result to create. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.CompilationResult compilation_result = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Dataform\V1beta1\CompilationResult|null + */ + public function getCompilationResult() + { + return $this->compilation_result; + } + + public function hasCompilationResult() + { + return isset($this->compilation_result); + } + + public function clearCompilationResult() + { + unset($this->compilation_result); + } + + /** + * Required. The compilation result to create. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.CompilationResult compilation_result = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Dataform\V1beta1\CompilationResult $var + * @return $this + */ + public function setCompilationResult($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dataform\V1beta1\CompilationResult::class); + $this->compilation_result = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/CreateRepositoryRequest.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/CreateRepositoryRequest.php new file mode 100644 index 000000000000..1d7571125c09 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/CreateRepositoryRequest.php @@ -0,0 +1,173 @@ +google.cloud.dataform.v1beta1.CreateRepositoryRequest + */ +class CreateRepositoryRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The location in which to create the repository. Must be in the format + * `projects/*/locations/*`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The repository to create. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.Repository repository = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $repository = null; + /** + * Required. The ID to use for the repository, which will become the final component of + * the repository's resource name. + * + * Generated from protobuf field string repository_id = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $repository_id = ''; + + /** + * @param string $parent Required. The location in which to create the repository. Must be in the format + * `projects/*/locations/*`. Please see + * {@see DataformClient::locationName()} for help formatting this field. + * @param \Google\Cloud\Dataform\V1beta1\Repository $repository Required. The repository to create. + * @param string $repositoryId Required. The ID to use for the repository, which will become the final component of + * the repository's resource name. + * + * @return \Google\Cloud\Dataform\V1beta1\CreateRepositoryRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\Dataform\V1beta1\Repository $repository, string $repositoryId): self + { + return (new self()) + ->setParent($parent) + ->setRepository($repository) + ->setRepositoryId($repositoryId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The location in which to create the repository. Must be in the format + * `projects/*/locations/*`. + * @type \Google\Cloud\Dataform\V1beta1\Repository $repository + * Required. The repository to create. + * @type string $repository_id + * Required. The ID to use for the repository, which will become the final component of + * the repository's resource name. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + + /** + * Required. The location in which to create the repository. Must be in the format + * `projects/*/locations/*`. + * + * 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. The location in which to create the repository. Must be in the format + * `projects/*/locations/*`. + * + * 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. The repository to create. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.Repository repository = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Dataform\V1beta1\Repository|null + */ + public function getRepository() + { + return $this->repository; + } + + public function hasRepository() + { + return isset($this->repository); + } + + public function clearRepository() + { + unset($this->repository); + } + + /** + * Required. The repository to create. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.Repository repository = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Dataform\V1beta1\Repository $var + * @return $this + */ + public function setRepository($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dataform\V1beta1\Repository::class); + $this->repository = $var; + + return $this; + } + + /** + * Required. The ID to use for the repository, which will become the final component of + * the repository's resource name. + * + * Generated from protobuf field string repository_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getRepositoryId() + { + return $this->repository_id; + } + + /** + * Required. The ID to use for the repository, which will become the final component of + * the repository's resource name. + * + * Generated from protobuf field string repository_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setRepositoryId($var) + { + GPBUtil::checkString($var, True); + $this->repository_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/CreateWorkflowInvocationRequest.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/CreateWorkflowInvocationRequest.php new file mode 100644 index 000000000000..463556d411b0 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/CreateWorkflowInvocationRequest.php @@ -0,0 +1,132 @@ +google.cloud.dataform.v1beta1.CreateWorkflowInvocationRequest + */ +class CreateWorkflowInvocationRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The repository in which to create the workflow invocation. Must be in the + * format `projects/*/locations/*/repositories/*`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The workflow invocation resource to create. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.WorkflowInvocation workflow_invocation = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $workflow_invocation = null; + + /** + * @param string $parent Required. The repository in which to create the workflow invocation. Must be in the + * format `projects/*/locations/*/repositories/*`. Please see + * {@see DataformClient::repositoryName()} for help formatting this field. + * @param \Google\Cloud\Dataform\V1beta1\WorkflowInvocation $workflowInvocation Required. The workflow invocation resource to create. + * + * @return \Google\Cloud\Dataform\V1beta1\CreateWorkflowInvocationRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\Dataform\V1beta1\WorkflowInvocation $workflowInvocation): self + { + return (new self()) + ->setParent($parent) + ->setWorkflowInvocation($workflowInvocation); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The repository in which to create the workflow invocation. Must be in the + * format `projects/*/locations/*/repositories/*`. + * @type \Google\Cloud\Dataform\V1beta1\WorkflowInvocation $workflow_invocation + * Required. The workflow invocation resource to create. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + + /** + * Required. The repository in which to create the workflow invocation. Must be in the + * format `projects/*/locations/*/repositories/*`. + * + * 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. The repository in which to create the workflow invocation. Must be in the + * format `projects/*/locations/*/repositories/*`. + * + * 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. The workflow invocation resource to create. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.WorkflowInvocation workflow_invocation = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Dataform\V1beta1\WorkflowInvocation|null + */ + public function getWorkflowInvocation() + { + return $this->workflow_invocation; + } + + public function hasWorkflowInvocation() + { + return isset($this->workflow_invocation); + } + + public function clearWorkflowInvocation() + { + unset($this->workflow_invocation); + } + + /** + * Required. The workflow invocation resource to create. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.WorkflowInvocation workflow_invocation = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Dataform\V1beta1\WorkflowInvocation $var + * @return $this + */ + public function setWorkflowInvocation($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dataform\V1beta1\WorkflowInvocation::class); + $this->workflow_invocation = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/CreateWorkspaceRequest.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/CreateWorkspaceRequest.php new file mode 100644 index 000000000000..9ff26ecda52b --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/CreateWorkspaceRequest.php @@ -0,0 +1,173 @@ +google.cloud.dataform.v1beta1.CreateWorkspaceRequest + */ +class CreateWorkspaceRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The repository in which to create the workspace. Must be in the format + * `projects/*/locations/*/repositories/*`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The workspace to create. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.Workspace workspace = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $workspace = null; + /** + * Required. The ID to use for the workspace, which will become the final component of + * the workspace's resource name. + * + * Generated from protobuf field string workspace_id = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $workspace_id = ''; + + /** + * @param string $parent Required. The repository in which to create the workspace. Must be in the format + * `projects/*/locations/*/repositories/*`. Please see + * {@see DataformClient::repositoryName()} for help formatting this field. + * @param \Google\Cloud\Dataform\V1beta1\Workspace $workspace Required. The workspace to create. + * @param string $workspaceId Required. The ID to use for the workspace, which will become the final component of + * the workspace's resource name. + * + * @return \Google\Cloud\Dataform\V1beta1\CreateWorkspaceRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\Dataform\V1beta1\Workspace $workspace, string $workspaceId): self + { + return (new self()) + ->setParent($parent) + ->setWorkspace($workspace) + ->setWorkspaceId($workspaceId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The repository in which to create the workspace. Must be in the format + * `projects/*/locations/*/repositories/*`. + * @type \Google\Cloud\Dataform\V1beta1\Workspace $workspace + * Required. The workspace to create. + * @type string $workspace_id + * Required. The ID to use for the workspace, which will become the final component of + * the workspace's resource name. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + + /** + * Required. The repository in which to create the workspace. Must be in the format + * `projects/*/locations/*/repositories/*`. + * + * 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. The repository in which to create the workspace. Must be in the format + * `projects/*/locations/*/repositories/*`. + * + * 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. The workspace to create. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.Workspace workspace = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Dataform\V1beta1\Workspace|null + */ + public function getWorkspace() + { + return $this->workspace; + } + + public function hasWorkspace() + { + return isset($this->workspace); + } + + public function clearWorkspace() + { + unset($this->workspace); + } + + /** + * Required. The workspace to create. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.Workspace workspace = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Dataform\V1beta1\Workspace $var + * @return $this + */ + public function setWorkspace($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dataform\V1beta1\Workspace::class); + $this->workspace = $var; + + return $this; + } + + /** + * Required. The ID to use for the workspace, which will become the final component of + * the workspace's resource name. + * + * Generated from protobuf field string workspace_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getWorkspaceId() + { + return $this->workspace_id; + } + + /** + * Required. The ID to use for the workspace, which will become the final component of + * the workspace's resource name. + * + * Generated from protobuf field string workspace_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setWorkspaceId($var) + { + GPBUtil::checkString($var, True); + $this->workspace_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/DataformGrpcClient.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/DataformGrpcClient.php new file mode 100644 index 000000000000..80dffcce80e1 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/DataformGrpcClient.php @@ -0,0 +1,577 @@ +_simpleRequest('/google.cloud.dataform.v1beta1.Dataform/ListRepositories', + $argument, + ['\Google\Cloud\Dataform\V1beta1\ListRepositoriesResponse', 'decode'], + $metadata, $options); + } + + /** + * Fetches a single Repository. + * @param \Google\Cloud\Dataform\V1beta1\GetRepositoryRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function GetRepository(\Google\Cloud\Dataform\V1beta1\GetRepositoryRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.dataform.v1beta1.Dataform/GetRepository', + $argument, + ['\Google\Cloud\Dataform\V1beta1\Repository', 'decode'], + $metadata, $options); + } + + /** + * Creates a new Repository in a given project and location. + * @param \Google\Cloud\Dataform\V1beta1\CreateRepositoryRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function CreateRepository(\Google\Cloud\Dataform\V1beta1\CreateRepositoryRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.dataform.v1beta1.Dataform/CreateRepository', + $argument, + ['\Google\Cloud\Dataform\V1beta1\Repository', 'decode'], + $metadata, $options); + } + + /** + * Updates a single Repository. + * @param \Google\Cloud\Dataform\V1beta1\UpdateRepositoryRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function UpdateRepository(\Google\Cloud\Dataform\V1beta1\UpdateRepositoryRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.dataform.v1beta1.Dataform/UpdateRepository', + $argument, + ['\Google\Cloud\Dataform\V1beta1\Repository', 'decode'], + $metadata, $options); + } + + /** + * Deletes a single Repository. + * @param \Google\Cloud\Dataform\V1beta1\DeleteRepositoryRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function DeleteRepository(\Google\Cloud\Dataform\V1beta1\DeleteRepositoryRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.dataform.v1beta1.Dataform/DeleteRepository', + $argument, + ['\Google\Protobuf\GPBEmpty', 'decode'], + $metadata, $options); + } + + /** + * Fetches a Repository's remote branches. + * @param \Google\Cloud\Dataform\V1beta1\FetchRemoteBranchesRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function FetchRemoteBranches(\Google\Cloud\Dataform\V1beta1\FetchRemoteBranchesRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.dataform.v1beta1.Dataform/FetchRemoteBranches', + $argument, + ['\Google\Cloud\Dataform\V1beta1\FetchRemoteBranchesResponse', 'decode'], + $metadata, $options); + } + + /** + * Lists Workspaces in a given Repository. + * @param \Google\Cloud\Dataform\V1beta1\ListWorkspacesRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function ListWorkspaces(\Google\Cloud\Dataform\V1beta1\ListWorkspacesRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.dataform.v1beta1.Dataform/ListWorkspaces', + $argument, + ['\Google\Cloud\Dataform\V1beta1\ListWorkspacesResponse', 'decode'], + $metadata, $options); + } + + /** + * Fetches a single Workspace. + * @param \Google\Cloud\Dataform\V1beta1\GetWorkspaceRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function GetWorkspace(\Google\Cloud\Dataform\V1beta1\GetWorkspaceRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.dataform.v1beta1.Dataform/GetWorkspace', + $argument, + ['\Google\Cloud\Dataform\V1beta1\Workspace', 'decode'], + $metadata, $options); + } + + /** + * Creates a new Workspace in a given Repository. + * @param \Google\Cloud\Dataform\V1beta1\CreateWorkspaceRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function CreateWorkspace(\Google\Cloud\Dataform\V1beta1\CreateWorkspaceRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.dataform.v1beta1.Dataform/CreateWorkspace', + $argument, + ['\Google\Cloud\Dataform\V1beta1\Workspace', 'decode'], + $metadata, $options); + } + + /** + * Deletes a single Workspace. + * @param \Google\Cloud\Dataform\V1beta1\DeleteWorkspaceRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function DeleteWorkspace(\Google\Cloud\Dataform\V1beta1\DeleteWorkspaceRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.dataform.v1beta1.Dataform/DeleteWorkspace', + $argument, + ['\Google\Protobuf\GPBEmpty', 'decode'], + $metadata, $options); + } + + /** + * Installs dependency NPM packages (inside a Workspace). + * @param \Google\Cloud\Dataform\V1beta1\InstallNpmPackagesRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function InstallNpmPackages(\Google\Cloud\Dataform\V1beta1\InstallNpmPackagesRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.dataform.v1beta1.Dataform/InstallNpmPackages', + $argument, + ['\Google\Cloud\Dataform\V1beta1\InstallNpmPackagesResponse', 'decode'], + $metadata, $options); + } + + /** + * Pulls Git commits from the Repository's remote into a Workspace. + * @param \Google\Cloud\Dataform\V1beta1\PullGitCommitsRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function PullGitCommits(\Google\Cloud\Dataform\V1beta1\PullGitCommitsRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.dataform.v1beta1.Dataform/PullGitCommits', + $argument, + ['\Google\Protobuf\GPBEmpty', 'decode'], + $metadata, $options); + } + + /** + * Pushes Git commits from a Workspace to the Repository's remote. + * @param \Google\Cloud\Dataform\V1beta1\PushGitCommitsRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function PushGitCommits(\Google\Cloud\Dataform\V1beta1\PushGitCommitsRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.dataform.v1beta1.Dataform/PushGitCommits', + $argument, + ['\Google\Protobuf\GPBEmpty', 'decode'], + $metadata, $options); + } + + /** + * Fetches Git statuses for the files in a Workspace. + * @param \Google\Cloud\Dataform\V1beta1\FetchFileGitStatusesRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function FetchFileGitStatuses(\Google\Cloud\Dataform\V1beta1\FetchFileGitStatusesRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.dataform.v1beta1.Dataform/FetchFileGitStatuses', + $argument, + ['\Google\Cloud\Dataform\V1beta1\FetchFileGitStatusesResponse', 'decode'], + $metadata, $options); + } + + /** + * Fetches Git ahead/behind against a remote branch. + * @param \Google\Cloud\Dataform\V1beta1\FetchGitAheadBehindRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function FetchGitAheadBehind(\Google\Cloud\Dataform\V1beta1\FetchGitAheadBehindRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.dataform.v1beta1.Dataform/FetchGitAheadBehind', + $argument, + ['\Google\Cloud\Dataform\V1beta1\FetchGitAheadBehindResponse', 'decode'], + $metadata, $options); + } + + /** + * Applies a Git commit for uncommitted files in a Workspace. + * @param \Google\Cloud\Dataform\V1beta1\CommitWorkspaceChangesRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function CommitWorkspaceChanges(\Google\Cloud\Dataform\V1beta1\CommitWorkspaceChangesRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.dataform.v1beta1.Dataform/CommitWorkspaceChanges', + $argument, + ['\Google\Protobuf\GPBEmpty', 'decode'], + $metadata, $options); + } + + /** + * Performs a Git reset for uncommitted files in a Workspace. + * @param \Google\Cloud\Dataform\V1beta1\ResetWorkspaceChangesRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function ResetWorkspaceChanges(\Google\Cloud\Dataform\V1beta1\ResetWorkspaceChangesRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.dataform.v1beta1.Dataform/ResetWorkspaceChanges', + $argument, + ['\Google\Protobuf\GPBEmpty', 'decode'], + $metadata, $options); + } + + /** + * Fetches Git diff for an uncommitted file in a Workspace. + * @param \Google\Cloud\Dataform\V1beta1\FetchFileDiffRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function FetchFileDiff(\Google\Cloud\Dataform\V1beta1\FetchFileDiffRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.dataform.v1beta1.Dataform/FetchFileDiff', + $argument, + ['\Google\Cloud\Dataform\V1beta1\FetchFileDiffResponse', 'decode'], + $metadata, $options); + } + + /** + * Returns the contents of a given Workspace directory. + * @param \Google\Cloud\Dataform\V1beta1\QueryDirectoryContentsRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function QueryDirectoryContents(\Google\Cloud\Dataform\V1beta1\QueryDirectoryContentsRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.dataform.v1beta1.Dataform/QueryDirectoryContents', + $argument, + ['\Google\Cloud\Dataform\V1beta1\QueryDirectoryContentsResponse', 'decode'], + $metadata, $options); + } + + /** + * Creates a directory inside a Workspace. + * @param \Google\Cloud\Dataform\V1beta1\MakeDirectoryRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function MakeDirectory(\Google\Cloud\Dataform\V1beta1\MakeDirectoryRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.dataform.v1beta1.Dataform/MakeDirectory', + $argument, + ['\Google\Cloud\Dataform\V1beta1\MakeDirectoryResponse', 'decode'], + $metadata, $options); + } + + /** + * Deletes a directory (inside a Workspace) and all of its contents. + * @param \Google\Cloud\Dataform\V1beta1\RemoveDirectoryRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function RemoveDirectory(\Google\Cloud\Dataform\V1beta1\RemoveDirectoryRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.dataform.v1beta1.Dataform/RemoveDirectory', + $argument, + ['\Google\Protobuf\GPBEmpty', 'decode'], + $metadata, $options); + } + + /** + * Moves a directory (inside a Workspace), and all of its contents, to a new + * location. + * @param \Google\Cloud\Dataform\V1beta1\MoveDirectoryRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function MoveDirectory(\Google\Cloud\Dataform\V1beta1\MoveDirectoryRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.dataform.v1beta1.Dataform/MoveDirectory', + $argument, + ['\Google\Cloud\Dataform\V1beta1\MoveDirectoryResponse', 'decode'], + $metadata, $options); + } + + /** + * Returns the contents of a file (inside a Workspace). + * @param \Google\Cloud\Dataform\V1beta1\ReadFileRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function ReadFile(\Google\Cloud\Dataform\V1beta1\ReadFileRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.dataform.v1beta1.Dataform/ReadFile', + $argument, + ['\Google\Cloud\Dataform\V1beta1\ReadFileResponse', 'decode'], + $metadata, $options); + } + + /** + * Deletes a file (inside a Workspace). + * @param \Google\Cloud\Dataform\V1beta1\RemoveFileRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function RemoveFile(\Google\Cloud\Dataform\V1beta1\RemoveFileRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.dataform.v1beta1.Dataform/RemoveFile', + $argument, + ['\Google\Protobuf\GPBEmpty', 'decode'], + $metadata, $options); + } + + /** + * Moves a file (inside a Workspace) to a new location. + * @param \Google\Cloud\Dataform\V1beta1\MoveFileRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function MoveFile(\Google\Cloud\Dataform\V1beta1\MoveFileRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.dataform.v1beta1.Dataform/MoveFile', + $argument, + ['\Google\Cloud\Dataform\V1beta1\MoveFileResponse', 'decode'], + $metadata, $options); + } + + /** + * Writes to a file (inside a Workspace). + * @param \Google\Cloud\Dataform\V1beta1\WriteFileRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function WriteFile(\Google\Cloud\Dataform\V1beta1\WriteFileRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.dataform.v1beta1.Dataform/WriteFile', + $argument, + ['\Google\Cloud\Dataform\V1beta1\WriteFileResponse', 'decode'], + $metadata, $options); + } + + /** + * Lists CompilationResults in a given Repository. + * @param \Google\Cloud\Dataform\V1beta1\ListCompilationResultsRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function ListCompilationResults(\Google\Cloud\Dataform\V1beta1\ListCompilationResultsRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.dataform.v1beta1.Dataform/ListCompilationResults', + $argument, + ['\Google\Cloud\Dataform\V1beta1\ListCompilationResultsResponse', 'decode'], + $metadata, $options); + } + + /** + * Fetches a single CompilationResult. + * @param \Google\Cloud\Dataform\V1beta1\GetCompilationResultRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function GetCompilationResult(\Google\Cloud\Dataform\V1beta1\GetCompilationResultRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.dataform.v1beta1.Dataform/GetCompilationResult', + $argument, + ['\Google\Cloud\Dataform\V1beta1\CompilationResult', 'decode'], + $metadata, $options); + } + + /** + * Creates a new CompilationResult in a given project and location. + * @param \Google\Cloud\Dataform\V1beta1\CreateCompilationResultRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function CreateCompilationResult(\Google\Cloud\Dataform\V1beta1\CreateCompilationResultRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.dataform.v1beta1.Dataform/CreateCompilationResult', + $argument, + ['\Google\Cloud\Dataform\V1beta1\CompilationResult', 'decode'], + $metadata, $options); + } + + /** + * Returns CompilationResultActions in a given CompilationResult. + * @param \Google\Cloud\Dataform\V1beta1\QueryCompilationResultActionsRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function QueryCompilationResultActions(\Google\Cloud\Dataform\V1beta1\QueryCompilationResultActionsRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.dataform.v1beta1.Dataform/QueryCompilationResultActions', + $argument, + ['\Google\Cloud\Dataform\V1beta1\QueryCompilationResultActionsResponse', 'decode'], + $metadata, $options); + } + + /** + * Lists WorkflowInvocations in a given Repository. + * @param \Google\Cloud\Dataform\V1beta1\ListWorkflowInvocationsRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function ListWorkflowInvocations(\Google\Cloud\Dataform\V1beta1\ListWorkflowInvocationsRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.dataform.v1beta1.Dataform/ListWorkflowInvocations', + $argument, + ['\Google\Cloud\Dataform\V1beta1\ListWorkflowInvocationsResponse', 'decode'], + $metadata, $options); + } + + /** + * Fetches a single WorkflowInvocation. + * @param \Google\Cloud\Dataform\V1beta1\GetWorkflowInvocationRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function GetWorkflowInvocation(\Google\Cloud\Dataform\V1beta1\GetWorkflowInvocationRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.dataform.v1beta1.Dataform/GetWorkflowInvocation', + $argument, + ['\Google\Cloud\Dataform\V1beta1\WorkflowInvocation', 'decode'], + $metadata, $options); + } + + /** + * Creates a new WorkflowInvocation in a given Repository. + * @param \Google\Cloud\Dataform\V1beta1\CreateWorkflowInvocationRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function CreateWorkflowInvocation(\Google\Cloud\Dataform\V1beta1\CreateWorkflowInvocationRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.dataform.v1beta1.Dataform/CreateWorkflowInvocation', + $argument, + ['\Google\Cloud\Dataform\V1beta1\WorkflowInvocation', 'decode'], + $metadata, $options); + } + + /** + * Deletes a single WorkflowInvocation. + * @param \Google\Cloud\Dataform\V1beta1\DeleteWorkflowInvocationRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function DeleteWorkflowInvocation(\Google\Cloud\Dataform\V1beta1\DeleteWorkflowInvocationRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.dataform.v1beta1.Dataform/DeleteWorkflowInvocation', + $argument, + ['\Google\Protobuf\GPBEmpty', 'decode'], + $metadata, $options); + } + + /** + * Requests cancellation of a running WorkflowInvocation. + * @param \Google\Cloud\Dataform\V1beta1\CancelWorkflowInvocationRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function CancelWorkflowInvocation(\Google\Cloud\Dataform\V1beta1\CancelWorkflowInvocationRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.dataform.v1beta1.Dataform/CancelWorkflowInvocation', + $argument, + ['\Google\Protobuf\GPBEmpty', 'decode'], + $metadata, $options); + } + + /** + * Returns WorkflowInvocationActions in a given WorkflowInvocation. + * @param \Google\Cloud\Dataform\V1beta1\QueryWorkflowInvocationActionsRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function QueryWorkflowInvocationActions(\Google\Cloud\Dataform\V1beta1\QueryWorkflowInvocationActionsRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.dataform.v1beta1.Dataform/QueryWorkflowInvocationActions', + $argument, + ['\Google\Cloud\Dataform\V1beta1\QueryWorkflowInvocationActionsResponse', 'decode'], + $metadata, $options); + } + +} diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/DeleteRepositoryRequest.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/DeleteRepositoryRequest.php new file mode 100644 index 000000000000..4ab952474da0 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/DeleteRepositoryRequest.php @@ -0,0 +1,123 @@ +google.cloud.dataform.v1beta1.DeleteRepositoryRequest + */ +class DeleteRepositoryRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The repository's name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * If set to true, any child resources of this repository will also be + * deleted. (Otherwise, the request will only succeed if the repository has no + * child resources.) + * + * Generated from protobuf field bool force = 2; + */ + protected $force = false; + + /** + * @param string $name Required. The repository's name. Please see + * {@see DataformClient::repositoryName()} for help formatting this field. + * + * @return \Google\Cloud\Dataform\V1beta1\DeleteRepositoryRequest + * + * @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 repository's name. + * @type bool $force + * If set to true, any child resources of this repository will also be + * deleted. (Otherwise, the request will only succeed if the repository has no + * child resources.) + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + + /** + * Required. The repository's name. + * + * 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 repository's name. + * + * 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; + } + + /** + * If set to true, any child resources of this repository will also be + * deleted. (Otherwise, the request will only succeed if the repository has no + * child resources.) + * + * Generated from protobuf field bool force = 2; + * @return bool + */ + public function getForce() + { + return $this->force; + } + + /** + * If set to true, any child resources of this repository will also be + * deleted. (Otherwise, the request will only succeed if the repository has no + * child resources.) + * + * Generated from protobuf field bool force = 2; + * @param bool $var + * @return $this + */ + public function setForce($var) + { + GPBUtil::checkBool($var); + $this->force = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/DeleteWorkflowInvocationRequest.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/DeleteWorkflowInvocationRequest.php new file mode 100644 index 000000000000..bfd061a26936 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/DeleteWorkflowInvocationRequest.php @@ -0,0 +1,81 @@ +google.cloud.dataform.v1beta1.DeleteWorkflowInvocationRequest + */ +class DeleteWorkflowInvocationRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The workflow invocation resource's name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The workflow invocation resource's name. Please see + * {@see DataformClient::workflowInvocationName()} for help formatting this field. + * + * @return \Google\Cloud\Dataform\V1beta1\DeleteWorkflowInvocationRequest + * + * @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 workflow invocation resource's name. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + + /** + * Required. The workflow invocation resource's name. + * + * 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 workflow invocation resource's name. + * + * 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; + } + +} + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/DeleteWorkspaceRequest.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/DeleteWorkspaceRequest.php new file mode 100644 index 000000000000..bf2989f15dd4 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/DeleteWorkspaceRequest.php @@ -0,0 +1,81 @@ +google.cloud.dataform.v1beta1.DeleteWorkspaceRequest + */ +class DeleteWorkspaceRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The workspace resource's name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The workspace resource's name. Please see + * {@see DataformClient::workspaceName()} for help formatting this field. + * + * @return \Google\Cloud\Dataform\V1beta1\DeleteWorkspaceRequest + * + * @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 workspace resource's name. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + + /** + * Required. The workspace resource's name. + * + * 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 workspace resource's name. + * + * 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; + } + +} + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/FetchFileDiffRequest.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/FetchFileDiffRequest.php new file mode 100644 index 000000000000..29807b0fe534 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/FetchFileDiffRequest.php @@ -0,0 +1,101 @@ +google.cloud.dataform.v1beta1.FetchFileDiffRequest + */ +class FetchFileDiffRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The workspace's name. + * + * Generated from protobuf field string workspace = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $workspace = ''; + /** + * Required. The file's full path including filename, relative to the workspace root. + * + * Generated from protobuf field string path = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $path = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $workspace + * Required. The workspace's name. + * @type string $path + * Required. The file's full path including filename, relative to the workspace root. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + + /** + * Required. The workspace's name. + * + * Generated from protobuf field string workspace = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getWorkspace() + { + return $this->workspace; + } + + /** + * Required. The workspace's name. + * + * Generated from protobuf field string workspace = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setWorkspace($var) + { + GPBUtil::checkString($var, True); + $this->workspace = $var; + + return $this; + } + + /** + * Required. The file's full path including filename, relative to the workspace root. + * + * Generated from protobuf field string path = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getPath() + { + return $this->path; + } + + /** + * Required. The file's full path including filename, relative to the workspace root. + * + * Generated from protobuf field string path = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setPath($var) + { + GPBUtil::checkString($var, True); + $this->path = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/FetchFileDiffResponse.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/FetchFileDiffResponse.php new file mode 100644 index 000000000000..a6f86b5d5a6a --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/FetchFileDiffResponse.php @@ -0,0 +1,67 @@ +google.cloud.dataform.v1beta1.FetchFileDiffResponse + */ +class FetchFileDiffResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The raw formatted Git diff for the file. + * + * Generated from protobuf field string formatted_diff = 1; + */ + protected $formatted_diff = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $formatted_diff + * The raw formatted Git diff for the file. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + + /** + * The raw formatted Git diff for the file. + * + * Generated from protobuf field string formatted_diff = 1; + * @return string + */ + public function getFormattedDiff() + { + return $this->formatted_diff; + } + + /** + * The raw formatted Git diff for the file. + * + * Generated from protobuf field string formatted_diff = 1; + * @param string $var + * @return $this + */ + public function setFormattedDiff($var) + { + GPBUtil::checkString($var, True); + $this->formatted_diff = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/FetchFileGitStatusesRequest.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/FetchFileGitStatusesRequest.php new file mode 100644 index 000000000000..842203ba1a95 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/FetchFileGitStatusesRequest.php @@ -0,0 +1,67 @@ +google.cloud.dataform.v1beta1.FetchFileGitStatusesRequest + */ +class FetchFileGitStatusesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The workspace's name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The workspace's name. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + + /** + * Required. The workspace's name. + * + * 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 workspace's name. + * + * 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; + } + +} + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/FetchFileGitStatusesResponse.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/FetchFileGitStatusesResponse.php new file mode 100644 index 000000000000..bd9423c0a369 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/FetchFileGitStatusesResponse.php @@ -0,0 +1,71 @@ +google.cloud.dataform.v1beta1.FetchFileGitStatusesResponse + */ +class FetchFileGitStatusesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * A list of all files which have uncommitted Git changes. There will only be + * a single entry for any given file. + * + * Generated from protobuf field repeated .google.cloud.dataform.v1beta1.FetchFileGitStatusesResponse.UncommittedFileChange uncommitted_file_changes = 1; + */ + private $uncommitted_file_changes; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Dataform\V1beta1\FetchFileGitStatusesResponse\UncommittedFileChange>|\Google\Protobuf\Internal\RepeatedField $uncommitted_file_changes + * A list of all files which have uncommitted Git changes. There will only be + * a single entry for any given file. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + + /** + * A list of all files which have uncommitted Git changes. There will only be + * a single entry for any given file. + * + * Generated from protobuf field repeated .google.cloud.dataform.v1beta1.FetchFileGitStatusesResponse.UncommittedFileChange uncommitted_file_changes = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUncommittedFileChanges() + { + return $this->uncommitted_file_changes; + } + + /** + * A list of all files which have uncommitted Git changes. There will only be + * a single entry for any given file. + * + * Generated from protobuf field repeated .google.cloud.dataform.v1beta1.FetchFileGitStatusesResponse.UncommittedFileChange uncommitted_file_changes = 1; + * @param array<\Google\Cloud\Dataform\V1beta1\FetchFileGitStatusesResponse\UncommittedFileChange>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUncommittedFileChanges($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dataform\V1beta1\FetchFileGitStatusesResponse\UncommittedFileChange::class); + $this->uncommitted_file_changes = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/FetchFileGitStatusesResponse/UncommittedFileChange.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/FetchFileGitStatusesResponse/UncommittedFileChange.php new file mode 100644 index 000000000000..18b9d5675fd0 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/FetchFileGitStatusesResponse/UncommittedFileChange.php @@ -0,0 +1,104 @@ +google.cloud.dataform.v1beta1.FetchFileGitStatusesResponse.UncommittedFileChange + */ +class UncommittedFileChange extends \Google\Protobuf\Internal\Message +{ + /** + * The file's full path including filename, relative to the workspace root. + * + * Generated from protobuf field string path = 1; + */ + protected $path = ''; + /** + * Indicates the status of the file. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.FetchFileGitStatusesResponse.UncommittedFileChange.State state = 2; + */ + protected $state = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $path + * The file's full path including filename, relative to the workspace root. + * @type int $state + * Indicates the status of the file. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + + /** + * The file's full path including filename, relative to the workspace root. + * + * Generated from protobuf field string path = 1; + * @return string + */ + public function getPath() + { + return $this->path; + } + + /** + * The file's full path including filename, relative to the workspace root. + * + * Generated from protobuf field string path = 1; + * @param string $var + * @return $this + */ + public function setPath($var) + { + GPBUtil::checkString($var, True); + $this->path = $var; + + return $this; + } + + /** + * Indicates the status of the file. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.FetchFileGitStatusesResponse.UncommittedFileChange.State state = 2; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Indicates the status of the file. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.FetchFileGitStatusesResponse.UncommittedFileChange.State state = 2; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Dataform\V1beta1\FetchFileGitStatusesResponse\UncommittedFileChange\State::class); + $this->state = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(UncommittedFileChange::class, \Google\Cloud\Dataform\V1beta1\FetchFileGitStatusesResponse_UncommittedFileChange::class); + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/FetchFileGitStatusesResponse/UncommittedFileChange/State.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/FetchFileGitStatusesResponse/UncommittedFileChange/State.php new file mode 100644 index 000000000000..cb9467723386 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/FetchFileGitStatusesResponse/UncommittedFileChange/State.php @@ -0,0 +1,78 @@ +google.cloud.dataform.v1beta1.FetchFileGitStatusesResponse.UncommittedFileChange.State + */ +class State +{ + /** + * Default value. This value is unused. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The file has been newly added. + * + * Generated from protobuf enum ADDED = 1; + */ + const ADDED = 1; + /** + * The file has been deleted. + * + * Generated from protobuf enum DELETED = 2; + */ + const DELETED = 2; + /** + * The file has been modified. + * + * Generated from protobuf enum MODIFIED = 3; + */ + const MODIFIED = 3; + /** + * The file contains merge conflicts. + * + * Generated from protobuf enum HAS_CONFLICTS = 4; + */ + const HAS_CONFLICTS = 4; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::ADDED => 'ADDED', + self::DELETED => 'DELETED', + self::MODIFIED => 'MODIFIED', + self::HAS_CONFLICTS => 'HAS_CONFLICTS', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\Dataform\V1beta1\FetchFileGitStatusesResponse_UncommittedFileChange_State::class); + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/FetchFileGitStatusesResponse_UncommittedFileChange.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/FetchFileGitStatusesResponse_UncommittedFileChange.php new file mode 100644 index 000000000000..31a39d106c59 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/FetchFileGitStatusesResponse_UncommittedFileChange.php @@ -0,0 +1,16 @@ +google.cloud.dataform.v1beta1.FetchGitAheadBehindRequest + */ +class FetchGitAheadBehindRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The workspace's name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. The name of the branch in the Git remote against which this workspace + * should be compared. If left unset, the repository's default branch name + * will be used. + * + * Generated from protobuf field string remote_branch = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $remote_branch = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The workspace's name. + * @type string $remote_branch + * Optional. The name of the branch in the Git remote against which this workspace + * should be compared. If left unset, the repository's default branch name + * will be used. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + + /** + * Required. The workspace's name. + * + * 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 workspace's name. + * + * 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; + } + + /** + * Optional. The name of the branch in the Git remote against which this workspace + * should be compared. If left unset, the repository's default branch name + * will be used. + * + * Generated from protobuf field string remote_branch = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRemoteBranch() + { + return $this->remote_branch; + } + + /** + * Optional. The name of the branch in the Git remote against which this workspace + * should be compared. If left unset, the repository's default branch name + * will be used. + * + * Generated from protobuf field string remote_branch = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRemoteBranch($var) + { + GPBUtil::checkString($var, True); + $this->remote_branch = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/FetchGitAheadBehindResponse.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/FetchGitAheadBehindResponse.php new file mode 100644 index 000000000000..27b1b288d80d --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/FetchGitAheadBehindResponse.php @@ -0,0 +1,101 @@ +google.cloud.dataform.v1beta1.FetchGitAheadBehindResponse + */ +class FetchGitAheadBehindResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The number of commits in the remote branch that are not in the workspace. + * + * Generated from protobuf field int32 commits_ahead = 1; + */ + protected $commits_ahead = 0; + /** + * The number of commits in the workspace that are not in the remote branch. + * + * Generated from protobuf field int32 commits_behind = 2; + */ + protected $commits_behind = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $commits_ahead + * The number of commits in the remote branch that are not in the workspace. + * @type int $commits_behind + * The number of commits in the workspace that are not in the remote branch. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + + /** + * The number of commits in the remote branch that are not in the workspace. + * + * Generated from protobuf field int32 commits_ahead = 1; + * @return int + */ + public function getCommitsAhead() + { + return $this->commits_ahead; + } + + /** + * The number of commits in the remote branch that are not in the workspace. + * + * Generated from protobuf field int32 commits_ahead = 1; + * @param int $var + * @return $this + */ + public function setCommitsAhead($var) + { + GPBUtil::checkInt32($var); + $this->commits_ahead = $var; + + return $this; + } + + /** + * The number of commits in the workspace that are not in the remote branch. + * + * Generated from protobuf field int32 commits_behind = 2; + * @return int + */ + public function getCommitsBehind() + { + return $this->commits_behind; + } + + /** + * The number of commits in the workspace that are not in the remote branch. + * + * Generated from protobuf field int32 commits_behind = 2; + * @param int $var + * @return $this + */ + public function setCommitsBehind($var) + { + GPBUtil::checkInt32($var); + $this->commits_behind = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/FetchRemoteBranchesRequest.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/FetchRemoteBranchesRequest.php new file mode 100644 index 000000000000..68515930cd47 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/FetchRemoteBranchesRequest.php @@ -0,0 +1,67 @@ +google.cloud.dataform.v1beta1.FetchRemoteBranchesRequest + */ +class FetchRemoteBranchesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The repository's name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The repository's name. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + + /** + * Required. The repository's name. + * + * 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 repository's name. + * + * 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; + } + +} + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/FetchRemoteBranchesResponse.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/FetchRemoteBranchesResponse.php new file mode 100644 index 000000000000..bf0efee7b06e --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/FetchRemoteBranchesResponse.php @@ -0,0 +1,67 @@ +google.cloud.dataform.v1beta1.FetchRemoteBranchesResponse + */ +class FetchRemoteBranchesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The remote repository's branch names. + * + * Generated from protobuf field repeated string branches = 1; + */ + private $branches; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $branches + * The remote repository's branch names. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + + /** + * The remote repository's branch names. + * + * Generated from protobuf field repeated string branches = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getBranches() + { + return $this->branches; + } + + /** + * The remote repository's branch names. + * + * Generated from protobuf field repeated string branches = 1; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setBranches($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->branches = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/GetCompilationResultRequest.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/GetCompilationResultRequest.php new file mode 100644 index 000000000000..ff571e3e3e87 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/GetCompilationResultRequest.php @@ -0,0 +1,81 @@ +google.cloud.dataform.v1beta1.GetCompilationResultRequest + */ +class GetCompilationResultRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The compilation result's name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The compilation result's name. Please see + * {@see DataformClient::compilationResultName()} for help formatting this field. + * + * @return \Google\Cloud\Dataform\V1beta1\GetCompilationResultRequest + * + * @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 compilation result's name. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + + /** + * Required. The compilation result's name. + * + * 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 compilation result's name. + * + * 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; + } + +} + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/GetRepositoryRequest.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/GetRepositoryRequest.php new file mode 100644 index 000000000000..faab65436cf9 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/GetRepositoryRequest.php @@ -0,0 +1,81 @@ +google.cloud.dataform.v1beta1.GetRepositoryRequest + */ +class GetRepositoryRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The repository's name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The repository's name. Please see + * {@see DataformClient::repositoryName()} for help formatting this field. + * + * @return \Google\Cloud\Dataform\V1beta1\GetRepositoryRequest + * + * @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 repository's name. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + + /** + * Required. The repository's name. + * + * 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 repository's name. + * + * 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; + } + +} + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/GetWorkflowInvocationRequest.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/GetWorkflowInvocationRequest.php new file mode 100644 index 000000000000..f071607835a7 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/GetWorkflowInvocationRequest.php @@ -0,0 +1,81 @@ +google.cloud.dataform.v1beta1.GetWorkflowInvocationRequest + */ +class GetWorkflowInvocationRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The workflow invocation resource's name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The workflow invocation resource's name. Please see + * {@see DataformClient::workflowInvocationName()} for help formatting this field. + * + * @return \Google\Cloud\Dataform\V1beta1\GetWorkflowInvocationRequest + * + * @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 workflow invocation resource's name. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + + /** + * Required. The workflow invocation resource's name. + * + * 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 workflow invocation resource's name. + * + * 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; + } + +} + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/GetWorkspaceRequest.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/GetWorkspaceRequest.php new file mode 100644 index 000000000000..e4142c4e3257 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/GetWorkspaceRequest.php @@ -0,0 +1,81 @@ +google.cloud.dataform.v1beta1.GetWorkspaceRequest + */ +class GetWorkspaceRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The workspace's name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The workspace's name. Please see + * {@see DataformClient::workspaceName()} for help formatting this field. + * + * @return \Google\Cloud\Dataform\V1beta1\GetWorkspaceRequest + * + * @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 workspace's name. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + + /** + * Required. The workspace's name. + * + * 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 workspace's name. + * + * 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; + } + +} + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/InstallNpmPackagesRequest.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/InstallNpmPackagesRequest.php new file mode 100644 index 000000000000..a4f1c0cb7dd3 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/InstallNpmPackagesRequest.php @@ -0,0 +1,67 @@ +google.cloud.dataform.v1beta1.InstallNpmPackagesRequest + */ +class InstallNpmPackagesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The workspace's name. + * + * Generated from protobuf field string workspace = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $workspace = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $workspace + * Required. The workspace's name. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + + /** + * Required. The workspace's name. + * + * Generated from protobuf field string workspace = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getWorkspace() + { + return $this->workspace; + } + + /** + * Required. The workspace's name. + * + * Generated from protobuf field string workspace = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setWorkspace($var) + { + GPBUtil::checkString($var, True); + $this->workspace = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/InstallNpmPackagesResponse.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/InstallNpmPackagesResponse.php new file mode 100644 index 000000000000..3f490121e19c --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/InstallNpmPackagesResponse.php @@ -0,0 +1,33 @@ +google.cloud.dataform.v1beta1.InstallNpmPackagesResponse + */ +class InstallNpmPackagesResponse extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + +} + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/ListCompilationResultsRequest.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/ListCompilationResultsRequest.php new file mode 100644 index 000000000000..e8b2c9c177d3 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/ListCompilationResultsRequest.php @@ -0,0 +1,174 @@ +google.cloud.dataform.v1beta1.ListCompilationResultsRequest + */ +class ListCompilationResultsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The repository in which to list compilation results. Must be in the + * format `projects/*/locations/*/repositories/*`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. Maximum number of compilation results to return. The server may return + * fewer items than requested. If unspecified, the server will pick an + * appropriate default. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Optional. Page token received from a previous `ListCompilationResults` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListCompilationResults` + * must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = ''; + + /** + * @param string $parent Required. The repository in which to list compilation results. Must be in the + * format `projects/*/locations/*/repositories/*`. Please see + * {@see DataformClient::repositoryName()} for help formatting this field. + * + * @return \Google\Cloud\Dataform\V1beta1\ListCompilationResultsRequest + * + * @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. The repository in which to list compilation results. Must be in the + * format `projects/*/locations/*/repositories/*`. + * @type int $page_size + * Optional. Maximum number of compilation results to return. The server may return + * fewer items than requested. If unspecified, the server will pick an + * appropriate default. + * @type string $page_token + * Optional. Page token received from a previous `ListCompilationResults` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListCompilationResults` + * must match the call that provided the page token. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + + /** + * Required. The repository in which to list compilation results. Must be in the + * format `projects/*/locations/*/repositories/*`. + * + * 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. The repository in which to list compilation results. Must be in the + * format `projects/*/locations/*/repositories/*`. + * + * 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 compilation results to return. The server may return + * fewer items than requested. If unspecified, the server will pick an + * appropriate default. + * + * 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 compilation results to return. The server may return + * fewer items than requested. If unspecified, the server will pick an + * appropriate default. + * + * 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. Page token received from a previous `ListCompilationResults` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListCompilationResults` + * must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. Page token received from a previous `ListCompilationResults` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListCompilationResults` + * must match the call that provided the page token. + * + * 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; + } + +} + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/ListCompilationResultsResponse.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/ListCompilationResultsResponse.php new file mode 100644 index 000000000000..047d9705ca8e --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/ListCompilationResultsResponse.php @@ -0,0 +1,139 @@ +google.cloud.dataform.v1beta1.ListCompilationResultsResponse + */ +class ListCompilationResultsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * List of compilation results. + * + * Generated from protobuf field repeated .google.cloud.dataform.v1beta1.CompilationResult compilation_results = 1; + */ + private $compilation_results; + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * Locations which could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + */ + private $unreachable; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Dataform\V1beta1\CompilationResult>|\Google\Protobuf\Internal\RepeatedField $compilation_results + * List of compilation results. + * @type string $next_page_token + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Locations which could not be reached. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + + /** + * List of compilation results. + * + * Generated from protobuf field repeated .google.cloud.dataform.v1beta1.CompilationResult compilation_results = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getCompilationResults() + { + return $this->compilation_results; + } + + /** + * List of compilation results. + * + * Generated from protobuf field repeated .google.cloud.dataform.v1beta1.CompilationResult compilation_results = 1; + * @param array<\Google\Cloud\Dataform\V1beta1\CompilationResult>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setCompilationResults($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dataform\V1beta1\CompilationResult::class); + $this->compilation_results = $arr; + + return $this; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * 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; + } + + /** + * Locations which could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Locations which could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUnreachable($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->unreachable = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/ListRepositoriesRequest.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/ListRepositoriesRequest.php new file mode 100644 index 000000000000..ba24c91287e7 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/ListRepositoriesRequest.php @@ -0,0 +1,250 @@ +google.cloud.dataform.v1beta1.ListRepositoriesRequest + */ +class ListRepositoriesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The location in which to list repositories. Must be in the format + * `projects/*/locations/*`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. Maximum number of repositories to return. The server may return fewer + * items than requested. If unspecified, the server will pick an appropriate + * default. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Optional. Page token received from a previous `ListRepositories` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListRepositories` + * must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = ''; + /** + * Optional. This field only supports ordering by `name`. If unspecified, the server + * will choose the ordering. If specified, the default order is ascending for + * the `name` field. + * + * Generated from protobuf field string order_by = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $order_by = ''; + /** + * Optional. Filter for the returned list. + * + * Generated from protobuf field string filter = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $filter = ''; + + /** + * @param string $parent Required. The location in which to list repositories. Must be in the format + * `projects/*/locations/*`. Please see + * {@see DataformClient::locationName()} for help formatting this field. + * + * @return \Google\Cloud\Dataform\V1beta1\ListRepositoriesRequest + * + * @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. The location in which to list repositories. Must be in the format + * `projects/*/locations/*`. + * @type int $page_size + * Optional. Maximum number of repositories to return. The server may return fewer + * items than requested. If unspecified, the server will pick an appropriate + * default. + * @type string $page_token + * Optional. Page token received from a previous `ListRepositories` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListRepositories` + * must match the call that provided the page token. + * @type string $order_by + * Optional. This field only supports ordering by `name`. If unspecified, the server + * will choose the ordering. If specified, the default order is ascending for + * the `name` field. + * @type string $filter + * Optional. Filter for the returned list. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + + /** + * Required. The location in which to list repositories. Must be in the format + * `projects/*/locations/*`. + * + * 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. The location in which to list repositories. Must be in the format + * `projects/*/locations/*`. + * + * 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 repositories to return. The server may return fewer + * items than requested. If unspecified, the server will pick an appropriate + * default. + * + * 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 repositories to return. The server may return fewer + * items than requested. If unspecified, the server will pick an appropriate + * default. + * + * 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. Page token received from a previous `ListRepositories` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListRepositories` + * must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. Page token received from a previous `ListRepositories` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListRepositories` + * must match the call that provided the page token. + * + * 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. This field only supports ordering by `name`. If unspecified, the server + * will choose the ordering. If specified, the default order is ascending for + * the `name` field. + * + * Generated from protobuf field string order_by = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Optional. This field only supports ordering by `name`. If unspecified, the server + * will choose the ordering. If specified, the default order is ascending for + * the `name` field. + * + * Generated from protobuf field string order_by = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + + /** + * Optional. Filter for the returned list. + * + * Generated from protobuf field string filter = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Optional. Filter for the returned list. + * + * Generated from protobuf field string filter = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/ListRepositoriesResponse.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/ListRepositoriesResponse.php new file mode 100644 index 000000000000..7852d0e1266a --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/ListRepositoriesResponse.php @@ -0,0 +1,139 @@ +google.cloud.dataform.v1beta1.ListRepositoriesResponse + */ +class ListRepositoriesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * List of repositories. + * + * Generated from protobuf field repeated .google.cloud.dataform.v1beta1.Repository repositories = 1; + */ + private $repositories; + /** + * A token which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * Locations which could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + */ + private $unreachable; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Dataform\V1beta1\Repository>|\Google\Protobuf\Internal\RepeatedField $repositories + * List of repositories. + * @type string $next_page_token + * A token which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Locations which could not be reached. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + + /** + * List of repositories. + * + * Generated from protobuf field repeated .google.cloud.dataform.v1beta1.Repository repositories = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRepositories() + { + return $this->repositories; + } + + /** + * List of repositories. + * + * Generated from protobuf field repeated .google.cloud.dataform.v1beta1.Repository repositories = 1; + * @param array<\Google\Cloud\Dataform\V1beta1\Repository>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRepositories($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dataform\V1beta1\Repository::class); + $this->repositories = $arr; + + return $this; + } + + /** + * A token which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * 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; + } + + /** + * Locations which could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Locations which could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUnreachable($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->unreachable = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/ListWorkflowInvocationsRequest.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/ListWorkflowInvocationsRequest.php new file mode 100644 index 000000000000..1fe33b0296da --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/ListWorkflowInvocationsRequest.php @@ -0,0 +1,174 @@ +google.cloud.dataform.v1beta1.ListWorkflowInvocationsRequest + */ +class ListWorkflowInvocationsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent resource of the WorkflowInvocation type. Must be in the + * format `projects/*/locations/*/repositories/*`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. Maximum number of workflow invocations to return. The server may return + * fewer items than requested. If unspecified, the server will pick an + * appropriate default. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Optional. Page token received from a previous `ListWorkflowInvocations` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListWorkflowInvocations` + * must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = ''; + + /** + * @param string $parent Required. The parent resource of the WorkflowInvocation type. Must be in the + * format `projects/*/locations/*/repositories/*`. Please see + * {@see DataformClient::repositoryName()} for help formatting this field. + * + * @return \Google\Cloud\Dataform\V1beta1\ListWorkflowInvocationsRequest + * + * @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. The parent resource of the WorkflowInvocation type. Must be in the + * format `projects/*/locations/*/repositories/*`. + * @type int $page_size + * Optional. Maximum number of workflow invocations to return. The server may return + * fewer items than requested. If unspecified, the server will pick an + * appropriate default. + * @type string $page_token + * Optional. Page token received from a previous `ListWorkflowInvocations` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListWorkflowInvocations` + * must match the call that provided the page token. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent resource of the WorkflowInvocation type. Must be in the + * format `projects/*/locations/*/repositories/*`. + * + * 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. The parent resource of the WorkflowInvocation type. Must be in the + * format `projects/*/locations/*/repositories/*`. + * + * 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 workflow invocations to return. The server may return + * fewer items than requested. If unspecified, the server will pick an + * appropriate default. + * + * 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 workflow invocations to return. The server may return + * fewer items than requested. If unspecified, the server will pick an + * appropriate default. + * + * 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. Page token received from a previous `ListWorkflowInvocations` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListWorkflowInvocations` + * must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. Page token received from a previous `ListWorkflowInvocations` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListWorkflowInvocations` + * must match the call that provided the page token. + * + * 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; + } + +} + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/ListWorkflowInvocationsResponse.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/ListWorkflowInvocationsResponse.php new file mode 100644 index 000000000000..d9fcb85b2e33 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/ListWorkflowInvocationsResponse.php @@ -0,0 +1,139 @@ +google.cloud.dataform.v1beta1.ListWorkflowInvocationsResponse + */ +class ListWorkflowInvocationsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * List of workflow invocations. + * + * Generated from protobuf field repeated .google.cloud.dataform.v1beta1.WorkflowInvocation workflow_invocations = 1; + */ + private $workflow_invocations; + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * Locations which could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + */ + private $unreachable; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Dataform\V1beta1\WorkflowInvocation>|\Google\Protobuf\Internal\RepeatedField $workflow_invocations + * List of workflow invocations. + * @type string $next_page_token + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Locations which could not be reached. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + + /** + * List of workflow invocations. + * + * Generated from protobuf field repeated .google.cloud.dataform.v1beta1.WorkflowInvocation workflow_invocations = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getWorkflowInvocations() + { + return $this->workflow_invocations; + } + + /** + * List of workflow invocations. + * + * Generated from protobuf field repeated .google.cloud.dataform.v1beta1.WorkflowInvocation workflow_invocations = 1; + * @param array<\Google\Cloud\Dataform\V1beta1\WorkflowInvocation>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setWorkflowInvocations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dataform\V1beta1\WorkflowInvocation::class); + $this->workflow_invocations = $arr; + + return $this; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * 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; + } + + /** + * Locations which could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Locations which could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUnreachable($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->unreachable = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/ListWorkspacesRequest.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/ListWorkspacesRequest.php new file mode 100644 index 000000000000..b9e260f2fd13 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/ListWorkspacesRequest.php @@ -0,0 +1,250 @@ +google.cloud.dataform.v1beta1.ListWorkspacesRequest + */ +class ListWorkspacesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The repository in which to list workspaces. Must be in the + * format `projects/*/locations/*/repositories/*`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. Maximum number of workspaces to return. The server may return fewer + * items than requested. If unspecified, the server will pick an appropriate + * default. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Optional. Page token received from a previous `ListWorkspaces` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListWorkspaces` + * must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = ''; + /** + * Optional. This field only supports ordering by `name`. If unspecified, the server + * will choose the ordering. If specified, the default order is ascending for + * the `name` field. + * + * Generated from protobuf field string order_by = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $order_by = ''; + /** + * Optional. Filter for the returned list. + * + * Generated from protobuf field string filter = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $filter = ''; + + /** + * @param string $parent Required. The repository in which to list workspaces. Must be in the + * format `projects/*/locations/*/repositories/*`. Please see + * {@see DataformClient::repositoryName()} for help formatting this field. + * + * @return \Google\Cloud\Dataform\V1beta1\ListWorkspacesRequest + * + * @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. The repository in which to list workspaces. Must be in the + * format `projects/*/locations/*/repositories/*`. + * @type int $page_size + * Optional. Maximum number of workspaces to return. The server may return fewer + * items than requested. If unspecified, the server will pick an appropriate + * default. + * @type string $page_token + * Optional. Page token received from a previous `ListWorkspaces` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListWorkspaces` + * must match the call that provided the page token. + * @type string $order_by + * Optional. This field only supports ordering by `name`. If unspecified, the server + * will choose the ordering. If specified, the default order is ascending for + * the `name` field. + * @type string $filter + * Optional. Filter for the returned list. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + + /** + * Required. The repository in which to list workspaces. Must be in the + * format `projects/*/locations/*/repositories/*`. + * + * 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. The repository in which to list workspaces. Must be in the + * format `projects/*/locations/*/repositories/*`. + * + * 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 workspaces to return. The server may return fewer + * items than requested. If unspecified, the server will pick an appropriate + * default. + * + * 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 workspaces to return. The server may return fewer + * items than requested. If unspecified, the server will pick an appropriate + * default. + * + * 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. Page token received from a previous `ListWorkspaces` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListWorkspaces` + * must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. Page token received from a previous `ListWorkspaces` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListWorkspaces` + * must match the call that provided the page token. + * + * 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. This field only supports ordering by `name`. If unspecified, the server + * will choose the ordering. If specified, the default order is ascending for + * the `name` field. + * + * Generated from protobuf field string order_by = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Optional. This field only supports ordering by `name`. If unspecified, the server + * will choose the ordering. If specified, the default order is ascending for + * the `name` field. + * + * Generated from protobuf field string order_by = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + + /** + * Optional. Filter for the returned list. + * + * Generated from protobuf field string filter = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Optional. Filter for the returned list. + * + * Generated from protobuf field string filter = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/ListWorkspacesResponse.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/ListWorkspacesResponse.php new file mode 100644 index 000000000000..54ef94dd2164 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/ListWorkspacesResponse.php @@ -0,0 +1,139 @@ +google.cloud.dataform.v1beta1.ListWorkspacesResponse + */ +class ListWorkspacesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * List of workspaces. + * + * Generated from protobuf field repeated .google.cloud.dataform.v1beta1.Workspace workspaces = 1; + */ + private $workspaces; + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * Locations which could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + */ + private $unreachable; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Dataform\V1beta1\Workspace>|\Google\Protobuf\Internal\RepeatedField $workspaces + * List of workspaces. + * @type string $next_page_token + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Locations which could not be reached. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + + /** + * List of workspaces. + * + * Generated from protobuf field repeated .google.cloud.dataform.v1beta1.Workspace workspaces = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getWorkspaces() + { + return $this->workspaces; + } + + /** + * List of workspaces. + * + * Generated from protobuf field repeated .google.cloud.dataform.v1beta1.Workspace workspaces = 1; + * @param array<\Google\Cloud\Dataform\V1beta1\Workspace>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setWorkspaces($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dataform\V1beta1\Workspace::class); + $this->workspaces = $arr; + + return $this; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * 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; + } + + /** + * Locations which could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Locations which could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUnreachable($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->unreachable = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/MakeDirectoryRequest.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/MakeDirectoryRequest.php new file mode 100644 index 000000000000..1617b3114f83 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/MakeDirectoryRequest.php @@ -0,0 +1,105 @@ +google.cloud.dataform.v1beta1.MakeDirectoryRequest + */ +class MakeDirectoryRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The workspace's name. + * + * Generated from protobuf field string workspace = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $workspace = ''; + /** + * Required. The directory's full path including directory name, relative to the + * workspace root. + * + * Generated from protobuf field string path = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $path = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $workspace + * Required. The workspace's name. + * @type string $path + * Required. The directory's full path including directory name, relative to the + * workspace root. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + + /** + * Required. The workspace's name. + * + * Generated from protobuf field string workspace = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getWorkspace() + { + return $this->workspace; + } + + /** + * Required. The workspace's name. + * + * Generated from protobuf field string workspace = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setWorkspace($var) + { + GPBUtil::checkString($var, True); + $this->workspace = $var; + + return $this; + } + + /** + * Required. The directory's full path including directory name, relative to the + * workspace root. + * + * Generated from protobuf field string path = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getPath() + { + return $this->path; + } + + /** + * Required. The directory's full path including directory name, relative to the + * workspace root. + * + * Generated from protobuf field string path = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setPath($var) + { + GPBUtil::checkString($var, True); + $this->path = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/MakeDirectoryResponse.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/MakeDirectoryResponse.php new file mode 100644 index 000000000000..05d2d176a30e --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/MakeDirectoryResponse.php @@ -0,0 +1,33 @@ +google.cloud.dataform.v1beta1.MakeDirectoryResponse + */ +class MakeDirectoryResponse extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + +} + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/MoveDirectoryRequest.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/MoveDirectoryRequest.php new file mode 100644 index 000000000000..7b8f0cd213bb --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/MoveDirectoryRequest.php @@ -0,0 +1,143 @@ +google.cloud.dataform.v1beta1.MoveDirectoryRequest + */ +class MoveDirectoryRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The workspace's name. + * + * Generated from protobuf field string workspace = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $workspace = ''; + /** + * Required. The directory's full path including directory name, relative to the + * workspace root. + * + * Generated from protobuf field string path = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $path = ''; + /** + * Required. The new path for the directory including directory name, rooted at + * workspace root. + * + * Generated from protobuf field string new_path = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $new_path = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $workspace + * Required. The workspace's name. + * @type string $path + * Required. The directory's full path including directory name, relative to the + * workspace root. + * @type string $new_path + * Required. The new path for the directory including directory name, rooted at + * workspace root. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + + /** + * Required. The workspace's name. + * + * Generated from protobuf field string workspace = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getWorkspace() + { + return $this->workspace; + } + + /** + * Required. The workspace's name. + * + * Generated from protobuf field string workspace = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setWorkspace($var) + { + GPBUtil::checkString($var, True); + $this->workspace = $var; + + return $this; + } + + /** + * Required. The directory's full path including directory name, relative to the + * workspace root. + * + * Generated from protobuf field string path = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getPath() + { + return $this->path; + } + + /** + * Required. The directory's full path including directory name, relative to the + * workspace root. + * + * Generated from protobuf field string path = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setPath($var) + { + GPBUtil::checkString($var, True); + $this->path = $var; + + return $this; + } + + /** + * Required. The new path for the directory including directory name, rooted at + * workspace root. + * + * Generated from protobuf field string new_path = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getNewPath() + { + return $this->new_path; + } + + /** + * Required. The new path for the directory including directory name, rooted at + * workspace root. + * + * Generated from protobuf field string new_path = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setNewPath($var) + { + GPBUtil::checkString($var, True); + $this->new_path = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/MoveDirectoryResponse.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/MoveDirectoryResponse.php new file mode 100644 index 000000000000..a3e6cb5265e9 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/MoveDirectoryResponse.php @@ -0,0 +1,33 @@ +google.cloud.dataform.v1beta1.MoveDirectoryResponse + */ +class MoveDirectoryResponse extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + +} + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/MoveFileRequest.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/MoveFileRequest.php new file mode 100644 index 000000000000..07e452ca8cd2 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/MoveFileRequest.php @@ -0,0 +1,135 @@ +google.cloud.dataform.v1beta1.MoveFileRequest + */ +class MoveFileRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The workspace's name. + * + * Generated from protobuf field string workspace = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $workspace = ''; + /** + * Required. The file's full path including filename, relative to the workspace root. + * + * Generated from protobuf field string path = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $path = ''; + /** + * Required. The file's new path including filename, relative to the workspace root. + * + * Generated from protobuf field string new_path = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $new_path = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $workspace + * Required. The workspace's name. + * @type string $path + * Required. The file's full path including filename, relative to the workspace root. + * @type string $new_path + * Required. The file's new path including filename, relative to the workspace root. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + + /** + * Required. The workspace's name. + * + * Generated from protobuf field string workspace = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getWorkspace() + { + return $this->workspace; + } + + /** + * Required. The workspace's name. + * + * Generated from protobuf field string workspace = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setWorkspace($var) + { + GPBUtil::checkString($var, True); + $this->workspace = $var; + + return $this; + } + + /** + * Required. The file's full path including filename, relative to the workspace root. + * + * Generated from protobuf field string path = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getPath() + { + return $this->path; + } + + /** + * Required. The file's full path including filename, relative to the workspace root. + * + * Generated from protobuf field string path = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setPath($var) + { + GPBUtil::checkString($var, True); + $this->path = $var; + + return $this; + } + + /** + * Required. The file's new path including filename, relative to the workspace root. + * + * Generated from protobuf field string new_path = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getNewPath() + { + return $this->new_path; + } + + /** + * Required. The file's new path including filename, relative to the workspace root. + * + * Generated from protobuf field string new_path = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setNewPath($var) + { + GPBUtil::checkString($var, True); + $this->new_path = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/MoveFileResponse.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/MoveFileResponse.php new file mode 100644 index 000000000000..25d0cb19ced2 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/MoveFileResponse.php @@ -0,0 +1,33 @@ +google.cloud.dataform.v1beta1.MoveFileResponse + */ +class MoveFileResponse extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + +} + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/PullGitCommitsRequest.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/PullGitCommitsRequest.php new file mode 100644 index 000000000000..4569b6e493d8 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/PullGitCommitsRequest.php @@ -0,0 +1,153 @@ +google.cloud.dataform.v1beta1.PullGitCommitsRequest + */ +class PullGitCommitsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The workspace's name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. The name of the branch in the Git remote from which to pull commits. + * If left unset, the repository's default branch name will be used. + * + * Generated from protobuf field string remote_branch = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $remote_branch = ''; + /** + * Required. The author of any merge commit which may be created as a result of merging + * fetched Git commits into this workspace. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.CommitAuthor author = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $author = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The workspace's name. + * @type string $remote_branch + * Optional. The name of the branch in the Git remote from which to pull commits. + * If left unset, the repository's default branch name will be used. + * @type \Google\Cloud\Dataform\V1beta1\CommitAuthor $author + * Required. The author of any merge commit which may be created as a result of merging + * fetched Git commits into this workspace. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + + /** + * Required. The workspace's name. + * + * 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 workspace's name. + * + * 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; + } + + /** + * Optional. The name of the branch in the Git remote from which to pull commits. + * If left unset, the repository's default branch name will be used. + * + * Generated from protobuf field string remote_branch = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRemoteBranch() + { + return $this->remote_branch; + } + + /** + * Optional. The name of the branch in the Git remote from which to pull commits. + * If left unset, the repository's default branch name will be used. + * + * Generated from protobuf field string remote_branch = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRemoteBranch($var) + { + GPBUtil::checkString($var, True); + $this->remote_branch = $var; + + return $this; + } + + /** + * Required. The author of any merge commit which may be created as a result of merging + * fetched Git commits into this workspace. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.CommitAuthor author = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Dataform\V1beta1\CommitAuthor|null + */ + public function getAuthor() + { + return $this->author; + } + + public function hasAuthor() + { + return isset($this->author); + } + + public function clearAuthor() + { + unset($this->author); + } + + /** + * Required. The author of any merge commit which may be created as a result of merging + * fetched Git commits into this workspace. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.CommitAuthor author = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Dataform\V1beta1\CommitAuthor $var + * @return $this + */ + public function setAuthor($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dataform\V1beta1\CommitAuthor::class); + $this->author = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/PushGitCommitsRequest.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/PushGitCommitsRequest.php new file mode 100644 index 000000000000..91c87fea4150 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/PushGitCommitsRequest.php @@ -0,0 +1,105 @@ +google.cloud.dataform.v1beta1.PushGitCommitsRequest + */ +class PushGitCommitsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The workspace's name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. The name of the branch in the Git remote to which commits should be pushed. + * If left unset, the repository's default branch name will be used. + * + * Generated from protobuf field string remote_branch = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $remote_branch = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The workspace's name. + * @type string $remote_branch + * Optional. The name of the branch in the Git remote to which commits should be pushed. + * If left unset, the repository's default branch name will be used. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + + /** + * Required. The workspace's name. + * + * 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 workspace's name. + * + * 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; + } + + /** + * Optional. The name of the branch in the Git remote to which commits should be pushed. + * If left unset, the repository's default branch name will be used. + * + * Generated from protobuf field string remote_branch = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRemoteBranch() + { + return $this->remote_branch; + } + + /** + * Optional. The name of the branch in the Git remote to which commits should be pushed. + * If left unset, the repository's default branch name will be used. + * + * Generated from protobuf field string remote_branch = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRemoteBranch($var) + { + GPBUtil::checkString($var, True); + $this->remote_branch = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/QueryCompilationResultActionsRequest.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/QueryCompilationResultActionsRequest.php new file mode 100644 index 000000000000..8907e61d7e2f --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/QueryCompilationResultActionsRequest.php @@ -0,0 +1,197 @@ +google.cloud.dataform.v1beta1.QueryCompilationResultActionsRequest + */ +class QueryCompilationResultActionsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The compilation result's name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. Maximum number of compilation results to return. The server may return + * fewer items than requested. If unspecified, the server will pick an + * appropriate default. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Optional. Page token received from a previous `QueryCompilationResultActions` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `QueryCompilationResultActions` must match the call that provided the page + * token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = ''; + /** + * Optional. Optional filter for the returned list. Filtering is only currently + * supported on the `file_path` field. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $filter = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The compilation result's name. + * @type int $page_size + * Optional. Maximum number of compilation results to return. The server may return + * fewer items than requested. If unspecified, the server will pick an + * appropriate default. + * @type string $page_token + * Optional. Page token received from a previous `QueryCompilationResultActions` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `QueryCompilationResultActions` must match the call that provided the page + * token. + * @type string $filter + * Optional. Optional filter for the returned list. Filtering is only currently + * supported on the `file_path` field. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + + /** + * Required. The compilation result's name. + * + * 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 compilation result's name. + * + * 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; + } + + /** + * Optional. Maximum number of compilation results to return. The server may return + * fewer items than requested. If unspecified, the server will pick an + * appropriate default. + * + * 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 compilation results to return. The server may return + * fewer items than requested. If unspecified, the server will pick an + * appropriate default. + * + * 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. Page token received from a previous `QueryCompilationResultActions` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `QueryCompilationResultActions` must match the call that provided the page + * token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. Page token received from a previous `QueryCompilationResultActions` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `QueryCompilationResultActions` must match the call that provided the page + * token. + * + * 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. Optional filter for the returned list. Filtering is only currently + * supported on the `file_path` field. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Optional. Optional filter for the returned list. Filtering is only currently + * supported on the `file_path` field. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/QueryCompilationResultActionsResponse.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/QueryCompilationResultActionsResponse.php new file mode 100644 index 000000000000..b21b880933e5 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/QueryCompilationResultActionsResponse.php @@ -0,0 +1,105 @@ +google.cloud.dataform.v1beta1.QueryCompilationResultActionsResponse + */ +class QueryCompilationResultActionsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * List of compilation result actions. + * + * Generated from protobuf field repeated .google.cloud.dataform.v1beta1.CompilationResultAction compilation_result_actions = 1; + */ + private $compilation_result_actions; + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * 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\Dataform\V1beta1\CompilationResultAction>|\Google\Protobuf\Internal\RepeatedField $compilation_result_actions + * List of compilation result actions. + * @type string $next_page_token + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + + /** + * List of compilation result actions. + * + * Generated from protobuf field repeated .google.cloud.dataform.v1beta1.CompilationResultAction compilation_result_actions = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getCompilationResultActions() + { + return $this->compilation_result_actions; + } + + /** + * List of compilation result actions. + * + * Generated from protobuf field repeated .google.cloud.dataform.v1beta1.CompilationResultAction compilation_result_actions = 1; + * @param array<\Google\Cloud\Dataform\V1beta1\CompilationResultAction>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setCompilationResultActions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dataform\V1beta1\CompilationResultAction::class); + $this->compilation_result_actions = $arr; + + return $this; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * 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/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/QueryDirectoryContentsRequest.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/QueryDirectoryContentsRequest.php new file mode 100644 index 000000000000..f91de87a6863 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/QueryDirectoryContentsRequest.php @@ -0,0 +1,197 @@ +google.cloud.dataform.v1beta1.QueryDirectoryContentsRequest + */ +class QueryDirectoryContentsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The workspace's name. + * + * Generated from protobuf field string workspace = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $workspace = ''; + /** + * Optional. The directory's full path including directory name, relative to the + * workspace root. If left unset, the workspace root is used. + * + * Generated from protobuf field string path = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $path = ''; + /** + * Optional. Maximum number of paths to return. The server may return fewer + * items than requested. If unspecified, the server will pick an appropriate + * default. + * + * Generated from protobuf field int32 page_size = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Optional. Page token received from a previous `QueryDirectoryContents` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `QueryDirectoryContents` must match the call that provided the page + * token. + * + * Generated from protobuf field string page_token = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $workspace + * Required. The workspace's name. + * @type string $path + * Optional. The directory's full path including directory name, relative to the + * workspace root. If left unset, the workspace root is used. + * @type int $page_size + * Optional. Maximum number of paths to return. The server may return fewer + * items than requested. If unspecified, the server will pick an appropriate + * default. + * @type string $page_token + * Optional. Page token received from a previous `QueryDirectoryContents` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `QueryDirectoryContents` must match the call that provided the page + * token. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + + /** + * Required. The workspace's name. + * + * Generated from protobuf field string workspace = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getWorkspace() + { + return $this->workspace; + } + + /** + * Required. The workspace's name. + * + * Generated from protobuf field string workspace = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setWorkspace($var) + { + GPBUtil::checkString($var, True); + $this->workspace = $var; + + return $this; + } + + /** + * Optional. The directory's full path including directory name, relative to the + * workspace root. If left unset, the workspace root is used. + * + * Generated from protobuf field string path = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPath() + { + return $this->path; + } + + /** + * Optional. The directory's full path including directory name, relative to the + * workspace root. If left unset, the workspace root is used. + * + * Generated from protobuf field string path = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setPath($var) + { + GPBUtil::checkString($var, True); + $this->path = $var; + + return $this; + } + + /** + * Optional. Maximum number of paths to return. The server may return fewer + * items than requested. If unspecified, the server will pick an appropriate + * default. + * + * Generated from protobuf field int32 page_size = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. Maximum number of paths to return. The server may return fewer + * items than requested. If unspecified, the server will pick an appropriate + * default. + * + * Generated from protobuf field int32 page_size = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * Optional. Page token received from a previous `QueryDirectoryContents` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `QueryDirectoryContents` must match the call that provided the page + * token. + * + * Generated from protobuf field string page_token = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. Page token received from a previous `QueryDirectoryContents` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `QueryDirectoryContents` must match the call that provided the page + * token. + * + * Generated from protobuf field string page_token = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/QueryDirectoryContentsResponse.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/QueryDirectoryContentsResponse.php new file mode 100644 index 000000000000..7dd6d0787b66 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/QueryDirectoryContentsResponse.php @@ -0,0 +1,105 @@ +google.cloud.dataform.v1beta1.QueryDirectoryContentsResponse + */ +class QueryDirectoryContentsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * List of entries in the directory. + * + * Generated from protobuf field repeated .google.cloud.dataform.v1beta1.QueryDirectoryContentsResponse.DirectoryEntry directory_entries = 1; + */ + private $directory_entries; + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * 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\Dataform\V1beta1\QueryDirectoryContentsResponse\DirectoryEntry>|\Google\Protobuf\Internal\RepeatedField $directory_entries + * List of entries in the directory. + * @type string $next_page_token + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + + /** + * List of entries in the directory. + * + * Generated from protobuf field repeated .google.cloud.dataform.v1beta1.QueryDirectoryContentsResponse.DirectoryEntry directory_entries = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDirectoryEntries() + { + return $this->directory_entries; + } + + /** + * List of entries in the directory. + * + * Generated from protobuf field repeated .google.cloud.dataform.v1beta1.QueryDirectoryContentsResponse.DirectoryEntry directory_entries = 1; + * @param array<\Google\Cloud\Dataform\V1beta1\QueryDirectoryContentsResponse\DirectoryEntry>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDirectoryEntries($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dataform\V1beta1\QueryDirectoryContentsResponse\DirectoryEntry::class); + $this->directory_entries = $arr; + + return $this; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * 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/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/QueryDirectoryContentsResponse/DirectoryEntry.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/QueryDirectoryContentsResponse/DirectoryEntry.php new file mode 100644 index 000000000000..2b2d616acdd3 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/QueryDirectoryContentsResponse/DirectoryEntry.php @@ -0,0 +1,111 @@ +google.cloud.dataform.v1beta1.QueryDirectoryContentsResponse.DirectoryEntry + */ +class DirectoryEntry extends \Google\Protobuf\Internal\Message +{ + protected $entry; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $file + * A file in the directory. + * @type string $directory + * A child directory in the directory. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + + /** + * A file in the directory. + * + * Generated from protobuf field string file = 1; + * @return string + */ + public function getFile() + { + return $this->readOneof(1); + } + + public function hasFile() + { + return $this->hasOneof(1); + } + + /** + * A file in the directory. + * + * Generated from protobuf field string file = 1; + * @param string $var + * @return $this + */ + public function setFile($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * A child directory in the directory. + * + * Generated from protobuf field string directory = 2; + * @return string + */ + public function getDirectory() + { + return $this->readOneof(2); + } + + public function hasDirectory() + { + return $this->hasOneof(2); + } + + /** + * A child directory in the directory. + * + * Generated from protobuf field string directory = 2; + * @param string $var + * @return $this + */ + public function setDirectory($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * @return string + */ + public function getEntry() + { + return $this->whichOneof("entry"); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(DirectoryEntry::class, \Google\Cloud\Dataform\V1beta1\QueryDirectoryContentsResponse_DirectoryEntry::class); + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/QueryDirectoryContentsResponse_DirectoryEntry.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/QueryDirectoryContentsResponse_DirectoryEntry.php new file mode 100644 index 000000000000..af70ffbf85f8 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/QueryDirectoryContentsResponse_DirectoryEntry.php @@ -0,0 +1,16 @@ +google.cloud.dataform.v1beta1.QueryWorkflowInvocationActionsRequest + */ +class QueryWorkflowInvocationActionsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The workflow invocation's name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. Maximum number of workflow invocations to return. The server may return + * fewer items than requested. If unspecified, the server will pick an + * appropriate default. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Optional. Page token received from a previous `QueryWorkflowInvocationActions` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `QueryWorkflowInvocationActions` must match the call that provided the page + * token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The workflow invocation's name. + * @type int $page_size + * Optional. Maximum number of workflow invocations to return. The server may return + * fewer items than requested. If unspecified, the server will pick an + * appropriate default. + * @type string $page_token + * Optional. Page token received from a previous `QueryWorkflowInvocationActions` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `QueryWorkflowInvocationActions` must match the call that provided the page + * token. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + + /** + * Required. The workflow invocation's name. + * + * 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 workflow invocation's name. + * + * 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; + } + + /** + * Optional. Maximum number of workflow invocations to return. The server may return + * fewer items than requested. If unspecified, the server will pick an + * appropriate default. + * + * 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 workflow invocations to return. The server may return + * fewer items than requested. If unspecified, the server will pick an + * appropriate default. + * + * 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. Page token received from a previous `QueryWorkflowInvocationActions` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `QueryWorkflowInvocationActions` must match the call that provided the page + * token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. Page token received from a previous `QueryWorkflowInvocationActions` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `QueryWorkflowInvocationActions` must match the call that provided the page + * token. + * + * 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; + } + +} + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/QueryWorkflowInvocationActionsResponse.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/QueryWorkflowInvocationActionsResponse.php new file mode 100644 index 000000000000..0c7779e7964f --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/QueryWorkflowInvocationActionsResponse.php @@ -0,0 +1,105 @@ +google.cloud.dataform.v1beta1.QueryWorkflowInvocationActionsResponse + */ +class QueryWorkflowInvocationActionsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * List of workflow invocation actions. + * + * Generated from protobuf field repeated .google.cloud.dataform.v1beta1.WorkflowInvocationAction workflow_invocation_actions = 1; + */ + private $workflow_invocation_actions; + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * 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\Dataform\V1beta1\WorkflowInvocationAction>|\Google\Protobuf\Internal\RepeatedField $workflow_invocation_actions + * List of workflow invocation actions. + * @type string $next_page_token + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + + /** + * List of workflow invocation actions. + * + * Generated from protobuf field repeated .google.cloud.dataform.v1beta1.WorkflowInvocationAction workflow_invocation_actions = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getWorkflowInvocationActions() + { + return $this->workflow_invocation_actions; + } + + /** + * List of workflow invocation actions. + * + * Generated from protobuf field repeated .google.cloud.dataform.v1beta1.WorkflowInvocationAction workflow_invocation_actions = 1; + * @param array<\Google\Cloud\Dataform\V1beta1\WorkflowInvocationAction>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setWorkflowInvocationActions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dataform\V1beta1\WorkflowInvocationAction::class); + $this->workflow_invocation_actions = $arr; + + return $this; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * 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/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/ReadFileRequest.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/ReadFileRequest.php new file mode 100644 index 000000000000..0724e51eebef --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/ReadFileRequest.php @@ -0,0 +1,101 @@ +google.cloud.dataform.v1beta1.ReadFileRequest + */ +class ReadFileRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The workspace's name. + * + * Generated from protobuf field string workspace = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $workspace = ''; + /** + * Required. The file's full path including filename, relative to the workspace root. + * + * Generated from protobuf field string path = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $path = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $workspace + * Required. The workspace's name. + * @type string $path + * Required. The file's full path including filename, relative to the workspace root. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + + /** + * Required. The workspace's name. + * + * Generated from protobuf field string workspace = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getWorkspace() + { + return $this->workspace; + } + + /** + * Required. The workspace's name. + * + * Generated from protobuf field string workspace = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setWorkspace($var) + { + GPBUtil::checkString($var, True); + $this->workspace = $var; + + return $this; + } + + /** + * Required. The file's full path including filename, relative to the workspace root. + * + * Generated from protobuf field string path = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getPath() + { + return $this->path; + } + + /** + * Required. The file's full path including filename, relative to the workspace root. + * + * Generated from protobuf field string path = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setPath($var) + { + GPBUtil::checkString($var, True); + $this->path = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/ReadFileResponse.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/ReadFileResponse.php new file mode 100644 index 000000000000..f9978e7e33d8 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/ReadFileResponse.php @@ -0,0 +1,67 @@ +google.cloud.dataform.v1beta1.ReadFileResponse + */ +class ReadFileResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The file's contents. + * + * Generated from protobuf field bytes file_contents = 1; + */ + protected $file_contents = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $file_contents + * The file's contents. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + + /** + * The file's contents. + * + * Generated from protobuf field bytes file_contents = 1; + * @return string + */ + public function getFileContents() + { + return $this->file_contents; + } + + /** + * The file's contents. + * + * Generated from protobuf field bytes file_contents = 1; + * @param string $var + * @return $this + */ + public function setFileContents($var) + { + GPBUtil::checkString($var, False); + $this->file_contents = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/RelationDescriptor.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/RelationDescriptor.php new file mode 100644 index 000000000000..eaa53f555348 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/RelationDescriptor.php @@ -0,0 +1,135 @@ +google.cloud.dataform.v1beta1.RelationDescriptor + */ +class RelationDescriptor extends \Google\Protobuf\Internal\Message +{ + /** + * A text description of the relation. + * + * Generated from protobuf field string description = 1; + */ + protected $description = ''; + /** + * A list of descriptions of columns within the relation. + * + * Generated from protobuf field repeated .google.cloud.dataform.v1beta1.RelationDescriptor.ColumnDescriptor columns = 2; + */ + private $columns; + /** + * A set of BigQuery labels that should be applied to the relation. + * + * Generated from protobuf field map bigquery_labels = 3; + */ + private $bigquery_labels; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $description + * A text description of the relation. + * @type array<\Google\Cloud\Dataform\V1beta1\RelationDescriptor\ColumnDescriptor>|\Google\Protobuf\Internal\RepeatedField $columns + * A list of descriptions of columns within the relation. + * @type array|\Google\Protobuf\Internal\MapField $bigquery_labels + * A set of BigQuery labels that should be applied to the relation. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + + /** + * A text description of the relation. + * + * Generated from protobuf field string description = 1; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * A text description of the relation. + * + * Generated from protobuf field string description = 1; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * A list of descriptions of columns within the relation. + * + * Generated from protobuf field repeated .google.cloud.dataform.v1beta1.RelationDescriptor.ColumnDescriptor columns = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getColumns() + { + return $this->columns; + } + + /** + * A list of descriptions of columns within the relation. + * + * Generated from protobuf field repeated .google.cloud.dataform.v1beta1.RelationDescriptor.ColumnDescriptor columns = 2; + * @param array<\Google\Cloud\Dataform\V1beta1\RelationDescriptor\ColumnDescriptor>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setColumns($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dataform\V1beta1\RelationDescriptor\ColumnDescriptor::class); + $this->columns = $arr; + + return $this; + } + + /** + * A set of BigQuery labels that should be applied to the relation. + * + * Generated from protobuf field map bigquery_labels = 3; + * @return \Google\Protobuf\Internal\MapField + */ + public function getBigqueryLabels() + { + return $this->bigquery_labels; + } + + /** + * A set of BigQuery labels that should be applied to the relation. + * + * Generated from protobuf field map bigquery_labels = 3; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setBigqueryLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->bigquery_labels = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/RelationDescriptor/ColumnDescriptor.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/RelationDescriptor/ColumnDescriptor.php new file mode 100644 index 000000000000..c2d4527016ee --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/RelationDescriptor/ColumnDescriptor.php @@ -0,0 +1,142 @@ +google.cloud.dataform.v1beta1.RelationDescriptor.ColumnDescriptor + */ +class ColumnDescriptor extends \Google\Protobuf\Internal\Message +{ + /** + * The identifier for the column. Each entry in `path` represents one level + * of nesting. + * + * Generated from protobuf field repeated string path = 1; + */ + private $path; + /** + * A textual description of the column. + * + * Generated from protobuf field string description = 2; + */ + protected $description = ''; + /** + * A list of BigQuery policy tags that will be applied to the column. + * + * Generated from protobuf field repeated string bigquery_policy_tags = 3; + */ + private $bigquery_policy_tags; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $path + * The identifier for the column. Each entry in `path` represents one level + * of nesting. + * @type string $description + * A textual description of the column. + * @type array|\Google\Protobuf\Internal\RepeatedField $bigquery_policy_tags + * A list of BigQuery policy tags that will be applied to the column. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + + /** + * The identifier for the column. Each entry in `path` represents one level + * of nesting. + * + * Generated from protobuf field repeated string path = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getPath() + { + return $this->path; + } + + /** + * The identifier for the column. Each entry in `path` represents one level + * of nesting. + * + * Generated from protobuf field repeated string path = 1; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setPath($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->path = $arr; + + return $this; + } + + /** + * A textual description of the column. + * + * Generated from protobuf field string description = 2; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * A textual description of the column. + * + * Generated from protobuf field string description = 2; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * A list of BigQuery policy tags that will be applied to the column. + * + * Generated from protobuf field repeated string bigquery_policy_tags = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getBigqueryPolicyTags() + { + return $this->bigquery_policy_tags; + } + + /** + * A list of BigQuery policy tags that will be applied to the column. + * + * Generated from protobuf field repeated string bigquery_policy_tags = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setBigqueryPolicyTags($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->bigquery_policy_tags = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ColumnDescriptor::class, \Google\Cloud\Dataform\V1beta1\RelationDescriptor_ColumnDescriptor::class); + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/RelationDescriptor_ColumnDescriptor.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/RelationDescriptor_ColumnDescriptor.php new file mode 100644 index 000000000000..e7d0e023552e --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/RelationDescriptor_ColumnDescriptor.php @@ -0,0 +1,16 @@ +google.cloud.dataform.v1beta1.RemoveDirectoryRequest + */ +class RemoveDirectoryRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The workspace's name. + * + * Generated from protobuf field string workspace = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $workspace = ''; + /** + * Required. The directory's full path including directory name, relative to the + * workspace root. + * + * Generated from protobuf field string path = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $path = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $workspace + * Required. The workspace's name. + * @type string $path + * Required. The directory's full path including directory name, relative to the + * workspace root. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + + /** + * Required. The workspace's name. + * + * Generated from protobuf field string workspace = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getWorkspace() + { + return $this->workspace; + } + + /** + * Required. The workspace's name. + * + * Generated from protobuf field string workspace = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setWorkspace($var) + { + GPBUtil::checkString($var, True); + $this->workspace = $var; + + return $this; + } + + /** + * Required. The directory's full path including directory name, relative to the + * workspace root. + * + * Generated from protobuf field string path = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getPath() + { + return $this->path; + } + + /** + * Required. The directory's full path including directory name, relative to the + * workspace root. + * + * Generated from protobuf field string path = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setPath($var) + { + GPBUtil::checkString($var, True); + $this->path = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/RemoveFileRequest.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/RemoveFileRequest.php new file mode 100644 index 000000000000..6ef2277d3292 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/RemoveFileRequest.php @@ -0,0 +1,101 @@ +google.cloud.dataform.v1beta1.RemoveFileRequest + */ +class RemoveFileRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The workspace's name. + * + * Generated from protobuf field string workspace = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $workspace = ''; + /** + * Required. The file's full path including filename, relative to the workspace root. + * + * Generated from protobuf field string path = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $path = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $workspace + * Required. The workspace's name. + * @type string $path + * Required. The file's full path including filename, relative to the workspace root. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + + /** + * Required. The workspace's name. + * + * Generated from protobuf field string workspace = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getWorkspace() + { + return $this->workspace; + } + + /** + * Required. The workspace's name. + * + * Generated from protobuf field string workspace = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setWorkspace($var) + { + GPBUtil::checkString($var, True); + $this->workspace = $var; + + return $this; + } + + /** + * Required. The file's full path including filename, relative to the workspace root. + * + * Generated from protobuf field string path = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getPath() + { + return $this->path; + } + + /** + * Required. The file's full path including filename, relative to the workspace root. + * + * Generated from protobuf field string path = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setPath($var) + { + GPBUtil::checkString($var, True); + $this->path = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/Repository.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/Repository.php new file mode 100644 index 000000000000..1d997963ba80 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/Repository.php @@ -0,0 +1,111 @@ +google.cloud.dataform.v1beta1.Repository + */ +class Repository extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The repository's name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $name = ''; + /** + * Optional. If set, configures this repository to be linked to a Git remote. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.Repository.GitRemoteSettings git_remote_settings = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $git_remote_settings = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Output only. The repository's name. + * @type \Google\Cloud\Dataform\V1beta1\Repository\GitRemoteSettings $git_remote_settings + * Optional. If set, configures this repository to be linked to a Git remote. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The repository's name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Output only. The repository's name. + * + * 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; + } + + /** + * Optional. If set, configures this repository to be linked to a Git remote. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.Repository.GitRemoteSettings git_remote_settings = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\Dataform\V1beta1\Repository\GitRemoteSettings|null + */ + public function getGitRemoteSettings() + { + return $this->git_remote_settings; + } + + public function hasGitRemoteSettings() + { + return isset($this->git_remote_settings); + } + + public function clearGitRemoteSettings() + { + unset($this->git_remote_settings); + } + + /** + * Optional. If set, configures this repository to be linked to a Git remote. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.Repository.GitRemoteSettings git_remote_settings = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\Dataform\V1beta1\Repository\GitRemoteSettings $var + * @return $this + */ + public function setGitRemoteSettings($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dataform\V1beta1\Repository\GitRemoteSettings::class); + $this->git_remote_settings = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/Repository/GitRemoteSettings.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/Repository/GitRemoteSettings.php new file mode 100644 index 000000000000..bd9b0210e78c --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/Repository/GitRemoteSettings.php @@ -0,0 +1,180 @@ +google.cloud.dataform.v1beta1.Repository.GitRemoteSettings + */ +class GitRemoteSettings extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The Git remote's URL. + * + * Generated from protobuf field string url = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $url = ''; + /** + * Required. The Git remote's default branch name. + * + * Generated from protobuf field string default_branch = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $default_branch = ''; + /** + * Required. The name of the Secret Manager secret version to use as an + * authentication token for Git operations. Must be in the format + * `projects/*/secrets/*/versions/*`. + * + * Generated from protobuf field string authentication_token_secret_version = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $authentication_token_secret_version = ''; + /** + * Output only. Indicates the status of the Git access token. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.Repository.GitRemoteSettings.TokenStatus token_status = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $token_status = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $url + * Required. The Git remote's URL. + * @type string $default_branch + * Required. The Git remote's default branch name. + * @type string $authentication_token_secret_version + * Required. The name of the Secret Manager secret version to use as an + * authentication token for Git operations. Must be in the format + * `projects/*/secrets/*/versions/*`. + * @type int $token_status + * Output only. Indicates the status of the Git access token. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + + /** + * Required. The Git remote's URL. + * + * Generated from protobuf field string url = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getUrl() + { + return $this->url; + } + + /** + * Required. The Git remote's URL. + * + * Generated from protobuf field string url = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setUrl($var) + { + GPBUtil::checkString($var, True); + $this->url = $var; + + return $this; + } + + /** + * Required. The Git remote's default branch name. + * + * Generated from protobuf field string default_branch = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getDefaultBranch() + { + return $this->default_branch; + } + + /** + * Required. The Git remote's default branch name. + * + * Generated from protobuf field string default_branch = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setDefaultBranch($var) + { + GPBUtil::checkString($var, True); + $this->default_branch = $var; + + return $this; + } + + /** + * Required. The name of the Secret Manager secret version to use as an + * authentication token for Git operations. Must be in the format + * `projects/*/secrets/*/versions/*`. + * + * Generated from protobuf field string authentication_token_secret_version = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getAuthenticationTokenSecretVersion() + { + return $this->authentication_token_secret_version; + } + + /** + * Required. The name of the Secret Manager secret version to use as an + * authentication token for Git operations. Must be in the format + * `projects/*/secrets/*/versions/*`. + * + * Generated from protobuf field string authentication_token_secret_version = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setAuthenticationTokenSecretVersion($var) + { + GPBUtil::checkString($var, True); + $this->authentication_token_secret_version = $var; + + return $this; + } + + /** + * Output only. Indicates the status of the Git access token. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.Repository.GitRemoteSettings.TokenStatus token_status = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getTokenStatus() + { + return $this->token_status; + } + + /** + * Output only. Indicates the status of the Git access token. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.Repository.GitRemoteSettings.TokenStatus token_status = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setTokenStatus($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Dataform\V1beta1\Repository\GitRemoteSettings\TokenStatus::class); + $this->token_status = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(GitRemoteSettings::class, \Google\Cloud\Dataform\V1beta1\Repository_GitRemoteSettings::class); + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/Repository/GitRemoteSettings/TokenStatus.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/Repository/GitRemoteSettings/TokenStatus.php new file mode 100644 index 000000000000..2879131ecdd6 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/Repository/GitRemoteSettings/TokenStatus.php @@ -0,0 +1,72 @@ +google.cloud.dataform.v1beta1.Repository.GitRemoteSettings.TokenStatus + */ +class TokenStatus +{ + /** + * Default value. This value is unused. + * + * Generated from protobuf enum TOKEN_STATUS_UNSPECIFIED = 0; + */ + const TOKEN_STATUS_UNSPECIFIED = 0; + /** + * The token could not be found in Secret Manager (or the Dataform + * Service Account did not have permission to access it). + * + * Generated from protobuf enum NOT_FOUND = 1; + */ + const NOT_FOUND = 1; + /** + * The token could not be used to authenticate against the Git remote. + * + * Generated from protobuf enum INVALID = 2; + */ + const INVALID = 2; + /** + * The token was used successfully to authenticate against the Git remote. + * + * Generated from protobuf enum VALID = 3; + */ + const VALID = 3; + + private static $valueToName = [ + self::TOKEN_STATUS_UNSPECIFIED => 'TOKEN_STATUS_UNSPECIFIED', + self::NOT_FOUND => 'NOT_FOUND', + self::INVALID => 'INVALID', + self::VALID => 'VALID', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(TokenStatus::class, \Google\Cloud\Dataform\V1beta1\Repository_GitRemoteSettings_TokenStatus::class); + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/Repository_GitRemoteSettings.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/Repository_GitRemoteSettings.php new file mode 100644 index 000000000000..7d3b6960f03d --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/Repository_GitRemoteSettings.php @@ -0,0 +1,16 @@ +google.cloud.dataform.v1beta1.ResetWorkspaceChangesRequest + */ +class ResetWorkspaceChangesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The workspace's name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. Full file paths to reset back to their committed state including filename, + * rooted at workspace root. If left empty, all files will be reset. + * + * Generated from protobuf field repeated string paths = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $paths; + /** + * Optional. If set to true, untracked files will be deleted. + * + * Generated from protobuf field bool clean = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $clean = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The workspace's name. + * @type array|\Google\Protobuf\Internal\RepeatedField $paths + * Optional. Full file paths to reset back to their committed state including filename, + * rooted at workspace root. If left empty, all files will be reset. + * @type bool $clean + * Optional. If set to true, untracked files will be deleted. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + + /** + * Required. The workspace's name. + * + * 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 workspace's name. + * + * 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; + } + + /** + * Optional. Full file paths to reset back to their committed state including filename, + * rooted at workspace root. If left empty, all files will be reset. + * + * Generated from protobuf field repeated string paths = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getPaths() + { + return $this->paths; + } + + /** + * Optional. Full file paths to reset back to their committed state including filename, + * rooted at workspace root. If left empty, all files will be reset. + * + * Generated from protobuf field repeated string paths = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setPaths($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->paths = $arr; + + return $this; + } + + /** + * Optional. If set to true, untracked files will be deleted. + * + * Generated from protobuf field bool clean = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getClean() + { + return $this->clean; + } + + /** + * Optional. If set to true, untracked files will be deleted. + * + * Generated from protobuf field bool clean = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setClean($var) + { + GPBUtil::checkBool($var); + $this->clean = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/Target.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/Target.php new file mode 100644 index 000000000000..2b0c0a40cdf1 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/Target.php @@ -0,0 +1,136 @@ +google.cloud.dataform.v1beta1.Target + */ +class Target extends \Google\Protobuf\Internal\Message +{ + /** + * The action's database (Google Cloud project ID) . + * + * Generated from protobuf field string database = 1; + */ + protected $database = ''; + /** + * The action's schema (BigQuery dataset ID), within `database`. + * + * Generated from protobuf field string schema = 2; + */ + protected $schema = ''; + /** + * The action's name, within `database` and `schema`. + * + * Generated from protobuf field string name = 3; + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $database + * The action's database (Google Cloud project ID) . + * @type string $schema + * The action's schema (BigQuery dataset ID), within `database`. + * @type string $name + * The action's name, within `database` and `schema`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + + /** + * The action's database (Google Cloud project ID) . + * + * Generated from protobuf field string database = 1; + * @return string + */ + public function getDatabase() + { + return $this->database; + } + + /** + * The action's database (Google Cloud project ID) . + * + * Generated from protobuf field string database = 1; + * @param string $var + * @return $this + */ + public function setDatabase($var) + { + GPBUtil::checkString($var, True); + $this->database = $var; + + return $this; + } + + /** + * The action's schema (BigQuery dataset ID), within `database`. + * + * Generated from protobuf field string schema = 2; + * @return string + */ + public function getSchema() + { + return $this->schema; + } + + /** + * The action's schema (BigQuery dataset ID), within `database`. + * + * Generated from protobuf field string schema = 2; + * @param string $var + * @return $this + */ + public function setSchema($var) + { + GPBUtil::checkString($var, True); + $this->schema = $var; + + return $this; + } + + /** + * The action's name, within `database` and `schema`. + * + * Generated from protobuf field string name = 3; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The action's name, within `database` and `schema`. + * + * Generated from protobuf field string name = 3; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/UpdateRepositoryRequest.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/UpdateRepositoryRequest.php new file mode 100644 index 000000000000..c8cc67f4b8ef --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/UpdateRepositoryRequest.php @@ -0,0 +1,141 @@ +google.cloud.dataform.v1beta1.UpdateRepositoryRequest + */ +class UpdateRepositoryRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. Specifies the fields to be updated in the repository. If left unset, + * all fields will be updated. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $update_mask = null; + /** + * Required. The repository to update. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.Repository repository = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $repository = null; + + /** + * @param \Google\Cloud\Dataform\V1beta1\Repository $repository Required. The repository to update. + * @param \Google\Protobuf\FieldMask $updateMask Optional. Specifies the fields to be updated in the repository. If left unset, + * all fields will be updated. + * + * @return \Google\Cloud\Dataform\V1beta1\UpdateRepositoryRequest + * + * @experimental + */ + public static function build(\Google\Cloud\Dataform\V1beta1\Repository $repository, \Google\Protobuf\FieldMask $updateMask): self + { + return (new self()) + ->setRepository($repository) + ->setUpdateMask($updateMask); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\FieldMask $update_mask + * Optional. Specifies the fields to be updated in the repository. If left unset, + * all fields will be updated. + * @type \Google\Cloud\Dataform\V1beta1\Repository $repository + * Required. The repository to update. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + + /** + * Optional. Specifies the fields to be updated in the repository. If left unset, + * all fields will be updated. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Optional. Specifies the fields to be updated in the repository. If left unset, + * all fields will be updated. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + + /** + * Required. The repository to update. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.Repository repository = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Dataform\V1beta1\Repository|null + */ + public function getRepository() + { + return $this->repository; + } + + public function hasRepository() + { + return isset($this->repository); + } + + public function clearRepository() + { + unset($this->repository); + } + + /** + * Required. The repository to update. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.Repository repository = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Dataform\V1beta1\Repository $var + * @return $this + */ + public function setRepository($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dataform\V1beta1\Repository::class); + $this->repository = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/WorkflowInvocation.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/WorkflowInvocation.php new file mode 100644 index 000000000000..2326bf69d751 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/WorkflowInvocation.php @@ -0,0 +1,227 @@ +google.cloud.dataform.v1beta1.WorkflowInvocation + */ +class WorkflowInvocation extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The workflow invocation's name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $name = ''; + /** + * Immutable. The name of the compilation result to compile. Must be in the format + * `projects/*/locations/*/repositories/*/compilationResults/*`. + * + * Generated from protobuf field string compilation_result = 2 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.resource_reference) = { + */ + protected $compilation_result = ''; + /** + * Immutable. If left unset, a default InvocationConfig will be used. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.WorkflowInvocation.InvocationConfig invocation_config = 3 [(.google.api.field_behavior) = IMMUTABLE]; + */ + protected $invocation_config = null; + /** + * Output only. This workflow invocation's current state. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.WorkflowInvocation.State state = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Output only. This workflow invocation's timing details. + * + * Generated from protobuf field .google.type.Interval invocation_timing = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $invocation_timing = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Output only. The workflow invocation's name. + * @type string $compilation_result + * Immutable. The name of the compilation result to compile. Must be in the format + * `projects/*/locations/*/repositories/*/compilationResults/*`. + * @type \Google\Cloud\Dataform\V1beta1\WorkflowInvocation\InvocationConfig $invocation_config + * Immutable. If left unset, a default InvocationConfig will be used. + * @type int $state + * Output only. This workflow invocation's current state. + * @type \Google\Type\Interval $invocation_timing + * Output only. This workflow invocation's timing details. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The workflow invocation's name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Output only. The workflow invocation's name. + * + * 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; + } + + /** + * Immutable. The name of the compilation result to compile. Must be in the format + * `projects/*/locations/*/repositories/*/compilationResults/*`. + * + * Generated from protobuf field string compilation_result = 2 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.resource_reference) = { + * @return string + */ + public function getCompilationResult() + { + return $this->compilation_result; + } + + /** + * Immutable. The name of the compilation result to compile. Must be in the format + * `projects/*/locations/*/repositories/*/compilationResults/*`. + * + * Generated from protobuf field string compilation_result = 2 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setCompilationResult($var) + { + GPBUtil::checkString($var, True); + $this->compilation_result = $var; + + return $this; + } + + /** + * Immutable. If left unset, a default InvocationConfig will be used. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.WorkflowInvocation.InvocationConfig invocation_config = 3 [(.google.api.field_behavior) = IMMUTABLE]; + * @return \Google\Cloud\Dataform\V1beta1\WorkflowInvocation\InvocationConfig|null + */ + public function getInvocationConfig() + { + return $this->invocation_config; + } + + public function hasInvocationConfig() + { + return isset($this->invocation_config); + } + + public function clearInvocationConfig() + { + unset($this->invocation_config); + } + + /** + * Immutable. If left unset, a default InvocationConfig will be used. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.WorkflowInvocation.InvocationConfig invocation_config = 3 [(.google.api.field_behavior) = IMMUTABLE]; + * @param \Google\Cloud\Dataform\V1beta1\WorkflowInvocation\InvocationConfig $var + * @return $this + */ + public function setInvocationConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dataform\V1beta1\WorkflowInvocation\InvocationConfig::class); + $this->invocation_config = $var; + + return $this; + } + + /** + * Output only. This workflow invocation's current state. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.WorkflowInvocation.State state = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. This workflow invocation's current state. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.WorkflowInvocation.State state = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Dataform\V1beta1\WorkflowInvocation\State::class); + $this->state = $var; + + return $this; + } + + /** + * Output only. This workflow invocation's timing details. + * + * Generated from protobuf field .google.type.Interval invocation_timing = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Type\Interval|null + */ + public function getInvocationTiming() + { + return $this->invocation_timing; + } + + public function hasInvocationTiming() + { + return isset($this->invocation_timing); + } + + public function clearInvocationTiming() + { + unset($this->invocation_timing); + } + + /** + * Output only. This workflow invocation's timing details. + * + * Generated from protobuf field .google.type.Interval invocation_timing = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Type\Interval $var + * @return $this + */ + public function setInvocationTiming($var) + { + GPBUtil::checkMessage($var, \Google\Type\Interval::class); + $this->invocation_timing = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/WorkflowInvocation/InvocationConfig.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/WorkflowInvocation/InvocationConfig.php new file mode 100644 index 000000000000..c91a11b1387c --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/WorkflowInvocation/InvocationConfig.php @@ -0,0 +1,216 @@ +google.cloud.dataform.v1beta1.WorkflowInvocation.InvocationConfig + */ +class InvocationConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Immutable. The set of action identifiers to include. + * + * Generated from protobuf field repeated .google.cloud.dataform.v1beta1.Target included_targets = 1 [(.google.api.field_behavior) = IMMUTABLE]; + */ + private $included_targets; + /** + * Immutable. The set of tags to include. + * + * Generated from protobuf field repeated string included_tags = 2 [(.google.api.field_behavior) = IMMUTABLE]; + */ + private $included_tags; + /** + * Immutable. When set to true, transitive dependencies of included actions will be + * executed. + * + * Generated from protobuf field bool transitive_dependencies_included = 3 [(.google.api.field_behavior) = IMMUTABLE]; + */ + protected $transitive_dependencies_included = false; + /** + * Immutable. When set to true, transitive dependents of included actions will be + * executed. + * + * Generated from protobuf field bool transitive_dependents_included = 4 [(.google.api.field_behavior) = IMMUTABLE]; + */ + protected $transitive_dependents_included = false; + /** + * Immutable. When set to true, any incremental tables will be fully refreshed. + * + * Generated from protobuf field bool fully_refresh_incremental_tables_enabled = 5 [(.google.api.field_behavior) = IMMUTABLE]; + */ + protected $fully_refresh_incremental_tables_enabled = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Dataform\V1beta1\Target>|\Google\Protobuf\Internal\RepeatedField $included_targets + * Immutable. The set of action identifiers to include. + * @type array|\Google\Protobuf\Internal\RepeatedField $included_tags + * Immutable. The set of tags to include. + * @type bool $transitive_dependencies_included + * Immutable. When set to true, transitive dependencies of included actions will be + * executed. + * @type bool $transitive_dependents_included + * Immutable. When set to true, transitive dependents of included actions will be + * executed. + * @type bool $fully_refresh_incremental_tables_enabled + * Immutable. When set to true, any incremental tables will be fully refreshed. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + + /** + * Immutable. The set of action identifiers to include. + * + * Generated from protobuf field repeated .google.cloud.dataform.v1beta1.Target included_targets = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getIncludedTargets() + { + return $this->included_targets; + } + + /** + * Immutable. The set of action identifiers to include. + * + * Generated from protobuf field repeated .google.cloud.dataform.v1beta1.Target included_targets = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * @param array<\Google\Cloud\Dataform\V1beta1\Target>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setIncludedTargets($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dataform\V1beta1\Target::class); + $this->included_targets = $arr; + + return $this; + } + + /** + * Immutable. The set of tags to include. + * + * Generated from protobuf field repeated string included_tags = 2 [(.google.api.field_behavior) = IMMUTABLE]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getIncludedTags() + { + return $this->included_tags; + } + + /** + * Immutable. The set of tags to include. + * + * Generated from protobuf field repeated string included_tags = 2 [(.google.api.field_behavior) = IMMUTABLE]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setIncludedTags($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->included_tags = $arr; + + return $this; + } + + /** + * Immutable. When set to true, transitive dependencies of included actions will be + * executed. + * + * Generated from protobuf field bool transitive_dependencies_included = 3 [(.google.api.field_behavior) = IMMUTABLE]; + * @return bool + */ + public function getTransitiveDependenciesIncluded() + { + return $this->transitive_dependencies_included; + } + + /** + * Immutable. When set to true, transitive dependencies of included actions will be + * executed. + * + * Generated from protobuf field bool transitive_dependencies_included = 3 [(.google.api.field_behavior) = IMMUTABLE]; + * @param bool $var + * @return $this + */ + public function setTransitiveDependenciesIncluded($var) + { + GPBUtil::checkBool($var); + $this->transitive_dependencies_included = $var; + + return $this; + } + + /** + * Immutable. When set to true, transitive dependents of included actions will be + * executed. + * + * Generated from protobuf field bool transitive_dependents_included = 4 [(.google.api.field_behavior) = IMMUTABLE]; + * @return bool + */ + public function getTransitiveDependentsIncluded() + { + return $this->transitive_dependents_included; + } + + /** + * Immutable. When set to true, transitive dependents of included actions will be + * executed. + * + * Generated from protobuf field bool transitive_dependents_included = 4 [(.google.api.field_behavior) = IMMUTABLE]; + * @param bool $var + * @return $this + */ + public function setTransitiveDependentsIncluded($var) + { + GPBUtil::checkBool($var); + $this->transitive_dependents_included = $var; + + return $this; + } + + /** + * Immutable. When set to true, any incremental tables will be fully refreshed. + * + * Generated from protobuf field bool fully_refresh_incremental_tables_enabled = 5 [(.google.api.field_behavior) = IMMUTABLE]; + * @return bool + */ + public function getFullyRefreshIncrementalTablesEnabled() + { + return $this->fully_refresh_incremental_tables_enabled; + } + + /** + * Immutable. When set to true, any incremental tables will be fully refreshed. + * + * Generated from protobuf field bool fully_refresh_incremental_tables_enabled = 5 [(.google.api.field_behavior) = IMMUTABLE]; + * @param bool $var + * @return $this + */ + public function setFullyRefreshIncrementalTablesEnabled($var) + { + GPBUtil::checkBool($var); + $this->fully_refresh_incremental_tables_enabled = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(InvocationConfig::class, \Google\Cloud\Dataform\V1beta1\WorkflowInvocation_InvocationConfig::class); + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/WorkflowInvocation/State.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/WorkflowInvocation/State.php new file mode 100644 index 000000000000..b5a080c906ee --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/WorkflowInvocation/State.php @@ -0,0 +1,86 @@ +google.cloud.dataform.v1beta1.WorkflowInvocation.State + */ +class State +{ + /** + * Default value. This value is unused. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The workflow invocation is currently running. + * + * Generated from protobuf enum RUNNING = 1; + */ + const RUNNING = 1; + /** + * The workflow invocation succeeded. A terminal state. + * + * Generated from protobuf enum SUCCEEDED = 2; + */ + const SUCCEEDED = 2; + /** + * The workflow invocation was cancelled. A terminal state. + * + * Generated from protobuf enum CANCELLED = 3; + */ + const CANCELLED = 3; + /** + * The workflow invocation failed. A terminal state. + * + * Generated from protobuf enum FAILED = 4; + */ + const FAILED = 4; + /** + * The workflow invocation is being cancelled, but some actions are still + * running. + * + * Generated from protobuf enum CANCELING = 5; + */ + const CANCELING = 5; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::RUNNING => 'RUNNING', + self::SUCCEEDED => 'SUCCEEDED', + self::CANCELLED => 'CANCELLED', + self::FAILED => 'FAILED', + self::CANCELING => 'CANCELING', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\Dataform\V1beta1\WorkflowInvocation_State::class); + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/WorkflowInvocationAction.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/WorkflowInvocationAction.php new file mode 100644 index 000000000000..1c756c45f60d --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/WorkflowInvocationAction.php @@ -0,0 +1,297 @@ +google.cloud.dataform.v1beta1.WorkflowInvocationAction + */ +class WorkflowInvocationAction extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. This action's identifier. Unique within the workflow invocation. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.Target target = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $target = null; + /** + * Output only. The action's identifier if the project had been compiled without any + * overrides configured. Unique within the compilation result. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.Target canonical_target = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $canonical_target = null; + /** + * Output only. This action's current state. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.WorkflowInvocationAction.State state = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Output only. If and only if action's state is FAILED a failure reason is set. + * + * Generated from protobuf field string failure_reason = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $failure_reason = ''; + /** + * Output only. This action's timing details. + * `start_time` will be set if the action is in [RUNNING, SUCCEEDED, + * CANCELLED, FAILED] state. + * `end_time` will be set if the action is in [SUCCEEDED, CANCELLED, FAILED] + * state. + * + * Generated from protobuf field .google.type.Interval invocation_timing = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $invocation_timing = null; + /** + * Output only. The workflow action's bigquery action details. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.WorkflowInvocationAction.BigQueryAction bigquery_action = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $bigquery_action = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Dataform\V1beta1\Target $target + * Output only. This action's identifier. Unique within the workflow invocation. + * @type \Google\Cloud\Dataform\V1beta1\Target $canonical_target + * Output only. The action's identifier if the project had been compiled without any + * overrides configured. Unique within the compilation result. + * @type int $state + * Output only. This action's current state. + * @type string $failure_reason + * Output only. If and only if action's state is FAILED a failure reason is set. + * @type \Google\Type\Interval $invocation_timing + * Output only. This action's timing details. + * `start_time` will be set if the action is in [RUNNING, SUCCEEDED, + * CANCELLED, FAILED] state. + * `end_time` will be set if the action is in [SUCCEEDED, CANCELLED, FAILED] + * state. + * @type \Google\Cloud\Dataform\V1beta1\WorkflowInvocationAction\BigQueryAction $bigquery_action + * Output only. The workflow action's bigquery action details. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + + /** + * Output only. This action's identifier. Unique within the workflow invocation. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.Target target = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\Dataform\V1beta1\Target|null + */ + public function getTarget() + { + return $this->target; + } + + public function hasTarget() + { + return isset($this->target); + } + + public function clearTarget() + { + unset($this->target); + } + + /** + * Output only. This action's identifier. Unique within the workflow invocation. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.Target target = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\Dataform\V1beta1\Target $var + * @return $this + */ + public function setTarget($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dataform\V1beta1\Target::class); + $this->target = $var; + + return $this; + } + + /** + * Output only. The action's identifier if the project had been compiled without any + * overrides configured. Unique within the compilation result. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.Target canonical_target = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\Dataform\V1beta1\Target|null + */ + public function getCanonicalTarget() + { + return $this->canonical_target; + } + + public function hasCanonicalTarget() + { + return isset($this->canonical_target); + } + + public function clearCanonicalTarget() + { + unset($this->canonical_target); + } + + /** + * Output only. The action's identifier if the project had been compiled without any + * overrides configured. Unique within the compilation result. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.Target canonical_target = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\Dataform\V1beta1\Target $var + * @return $this + */ + public function setCanonicalTarget($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dataform\V1beta1\Target::class); + $this->canonical_target = $var; + + return $this; + } + + /** + * Output only. This action's current state. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.WorkflowInvocationAction.State state = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. This action's current state. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.WorkflowInvocationAction.State state = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Dataform\V1beta1\WorkflowInvocationAction\State::class); + $this->state = $var; + + return $this; + } + + /** + * Output only. If and only if action's state is FAILED a failure reason is set. + * + * Generated from protobuf field string failure_reason = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getFailureReason() + { + return $this->failure_reason; + } + + /** + * Output only. If and only if action's state is FAILED a failure reason is set. + * + * Generated from protobuf field string failure_reason = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setFailureReason($var) + { + GPBUtil::checkString($var, True); + $this->failure_reason = $var; + + return $this; + } + + /** + * Output only. This action's timing details. + * `start_time` will be set if the action is in [RUNNING, SUCCEEDED, + * CANCELLED, FAILED] state. + * `end_time` will be set if the action is in [SUCCEEDED, CANCELLED, FAILED] + * state. + * + * Generated from protobuf field .google.type.Interval invocation_timing = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Type\Interval|null + */ + public function getInvocationTiming() + { + return $this->invocation_timing; + } + + public function hasInvocationTiming() + { + return isset($this->invocation_timing); + } + + public function clearInvocationTiming() + { + unset($this->invocation_timing); + } + + /** + * Output only. This action's timing details. + * `start_time` will be set if the action is in [RUNNING, SUCCEEDED, + * CANCELLED, FAILED] state. + * `end_time` will be set if the action is in [SUCCEEDED, CANCELLED, FAILED] + * state. + * + * Generated from protobuf field .google.type.Interval invocation_timing = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Type\Interval $var + * @return $this + */ + public function setInvocationTiming($var) + { + GPBUtil::checkMessage($var, \Google\Type\Interval::class); + $this->invocation_timing = $var; + + return $this; + } + + /** + * Output only. The workflow action's bigquery action details. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.WorkflowInvocationAction.BigQueryAction bigquery_action = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\Dataform\V1beta1\WorkflowInvocationAction\BigQueryAction|null + */ + public function getBigqueryAction() + { + return $this->bigquery_action; + } + + public function hasBigqueryAction() + { + return isset($this->bigquery_action); + } + + public function clearBigqueryAction() + { + unset($this->bigquery_action); + } + + /** + * Output only. The workflow action's bigquery action details. + * + * Generated from protobuf field .google.cloud.dataform.v1beta1.WorkflowInvocationAction.BigQueryAction bigquery_action = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\Dataform\V1beta1\WorkflowInvocationAction\BigQueryAction $var + * @return $this + */ + public function setBigqueryAction($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dataform\V1beta1\WorkflowInvocationAction\BigQueryAction::class); + $this->bigquery_action = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/WorkflowInvocationAction/BigQueryAction.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/WorkflowInvocationAction/BigQueryAction.php new file mode 100644 index 000000000000..f65077ba1fea --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/WorkflowInvocationAction/BigQueryAction.php @@ -0,0 +1,70 @@ +google.cloud.dataform.v1beta1.WorkflowInvocationAction.BigQueryAction + */ +class BigQueryAction extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The generated BigQuery SQL script that will be executed. + * + * Generated from protobuf field string sql_script = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $sql_script = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $sql_script + * Output only. The generated BigQuery SQL script that will be executed. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The generated BigQuery SQL script that will be executed. + * + * Generated from protobuf field string sql_script = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getSqlScript() + { + return $this->sql_script; + } + + /** + * Output only. The generated BigQuery SQL script that will be executed. + * + * Generated from protobuf field string sql_script = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setSqlScript($var) + { + GPBUtil::checkString($var, True); + $this->sql_script = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(BigQueryAction::class, \Google\Cloud\Dataform\V1beta1\WorkflowInvocationAction_BigQueryAction::class); + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/WorkflowInvocationAction/State.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/WorkflowInvocationAction/State.php new file mode 100644 index 000000000000..e039c8c91ad3 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/WorkflowInvocationAction/State.php @@ -0,0 +1,94 @@ +google.cloud.dataform.v1beta1.WorkflowInvocationAction.State + */ +class State +{ + /** + * The action has not yet been considered for invocation. + * + * Generated from protobuf enum PENDING = 0; + */ + const PENDING = 0; + /** + * The action is currently running. + * + * Generated from protobuf enum RUNNING = 1; + */ + const RUNNING = 1; + /** + * Execution of the action was skipped because upstream dependencies did not + * all complete successfully. A terminal state. + * + * Generated from protobuf enum SKIPPED = 2; + */ + const SKIPPED = 2; + /** + * Execution of the action was disabled as per the configuration of the + * corresponding compilation result action. A terminal state. + * + * Generated from protobuf enum DISABLED = 3; + */ + const DISABLED = 3; + /** + * The action succeeded. A terminal state. + * + * Generated from protobuf enum SUCCEEDED = 4; + */ + const SUCCEEDED = 4; + /** + * The action was cancelled. A terminal state. + * + * Generated from protobuf enum CANCELLED = 5; + */ + const CANCELLED = 5; + /** + * The action failed. A terminal state. + * + * Generated from protobuf enum FAILED = 6; + */ + const FAILED = 6; + + private static $valueToName = [ + self::PENDING => 'PENDING', + self::RUNNING => 'RUNNING', + self::SKIPPED => 'SKIPPED', + self::DISABLED => 'DISABLED', + self::SUCCEEDED => 'SUCCEEDED', + self::CANCELLED => 'CANCELLED', + self::FAILED => 'FAILED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\Dataform\V1beta1\WorkflowInvocationAction_State::class); + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/WorkflowInvocationAction_BigQueryAction.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/WorkflowInvocationAction_BigQueryAction.php new file mode 100644 index 000000000000..59887d60cf60 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/WorkflowInvocationAction_BigQueryAction.php @@ -0,0 +1,16 @@ +google.cloud.dataform.v1beta1.Workspace + */ +class Workspace extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The workspace's name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Output only. The workspace's name. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The workspace's name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Output only. The workspace's name. + * + * 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; + } + +} + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/WriteFileRequest.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/WriteFileRequest.php new file mode 100644 index 000000000000..52c30bdc5692 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/WriteFileRequest.php @@ -0,0 +1,135 @@ +google.cloud.dataform.v1beta1.WriteFileRequest + */ +class WriteFileRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The workspace's name. + * + * Generated from protobuf field string workspace = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $workspace = ''; + /** + * Required. The file. + * + * Generated from protobuf field string path = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $path = ''; + /** + * Required. The file's contents. + * + * Generated from protobuf field bytes contents = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $contents = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $workspace + * Required. The workspace's name. + * @type string $path + * Required. The file. + * @type string $contents + * Required. The file's contents. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + + /** + * Required. The workspace's name. + * + * Generated from protobuf field string workspace = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getWorkspace() + { + return $this->workspace; + } + + /** + * Required. The workspace's name. + * + * Generated from protobuf field string workspace = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setWorkspace($var) + { + GPBUtil::checkString($var, True); + $this->workspace = $var; + + return $this; + } + + /** + * Required. The file. + * + * Generated from protobuf field string path = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getPath() + { + return $this->path; + } + + /** + * Required. The file. + * + * Generated from protobuf field string path = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setPath($var) + { + GPBUtil::checkString($var, True); + $this->path = $var; + + return $this; + } + + /** + * Required. The file's contents. + * + * Generated from protobuf field bytes contents = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getContents() + { + return $this->contents; + } + + /** + * Required. The file's contents. + * + * Generated from protobuf field bytes contents = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setContents($var) + { + GPBUtil::checkString($var, False); + $this->contents = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/WriteFileResponse.php b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/WriteFileResponse.php new file mode 100644 index 000000000000..610d4c47dfa2 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/proto/src/Google/Cloud/Dataform/V1beta1/WriteFileResponse.php @@ -0,0 +1,33 @@ +google.cloud.dataform.v1beta1.WriteFileResponse + */ +class WriteFileResponse extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce(); + parent::__construct($data); + } + +} + diff --git a/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/cancel_workflow_invocation.php b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/cancel_workflow_invocation.php new file mode 100644 index 000000000000..93b79c1720a1 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/cancel_workflow_invocation.php @@ -0,0 +1,74 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + $dataformClient->cancelWorkflowInvocation($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 = DataformClient::workflowInvocationName( + '[PROJECT]', + '[LOCATION]', + '[REPOSITORY]', + '[WORKFLOW_INVOCATION]' + ); + + cancel_workflow_invocation_sample($formattedName); +} +// [END dataform_v1beta1_generated_Dataform_CancelWorkflowInvocation_sync] diff --git a/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/commit_workspace_changes.php b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/commit_workspace_changes.php new file mode 100644 index 000000000000..9094a1c4522c --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/commit_workspace_changes.php @@ -0,0 +1,86 @@ +setName($authorName) + ->setEmailAddress($authorEmailAddress); + $request = (new CommitWorkspaceChangesRequest()) + ->setName($formattedName) + ->setAuthor($author); + + // Call the API and handle any network failures. + try { + $dataformClient->commitWorkspaceChanges($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 = DataformClient::workspaceName( + '[PROJECT]', + '[LOCATION]', + '[REPOSITORY]', + '[WORKSPACE]' + ); + $authorName = '[NAME]'; + $authorEmailAddress = '[EMAIL_ADDRESS]'; + + commit_workspace_changes_sample($formattedName, $authorName, $authorEmailAddress); +} +// [END dataform_v1beta1_generated_Dataform_CommitWorkspaceChanges_sync] diff --git a/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/create_compilation_result.php b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/create_compilation_result.php new file mode 100644 index 000000000000..d8bcf8d8fa1e --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/create_compilation_result.php @@ -0,0 +1,74 @@ +setParent($formattedParent) + ->setCompilationResult($compilationResult); + + // Call the API and handle any network failures. + try { + /** @var CompilationResult $response */ + $response = $dataformClient->createCompilationResult($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 = DataformClient::repositoryName('[PROJECT]', '[LOCATION]', '[REPOSITORY]'); + + create_compilation_result_sample($formattedParent); +} +// [END dataform_v1beta1_generated_Dataform_CreateCompilationResult_sync] diff --git a/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/create_repository.php b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/create_repository.php new file mode 100644 index 000000000000..5c8fb699f068 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/create_repository.php @@ -0,0 +1,78 @@ +setParent($formattedParent) + ->setRepository($repository) + ->setRepositoryId($repositoryId); + + // Call the API and handle any network failures. + try { + /** @var Repository $response */ + $response = $dataformClient->createRepository($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 = DataformClient::locationName('[PROJECT]', '[LOCATION]'); + $repositoryId = '[REPOSITORY_ID]'; + + create_repository_sample($formattedParent, $repositoryId); +} +// [END dataform_v1beta1_generated_Dataform_CreateRepository_sync] diff --git a/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/create_workflow_invocation.php b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/create_workflow_invocation.php new file mode 100644 index 000000000000..154943e9c700 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/create_workflow_invocation.php @@ -0,0 +1,74 @@ +setParent($formattedParent) + ->setWorkflowInvocation($workflowInvocation); + + // Call the API and handle any network failures. + try { + /** @var WorkflowInvocation $response */ + $response = $dataformClient->createWorkflowInvocation($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 = DataformClient::repositoryName('[PROJECT]', '[LOCATION]', '[REPOSITORY]'); + + create_workflow_invocation_sample($formattedParent); +} +// [END dataform_v1beta1_generated_Dataform_CreateWorkflowInvocation_sync] diff --git a/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/create_workspace.php b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/create_workspace.php new file mode 100644 index 000000000000..e87e44e13694 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/create_workspace.php @@ -0,0 +1,78 @@ +setParent($formattedParent) + ->setWorkspace($workspace) + ->setWorkspaceId($workspaceId); + + // Call the API and handle any network failures. + try { + /** @var Workspace $response */ + $response = $dataformClient->createWorkspace($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 = DataformClient::repositoryName('[PROJECT]', '[LOCATION]', '[REPOSITORY]'); + $workspaceId = '[WORKSPACE_ID]'; + + create_workspace_sample($formattedParent, $workspaceId); +} +// [END dataform_v1beta1_generated_Dataform_CreateWorkspace_sync] diff --git a/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/delete_repository.php b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/delete_repository.php new file mode 100644 index 000000000000..6fc895b45215 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/delete_repository.php @@ -0,0 +1,69 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + $dataformClient->deleteRepository($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 = DataformClient::repositoryName('[PROJECT]', '[LOCATION]', '[REPOSITORY]'); + + delete_repository_sample($formattedName); +} +// [END dataform_v1beta1_generated_Dataform_DeleteRepository_sync] diff --git a/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/delete_workflow_invocation.php b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/delete_workflow_invocation.php new file mode 100644 index 000000000000..111b8969b589 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/delete_workflow_invocation.php @@ -0,0 +1,74 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + $dataformClient->deleteWorkflowInvocation($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 = DataformClient::workflowInvocationName( + '[PROJECT]', + '[LOCATION]', + '[REPOSITORY]', + '[WORKFLOW_INVOCATION]' + ); + + delete_workflow_invocation_sample($formattedName); +} +// [END dataform_v1beta1_generated_Dataform_DeleteWorkflowInvocation_sync] diff --git a/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/delete_workspace.php b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/delete_workspace.php new file mode 100644 index 000000000000..24f3931ccf87 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/delete_workspace.php @@ -0,0 +1,74 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + $dataformClient->deleteWorkspace($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 = DataformClient::workspaceName( + '[PROJECT]', + '[LOCATION]', + '[REPOSITORY]', + '[WORKSPACE]' + ); + + delete_workspace_sample($formattedName); +} +// [END dataform_v1beta1_generated_Dataform_DeleteWorkspace_sync] diff --git a/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/fetch_file_diff.php b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/fetch_file_diff.php new file mode 100644 index 000000000000..e92939b885b8 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/fetch_file_diff.php @@ -0,0 +1,79 @@ +setWorkspace($formattedWorkspace) + ->setPath($path); + + // Call the API and handle any network failures. + try { + /** @var FetchFileDiffResponse $response */ + $response = $dataformClient->fetchFileDiff($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 +{ + $formattedWorkspace = DataformClient::workspaceName( + '[PROJECT]', + '[LOCATION]', + '[REPOSITORY]', + '[WORKSPACE]' + ); + $path = '[PATH]'; + + fetch_file_diff_sample($formattedWorkspace, $path); +} +// [END dataform_v1beta1_generated_Dataform_FetchFileDiff_sync] diff --git a/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/fetch_file_git_statuses.php b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/fetch_file_git_statuses.php new file mode 100644 index 000000000000..3c9d4c1a6e7e --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/fetch_file_git_statuses.php @@ -0,0 +1,76 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var FetchFileGitStatusesResponse $response */ + $response = $dataformClient->fetchFileGitStatuses($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 = DataformClient::workspaceName( + '[PROJECT]', + '[LOCATION]', + '[REPOSITORY]', + '[WORKSPACE]' + ); + + fetch_file_git_statuses_sample($formattedName); +} +// [END dataform_v1beta1_generated_Dataform_FetchFileGitStatuses_sync] diff --git a/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/fetch_git_ahead_behind.php b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/fetch_git_ahead_behind.php new file mode 100644 index 000000000000..d4c69639c056 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/fetch_git_ahead_behind.php @@ -0,0 +1,76 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var FetchGitAheadBehindResponse $response */ + $response = $dataformClient->fetchGitAheadBehind($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 = DataformClient::workspaceName( + '[PROJECT]', + '[LOCATION]', + '[REPOSITORY]', + '[WORKSPACE]' + ); + + fetch_git_ahead_behind_sample($formattedName); +} +// [END dataform_v1beta1_generated_Dataform_FetchGitAheadBehind_sync] diff --git a/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/fetch_remote_branches.php b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/fetch_remote_branches.php new file mode 100644 index 000000000000..3608ffd0969f --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/fetch_remote_branches.php @@ -0,0 +1,71 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var FetchRemoteBranchesResponse $response */ + $response = $dataformClient->fetchRemoteBranches($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 = DataformClient::repositoryName('[PROJECT]', '[LOCATION]', '[REPOSITORY]'); + + fetch_remote_branches_sample($formattedName); +} +// [END dataform_v1beta1_generated_Dataform_FetchRemoteBranches_sync] diff --git a/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/get_compilation_result.php b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/get_compilation_result.php new file mode 100644 index 000000000000..4fcc6393d7ba --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/get_compilation_result.php @@ -0,0 +1,76 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var CompilationResult $response */ + $response = $dataformClient->getCompilationResult($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 = DataformClient::compilationResultName( + '[PROJECT]', + '[LOCATION]', + '[REPOSITORY]', + '[COMPILATION_RESULT]' + ); + + get_compilation_result_sample($formattedName); +} +// [END dataform_v1beta1_generated_Dataform_GetCompilationResult_sync] diff --git a/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/get_location.php b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/get_location.php new file mode 100644 index 000000000000..8a2e5f25ae60 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/get_location.php @@ -0,0 +1,57 @@ +getLocation($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END dataform_v1beta1_generated_Dataform_GetLocation_sync] diff --git a/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/get_repository.php b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/get_repository.php new file mode 100644 index 000000000000..424d9c16876a --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/get_repository.php @@ -0,0 +1,71 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var Repository $response */ + $response = $dataformClient->getRepository($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 = DataformClient::repositoryName('[PROJECT]', '[LOCATION]', '[REPOSITORY]'); + + get_repository_sample($formattedName); +} +// [END dataform_v1beta1_generated_Dataform_GetRepository_sync] diff --git a/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/get_workflow_invocation.php b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/get_workflow_invocation.php new file mode 100644 index 000000000000..3b606e480758 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/get_workflow_invocation.php @@ -0,0 +1,76 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var WorkflowInvocation $response */ + $response = $dataformClient->getWorkflowInvocation($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 = DataformClient::workflowInvocationName( + '[PROJECT]', + '[LOCATION]', + '[REPOSITORY]', + '[WORKFLOW_INVOCATION]' + ); + + get_workflow_invocation_sample($formattedName); +} +// [END dataform_v1beta1_generated_Dataform_GetWorkflowInvocation_sync] diff --git a/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/get_workspace.php b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/get_workspace.php new file mode 100644 index 000000000000..32c39f4d1fa5 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/get_workspace.php @@ -0,0 +1,76 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var Workspace $response */ + $response = $dataformClient->getWorkspace($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 = DataformClient::workspaceName( + '[PROJECT]', + '[LOCATION]', + '[REPOSITORY]', + '[WORKSPACE]' + ); + + get_workspace_sample($formattedName); +} +// [END dataform_v1beta1_generated_Dataform_GetWorkspace_sync] diff --git a/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/install_npm_packages.php b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/install_npm_packages.php new file mode 100644 index 000000000000..0a6bbfcb0a2b --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/install_npm_packages.php @@ -0,0 +1,76 @@ +setWorkspace($formattedWorkspace); + + // Call the API and handle any network failures. + try { + /** @var InstallNpmPackagesResponse $response */ + $response = $dataformClient->installNpmPackages($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 +{ + $formattedWorkspace = DataformClient::workspaceName( + '[PROJECT]', + '[LOCATION]', + '[REPOSITORY]', + '[WORKSPACE]' + ); + + install_npm_packages_sample($formattedWorkspace); +} +// [END dataform_v1beta1_generated_Dataform_InstallNpmPackages_sync] diff --git a/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/list_compilation_results.php b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/list_compilation_results.php new file mode 100644 index 000000000000..3bf6b760f658 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/list_compilation_results.php @@ -0,0 +1,77 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $dataformClient->listCompilationResults($request); + + /** @var CompilationResult $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 = DataformClient::repositoryName('[PROJECT]', '[LOCATION]', '[REPOSITORY]'); + + list_compilation_results_sample($formattedParent); +} +// [END dataform_v1beta1_generated_Dataform_ListCompilationResults_sync] diff --git a/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/list_locations.php b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/list_locations.php new file mode 100644 index 000000000000..4eabf94975d2 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/list_locations.php @@ -0,0 +1,62 @@ +listLocations($request); + + /** @var Location $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()); + } +} +// [END dataform_v1beta1_generated_Dataform_ListLocations_sync] diff --git a/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/list_repositories.php b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/list_repositories.php new file mode 100644 index 000000000000..19130a6bc4ea --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/list_repositories.php @@ -0,0 +1,77 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $dataformClient->listRepositories($request); + + /** @var Repository $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 = DataformClient::locationName('[PROJECT]', '[LOCATION]'); + + list_repositories_sample($formattedParent); +} +// [END dataform_v1beta1_generated_Dataform_ListRepositories_sync] diff --git a/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/list_workflow_invocations.php b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/list_workflow_invocations.php new file mode 100644 index 000000000000..9a479725d542 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/list_workflow_invocations.php @@ -0,0 +1,77 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $dataformClient->listWorkflowInvocations($request); + + /** @var WorkflowInvocation $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 = DataformClient::repositoryName('[PROJECT]', '[LOCATION]', '[REPOSITORY]'); + + list_workflow_invocations_sample($formattedParent); +} +// [END dataform_v1beta1_generated_Dataform_ListWorkflowInvocations_sync] diff --git a/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/list_workspaces.php b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/list_workspaces.php new file mode 100644 index 000000000000..341ab77511fc --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/list_workspaces.php @@ -0,0 +1,77 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $dataformClient->listWorkspaces($request); + + /** @var Workspace $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 = DataformClient::repositoryName('[PROJECT]', '[LOCATION]', '[REPOSITORY]'); + + list_workspaces_sample($formattedParent); +} +// [END dataform_v1beta1_generated_Dataform_ListWorkspaces_sync] diff --git a/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/make_directory.php b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/make_directory.php new file mode 100644 index 000000000000..25ff47ad27aa --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/make_directory.php @@ -0,0 +1,80 @@ +setWorkspace($formattedWorkspace) + ->setPath($path); + + // Call the API and handle any network failures. + try { + /** @var MakeDirectoryResponse $response */ + $response = $dataformClient->makeDirectory($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 +{ + $formattedWorkspace = DataformClient::workspaceName( + '[PROJECT]', + '[LOCATION]', + '[REPOSITORY]', + '[WORKSPACE]' + ); + $path = '[PATH]'; + + make_directory_sample($formattedWorkspace, $path); +} +// [END dataform_v1beta1_generated_Dataform_MakeDirectory_sync] diff --git a/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/move_directory.php b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/move_directory.php new file mode 100644 index 000000000000..d4d9093269dd --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/move_directory.php @@ -0,0 +1,85 @@ +setWorkspace($formattedWorkspace) + ->setPath($path) + ->setNewPath($newPath); + + // Call the API and handle any network failures. + try { + /** @var MoveDirectoryResponse $response */ + $response = $dataformClient->moveDirectory($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 +{ + $formattedWorkspace = DataformClient::workspaceName( + '[PROJECT]', + '[LOCATION]', + '[REPOSITORY]', + '[WORKSPACE]' + ); + $path = '[PATH]'; + $newPath = '[NEW_PATH]'; + + move_directory_sample($formattedWorkspace, $path, $newPath); +} +// [END dataform_v1beta1_generated_Dataform_MoveDirectory_sync] diff --git a/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/move_file.php b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/move_file.php new file mode 100644 index 000000000000..b78014c2d6d4 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/move_file.php @@ -0,0 +1,82 @@ +setWorkspace($formattedWorkspace) + ->setPath($path) + ->setNewPath($newPath); + + // Call the API and handle any network failures. + try { + /** @var MoveFileResponse $response */ + $response = $dataformClient->moveFile($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 +{ + $formattedWorkspace = DataformClient::workspaceName( + '[PROJECT]', + '[LOCATION]', + '[REPOSITORY]', + '[WORKSPACE]' + ); + $path = '[PATH]'; + $newPath = '[NEW_PATH]'; + + move_file_sample($formattedWorkspace, $path, $newPath); +} +// [END dataform_v1beta1_generated_Dataform_MoveFile_sync] diff --git a/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/pull_git_commits.php b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/pull_git_commits.php new file mode 100644 index 000000000000..0f6e6d698729 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/pull_git_commits.php @@ -0,0 +1,86 @@ +setName($authorName) + ->setEmailAddress($authorEmailAddress); + $request = (new PullGitCommitsRequest()) + ->setName($formattedName) + ->setAuthor($author); + + // Call the API and handle any network failures. + try { + $dataformClient->pullGitCommits($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 = DataformClient::workspaceName( + '[PROJECT]', + '[LOCATION]', + '[REPOSITORY]', + '[WORKSPACE]' + ); + $authorName = '[NAME]'; + $authorEmailAddress = '[EMAIL_ADDRESS]'; + + pull_git_commits_sample($formattedName, $authorName, $authorEmailAddress); +} +// [END dataform_v1beta1_generated_Dataform_PullGitCommits_sync] diff --git a/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/push_git_commits.php b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/push_git_commits.php new file mode 100644 index 000000000000..1437eec6e54a --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/push_git_commits.php @@ -0,0 +1,74 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + $dataformClient->pushGitCommits($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 = DataformClient::workspaceName( + '[PROJECT]', + '[LOCATION]', + '[REPOSITORY]', + '[WORKSPACE]' + ); + + push_git_commits_sample($formattedName); +} +// [END dataform_v1beta1_generated_Dataform_PushGitCommits_sync] diff --git a/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/query_compilation_result_actions.php b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/query_compilation_result_actions.php new file mode 100644 index 000000000000..3a82df8f5911 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/query_compilation_result_actions.php @@ -0,0 +1,81 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $dataformClient->queryCompilationResultActions($request); + + /** @var CompilationResultAction $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 +{ + $formattedName = DataformClient::compilationResultName( + '[PROJECT]', + '[LOCATION]', + '[REPOSITORY]', + '[COMPILATION_RESULT]' + ); + + query_compilation_result_actions_sample($formattedName); +} +// [END dataform_v1beta1_generated_Dataform_QueryCompilationResultActions_sync] diff --git a/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/query_directory_contents.php b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/query_directory_contents.php new file mode 100644 index 000000000000..3ff1a5f3c355 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/query_directory_contents.php @@ -0,0 +1,81 @@ +setWorkspace($formattedWorkspace); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $dataformClient->queryDirectoryContents($request); + + /** @var DirectoryEntry $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 +{ + $formattedWorkspace = DataformClient::workspaceName( + '[PROJECT]', + '[LOCATION]', + '[REPOSITORY]', + '[WORKSPACE]' + ); + + query_directory_contents_sample($formattedWorkspace); +} +// [END dataform_v1beta1_generated_Dataform_QueryDirectoryContents_sync] diff --git a/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/query_workflow_invocation_actions.php b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/query_workflow_invocation_actions.php new file mode 100644 index 000000000000..1ebc5ed8826a --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/query_workflow_invocation_actions.php @@ -0,0 +1,81 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $dataformClient->queryWorkflowInvocationActions($request); + + /** @var WorkflowInvocationAction $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 +{ + $formattedName = DataformClient::workflowInvocationName( + '[PROJECT]', + '[LOCATION]', + '[REPOSITORY]', + '[WORKFLOW_INVOCATION]' + ); + + query_workflow_invocation_actions_sample($formattedName); +} +// [END dataform_v1beta1_generated_Dataform_QueryWorkflowInvocationActions_sync] diff --git a/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/read_file.php b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/read_file.php new file mode 100644 index 000000000000..47698c67e8b5 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/read_file.php @@ -0,0 +1,79 @@ +setWorkspace($formattedWorkspace) + ->setPath($path); + + // Call the API and handle any network failures. + try { + /** @var ReadFileResponse $response */ + $response = $dataformClient->readFile($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 +{ + $formattedWorkspace = DataformClient::workspaceName( + '[PROJECT]', + '[LOCATION]', + '[REPOSITORY]', + '[WORKSPACE]' + ); + $path = '[PATH]'; + + read_file_sample($formattedWorkspace, $path); +} +// [END dataform_v1beta1_generated_Dataform_ReadFile_sync] diff --git a/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/remove_directory.php b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/remove_directory.php new file mode 100644 index 000000000000..3235af5b6415 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/remove_directory.php @@ -0,0 +1,78 @@ +setWorkspace($formattedWorkspace) + ->setPath($path); + + // Call the API and handle any network failures. + try { + $dataformClient->removeDirectory($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 +{ + $formattedWorkspace = DataformClient::workspaceName( + '[PROJECT]', + '[LOCATION]', + '[REPOSITORY]', + '[WORKSPACE]' + ); + $path = '[PATH]'; + + remove_directory_sample($formattedWorkspace, $path); +} +// [END dataform_v1beta1_generated_Dataform_RemoveDirectory_sync] diff --git a/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/remove_file.php b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/remove_file.php new file mode 100644 index 000000000000..5d9158b606c2 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/remove_file.php @@ -0,0 +1,77 @@ +setWorkspace($formattedWorkspace) + ->setPath($path); + + // Call the API and handle any network failures. + try { + $dataformClient->removeFile($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 +{ + $formattedWorkspace = DataformClient::workspaceName( + '[PROJECT]', + '[LOCATION]', + '[REPOSITORY]', + '[WORKSPACE]' + ); + $path = '[PATH]'; + + remove_file_sample($formattedWorkspace, $path); +} +// [END dataform_v1beta1_generated_Dataform_RemoveFile_sync] diff --git a/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/reset_workspace_changes.php b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/reset_workspace_changes.php new file mode 100644 index 000000000000..67305d6574f9 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/reset_workspace_changes.php @@ -0,0 +1,74 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + $dataformClient->resetWorkspaceChanges($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 = DataformClient::workspaceName( + '[PROJECT]', + '[LOCATION]', + '[REPOSITORY]', + '[WORKSPACE]' + ); + + reset_workspace_changes_sample($formattedName); +} +// [END dataform_v1beta1_generated_Dataform_ResetWorkspaceChanges_sync] diff --git a/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/update_repository.php b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/update_repository.php new file mode 100644 index 000000000000..7860bd0cd09c --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/update_repository.php @@ -0,0 +1,59 @@ +setRepository($repository); + + // Call the API and handle any network failures. + try { + /** @var Repository $response */ + $response = $dataformClient->updateRepository($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END dataform_v1beta1_generated_Dataform_UpdateRepository_sync] diff --git a/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/write_file.php b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/write_file.php new file mode 100644 index 000000000000..6ac63e00e277 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/samples/V1beta1/DataformClient/write_file.php @@ -0,0 +1,82 @@ +setWorkspace($formattedWorkspace) + ->setPath($path) + ->setContents($contents); + + // Call the API and handle any network failures. + try { + /** @var WriteFileResponse $response */ + $response = $dataformClient->writeFile($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 +{ + $formattedWorkspace = DataformClient::workspaceName( + '[PROJECT]', + '[LOCATION]', + '[REPOSITORY]', + '[WORKSPACE]' + ); + $path = '[PATH]'; + $contents = '...'; + + write_file_sample($formattedWorkspace, $path, $contents); +} +// [END dataform_v1beta1_generated_Dataform_WriteFile_sync] diff --git a/owl-bot-staging/Dataform/v1beta1/src/V1beta1/Client/BaseClient/DataformBaseClient.php b/owl-bot-staging/Dataform/v1beta1/src/V1beta1/Client/BaseClient/DataformBaseClient.php new file mode 100644 index 000000000000..f03ea97cd316 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/src/V1beta1/Client/BaseClient/DataformBaseClient.php @@ -0,0 +1,1393 @@ + self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../../resources/dataform_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../../resources/dataform_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../../resources/dataform_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../../resources/dataform_rest_client_config.php', + ], + ], + ]; + } + + /** + * Formats a string containing the fully-qualified path to represent a + * compilation_result resource. + * + * @param string $project + * @param string $location + * @param string $repository + * @param string $compilationResult + * + * @return string The formatted compilation_result resource. + * + * @experimental + */ + public static function compilationResultName(string $project, string $location, string $repository, string $compilationResult): string + { + return self::getPathTemplate('compilationResult')->render([ + 'project' => $project, + 'location' => $location, + 'repository' => $repository, + 'compilation_result' => $compilationResult, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a location + * resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted location resource. + * + * @experimental + */ + public static function locationName(string $project, string $location): string + { + return self::getPathTemplate('location')->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a repository + * resource. + * + * @param string $project + * @param string $location + * @param string $repository + * + * @return string The formatted repository resource. + * + * @experimental + */ + public static function repositoryName(string $project, string $location, string $repository): string + { + return self::getPathTemplate('repository')->render([ + 'project' => $project, + 'location' => $location, + 'repository' => $repository, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * secret_version resource. + * + * @param string $project + * @param string $secret + * @param string $version + * + * @return string The formatted secret_version resource. + * + * @experimental + */ + public static function secretVersionName(string $project, string $secret, string $version): string + { + return self::getPathTemplate('secretVersion')->render([ + 'project' => $project, + 'secret' => $secret, + 'version' => $version, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * workflow_invocation resource. + * + * @param string $project + * @param string $location + * @param string $repository + * @param string $workflowInvocation + * + * @return string The formatted workflow_invocation resource. + * + * @experimental + */ + public static function workflowInvocationName(string $project, string $location, string $repository, string $workflowInvocation): string + { + return self::getPathTemplate('workflowInvocation')->render([ + 'project' => $project, + 'location' => $location, + 'repository' => $repository, + 'workflow_invocation' => $workflowInvocation, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a workspace + * resource. + * + * @param string $project + * @param string $location + * @param string $repository + * @param string $workspace + * + * @return string The formatted workspace resource. + * + * @experimental + */ + public static function workspaceName(string $project, string $location, string $repository, string $workspace): string + { + return self::getPathTemplate('workspace')->render([ + 'project' => $project, + 'location' => $location, + 'repository' => $repository, + 'workspace' => $workspace, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - compilationResult: projects/{project}/locations/{location}/repositories/{repository}/compilationResults/{compilation_result} + * - location: projects/{project}/locations/{location} + * - repository: projects/{project}/locations/{location}/repositories/{repository} + * - secretVersion: projects/{project}/secrets/{secret}/versions/{version} + * - workflowInvocation: projects/{project}/locations/{location}/repositories/{repository}/workflowInvocations/{workflow_invocation} + * - workspace: projects/{project}/locations/{location}/repositories/{repository}/workspaces/{workspace} + * + * 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. + * + * @experimental + */ + 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 'dataform.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. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *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' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods 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 + * + * @experimental + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($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); + } + + /** + * Requests cancellation of a running WorkflowInvocation. + * + * The async variant is {@see self::cancelWorkflowInvocationAsync()} . + * + * @param CancelWorkflowInvocationRequest $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. + * + * @experimental + */ + public function cancelWorkflowInvocation(CancelWorkflowInvocationRequest $request, array $callOptions = []): void + { + $this->startApiCall('CancelWorkflowInvocation', $request, $callOptions)->wait(); + } + + /** + * Applies a Git commit for uncommitted files in a Workspace. + * + * The async variant is {@see self::commitWorkspaceChangesAsync()} . + * + * @param CommitWorkspaceChangesRequest $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. + * + * @experimental + */ + public function commitWorkspaceChanges(CommitWorkspaceChangesRequest $request, array $callOptions = []): void + { + $this->startApiCall('CommitWorkspaceChanges', $request, $callOptions)->wait(); + } + + /** + * Creates a new CompilationResult in a given project and location. + * + * The async variant is {@see self::createCompilationResultAsync()} . + * + * @param CreateCompilationResultRequest $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 CompilationResult + * + * @throws ApiException Thrown if the API call fails. + * + * @experimental + */ + public function createCompilationResult(CreateCompilationResultRequest $request, array $callOptions = []): CompilationResult + { + return $this->startApiCall('CreateCompilationResult', $request, $callOptions)->wait(); + } + + /** + * Creates a new Repository in a given project and location. + * + * The async variant is {@see self::createRepositoryAsync()} . + * + * @param CreateRepositoryRequest $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 Repository + * + * @throws ApiException Thrown if the API call fails. + * + * @experimental + */ + public function createRepository(CreateRepositoryRequest $request, array $callOptions = []): Repository + { + return $this->startApiCall('CreateRepository', $request, $callOptions)->wait(); + } + + /** + * Creates a new WorkflowInvocation in a given Repository. + * + * The async variant is {@see self::createWorkflowInvocationAsync()} . + * + * @param CreateWorkflowInvocationRequest $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 WorkflowInvocation + * + * @throws ApiException Thrown if the API call fails. + * + * @experimental + */ + public function createWorkflowInvocation(CreateWorkflowInvocationRequest $request, array $callOptions = []): WorkflowInvocation + { + return $this->startApiCall('CreateWorkflowInvocation', $request, $callOptions)->wait(); + } + + /** + * Creates a new Workspace in a given Repository. + * + * The async variant is {@see self::createWorkspaceAsync()} . + * + * @param CreateWorkspaceRequest $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 Workspace + * + * @throws ApiException Thrown if the API call fails. + * + * @experimental + */ + public function createWorkspace(CreateWorkspaceRequest $request, array $callOptions = []): Workspace + { + return $this->startApiCall('CreateWorkspace', $request, $callOptions)->wait(); + } + + /** + * Deletes a single Repository. + * + * The async variant is {@see self::deleteRepositoryAsync()} . + * + * @param DeleteRepositoryRequest $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. + * + * @experimental + */ + public function deleteRepository(DeleteRepositoryRequest $request, array $callOptions = []): void + { + $this->startApiCall('DeleteRepository', $request, $callOptions)->wait(); + } + + /** + * Deletes a single WorkflowInvocation. + * + * The async variant is {@see self::deleteWorkflowInvocationAsync()} . + * + * @param DeleteWorkflowInvocationRequest $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. + * + * @experimental + */ + public function deleteWorkflowInvocation(DeleteWorkflowInvocationRequest $request, array $callOptions = []): void + { + $this->startApiCall('DeleteWorkflowInvocation', $request, $callOptions)->wait(); + } + + /** + * Deletes a single Workspace. + * + * The async variant is {@see self::deleteWorkspaceAsync()} . + * + * @param DeleteWorkspaceRequest $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. + * + * @experimental + */ + public function deleteWorkspace(DeleteWorkspaceRequest $request, array $callOptions = []): void + { + $this->startApiCall('DeleteWorkspace', $request, $callOptions)->wait(); + } + + /** + * Fetches Git diff for an uncommitted file in a Workspace. + * + * The async variant is {@see self::fetchFileDiffAsync()} . + * + * @param FetchFileDiffRequest $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 FetchFileDiffResponse + * + * @throws ApiException Thrown if the API call fails. + * + * @experimental + */ + public function fetchFileDiff(FetchFileDiffRequest $request, array $callOptions = []): FetchFileDiffResponse + { + return $this->startApiCall('FetchFileDiff', $request, $callOptions)->wait(); + } + + /** + * Fetches Git statuses for the files in a Workspace. + * + * The async variant is {@see self::fetchFileGitStatusesAsync()} . + * + * @param FetchFileGitStatusesRequest $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 FetchFileGitStatusesResponse + * + * @throws ApiException Thrown if the API call fails. + * + * @experimental + */ + public function fetchFileGitStatuses(FetchFileGitStatusesRequest $request, array $callOptions = []): FetchFileGitStatusesResponse + { + return $this->startApiCall('FetchFileGitStatuses', $request, $callOptions)->wait(); + } + + /** + * Fetches Git ahead/behind against a remote branch. + * + * The async variant is {@see self::fetchGitAheadBehindAsync()} . + * + * @param FetchGitAheadBehindRequest $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 FetchGitAheadBehindResponse + * + * @throws ApiException Thrown if the API call fails. + * + * @experimental + */ + public function fetchGitAheadBehind(FetchGitAheadBehindRequest $request, array $callOptions = []): FetchGitAheadBehindResponse + { + return $this->startApiCall('FetchGitAheadBehind', $request, $callOptions)->wait(); + } + + /** + * Fetches a Repository's remote branches. + * + * The async variant is {@see self::fetchRemoteBranchesAsync()} . + * + * @param FetchRemoteBranchesRequest $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 FetchRemoteBranchesResponse + * + * @throws ApiException Thrown if the API call fails. + * + * @experimental + */ + public function fetchRemoteBranches(FetchRemoteBranchesRequest $request, array $callOptions = []): FetchRemoteBranchesResponse + { + return $this->startApiCall('FetchRemoteBranches', $request, $callOptions)->wait(); + } + + /** + * Fetches a single CompilationResult. + * + * The async variant is {@see self::getCompilationResultAsync()} . + * + * @param GetCompilationResultRequest $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 CompilationResult + * + * @throws ApiException Thrown if the API call fails. + * + * @experimental + */ + public function getCompilationResult(GetCompilationResultRequest $request, array $callOptions = []): CompilationResult + { + return $this->startApiCall('GetCompilationResult', $request, $callOptions)->wait(); + } + + /** + * Fetches a single Repository. + * + * The async variant is {@see self::getRepositoryAsync()} . + * + * @param GetRepositoryRequest $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 Repository + * + * @throws ApiException Thrown if the API call fails. + * + * @experimental + */ + public function getRepository(GetRepositoryRequest $request, array $callOptions = []): Repository + { + return $this->startApiCall('GetRepository', $request, $callOptions)->wait(); + } + + /** + * Fetches a single WorkflowInvocation. + * + * The async variant is {@see self::getWorkflowInvocationAsync()} . + * + * @param GetWorkflowInvocationRequest $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 WorkflowInvocation + * + * @throws ApiException Thrown if the API call fails. + * + * @experimental + */ + public function getWorkflowInvocation(GetWorkflowInvocationRequest $request, array $callOptions = []): WorkflowInvocation + { + return $this->startApiCall('GetWorkflowInvocation', $request, $callOptions)->wait(); + } + + /** + * Fetches a single Workspace. + * + * The async variant is {@see self::getWorkspaceAsync()} . + * + * @param GetWorkspaceRequest $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 Workspace + * + * @throws ApiException Thrown if the API call fails. + * + * @experimental + */ + public function getWorkspace(GetWorkspaceRequest $request, array $callOptions = []): Workspace + { + return $this->startApiCall('GetWorkspace', $request, $callOptions)->wait(); + } + + /** + * Installs dependency NPM packages (inside a Workspace). + * + * The async variant is {@see self::installNpmPackagesAsync()} . + * + * @param InstallNpmPackagesRequest $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 InstallNpmPackagesResponse + * + * @throws ApiException Thrown if the API call fails. + * + * @experimental + */ + public function installNpmPackages(InstallNpmPackagesRequest $request, array $callOptions = []): InstallNpmPackagesResponse + { + return $this->startApiCall('InstallNpmPackages', $request, $callOptions)->wait(); + } + + /** + * Lists CompilationResults in a given Repository. + * + * The async variant is {@see self::listCompilationResultsAsync()} . + * + * @param ListCompilationResultsRequest $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. + * + * @experimental + */ + public function listCompilationResults(ListCompilationResultsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListCompilationResults', $request, $callOptions); + } + + /** + * Lists Repositories in a given project and location. + * + * The async variant is {@see self::listRepositoriesAsync()} . + * + * @param ListRepositoriesRequest $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. + * + * @experimental + */ + public function listRepositories(ListRepositoriesRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListRepositories', $request, $callOptions); + } + + /** + * Lists WorkflowInvocations in a given Repository. + * + * The async variant is {@see self::listWorkflowInvocationsAsync()} . + * + * @param ListWorkflowInvocationsRequest $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. + * + * @experimental + */ + public function listWorkflowInvocations(ListWorkflowInvocationsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListWorkflowInvocations', $request, $callOptions); + } + + /** + * Lists Workspaces in a given Repository. + * + * The async variant is {@see self::listWorkspacesAsync()} . + * + * @param ListWorkspacesRequest $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. + * + * @experimental + */ + public function listWorkspaces(ListWorkspacesRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListWorkspaces', $request, $callOptions); + } + + /** + * Creates a directory inside a Workspace. + * + * The async variant is {@see self::makeDirectoryAsync()} . + * + * @param MakeDirectoryRequest $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 MakeDirectoryResponse + * + * @throws ApiException Thrown if the API call fails. + * + * @experimental + */ + public function makeDirectory(MakeDirectoryRequest $request, array $callOptions = []): MakeDirectoryResponse + { + return $this->startApiCall('MakeDirectory', $request, $callOptions)->wait(); + } + + /** + * Moves a directory (inside a Workspace), and all of its contents, to a new + * location. + * + * The async variant is {@see self::moveDirectoryAsync()} . + * + * @param MoveDirectoryRequest $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 MoveDirectoryResponse + * + * @throws ApiException Thrown if the API call fails. + * + * @experimental + */ + public function moveDirectory(MoveDirectoryRequest $request, array $callOptions = []): MoveDirectoryResponse + { + return $this->startApiCall('MoveDirectory', $request, $callOptions)->wait(); + } + + /** + * Moves a file (inside a Workspace) to a new location. + * + * The async variant is {@see self::moveFileAsync()} . + * + * @param MoveFileRequest $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 MoveFileResponse + * + * @throws ApiException Thrown if the API call fails. + * + * @experimental + */ + public function moveFile(MoveFileRequest $request, array $callOptions = []): MoveFileResponse + { + return $this->startApiCall('MoveFile', $request, $callOptions)->wait(); + } + + /** + * Pulls Git commits from the Repository's remote into a Workspace. + * + * The async variant is {@see self::pullGitCommitsAsync()} . + * + * @param PullGitCommitsRequest $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. + * + * @experimental + */ + public function pullGitCommits(PullGitCommitsRequest $request, array $callOptions = []): void + { + $this->startApiCall('PullGitCommits', $request, $callOptions)->wait(); + } + + /** + * Pushes Git commits from a Workspace to the Repository's remote. + * + * The async variant is {@see self::pushGitCommitsAsync()} . + * + * @param PushGitCommitsRequest $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. + * + * @experimental + */ + public function pushGitCommits(PushGitCommitsRequest $request, array $callOptions = []): void + { + $this->startApiCall('PushGitCommits', $request, $callOptions)->wait(); + } + + /** + * Returns CompilationResultActions in a given CompilationResult. + * + * The async variant is {@see self::queryCompilationResultActionsAsync()} . + * + * @param QueryCompilationResultActionsRequest $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. + * + * @experimental + */ + public function queryCompilationResultActions(QueryCompilationResultActionsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('QueryCompilationResultActions', $request, $callOptions); + } + + /** + * Returns the contents of a given Workspace directory. + * + * The async variant is {@see self::queryDirectoryContentsAsync()} . + * + * @param QueryDirectoryContentsRequest $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. + * + * @experimental + */ + public function queryDirectoryContents(QueryDirectoryContentsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('QueryDirectoryContents', $request, $callOptions); + } + + /** + * Returns WorkflowInvocationActions in a given WorkflowInvocation. + * + * The async variant is {@see self::queryWorkflowInvocationActionsAsync()} . + * + * @param QueryWorkflowInvocationActionsRequest $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. + * + * @experimental + */ + public function queryWorkflowInvocationActions(QueryWorkflowInvocationActionsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('QueryWorkflowInvocationActions', $request, $callOptions); + } + + /** + * Returns the contents of a file (inside a Workspace). + * + * The async variant is {@see self::readFileAsync()} . + * + * @param ReadFileRequest $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 ReadFileResponse + * + * @throws ApiException Thrown if the API call fails. + * + * @experimental + */ + public function readFile(ReadFileRequest $request, array $callOptions = []): ReadFileResponse + { + return $this->startApiCall('ReadFile', $request, $callOptions)->wait(); + } + + /** + * Deletes a directory (inside a Workspace) and all of its contents. + * + * The async variant is {@see self::removeDirectoryAsync()} . + * + * @param RemoveDirectoryRequest $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. + * + * @experimental + */ + public function removeDirectory(RemoveDirectoryRequest $request, array $callOptions = []): void + { + $this->startApiCall('RemoveDirectory', $request, $callOptions)->wait(); + } + + /** + * Deletes a file (inside a Workspace). + * + * The async variant is {@see self::removeFileAsync()} . + * + * @param RemoveFileRequest $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. + * + * @experimental + */ + public function removeFile(RemoveFileRequest $request, array $callOptions = []): void + { + $this->startApiCall('RemoveFile', $request, $callOptions)->wait(); + } + + /** + * Performs a Git reset for uncommitted files in a Workspace. + * + * The async variant is {@see self::resetWorkspaceChangesAsync()} . + * + * @param ResetWorkspaceChangesRequest $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. + * + * @experimental + */ + public function resetWorkspaceChanges(ResetWorkspaceChangesRequest $request, array $callOptions = []): void + { + $this->startApiCall('ResetWorkspaceChanges', $request, $callOptions)->wait(); + } + + /** + * Updates a single Repository. + * + * The async variant is {@see self::updateRepositoryAsync()} . + * + * @param UpdateRepositoryRequest $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 Repository + * + * @throws ApiException Thrown if the API call fails. + * + * @experimental + */ + public function updateRepository(UpdateRepositoryRequest $request, array $callOptions = []): Repository + { + return $this->startApiCall('UpdateRepository', $request, $callOptions)->wait(); + } + + /** + * Writes to a file (inside a Workspace). + * + * The async variant is {@see self::writeFileAsync()} . + * + * @param WriteFileRequest $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 WriteFileResponse + * + * @throws ApiException Thrown if the API call fails. + * + * @experimental + */ + public function writeFile(WriteFileRequest $request, array $callOptions = []): WriteFileResponse + { + return $this->startApiCall('WriteFile', $request, $callOptions)->wait(); + } + + /** + * Gets information about a location. + * + * The async variant is {@see self::getLocationAsync()} . + * + * @param GetLocationRequest $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 Location + * + * @throws ApiException Thrown if the API call fails. + * + * @experimental + */ + public function getLocation(GetLocationRequest $request, array $callOptions = []): Location + { + return $this->startApiCall('GetLocation', $request, $callOptions)->wait(); + } + + /** + * Lists information about the supported locations for this service. + * + * The async variant is {@see self::listLocationsAsync()} . + * + * @param ListLocationsRequest $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. + * + * @experimental + */ + public function listLocations(ListLocationsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListLocations', $request, $callOptions); + } +} diff --git a/owl-bot-staging/Dataform/v1beta1/src/V1beta1/Client/DataformClient.php b/owl-bot-staging/Dataform/v1beta1/src/V1beta1/Client/DataformClient.php new file mode 100644 index 000000000000..7346334af3fe --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/src/V1beta1/Client/DataformClient.php @@ -0,0 +1,42 @@ +workflowInvocationName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKFLOW_INVOCATION]'); + * $dataformClient->cancelWorkflowInvocation($formattedName); + * } finally { + * $dataformClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + * + * @experimental + */ +class DataformGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.dataform.v1beta1.Dataform'; + + /** The default address of the service. */ + const SERVICE_ADDRESS = 'dataform.googleapis.com'; + + /** The default port of the service. */ + const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + ]; + + private static $compilationResultNameTemplate; + + private static $locationNameTemplate; + + private static $repositoryNameTemplate; + + private static $secretVersionNameTemplate; + + private static $workflowInvocationNameTemplate; + + private static $workspaceNameTemplate; + + private static $pathTemplateMap; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/dataform_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/dataform_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/dataform_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/dataform_rest_client_config.php', + ], + ], + ]; + } + + private static function getCompilationResultNameTemplate() + { + if (self::$compilationResultNameTemplate == null) { + self::$compilationResultNameTemplate = new PathTemplate('projects/{project}/locations/{location}/repositories/{repository}/compilationResults/{compilation_result}'); + } + + return self::$compilationResultNameTemplate; + } + + private static function getLocationNameTemplate() + { + if (self::$locationNameTemplate == null) { + self::$locationNameTemplate = new PathTemplate('projects/{project}/locations/{location}'); + } + + return self::$locationNameTemplate; + } + + private static function getRepositoryNameTemplate() + { + if (self::$repositoryNameTemplate == null) { + self::$repositoryNameTemplate = new PathTemplate('projects/{project}/locations/{location}/repositories/{repository}'); + } + + return self::$repositoryNameTemplate; + } + + private static function getSecretVersionNameTemplate() + { + if (self::$secretVersionNameTemplate == null) { + self::$secretVersionNameTemplate = new PathTemplate('projects/{project}/secrets/{secret}/versions/{version}'); + } + + return self::$secretVersionNameTemplate; + } + + private static function getWorkflowInvocationNameTemplate() + { + if (self::$workflowInvocationNameTemplate == null) { + self::$workflowInvocationNameTemplate = new PathTemplate('projects/{project}/locations/{location}/repositories/{repository}/workflowInvocations/{workflow_invocation}'); + } + + return self::$workflowInvocationNameTemplate; + } + + private static function getWorkspaceNameTemplate() + { + if (self::$workspaceNameTemplate == null) { + self::$workspaceNameTemplate = new PathTemplate('projects/{project}/locations/{location}/repositories/{repository}/workspaces/{workspace}'); + } + + return self::$workspaceNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'compilationResult' => self::getCompilationResultNameTemplate(), + 'location' => self::getLocationNameTemplate(), + 'repository' => self::getRepositoryNameTemplate(), + 'secretVersion' => self::getSecretVersionNameTemplate(), + 'workflowInvocation' => self::getWorkflowInvocationNameTemplate(), + 'workspace' => self::getWorkspaceNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a + * compilation_result resource. + * + * @param string $project + * @param string $location + * @param string $repository + * @param string $compilationResult + * + * @return string The formatted compilation_result resource. + * + * @experimental + */ + public static function compilationResultName($project, $location, $repository, $compilationResult) + { + return self::getCompilationResultNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'repository' => $repository, + 'compilation_result' => $compilationResult, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a location + * resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted location resource. + * + * @experimental + */ + public static function locationName($project, $location) + { + return self::getLocationNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a repository + * resource. + * + * @param string $project + * @param string $location + * @param string $repository + * + * @return string The formatted repository resource. + * + * @experimental + */ + public static function repositoryName($project, $location, $repository) + { + return self::getRepositoryNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'repository' => $repository, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * secret_version resource. + * + * @param string $project + * @param string $secret + * @param string $version + * + * @return string The formatted secret_version resource. + * + * @experimental + */ + public static function secretVersionName($project, $secret, $version) + { + return self::getSecretVersionNameTemplate()->render([ + 'project' => $project, + 'secret' => $secret, + 'version' => $version, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * workflow_invocation resource. + * + * @param string $project + * @param string $location + * @param string $repository + * @param string $workflowInvocation + * + * @return string The formatted workflow_invocation resource. + * + * @experimental + */ + public static function workflowInvocationName($project, $location, $repository, $workflowInvocation) + { + return self::getWorkflowInvocationNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'repository' => $repository, + 'workflow_invocation' => $workflowInvocation, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a workspace + * resource. + * + * @param string $project + * @param string $location + * @param string $repository + * @param string $workspace + * + * @return string The formatted workspace resource. + * + * @experimental + */ + public static function workspaceName($project, $location, $repository, $workspace) + { + return self::getWorkspaceNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'repository' => $repository, + 'workspace' => $workspace, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - compilationResult: projects/{project}/locations/{location}/repositories/{repository}/compilationResults/{compilation_result} + * - location: projects/{project}/locations/{location} + * - repository: projects/{project}/locations/{location}/repositories/{repository} + * - secretVersion: projects/{project}/secrets/{secret}/versions/{version} + * - workflowInvocation: projects/{project}/locations/{location}/repositories/{repository}/workflowInvocations/{workflow_invocation} + * - workspace: projects/{project}/locations/{location}/repositories/{repository}/workspaces/{workspace} + * + * 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. + * + * @experimental + */ + public static function parseName($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * 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 'dataform.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. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *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' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods 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 + * + * @experimental + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + } + + /** + * Requests cancellation of a running WorkflowInvocation. + * + * Sample code: + * ``` + * $dataformClient = new DataformClient(); + * try { + * $formattedName = $dataformClient->workflowInvocationName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKFLOW_INVOCATION]'); + * $dataformClient->cancelWorkflowInvocation($formattedName); + * } finally { + * $dataformClient->close(); + * } + * ``` + * + * @param string $name Required. The workflow invocation resource's name. + * @param array $optionalArgs { + * 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 if the remote call fails + * + * @experimental + */ + public function cancelWorkflowInvocation($name, array $optionalArgs = []) + { + $request = new CancelWorkflowInvocationRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('CancelWorkflowInvocation', GPBEmpty::class, $optionalArgs, $request)->wait(); + } + + /** + * Applies a Git commit for uncommitted files in a Workspace. + * + * Sample code: + * ``` + * $dataformClient = new DataformClient(); + * try { + * $formattedName = $dataformClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + * $author = new CommitAuthor(); + * $dataformClient->commitWorkspaceChanges($formattedName, $author); + * } finally { + * $dataformClient->close(); + * } + * ``` + * + * @param string $name Required. The workspace's name. + * @param CommitAuthor $author Required. The commit's author. + * @param array $optionalArgs { + * Optional. + * + * @type string $commitMessage + * Optional. The commit's message. + * @type string[] $paths + * Optional. Full file paths to commit including filename, rooted at workspace root. If + * left empty, all files will be committed. + * @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 if the remote call fails + * + * @experimental + */ + public function commitWorkspaceChanges($name, $author, array $optionalArgs = []) + { + $request = new CommitWorkspaceChangesRequest(); + $requestParamHeaders = []; + $request->setName($name); + $request->setAuthor($author); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['commitMessage'])) { + $request->setCommitMessage($optionalArgs['commitMessage']); + } + + if (isset($optionalArgs['paths'])) { + $request->setPaths($optionalArgs['paths']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('CommitWorkspaceChanges', GPBEmpty::class, $optionalArgs, $request)->wait(); + } + + /** + * Creates a new CompilationResult in a given project and location. + * + * Sample code: + * ``` + * $dataformClient = new DataformClient(); + * try { + * $formattedParent = $dataformClient->repositoryName('[PROJECT]', '[LOCATION]', '[REPOSITORY]'); + * $compilationResult = new CompilationResult(); + * $response = $dataformClient->createCompilationResult($formattedParent, $compilationResult); + * } finally { + * $dataformClient->close(); + * } + * ``` + * + * @param string $parent Required. The repository in which to create the compilation result. Must be in the + * format `projects/*/locations/*/repositories/*`. + * @param CompilationResult $compilationResult Required. The compilation result to create. + * @param array $optionalArgs { + * 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 \Google\Cloud\Dataform\V1beta1\CompilationResult + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function createCompilationResult($parent, $compilationResult, array $optionalArgs = []) + { + $request = new CreateCompilationResultRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setCompilationResult($compilationResult); + $requestParamHeaders['parent'] = $parent; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('CreateCompilationResult', CompilationResult::class, $optionalArgs, $request)->wait(); + } + + /** + * Creates a new Repository in a given project and location. + * + * Sample code: + * ``` + * $dataformClient = new DataformClient(); + * try { + * $formattedParent = $dataformClient->locationName('[PROJECT]', '[LOCATION]'); + * $repository = new Repository(); + * $repositoryId = 'repository_id'; + * $response = $dataformClient->createRepository($formattedParent, $repository, $repositoryId); + * } finally { + * $dataformClient->close(); + * } + * ``` + * + * @param string $parent Required. The location in which to create the repository. Must be in the format + * `projects/*/locations/*`. + * @param Repository $repository Required. The repository to create. + * @param string $repositoryId Required. The ID to use for the repository, which will become the final component of + * the repository's resource name. + * @param array $optionalArgs { + * 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 \Google\Cloud\Dataform\V1beta1\Repository + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function createRepository($parent, $repository, $repositoryId, array $optionalArgs = []) + { + $request = new CreateRepositoryRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setRepository($repository); + $request->setRepositoryId($repositoryId); + $requestParamHeaders['parent'] = $parent; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('CreateRepository', Repository::class, $optionalArgs, $request)->wait(); + } + + /** + * Creates a new WorkflowInvocation in a given Repository. + * + * Sample code: + * ``` + * $dataformClient = new DataformClient(); + * try { + * $formattedParent = $dataformClient->repositoryName('[PROJECT]', '[LOCATION]', '[REPOSITORY]'); + * $workflowInvocation = new WorkflowInvocation(); + * $response = $dataformClient->createWorkflowInvocation($formattedParent, $workflowInvocation); + * } finally { + * $dataformClient->close(); + * } + * ``` + * + * @param string $parent Required. The repository in which to create the workflow invocation. Must be in the + * format `projects/*/locations/*/repositories/*`. + * @param WorkflowInvocation $workflowInvocation Required. The workflow invocation resource to create. + * @param array $optionalArgs { + * 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 \Google\Cloud\Dataform\V1beta1\WorkflowInvocation + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function createWorkflowInvocation($parent, $workflowInvocation, array $optionalArgs = []) + { + $request = new CreateWorkflowInvocationRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setWorkflowInvocation($workflowInvocation); + $requestParamHeaders['parent'] = $parent; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('CreateWorkflowInvocation', WorkflowInvocation::class, $optionalArgs, $request)->wait(); + } + + /** + * Creates a new Workspace in a given Repository. + * + * Sample code: + * ``` + * $dataformClient = new DataformClient(); + * try { + * $formattedParent = $dataformClient->repositoryName('[PROJECT]', '[LOCATION]', '[REPOSITORY]'); + * $workspace = new Workspace(); + * $workspaceId = 'workspace_id'; + * $response = $dataformClient->createWorkspace($formattedParent, $workspace, $workspaceId); + * } finally { + * $dataformClient->close(); + * } + * ``` + * + * @param string $parent Required. The repository in which to create the workspace. Must be in the format + * `projects/*/locations/*/repositories/*`. + * @param Workspace $workspace Required. The workspace to create. + * @param string $workspaceId Required. The ID to use for the workspace, which will become the final component of + * the workspace's resource name. + * @param array $optionalArgs { + * 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 \Google\Cloud\Dataform\V1beta1\Workspace + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function createWorkspace($parent, $workspace, $workspaceId, array $optionalArgs = []) + { + $request = new CreateWorkspaceRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setWorkspace($workspace); + $request->setWorkspaceId($workspaceId); + $requestParamHeaders['parent'] = $parent; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('CreateWorkspace', Workspace::class, $optionalArgs, $request)->wait(); + } + + /** + * Deletes a single Repository. + * + * Sample code: + * ``` + * $dataformClient = new DataformClient(); + * try { + * $formattedName = $dataformClient->repositoryName('[PROJECT]', '[LOCATION]', '[REPOSITORY]'); + * $dataformClient->deleteRepository($formattedName); + * } finally { + * $dataformClient->close(); + * } + * ``` + * + * @param string $name Required. The repository's name. + * @param array $optionalArgs { + * Optional. + * + * @type bool $force + * If set to true, any child resources of this repository will also be + * deleted. (Otherwise, the request will only succeed if the repository has no + * child resources.) + * @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 if the remote call fails + * + * @experimental + */ + public function deleteRepository($name, array $optionalArgs = []) + { + $request = new DeleteRepositoryRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['force'])) { + $request->setForce($optionalArgs['force']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('DeleteRepository', GPBEmpty::class, $optionalArgs, $request)->wait(); + } + + /** + * Deletes a single WorkflowInvocation. + * + * Sample code: + * ``` + * $dataformClient = new DataformClient(); + * try { + * $formattedName = $dataformClient->workflowInvocationName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKFLOW_INVOCATION]'); + * $dataformClient->deleteWorkflowInvocation($formattedName); + * } finally { + * $dataformClient->close(); + * } + * ``` + * + * @param string $name Required. The workflow invocation resource's name. + * @param array $optionalArgs { + * 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 if the remote call fails + * + * @experimental + */ + public function deleteWorkflowInvocation($name, array $optionalArgs = []) + { + $request = new DeleteWorkflowInvocationRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('DeleteWorkflowInvocation', GPBEmpty::class, $optionalArgs, $request)->wait(); + } + + /** + * Deletes a single Workspace. + * + * Sample code: + * ``` + * $dataformClient = new DataformClient(); + * try { + * $formattedName = $dataformClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + * $dataformClient->deleteWorkspace($formattedName); + * } finally { + * $dataformClient->close(); + * } + * ``` + * + * @param string $name Required. The workspace resource's name. + * @param array $optionalArgs { + * 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 if the remote call fails + * + * @experimental + */ + public function deleteWorkspace($name, array $optionalArgs = []) + { + $request = new DeleteWorkspaceRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('DeleteWorkspace', GPBEmpty::class, $optionalArgs, $request)->wait(); + } + + /** + * Fetches Git diff for an uncommitted file in a Workspace. + * + * Sample code: + * ``` + * $dataformClient = new DataformClient(); + * try { + * $formattedWorkspace = $dataformClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + * $path = 'path'; + * $response = $dataformClient->fetchFileDiff($formattedWorkspace, $path); + * } finally { + * $dataformClient->close(); + * } + * ``` + * + * @param string $workspace Required. The workspace's name. + * @param string $path Required. The file's full path including filename, relative to the workspace root. + * @param array $optionalArgs { + * 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 \Google\Cloud\Dataform\V1beta1\FetchFileDiffResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function fetchFileDiff($workspace, $path, array $optionalArgs = []) + { + $request = new FetchFileDiffRequest(); + $requestParamHeaders = []; + $request->setWorkspace($workspace); + $request->setPath($path); + $requestParamHeaders['workspace'] = $workspace; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('FetchFileDiff', FetchFileDiffResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Fetches Git statuses for the files in a Workspace. + * + * Sample code: + * ``` + * $dataformClient = new DataformClient(); + * try { + * $formattedName = $dataformClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + * $response = $dataformClient->fetchFileGitStatuses($formattedName); + * } finally { + * $dataformClient->close(); + * } + * ``` + * + * @param string $name Required. The workspace's name. + * @param array $optionalArgs { + * 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 \Google\Cloud\Dataform\V1beta1\FetchFileGitStatusesResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function fetchFileGitStatuses($name, array $optionalArgs = []) + { + $request = new FetchFileGitStatusesRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('FetchFileGitStatuses', FetchFileGitStatusesResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Fetches Git ahead/behind against a remote branch. + * + * Sample code: + * ``` + * $dataformClient = new DataformClient(); + * try { + * $formattedName = $dataformClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + * $response = $dataformClient->fetchGitAheadBehind($formattedName); + * } finally { + * $dataformClient->close(); + * } + * ``` + * + * @param string $name Required. The workspace's name. + * @param array $optionalArgs { + * Optional. + * + * @type string $remoteBranch + * Optional. The name of the branch in the Git remote against which this workspace + * should be compared. If left unset, the repository's default branch name + * will be used. + * @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 \Google\Cloud\Dataform\V1beta1\FetchGitAheadBehindResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function fetchGitAheadBehind($name, array $optionalArgs = []) + { + $request = new FetchGitAheadBehindRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['remoteBranch'])) { + $request->setRemoteBranch($optionalArgs['remoteBranch']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('FetchGitAheadBehind', FetchGitAheadBehindResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Fetches a Repository's remote branches. + * + * Sample code: + * ``` + * $dataformClient = new DataformClient(); + * try { + * $formattedName = $dataformClient->repositoryName('[PROJECT]', '[LOCATION]', '[REPOSITORY]'); + * $response = $dataformClient->fetchRemoteBranches($formattedName); + * } finally { + * $dataformClient->close(); + * } + * ``` + * + * @param string $name Required. The repository's name. + * @param array $optionalArgs { + * 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 \Google\Cloud\Dataform\V1beta1\FetchRemoteBranchesResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function fetchRemoteBranches($name, array $optionalArgs = []) + { + $request = new FetchRemoteBranchesRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('FetchRemoteBranches', FetchRemoteBranchesResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Fetches a single CompilationResult. + * + * Sample code: + * ``` + * $dataformClient = new DataformClient(); + * try { + * $formattedName = $dataformClient->compilationResultName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[COMPILATION_RESULT]'); + * $response = $dataformClient->getCompilationResult($formattedName); + * } finally { + * $dataformClient->close(); + * } + * ``` + * + * @param string $name Required. The compilation result's name. + * @param array $optionalArgs { + * 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 \Google\Cloud\Dataform\V1beta1\CompilationResult + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function getCompilationResult($name, array $optionalArgs = []) + { + $request = new GetCompilationResultRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetCompilationResult', CompilationResult::class, $optionalArgs, $request)->wait(); + } + + /** + * Fetches a single Repository. + * + * Sample code: + * ``` + * $dataformClient = new DataformClient(); + * try { + * $formattedName = $dataformClient->repositoryName('[PROJECT]', '[LOCATION]', '[REPOSITORY]'); + * $response = $dataformClient->getRepository($formattedName); + * } finally { + * $dataformClient->close(); + * } + * ``` + * + * @param string $name Required. The repository's name. + * @param array $optionalArgs { + * 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 \Google\Cloud\Dataform\V1beta1\Repository + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function getRepository($name, array $optionalArgs = []) + { + $request = new GetRepositoryRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetRepository', Repository::class, $optionalArgs, $request)->wait(); + } + + /** + * Fetches a single WorkflowInvocation. + * + * Sample code: + * ``` + * $dataformClient = new DataformClient(); + * try { + * $formattedName = $dataformClient->workflowInvocationName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKFLOW_INVOCATION]'); + * $response = $dataformClient->getWorkflowInvocation($formattedName); + * } finally { + * $dataformClient->close(); + * } + * ``` + * + * @param string $name Required. The workflow invocation resource's name. + * @param array $optionalArgs { + * 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 \Google\Cloud\Dataform\V1beta1\WorkflowInvocation + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function getWorkflowInvocation($name, array $optionalArgs = []) + { + $request = new GetWorkflowInvocationRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetWorkflowInvocation', WorkflowInvocation::class, $optionalArgs, $request)->wait(); + } + + /** + * Fetches a single Workspace. + * + * Sample code: + * ``` + * $dataformClient = new DataformClient(); + * try { + * $formattedName = $dataformClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + * $response = $dataformClient->getWorkspace($formattedName); + * } finally { + * $dataformClient->close(); + * } + * ``` + * + * @param string $name Required. The workspace's name. + * @param array $optionalArgs { + * 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 \Google\Cloud\Dataform\V1beta1\Workspace + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function getWorkspace($name, array $optionalArgs = []) + { + $request = new GetWorkspaceRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetWorkspace', Workspace::class, $optionalArgs, $request)->wait(); + } + + /** + * Installs dependency NPM packages (inside a Workspace). + * + * Sample code: + * ``` + * $dataformClient = new DataformClient(); + * try { + * $formattedWorkspace = $dataformClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + * $response = $dataformClient->installNpmPackages($formattedWorkspace); + * } finally { + * $dataformClient->close(); + * } + * ``` + * + * @param string $workspace Required. The workspace's name. + * @param array $optionalArgs { + * 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 \Google\Cloud\Dataform\V1beta1\InstallNpmPackagesResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function installNpmPackages($workspace, array $optionalArgs = []) + { + $request = new InstallNpmPackagesRequest(); + $requestParamHeaders = []; + $request->setWorkspace($workspace); + $requestParamHeaders['workspace'] = $workspace; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('InstallNpmPackages', InstallNpmPackagesResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Lists CompilationResults in a given Repository. + * + * Sample code: + * ``` + * $dataformClient = new DataformClient(); + * try { + * $formattedParent = $dataformClient->repositoryName('[PROJECT]', '[LOCATION]', '[REPOSITORY]'); + * // Iterate over pages of elements + * $pagedResponse = $dataformClient->listCompilationResults($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $dataformClient->listCompilationResults($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $dataformClient->close(); + * } + * ``` + * + * @param string $parent Required. The repository in which to list compilation results. Must be in the + * format `projects/*/locations/*/repositories/*`. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @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 \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function listCompilationResults($parent, array $optionalArgs = []) + { + $request = new ListCompilationResultsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListCompilationResults', $optionalArgs, ListCompilationResultsResponse::class, $request); + } + + /** + * Lists Repositories in a given project and location. + * + * Sample code: + * ``` + * $dataformClient = new DataformClient(); + * try { + * $formattedParent = $dataformClient->locationName('[PROJECT]', '[LOCATION]'); + * // Iterate over pages of elements + * $pagedResponse = $dataformClient->listRepositories($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $dataformClient->listRepositories($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $dataformClient->close(); + * } + * ``` + * + * @param string $parent Required. The location in which to list repositories. Must be in the format + * `projects/*/locations/*`. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type string $orderBy + * Optional. This field only supports ordering by `name`. If unspecified, the server + * will choose the ordering. If specified, the default order is ascending for + * the `name` field. + * @type string $filter + * Optional. Filter for the returned list. + * @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 \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function listRepositories($parent, array $optionalArgs = []) + { + $request = new ListRepositoriesRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListRepositories', $optionalArgs, ListRepositoriesResponse::class, $request); + } + + /** + * Lists WorkflowInvocations in a given Repository. + * + * Sample code: + * ``` + * $dataformClient = new DataformClient(); + * try { + * $formattedParent = $dataformClient->repositoryName('[PROJECT]', '[LOCATION]', '[REPOSITORY]'); + * // Iterate over pages of elements + * $pagedResponse = $dataformClient->listWorkflowInvocations($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $dataformClient->listWorkflowInvocations($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $dataformClient->close(); + * } + * ``` + * + * @param string $parent Required. The parent resource of the WorkflowInvocation type. Must be in the + * format `projects/*/locations/*/repositories/*`. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @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 \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function listWorkflowInvocations($parent, array $optionalArgs = []) + { + $request = new ListWorkflowInvocationsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListWorkflowInvocations', $optionalArgs, ListWorkflowInvocationsResponse::class, $request); + } + + /** + * Lists Workspaces in a given Repository. + * + * Sample code: + * ``` + * $dataformClient = new DataformClient(); + * try { + * $formattedParent = $dataformClient->repositoryName('[PROJECT]', '[LOCATION]', '[REPOSITORY]'); + * // Iterate over pages of elements + * $pagedResponse = $dataformClient->listWorkspaces($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $dataformClient->listWorkspaces($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $dataformClient->close(); + * } + * ``` + * + * @param string $parent Required. The repository in which to list workspaces. Must be in the + * format `projects/*/locations/*/repositories/*`. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type string $orderBy + * Optional. This field only supports ordering by `name`. If unspecified, the server + * will choose the ordering. If specified, the default order is ascending for + * the `name` field. + * @type string $filter + * Optional. Filter for the returned list. + * @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 \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function listWorkspaces($parent, array $optionalArgs = []) + { + $request = new ListWorkspacesRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListWorkspaces', $optionalArgs, ListWorkspacesResponse::class, $request); + } + + /** + * Creates a directory inside a Workspace. + * + * Sample code: + * ``` + * $dataformClient = new DataformClient(); + * try { + * $formattedWorkspace = $dataformClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + * $path = 'path'; + * $response = $dataformClient->makeDirectory($formattedWorkspace, $path); + * } finally { + * $dataformClient->close(); + * } + * ``` + * + * @param string $workspace Required. The workspace's name. + * @param string $path Required. The directory's full path including directory name, relative to the + * workspace root. + * @param array $optionalArgs { + * 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 \Google\Cloud\Dataform\V1beta1\MakeDirectoryResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function makeDirectory($workspace, $path, array $optionalArgs = []) + { + $request = new MakeDirectoryRequest(); + $requestParamHeaders = []; + $request->setWorkspace($workspace); + $request->setPath($path); + $requestParamHeaders['workspace'] = $workspace; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('MakeDirectory', MakeDirectoryResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Moves a directory (inside a Workspace), and all of its contents, to a new + * location. + * + * Sample code: + * ``` + * $dataformClient = new DataformClient(); + * try { + * $formattedWorkspace = $dataformClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + * $path = 'path'; + * $newPath = 'new_path'; + * $response = $dataformClient->moveDirectory($formattedWorkspace, $path, $newPath); + * } finally { + * $dataformClient->close(); + * } + * ``` + * + * @param string $workspace Required. The workspace's name. + * @param string $path Required. The directory's full path including directory name, relative to the + * workspace root. + * @param string $newPath Required. The new path for the directory including directory name, rooted at + * workspace root. + * @param array $optionalArgs { + * 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 \Google\Cloud\Dataform\V1beta1\MoveDirectoryResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function moveDirectory($workspace, $path, $newPath, array $optionalArgs = []) + { + $request = new MoveDirectoryRequest(); + $requestParamHeaders = []; + $request->setWorkspace($workspace); + $request->setPath($path); + $request->setNewPath($newPath); + $requestParamHeaders['workspace'] = $workspace; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('MoveDirectory', MoveDirectoryResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Moves a file (inside a Workspace) to a new location. + * + * Sample code: + * ``` + * $dataformClient = new DataformClient(); + * try { + * $formattedWorkspace = $dataformClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + * $path = 'path'; + * $newPath = 'new_path'; + * $response = $dataformClient->moveFile($formattedWorkspace, $path, $newPath); + * } finally { + * $dataformClient->close(); + * } + * ``` + * + * @param string $workspace Required. The workspace's name. + * @param string $path Required. The file's full path including filename, relative to the workspace root. + * @param string $newPath Required. The file's new path including filename, relative to the workspace root. + * @param array $optionalArgs { + * 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 \Google\Cloud\Dataform\V1beta1\MoveFileResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function moveFile($workspace, $path, $newPath, array $optionalArgs = []) + { + $request = new MoveFileRequest(); + $requestParamHeaders = []; + $request->setWorkspace($workspace); + $request->setPath($path); + $request->setNewPath($newPath); + $requestParamHeaders['workspace'] = $workspace; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('MoveFile', MoveFileResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Pulls Git commits from the Repository's remote into a Workspace. + * + * Sample code: + * ``` + * $dataformClient = new DataformClient(); + * try { + * $formattedName = $dataformClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + * $author = new CommitAuthor(); + * $dataformClient->pullGitCommits($formattedName, $author); + * } finally { + * $dataformClient->close(); + * } + * ``` + * + * @param string $name Required. The workspace's name. + * @param CommitAuthor $author Required. The author of any merge commit which may be created as a result of merging + * fetched Git commits into this workspace. + * @param array $optionalArgs { + * Optional. + * + * @type string $remoteBranch + * Optional. The name of the branch in the Git remote from which to pull commits. + * If left unset, the repository's default branch name will be used. + * @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 if the remote call fails + * + * @experimental + */ + public function pullGitCommits($name, $author, array $optionalArgs = []) + { + $request = new PullGitCommitsRequest(); + $requestParamHeaders = []; + $request->setName($name); + $request->setAuthor($author); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['remoteBranch'])) { + $request->setRemoteBranch($optionalArgs['remoteBranch']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('PullGitCommits', GPBEmpty::class, $optionalArgs, $request)->wait(); + } + + /** + * Pushes Git commits from a Workspace to the Repository's remote. + * + * Sample code: + * ``` + * $dataformClient = new DataformClient(); + * try { + * $formattedName = $dataformClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + * $dataformClient->pushGitCommits($formattedName); + * } finally { + * $dataformClient->close(); + * } + * ``` + * + * @param string $name Required. The workspace's name. + * @param array $optionalArgs { + * Optional. + * + * @type string $remoteBranch + * Optional. The name of the branch in the Git remote to which commits should be pushed. + * If left unset, the repository's default branch name will be used. + * @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 if the remote call fails + * + * @experimental + */ + public function pushGitCommits($name, array $optionalArgs = []) + { + $request = new PushGitCommitsRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['remoteBranch'])) { + $request->setRemoteBranch($optionalArgs['remoteBranch']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('PushGitCommits', GPBEmpty::class, $optionalArgs, $request)->wait(); + } + + /** + * Returns CompilationResultActions in a given CompilationResult. + * + * Sample code: + * ``` + * $dataformClient = new DataformClient(); + * try { + * $formattedName = $dataformClient->compilationResultName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[COMPILATION_RESULT]'); + * // Iterate over pages of elements + * $pagedResponse = $dataformClient->queryCompilationResultActions($formattedName); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $dataformClient->queryCompilationResultActions($formattedName); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $dataformClient->close(); + * } + * ``` + * + * @param string $name Required. The compilation result's name. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type string $filter + * Optional. Optional filter for the returned list. Filtering is only currently + * supported on the `file_path` field. + * @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 \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function queryCompilationResultActions($name, array $optionalArgs = []) + { + $request = new QueryCompilationResultActionsRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('QueryCompilationResultActions', $optionalArgs, QueryCompilationResultActionsResponse::class, $request); + } + + /** + * Returns the contents of a given Workspace directory. + * + * Sample code: + * ``` + * $dataformClient = new DataformClient(); + * try { + * $formattedWorkspace = $dataformClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + * // Iterate over pages of elements + * $pagedResponse = $dataformClient->queryDirectoryContents($formattedWorkspace); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $dataformClient->queryDirectoryContents($formattedWorkspace); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $dataformClient->close(); + * } + * ``` + * + * @param string $workspace Required. The workspace's name. + * @param array $optionalArgs { + * Optional. + * + * @type string $path + * Optional. The directory's full path including directory name, relative to the + * workspace root. If left unset, the workspace root is used. + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @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 \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function queryDirectoryContents($workspace, array $optionalArgs = []) + { + $request = new QueryDirectoryContentsRequest(); + $requestParamHeaders = []; + $request->setWorkspace($workspace); + $requestParamHeaders['workspace'] = $workspace; + if (isset($optionalArgs['path'])) { + $request->setPath($optionalArgs['path']); + } + + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('QueryDirectoryContents', $optionalArgs, QueryDirectoryContentsResponse::class, $request); + } + + /** + * Returns WorkflowInvocationActions in a given WorkflowInvocation. + * + * Sample code: + * ``` + * $dataformClient = new DataformClient(); + * try { + * $formattedName = $dataformClient->workflowInvocationName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKFLOW_INVOCATION]'); + * // Iterate over pages of elements + * $pagedResponse = $dataformClient->queryWorkflowInvocationActions($formattedName); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $dataformClient->queryWorkflowInvocationActions($formattedName); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $dataformClient->close(); + * } + * ``` + * + * @param string $name Required. The workflow invocation's name. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @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 \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function queryWorkflowInvocationActions($name, array $optionalArgs = []) + { + $request = new QueryWorkflowInvocationActionsRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('QueryWorkflowInvocationActions', $optionalArgs, QueryWorkflowInvocationActionsResponse::class, $request); + } + + /** + * Returns the contents of a file (inside a Workspace). + * + * Sample code: + * ``` + * $dataformClient = new DataformClient(); + * try { + * $formattedWorkspace = $dataformClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + * $path = 'path'; + * $response = $dataformClient->readFile($formattedWorkspace, $path); + * } finally { + * $dataformClient->close(); + * } + * ``` + * + * @param string $workspace Required. The workspace's name. + * @param string $path Required. The file's full path including filename, relative to the workspace root. + * @param array $optionalArgs { + * 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 \Google\Cloud\Dataform\V1beta1\ReadFileResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function readFile($workspace, $path, array $optionalArgs = []) + { + $request = new ReadFileRequest(); + $requestParamHeaders = []; + $request->setWorkspace($workspace); + $request->setPath($path); + $requestParamHeaders['workspace'] = $workspace; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('ReadFile', ReadFileResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Deletes a directory (inside a Workspace) and all of its contents. + * + * Sample code: + * ``` + * $dataformClient = new DataformClient(); + * try { + * $formattedWorkspace = $dataformClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + * $path = 'path'; + * $dataformClient->removeDirectory($formattedWorkspace, $path); + * } finally { + * $dataformClient->close(); + * } + * ``` + * + * @param string $workspace Required. The workspace's name. + * @param string $path Required. The directory's full path including directory name, relative to the + * workspace root. + * @param array $optionalArgs { + * 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 if the remote call fails + * + * @experimental + */ + public function removeDirectory($workspace, $path, array $optionalArgs = []) + { + $request = new RemoveDirectoryRequest(); + $requestParamHeaders = []; + $request->setWorkspace($workspace); + $request->setPath($path); + $requestParamHeaders['workspace'] = $workspace; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('RemoveDirectory', GPBEmpty::class, $optionalArgs, $request)->wait(); + } + + /** + * Deletes a file (inside a Workspace). + * + * Sample code: + * ``` + * $dataformClient = new DataformClient(); + * try { + * $formattedWorkspace = $dataformClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + * $path = 'path'; + * $dataformClient->removeFile($formattedWorkspace, $path); + * } finally { + * $dataformClient->close(); + * } + * ``` + * + * @param string $workspace Required. The workspace's name. + * @param string $path Required. The file's full path including filename, relative to the workspace root. + * @param array $optionalArgs { + * 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 if the remote call fails + * + * @experimental + */ + public function removeFile($workspace, $path, array $optionalArgs = []) + { + $request = new RemoveFileRequest(); + $requestParamHeaders = []; + $request->setWorkspace($workspace); + $request->setPath($path); + $requestParamHeaders['workspace'] = $workspace; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('RemoveFile', GPBEmpty::class, $optionalArgs, $request)->wait(); + } + + /** + * Performs a Git reset for uncommitted files in a Workspace. + * + * Sample code: + * ``` + * $dataformClient = new DataformClient(); + * try { + * $formattedName = $dataformClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + * $dataformClient->resetWorkspaceChanges($formattedName); + * } finally { + * $dataformClient->close(); + * } + * ``` + * + * @param string $name Required. The workspace's name. + * @param array $optionalArgs { + * Optional. + * + * @type string[] $paths + * Optional. Full file paths to reset back to their committed state including filename, + * rooted at workspace root. If left empty, all files will be reset. + * @type bool $clean + * Optional. If set to true, untracked files will be deleted. + * @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 if the remote call fails + * + * @experimental + */ + public function resetWorkspaceChanges($name, array $optionalArgs = []) + { + $request = new ResetWorkspaceChangesRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['paths'])) { + $request->setPaths($optionalArgs['paths']); + } + + if (isset($optionalArgs['clean'])) { + $request->setClean($optionalArgs['clean']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('ResetWorkspaceChanges', GPBEmpty::class, $optionalArgs, $request)->wait(); + } + + /** + * Updates a single Repository. + * + * Sample code: + * ``` + * $dataformClient = new DataformClient(); + * try { + * $repository = new Repository(); + * $response = $dataformClient->updateRepository($repository); + * } finally { + * $dataformClient->close(); + * } + * ``` + * + * @param Repository $repository Required. The repository to update. + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * Optional. Specifies the fields to be updated in the repository. If left unset, + * all fields will be updated. + * @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 \Google\Cloud\Dataform\V1beta1\Repository + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function updateRepository($repository, array $optionalArgs = []) + { + $request = new UpdateRepositoryRequest(); + $requestParamHeaders = []; + $request->setRepository($repository); + $requestParamHeaders['repository.name'] = $repository->getName(); + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('UpdateRepository', Repository::class, $optionalArgs, $request)->wait(); + } + + /** + * Writes to a file (inside a Workspace). + * + * Sample code: + * ``` + * $dataformClient = new DataformClient(); + * try { + * $formattedWorkspace = $dataformClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + * $path = 'path'; + * $contents = '...'; + * $response = $dataformClient->writeFile($formattedWorkspace, $path, $contents); + * } finally { + * $dataformClient->close(); + * } + * ``` + * + * @param string $workspace Required. The workspace's name. + * @param string $path Required. The file. + * @param string $contents Required. The file's contents. + * @param array $optionalArgs { + * 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 \Google\Cloud\Dataform\V1beta1\WriteFileResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function writeFile($workspace, $path, $contents, array $optionalArgs = []) + { + $request = new WriteFileRequest(); + $requestParamHeaders = []; + $request->setWorkspace($workspace); + $request->setPath($path); + $request->setContents($contents); + $requestParamHeaders['workspace'] = $workspace; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('WriteFile', WriteFileResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets information about a location. + * + * Sample code: + * ``` + * $dataformClient = new DataformClient(); + * try { + * $response = $dataformClient->getLocation(); + * } finally { + * $dataformClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * Resource name for the location. + * @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 \Google\Cloud\Location\Location + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function getLocation(array $optionalArgs = []) + { + $request = new GetLocationRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetLocation', Location::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.cloud.location.Locations')->wait(); + } + + /** + * Lists information about the supported locations for this service. + * + * Sample code: + * ``` + * $dataformClient = new DataformClient(); + * try { + * // Iterate over pages of elements + * $pagedResponse = $dataformClient->listLocations(); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $dataformClient->listLocations(); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $dataformClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * The resource that owns the locations collection, if applicable. + * @type string $filter + * The standard list filter. + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @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 \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function listLocations(array $optionalArgs = []) + { + $request = new ListLocationsRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListLocations', $optionalArgs, ListLocationsResponse::class, $request, 'google.cloud.location.Locations'); + } +} diff --git a/owl-bot-staging/Dataform/v1beta1/src/V1beta1/gapic_metadata.json b/owl-bot-staging/Dataform/v1beta1/src/V1beta1/gapic_metadata.json new file mode 100644 index 000000000000..8cd3c2be25f4 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/src/V1beta1/gapic_metadata.json @@ -0,0 +1,208 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services\/RPCs to the corresponding library clients\/methods", + "language": "php", + "protoPackage": "google.cloud.dataform.v1beta1", + "libraryPackage": "Google\\Cloud\\Dataform\\V1beta1", + "services": { + "Dataform": { + "clients": { + "grpc": { + "libraryClient": "DataformGapicClient", + "rpcs": { + "CancelWorkflowInvocation": { + "methods": [ + "cancelWorkflowInvocation" + ] + }, + "CommitWorkspaceChanges": { + "methods": [ + "commitWorkspaceChanges" + ] + }, + "CreateCompilationResult": { + "methods": [ + "createCompilationResult" + ] + }, + "CreateRepository": { + "methods": [ + "createRepository" + ] + }, + "CreateWorkflowInvocation": { + "methods": [ + "createWorkflowInvocation" + ] + }, + "CreateWorkspace": { + "methods": [ + "createWorkspace" + ] + }, + "DeleteRepository": { + "methods": [ + "deleteRepository" + ] + }, + "DeleteWorkflowInvocation": { + "methods": [ + "deleteWorkflowInvocation" + ] + }, + "DeleteWorkspace": { + "methods": [ + "deleteWorkspace" + ] + }, + "FetchFileDiff": { + "methods": [ + "fetchFileDiff" + ] + }, + "FetchFileGitStatuses": { + "methods": [ + "fetchFileGitStatuses" + ] + }, + "FetchGitAheadBehind": { + "methods": [ + "fetchGitAheadBehind" + ] + }, + "FetchRemoteBranches": { + "methods": [ + "fetchRemoteBranches" + ] + }, + "GetCompilationResult": { + "methods": [ + "getCompilationResult" + ] + }, + "GetRepository": { + "methods": [ + "getRepository" + ] + }, + "GetWorkflowInvocation": { + "methods": [ + "getWorkflowInvocation" + ] + }, + "GetWorkspace": { + "methods": [ + "getWorkspace" + ] + }, + "InstallNpmPackages": { + "methods": [ + "installNpmPackages" + ] + }, + "ListCompilationResults": { + "methods": [ + "listCompilationResults" + ] + }, + "ListRepositories": { + "methods": [ + "listRepositories" + ] + }, + "ListWorkflowInvocations": { + "methods": [ + "listWorkflowInvocations" + ] + }, + "ListWorkspaces": { + "methods": [ + "listWorkspaces" + ] + }, + "MakeDirectory": { + "methods": [ + "makeDirectory" + ] + }, + "MoveDirectory": { + "methods": [ + "moveDirectory" + ] + }, + "MoveFile": { + "methods": [ + "moveFile" + ] + }, + "PullGitCommits": { + "methods": [ + "pullGitCommits" + ] + }, + "PushGitCommits": { + "methods": [ + "pushGitCommits" + ] + }, + "QueryCompilationResultActions": { + "methods": [ + "queryCompilationResultActions" + ] + }, + "QueryDirectoryContents": { + "methods": [ + "queryDirectoryContents" + ] + }, + "QueryWorkflowInvocationActions": { + "methods": [ + "queryWorkflowInvocationActions" + ] + }, + "ReadFile": { + "methods": [ + "readFile" + ] + }, + "RemoveDirectory": { + "methods": [ + "removeDirectory" + ] + }, + "RemoveFile": { + "methods": [ + "removeFile" + ] + }, + "ResetWorkspaceChanges": { + "methods": [ + "resetWorkspaceChanges" + ] + }, + "UpdateRepository": { + "methods": [ + "updateRepository" + ] + }, + "WriteFile": { + "methods": [ + "writeFile" + ] + }, + "GetLocation": { + "methods": [ + "getLocation" + ] + }, + "ListLocations": { + "methods": [ + "listLocations" + ] + } + } + } + } + } + } +} \ No newline at end of file diff --git a/owl-bot-staging/Dataform/v1beta1/src/V1beta1/resources/dataform_client_config.json b/owl-bot-staging/Dataform/v1beta1/src/V1beta1/resources/dataform_client_config.json new file mode 100644 index 000000000000..492a50861653 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/src/V1beta1/resources/dataform_client_config.json @@ -0,0 +1,224 @@ +{ + "interfaces": { + "google.cloud.dataform.v1beta1.Dataform": { + "retry_codes": { + "no_retry_codes": [], + "retry_policy_1_codes": [ + "UNAVAILABLE" + ] + }, + "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": 1.3, + "max_retry_delay_millis": 10000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 60000 + } + }, + "methods": { + "CancelWorkflowInvocation": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "CommitWorkspaceChanges": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "CreateCompilationResult": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "CreateRepository": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "CreateWorkflowInvocation": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "CreateWorkspace": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "DeleteRepository": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "DeleteWorkflowInvocation": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "DeleteWorkspace": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "FetchFileDiff": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "FetchFileGitStatuses": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "FetchGitAheadBehind": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "FetchRemoteBranches": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "GetCompilationResult": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "GetRepository": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "GetWorkflowInvocation": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "GetWorkspace": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "InstallNpmPackages": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "ListCompilationResults": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "ListRepositories": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "ListWorkflowInvocations": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "ListWorkspaces": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "MakeDirectory": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "MoveDirectory": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "MoveFile": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "PullGitCommits": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "PushGitCommits": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "QueryCompilationResultActions": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "QueryDirectoryContents": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "QueryWorkflowInvocationActions": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "ReadFile": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "RemoveDirectory": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "RemoveFile": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "ResetWorkspaceChanges": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "UpdateRepository": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "WriteFile": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "GetLocation": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "ListLocations": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + } + } + } + } +} diff --git a/owl-bot-staging/Dataform/v1beta1/src/V1beta1/resources/dataform_descriptor_config.php b/owl-bot-staging/Dataform/v1beta1/src/V1beta1/resources/dataform_descriptor_config.php new file mode 100644 index 000000000000..2fb4914d841d --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/src/V1beta1/resources/dataform_descriptor_config.php @@ -0,0 +1,539 @@ + [ + 'google.cloud.dataform.v1beta1.Dataform' => [ + 'CancelWorkflowInvocation' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'CommitWorkspaceChanges' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'CreateCompilationResult' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Dataform\V1beta1\CompilationResult', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'CreateRepository' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Dataform\V1beta1\Repository', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'CreateWorkflowInvocation' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Dataform\V1beta1\WorkflowInvocation', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'CreateWorkspace' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Dataform\V1beta1\Workspace', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'DeleteRepository' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'DeleteWorkflowInvocation' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'DeleteWorkspace' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'FetchFileDiff' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Dataform\V1beta1\FetchFileDiffResponse', + 'headerParams' => [ + [ + 'keyName' => 'workspace', + 'fieldAccessors' => [ + 'getWorkspace', + ], + ], + ], + ], + 'FetchFileGitStatuses' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Dataform\V1beta1\FetchFileGitStatusesResponse', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'FetchGitAheadBehind' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Dataform\V1beta1\FetchGitAheadBehindResponse', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'FetchRemoteBranches' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Dataform\V1beta1\FetchRemoteBranchesResponse', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetCompilationResult' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Dataform\V1beta1\CompilationResult', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetRepository' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Dataform\V1beta1\Repository', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetWorkflowInvocation' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Dataform\V1beta1\WorkflowInvocation', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetWorkspace' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Dataform\V1beta1\Workspace', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'InstallNpmPackages' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Dataform\V1beta1\InstallNpmPackagesResponse', + 'headerParams' => [ + [ + 'keyName' => 'workspace', + 'fieldAccessors' => [ + 'getWorkspace', + ], + ], + ], + ], + 'ListCompilationResults' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getCompilationResults', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Dataform\V1beta1\ListCompilationResultsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListRepositories' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getRepositories', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Dataform\V1beta1\ListRepositoriesResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListWorkflowInvocations' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getWorkflowInvocations', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Dataform\V1beta1\ListWorkflowInvocationsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListWorkspaces' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getWorkspaces', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Dataform\V1beta1\ListWorkspacesResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'MakeDirectory' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Dataform\V1beta1\MakeDirectoryResponse', + 'headerParams' => [ + [ + 'keyName' => 'workspace', + 'fieldAccessors' => [ + 'getWorkspace', + ], + ], + ], + ], + 'MoveDirectory' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Dataform\V1beta1\MoveDirectoryResponse', + 'headerParams' => [ + [ + 'keyName' => 'workspace', + 'fieldAccessors' => [ + 'getWorkspace', + ], + ], + ], + ], + 'MoveFile' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Dataform\V1beta1\MoveFileResponse', + 'headerParams' => [ + [ + 'keyName' => 'workspace', + 'fieldAccessors' => [ + 'getWorkspace', + ], + ], + ], + ], + 'PullGitCommits' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'PushGitCommits' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'QueryCompilationResultActions' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getCompilationResultActions', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Dataform\V1beta1\QueryCompilationResultActionsResponse', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'QueryDirectoryContents' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getDirectoryEntries', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Dataform\V1beta1\QueryDirectoryContentsResponse', + 'headerParams' => [ + [ + 'keyName' => 'workspace', + 'fieldAccessors' => [ + 'getWorkspace', + ], + ], + ], + ], + 'QueryWorkflowInvocationActions' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getWorkflowInvocationActions', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Dataform\V1beta1\QueryWorkflowInvocationActionsResponse', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'ReadFile' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Dataform\V1beta1\ReadFileResponse', + 'headerParams' => [ + [ + 'keyName' => 'workspace', + 'fieldAccessors' => [ + 'getWorkspace', + ], + ], + ], + ], + 'RemoveDirectory' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'workspace', + 'fieldAccessors' => [ + 'getWorkspace', + ], + ], + ], + ], + 'RemoveFile' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'workspace', + 'fieldAccessors' => [ + 'getWorkspace', + ], + ], + ], + ], + 'ResetWorkspaceChanges' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'UpdateRepository' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Dataform\V1beta1\Repository', + 'headerParams' => [ + [ + 'keyName' => 'repository.name', + 'fieldAccessors' => [ + 'getRepository', + 'getName', + ], + ], + ], + ], + 'WriteFile' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Dataform\V1beta1\WriteFileResponse', + 'headerParams' => [ + [ + 'keyName' => 'workspace', + 'fieldAccessors' => [ + 'getWorkspace', + ], + ], + ], + ], + 'GetLocation' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Location\Location', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + 'interfaceOverride' => 'google.cloud.location.Locations', + ], + 'ListLocations' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getLocations', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Location\ListLocationsResponse', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + 'interfaceOverride' => 'google.cloud.location.Locations', + ], + 'templateMap' => [ + 'compilationResult' => 'projects/{project}/locations/{location}/repositories/{repository}/compilationResults/{compilation_result}', + 'location' => 'projects/{project}/locations/{location}', + 'repository' => 'projects/{project}/locations/{location}/repositories/{repository}', + 'secretVersion' => 'projects/{project}/secrets/{secret}/versions/{version}', + 'workflowInvocation' => 'projects/{project}/locations/{location}/repositories/{repository}/workflowInvocations/{workflow_invocation}', + 'workspace' => 'projects/{project}/locations/{location}/repositories/{repository}/workspaces/{workspace}', + ], + ], + ], +]; diff --git a/owl-bot-staging/Dataform/v1beta1/src/V1beta1/resources/dataform_rest_client_config.php b/owl-bot-staging/Dataform/v1beta1/src/V1beta1/resources/dataform_rest_client_config.php new file mode 100644 index 000000000000..4b22187fab66 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/src/V1beta1/resources/dataform_rest_client_config.php @@ -0,0 +1,453 @@ + [ + 'google.cloud.dataform.v1beta1.Dataform' => [ + 'CancelWorkflowInvocation' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta1/{name=projects/*/locations/*/repositories/*/workflowInvocations/*}:cancel', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'CommitWorkspaceChanges' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta1/{name=projects/*/locations/*/repositories/*/workspaces/*}:commit', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'CreateCompilationResult' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta1/{parent=projects/*/locations/*/repositories/*}/compilationResults', + 'body' => 'compilation_result', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'CreateRepository' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta1/{parent=projects/*/locations/*}/repositories', + 'body' => 'repository', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'repository_id', + ], + ], + 'CreateWorkflowInvocation' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta1/{parent=projects/*/locations/*/repositories/*}/workflowInvocations', + 'body' => 'workflow_invocation', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'CreateWorkspace' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta1/{parent=projects/*/locations/*/repositories/*}/workspaces', + 'body' => 'workspace', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'workspace_id', + ], + ], + 'DeleteRepository' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1beta1/{name=projects/*/locations/*/repositories/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteWorkflowInvocation' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1beta1/{name=projects/*/locations/*/repositories/*/workflowInvocations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteWorkspace' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1beta1/{name=projects/*/locations/*/repositories/*/workspaces/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'FetchFileDiff' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta1/{workspace=projects/*/locations/*/repositories/*/workspaces/*}:fetchFileDiff', + 'placeholders' => [ + 'workspace' => [ + 'getters' => [ + 'getWorkspace', + ], + ], + ], + ], + 'FetchFileGitStatuses' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta1/{name=projects/*/locations/*/repositories/*/workspaces/*}:fetchFileGitStatuses', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'FetchGitAheadBehind' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta1/{name=projects/*/locations/*/repositories/*/workspaces/*}:fetchGitAheadBehind', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'FetchRemoteBranches' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta1/{name=projects/*/locations/*/repositories/*}:fetchRemoteBranches', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetCompilationResult' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta1/{name=projects/*/locations/*/repositories/*/compilationResults/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetRepository' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta1/{name=projects/*/locations/*/repositories/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetWorkflowInvocation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta1/{name=projects/*/locations/*/repositories/*/workflowInvocations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetWorkspace' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta1/{name=projects/*/locations/*/repositories/*/workspaces/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'InstallNpmPackages' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta1/{workspace=projects/*/locations/*/repositories/*/workspaces/*}:installNpmPackages', + 'body' => '*', + 'placeholders' => [ + 'workspace' => [ + 'getters' => [ + 'getWorkspace', + ], + ], + ], + ], + 'ListCompilationResults' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta1/{parent=projects/*/locations/*/repositories/*}/compilationResults', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListRepositories' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta1/{parent=projects/*/locations/*}/repositories', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListWorkflowInvocations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta1/{parent=projects/*/locations/*/repositories/*}/workflowInvocations', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListWorkspaces' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta1/{parent=projects/*/locations/*/repositories/*}/workspaces', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'MakeDirectory' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta1/{workspace=projects/*/locations/*/repositories/*/workspaces/*}:makeDirectory', + 'body' => '*', + 'placeholders' => [ + 'workspace' => [ + 'getters' => [ + 'getWorkspace', + ], + ], + ], + ], + 'MoveDirectory' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta1/{workspace=projects/*/locations/*/repositories/*/workspaces/*}:moveDirectory', + 'body' => '*', + 'placeholders' => [ + 'workspace' => [ + 'getters' => [ + 'getWorkspace', + ], + ], + ], + ], + 'MoveFile' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta1/{workspace=projects/*/locations/*/repositories/*/workspaces/*}:moveFile', + 'body' => '*', + 'placeholders' => [ + 'workspace' => [ + 'getters' => [ + 'getWorkspace', + ], + ], + ], + ], + 'PullGitCommits' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta1/{name=projects/*/locations/*/repositories/*/workspaces/*}:pull', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'PushGitCommits' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta1/{name=projects/*/locations/*/repositories/*/workspaces/*}:push', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'QueryCompilationResultActions' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta1/{name=projects/*/locations/*/repositories/*/compilationResults/*}:query', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'QueryDirectoryContents' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta1/{workspace=projects/*/locations/*/repositories/*/workspaces/*}:queryDirectoryContents', + 'placeholders' => [ + 'workspace' => [ + 'getters' => [ + 'getWorkspace', + ], + ], + ], + ], + 'QueryWorkflowInvocationActions' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta1/{name=projects/*/locations/*/repositories/*/workflowInvocations/*}:query', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ReadFile' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta1/{workspace=projects/*/locations/*/repositories/*/workspaces/*}:readFile', + 'placeholders' => [ + 'workspace' => [ + 'getters' => [ + 'getWorkspace', + ], + ], + ], + ], + 'RemoveDirectory' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta1/{workspace=projects/*/locations/*/repositories/*/workspaces/*}:removeDirectory', + 'body' => '*', + 'placeholders' => [ + 'workspace' => [ + 'getters' => [ + 'getWorkspace', + ], + ], + ], + ], + 'RemoveFile' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta1/{workspace=projects/*/locations/*/repositories/*/workspaces/*}:removeFile', + 'body' => '*', + 'placeholders' => [ + 'workspace' => [ + 'getters' => [ + 'getWorkspace', + ], + ], + ], + ], + 'ResetWorkspaceChanges' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta1/{name=projects/*/locations/*/repositories/*/workspaces/*}:reset', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'UpdateRepository' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1beta1/{repository.name=projects/*/locations/*/repositories/*}', + 'body' => 'repository', + 'placeholders' => [ + 'repository.name' => [ + 'getters' => [ + 'getRepository', + 'getName', + ], + ], + ], + ], + 'WriteFile' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta1/{workspace=projects/*/locations/*/repositories/*/workspaces/*}:writeFile', + 'body' => '*', + 'placeholders' => [ + 'workspace' => [ + 'getters' => [ + 'getWorkspace', + ], + ], + ], + ], + ], + 'google.cloud.location.Locations' => [ + 'GetLocation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta1/{name=projects/*/locations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListLocations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta1/{name=projects/*}/locations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/Dataform/v1beta1/tests/Unit/V1beta1/Client/DataformClientTest.php b/owl-bot-staging/Dataform/v1beta1/tests/Unit/V1beta1/Client/DataformClientTest.php new file mode 100644 index 000000000000..e279e9298c4b --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/tests/Unit/V1beta1/Client/DataformClientTest.php @@ -0,0 +1,2736 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return DataformClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new DataformClient($options); + } + + /** @test */ + public function cancelWorkflowInvocationTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->workflowInvocationName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKFLOW_INVOCATION]'); + $request = (new CancelWorkflowInvocationRequest()) + ->setName($formattedName); + $gapicClient->cancelWorkflowInvocation($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dataform.v1beta1.Dataform/CancelWorkflowInvocation', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function cancelWorkflowInvocationExceptionTest() + { + $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->workflowInvocationName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKFLOW_INVOCATION]'); + $request = (new CancelWorkflowInvocationRequest()) + ->setName($formattedName); + try { + $gapicClient->cancelWorkflowInvocation($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 commitWorkspaceChangesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + $author = new CommitAuthor(); + $authorName = 'authorName-1501539658'; + $author->setName($authorName); + $authorEmailAddress = 'authorEmailAddress-6398493'; + $author->setEmailAddress($authorEmailAddress); + $request = (new CommitWorkspaceChangesRequest()) + ->setName($formattedName) + ->setAuthor($author); + $gapicClient->commitWorkspaceChanges($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dataform.v1beta1.Dataform/CommitWorkspaceChanges', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $actualValue = $actualRequestObject->getAuthor(); + $this->assertProtobufEquals($author, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function commitWorkspaceChangesExceptionTest() + { + $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->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + $author = new CommitAuthor(); + $authorName = 'authorName-1501539658'; + $author->setName($authorName); + $authorEmailAddress = 'authorEmailAddress-6398493'; + $author->setEmailAddress($authorEmailAddress); + $request = (new CommitWorkspaceChangesRequest()) + ->setName($formattedName) + ->setAuthor($author); + try { + $gapicClient->commitWorkspaceChanges($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 createCompilationResultTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $gitCommitish = 'gitCommitish-459981894'; + $dataformCoreVersion = 'dataformCoreVersion1918089577'; + $expectedResponse = new CompilationResult(); + $expectedResponse->setName($name); + $expectedResponse->setGitCommitish($gitCommitish); + $expectedResponse->setDataformCoreVersion($dataformCoreVersion); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->repositoryName('[PROJECT]', '[LOCATION]', '[REPOSITORY]'); + $compilationResult = new CompilationResult(); + $request = (new CreateCompilationResultRequest()) + ->setParent($formattedParent) + ->setCompilationResult($compilationResult); + $response = $gapicClient->createCompilationResult($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dataform.v1beta1.Dataform/CreateCompilationResult', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getCompilationResult(); + $this->assertProtobufEquals($compilationResult, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createCompilationResultExceptionTest() + { + $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->repositoryName('[PROJECT]', '[LOCATION]', '[REPOSITORY]'); + $compilationResult = new CompilationResult(); + $request = (new CreateCompilationResultRequest()) + ->setParent($formattedParent) + ->setCompilationResult($compilationResult); + try { + $gapicClient->createCompilationResult($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 createRepositoryTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $expectedResponse = new Repository(); + $expectedResponse->setName($name); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $repository = new Repository(); + $repositoryId = 'repositoryId1101683248'; + $request = (new CreateRepositoryRequest()) + ->setParent($formattedParent) + ->setRepository($repository) + ->setRepositoryId($repositoryId); + $response = $gapicClient->createRepository($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dataform.v1beta1.Dataform/CreateRepository', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getRepository(); + $this->assertProtobufEquals($repository, $actualValue); + $actualValue = $actualRequestObject->getRepositoryId(); + $this->assertProtobufEquals($repositoryId, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createRepositoryExceptionTest() + { + $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->locationName('[PROJECT]', '[LOCATION]'); + $repository = new Repository(); + $repositoryId = 'repositoryId1101683248'; + $request = (new CreateRepositoryRequest()) + ->setParent($formattedParent) + ->setRepository($repository) + ->setRepositoryId($repositoryId); + try { + $gapicClient->createRepository($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 createWorkflowInvocationTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $compilationResult = 'compilationResult-2035984871'; + $expectedResponse = new WorkflowInvocation(); + $expectedResponse->setName($name); + $expectedResponse->setCompilationResult($compilationResult); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->repositoryName('[PROJECT]', '[LOCATION]', '[REPOSITORY]'); + $workflowInvocation = new WorkflowInvocation(); + $request = (new CreateWorkflowInvocationRequest()) + ->setParent($formattedParent) + ->setWorkflowInvocation($workflowInvocation); + $response = $gapicClient->createWorkflowInvocation($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dataform.v1beta1.Dataform/CreateWorkflowInvocation', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getWorkflowInvocation(); + $this->assertProtobufEquals($workflowInvocation, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createWorkflowInvocationExceptionTest() + { + $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->repositoryName('[PROJECT]', '[LOCATION]', '[REPOSITORY]'); + $workflowInvocation = new WorkflowInvocation(); + $request = (new CreateWorkflowInvocationRequest()) + ->setParent($formattedParent) + ->setWorkflowInvocation($workflowInvocation); + try { + $gapicClient->createWorkflowInvocation($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 createWorkspaceTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $expectedResponse = new Workspace(); + $expectedResponse->setName($name); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->repositoryName('[PROJECT]', '[LOCATION]', '[REPOSITORY]'); + $workspace = new Workspace(); + $workspaceId = 'workspaceId1578483973'; + $request = (new CreateWorkspaceRequest()) + ->setParent($formattedParent) + ->setWorkspace($workspace) + ->setWorkspaceId($workspaceId); + $response = $gapicClient->createWorkspace($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dataform.v1beta1.Dataform/CreateWorkspace', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getWorkspace(); + $this->assertProtobufEquals($workspace, $actualValue); + $actualValue = $actualRequestObject->getWorkspaceId(); + $this->assertProtobufEquals($workspaceId, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createWorkspaceExceptionTest() + { + $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->repositoryName('[PROJECT]', '[LOCATION]', '[REPOSITORY]'); + $workspace = new Workspace(); + $workspaceId = 'workspaceId1578483973'; + $request = (new CreateWorkspaceRequest()) + ->setParent($formattedParent) + ->setWorkspace($workspace) + ->setWorkspaceId($workspaceId); + try { + $gapicClient->createWorkspace($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 deleteRepositoryTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->repositoryName('[PROJECT]', '[LOCATION]', '[REPOSITORY]'); + $request = (new DeleteRepositoryRequest()) + ->setName($formattedName); + $gapicClient->deleteRepository($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dataform.v1beta1.Dataform/DeleteRepository', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteRepositoryExceptionTest() + { + $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->repositoryName('[PROJECT]', '[LOCATION]', '[REPOSITORY]'); + $request = (new DeleteRepositoryRequest()) + ->setName($formattedName); + try { + $gapicClient->deleteRepository($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 deleteWorkflowInvocationTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->workflowInvocationName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKFLOW_INVOCATION]'); + $request = (new DeleteWorkflowInvocationRequest()) + ->setName($formattedName); + $gapicClient->deleteWorkflowInvocation($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dataform.v1beta1.Dataform/DeleteWorkflowInvocation', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteWorkflowInvocationExceptionTest() + { + $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->workflowInvocationName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKFLOW_INVOCATION]'); + $request = (new DeleteWorkflowInvocationRequest()) + ->setName($formattedName); + try { + $gapicClient->deleteWorkflowInvocation($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 deleteWorkspaceTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + $request = (new DeleteWorkspaceRequest()) + ->setName($formattedName); + $gapicClient->deleteWorkspace($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dataform.v1beta1.Dataform/DeleteWorkspace', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteWorkspaceExceptionTest() + { + $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->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + $request = (new DeleteWorkspaceRequest()) + ->setName($formattedName); + try { + $gapicClient->deleteWorkspace($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 fetchFileDiffTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $formattedDiff = 'formattedDiff-1687410264'; + $expectedResponse = new FetchFileDiffResponse(); + $expectedResponse->setFormattedDiff($formattedDiff); + $transport->addResponse($expectedResponse); + // Mock request + $formattedWorkspace = $gapicClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + $path = 'path3433509'; + $request = (new FetchFileDiffRequest()) + ->setWorkspace($formattedWorkspace) + ->setPath($path); + $response = $gapicClient->fetchFileDiff($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dataform.v1beta1.Dataform/FetchFileDiff', $actualFuncCall); + $actualValue = $actualRequestObject->getWorkspace(); + $this->assertProtobufEquals($formattedWorkspace, $actualValue); + $actualValue = $actualRequestObject->getPath(); + $this->assertProtobufEquals($path, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function fetchFileDiffExceptionTest() + { + $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 + $formattedWorkspace = $gapicClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + $path = 'path3433509'; + $request = (new FetchFileDiffRequest()) + ->setWorkspace($formattedWorkspace) + ->setPath($path); + try { + $gapicClient->fetchFileDiff($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 fetchFileGitStatusesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new FetchFileGitStatusesResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + $request = (new FetchFileGitStatusesRequest()) + ->setName($formattedName); + $response = $gapicClient->fetchFileGitStatuses($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dataform.v1beta1.Dataform/FetchFileGitStatuses', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function fetchFileGitStatusesExceptionTest() + { + $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->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + $request = (new FetchFileGitStatusesRequest()) + ->setName($formattedName); + try { + $gapicClient->fetchFileGitStatuses($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 fetchGitAheadBehindTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $commitsAhead = 1216483806; + $commitsBehind = 917751619; + $expectedResponse = new FetchGitAheadBehindResponse(); + $expectedResponse->setCommitsAhead($commitsAhead); + $expectedResponse->setCommitsBehind($commitsBehind); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + $request = (new FetchGitAheadBehindRequest()) + ->setName($formattedName); + $response = $gapicClient->fetchGitAheadBehind($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dataform.v1beta1.Dataform/FetchGitAheadBehind', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function fetchGitAheadBehindExceptionTest() + { + $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->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + $request = (new FetchGitAheadBehindRequest()) + ->setName($formattedName); + try { + $gapicClient->fetchGitAheadBehind($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 fetchRemoteBranchesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new FetchRemoteBranchesResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->repositoryName('[PROJECT]', '[LOCATION]', '[REPOSITORY]'); + $request = (new FetchRemoteBranchesRequest()) + ->setName($formattedName); + $response = $gapicClient->fetchRemoteBranches($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dataform.v1beta1.Dataform/FetchRemoteBranches', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function fetchRemoteBranchesExceptionTest() + { + $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->repositoryName('[PROJECT]', '[LOCATION]', '[REPOSITORY]'); + $request = (new FetchRemoteBranchesRequest()) + ->setName($formattedName); + try { + $gapicClient->fetchRemoteBranches($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 getCompilationResultTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $gitCommitish = 'gitCommitish-459981894'; + $dataformCoreVersion = 'dataformCoreVersion1918089577'; + $expectedResponse = new CompilationResult(); + $expectedResponse->setName($name2); + $expectedResponse->setGitCommitish($gitCommitish); + $expectedResponse->setDataformCoreVersion($dataformCoreVersion); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->compilationResultName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[COMPILATION_RESULT]'); + $request = (new GetCompilationResultRequest()) + ->setName($formattedName); + $response = $gapicClient->getCompilationResult($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dataform.v1beta1.Dataform/GetCompilationResult', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getCompilationResultExceptionTest() + { + $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->compilationResultName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[COMPILATION_RESULT]'); + $request = (new GetCompilationResultRequest()) + ->setName($formattedName); + try { + $gapicClient->getCompilationResult($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 getRepositoryTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $expectedResponse = new Repository(); + $expectedResponse->setName($name2); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->repositoryName('[PROJECT]', '[LOCATION]', '[REPOSITORY]'); + $request = (new GetRepositoryRequest()) + ->setName($formattedName); + $response = $gapicClient->getRepository($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dataform.v1beta1.Dataform/GetRepository', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getRepositoryExceptionTest() + { + $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->repositoryName('[PROJECT]', '[LOCATION]', '[REPOSITORY]'); + $request = (new GetRepositoryRequest()) + ->setName($formattedName); + try { + $gapicClient->getRepository($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 getWorkflowInvocationTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $compilationResult = 'compilationResult-2035984871'; + $expectedResponse = new WorkflowInvocation(); + $expectedResponse->setName($name2); + $expectedResponse->setCompilationResult($compilationResult); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->workflowInvocationName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKFLOW_INVOCATION]'); + $request = (new GetWorkflowInvocationRequest()) + ->setName($formattedName); + $response = $gapicClient->getWorkflowInvocation($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dataform.v1beta1.Dataform/GetWorkflowInvocation', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getWorkflowInvocationExceptionTest() + { + $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->workflowInvocationName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKFLOW_INVOCATION]'); + $request = (new GetWorkflowInvocationRequest()) + ->setName($formattedName); + try { + $gapicClient->getWorkflowInvocation($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 getWorkspaceTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $expectedResponse = new Workspace(); + $expectedResponse->setName($name2); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + $request = (new GetWorkspaceRequest()) + ->setName($formattedName); + $response = $gapicClient->getWorkspace($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dataform.v1beta1.Dataform/GetWorkspace', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getWorkspaceExceptionTest() + { + $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->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + $request = (new GetWorkspaceRequest()) + ->setName($formattedName); + try { + $gapicClient->getWorkspace($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 installNpmPackagesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new InstallNpmPackagesResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedWorkspace = $gapicClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + $request = (new InstallNpmPackagesRequest()) + ->setWorkspace($formattedWorkspace); + $response = $gapicClient->installNpmPackages($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dataform.v1beta1.Dataform/InstallNpmPackages', $actualFuncCall); + $actualValue = $actualRequestObject->getWorkspace(); + $this->assertProtobufEquals($formattedWorkspace, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function installNpmPackagesExceptionTest() + { + $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 + $formattedWorkspace = $gapicClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + $request = (new InstallNpmPackagesRequest()) + ->setWorkspace($formattedWorkspace); + try { + $gapicClient->installNpmPackages($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 listCompilationResultsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $compilationResultsElement = new CompilationResult(); + $compilationResults = [ + $compilationResultsElement, + ]; + $expectedResponse = new ListCompilationResultsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setCompilationResults($compilationResults); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->repositoryName('[PROJECT]', '[LOCATION]', '[REPOSITORY]'); + $request = (new ListCompilationResultsRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listCompilationResults($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getCompilationResults()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dataform.v1beta1.Dataform/ListCompilationResults', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listCompilationResultsExceptionTest() + { + $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->repositoryName('[PROJECT]', '[LOCATION]', '[REPOSITORY]'); + $request = (new ListCompilationResultsRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listCompilationResults($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 listRepositoriesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $repositoriesElement = new Repository(); + $repositories = [ + $repositoriesElement, + ]; + $expectedResponse = new ListRepositoriesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setRepositories($repositories); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListRepositoriesRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listRepositories($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getRepositories()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dataform.v1beta1.Dataform/ListRepositories', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listRepositoriesExceptionTest() + { + $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->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListRepositoriesRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listRepositories($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 listWorkflowInvocationsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $workflowInvocationsElement = new WorkflowInvocation(); + $workflowInvocations = [ + $workflowInvocationsElement, + ]; + $expectedResponse = new ListWorkflowInvocationsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setWorkflowInvocations($workflowInvocations); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->repositoryName('[PROJECT]', '[LOCATION]', '[REPOSITORY]'); + $request = (new ListWorkflowInvocationsRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listWorkflowInvocations($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getWorkflowInvocations()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dataform.v1beta1.Dataform/ListWorkflowInvocations', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listWorkflowInvocationsExceptionTest() + { + $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->repositoryName('[PROJECT]', '[LOCATION]', '[REPOSITORY]'); + $request = (new ListWorkflowInvocationsRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listWorkflowInvocations($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 listWorkspacesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $workspacesElement = new Workspace(); + $workspaces = [ + $workspacesElement, + ]; + $expectedResponse = new ListWorkspacesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setWorkspaces($workspaces); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->repositoryName('[PROJECT]', '[LOCATION]', '[REPOSITORY]'); + $request = (new ListWorkspacesRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listWorkspaces($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getWorkspaces()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dataform.v1beta1.Dataform/ListWorkspaces', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listWorkspacesExceptionTest() + { + $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->repositoryName('[PROJECT]', '[LOCATION]', '[REPOSITORY]'); + $request = (new ListWorkspacesRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listWorkspaces($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 makeDirectoryTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new MakeDirectoryResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedWorkspace = $gapicClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + $path = 'path3433509'; + $request = (new MakeDirectoryRequest()) + ->setWorkspace($formattedWorkspace) + ->setPath($path); + $response = $gapicClient->makeDirectory($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dataform.v1beta1.Dataform/MakeDirectory', $actualFuncCall); + $actualValue = $actualRequestObject->getWorkspace(); + $this->assertProtobufEquals($formattedWorkspace, $actualValue); + $actualValue = $actualRequestObject->getPath(); + $this->assertProtobufEquals($path, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function makeDirectoryExceptionTest() + { + $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 + $formattedWorkspace = $gapicClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + $path = 'path3433509'; + $request = (new MakeDirectoryRequest()) + ->setWorkspace($formattedWorkspace) + ->setPath($path); + try { + $gapicClient->makeDirectory($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 moveDirectoryTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new MoveDirectoryResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedWorkspace = $gapicClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + $path = 'path3433509'; + $newPath = 'newPath1377204068'; + $request = (new MoveDirectoryRequest()) + ->setWorkspace($formattedWorkspace) + ->setPath($path) + ->setNewPath($newPath); + $response = $gapicClient->moveDirectory($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dataform.v1beta1.Dataform/MoveDirectory', $actualFuncCall); + $actualValue = $actualRequestObject->getWorkspace(); + $this->assertProtobufEquals($formattedWorkspace, $actualValue); + $actualValue = $actualRequestObject->getPath(); + $this->assertProtobufEquals($path, $actualValue); + $actualValue = $actualRequestObject->getNewPath(); + $this->assertProtobufEquals($newPath, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function moveDirectoryExceptionTest() + { + $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 + $formattedWorkspace = $gapicClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + $path = 'path3433509'; + $newPath = 'newPath1377204068'; + $request = (new MoveDirectoryRequest()) + ->setWorkspace($formattedWorkspace) + ->setPath($path) + ->setNewPath($newPath); + try { + $gapicClient->moveDirectory($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 moveFileTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new MoveFileResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedWorkspace = $gapicClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + $path = 'path3433509'; + $newPath = 'newPath1377204068'; + $request = (new MoveFileRequest()) + ->setWorkspace($formattedWorkspace) + ->setPath($path) + ->setNewPath($newPath); + $response = $gapicClient->moveFile($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dataform.v1beta1.Dataform/MoveFile', $actualFuncCall); + $actualValue = $actualRequestObject->getWorkspace(); + $this->assertProtobufEquals($formattedWorkspace, $actualValue); + $actualValue = $actualRequestObject->getPath(); + $this->assertProtobufEquals($path, $actualValue); + $actualValue = $actualRequestObject->getNewPath(); + $this->assertProtobufEquals($newPath, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function moveFileExceptionTest() + { + $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 + $formattedWorkspace = $gapicClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + $path = 'path3433509'; + $newPath = 'newPath1377204068'; + $request = (new MoveFileRequest()) + ->setWorkspace($formattedWorkspace) + ->setPath($path) + ->setNewPath($newPath); + try { + $gapicClient->moveFile($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 pullGitCommitsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + $author = new CommitAuthor(); + $authorName = 'authorName-1501539658'; + $author->setName($authorName); + $authorEmailAddress = 'authorEmailAddress-6398493'; + $author->setEmailAddress($authorEmailAddress); + $request = (new PullGitCommitsRequest()) + ->setName($formattedName) + ->setAuthor($author); + $gapicClient->pullGitCommits($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dataform.v1beta1.Dataform/PullGitCommits', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $actualValue = $actualRequestObject->getAuthor(); + $this->assertProtobufEquals($author, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function pullGitCommitsExceptionTest() + { + $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->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + $author = new CommitAuthor(); + $authorName = 'authorName-1501539658'; + $author->setName($authorName); + $authorEmailAddress = 'authorEmailAddress-6398493'; + $author->setEmailAddress($authorEmailAddress); + $request = (new PullGitCommitsRequest()) + ->setName($formattedName) + ->setAuthor($author); + try { + $gapicClient->pullGitCommits($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 pushGitCommitsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + $request = (new PushGitCommitsRequest()) + ->setName($formattedName); + $gapicClient->pushGitCommits($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dataform.v1beta1.Dataform/PushGitCommits', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function pushGitCommitsExceptionTest() + { + $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->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + $request = (new PushGitCommitsRequest()) + ->setName($formattedName); + try { + $gapicClient->pushGitCommits($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 queryCompilationResultActionsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $compilationResultActionsElement = new CompilationResultAction(); + $compilationResultActions = [ + $compilationResultActionsElement, + ]; + $expectedResponse = new QueryCompilationResultActionsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setCompilationResultActions($compilationResultActions); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->compilationResultName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[COMPILATION_RESULT]'); + $request = (new QueryCompilationResultActionsRequest()) + ->setName($formattedName); + $response = $gapicClient->queryCompilationResultActions($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getCompilationResultActions()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dataform.v1beta1.Dataform/QueryCompilationResultActions', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function queryCompilationResultActionsExceptionTest() + { + $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->compilationResultName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[COMPILATION_RESULT]'); + $request = (new QueryCompilationResultActionsRequest()) + ->setName($formattedName); + try { + $gapicClient->queryCompilationResultActions($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 queryDirectoryContentsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $directoryEntriesElement = new DirectoryEntry(); + $directoryEntries = [ + $directoryEntriesElement, + ]; + $expectedResponse = new QueryDirectoryContentsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setDirectoryEntries($directoryEntries); + $transport->addResponse($expectedResponse); + // Mock request + $formattedWorkspace = $gapicClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + $request = (new QueryDirectoryContentsRequest()) + ->setWorkspace($formattedWorkspace); + $response = $gapicClient->queryDirectoryContents($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getDirectoryEntries()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dataform.v1beta1.Dataform/QueryDirectoryContents', $actualFuncCall); + $actualValue = $actualRequestObject->getWorkspace(); + $this->assertProtobufEquals($formattedWorkspace, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function queryDirectoryContentsExceptionTest() + { + $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 + $formattedWorkspace = $gapicClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + $request = (new QueryDirectoryContentsRequest()) + ->setWorkspace($formattedWorkspace); + try { + $gapicClient->queryDirectoryContents($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 queryWorkflowInvocationActionsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $workflowInvocationActionsElement = new WorkflowInvocationAction(); + $workflowInvocationActions = [ + $workflowInvocationActionsElement, + ]; + $expectedResponse = new QueryWorkflowInvocationActionsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setWorkflowInvocationActions($workflowInvocationActions); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->workflowInvocationName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKFLOW_INVOCATION]'); + $request = (new QueryWorkflowInvocationActionsRequest()) + ->setName($formattedName); + $response = $gapicClient->queryWorkflowInvocationActions($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getWorkflowInvocationActions()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dataform.v1beta1.Dataform/QueryWorkflowInvocationActions', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function queryWorkflowInvocationActionsExceptionTest() + { + $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->workflowInvocationName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKFLOW_INVOCATION]'); + $request = (new QueryWorkflowInvocationActionsRequest()) + ->setName($formattedName); + try { + $gapicClient->queryWorkflowInvocationActions($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 readFileTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $fileContents = '125'; + $expectedResponse = new ReadFileResponse(); + $expectedResponse->setFileContents($fileContents); + $transport->addResponse($expectedResponse); + // Mock request + $formattedWorkspace = $gapicClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + $path = 'path3433509'; + $request = (new ReadFileRequest()) + ->setWorkspace($formattedWorkspace) + ->setPath($path); + $response = $gapicClient->readFile($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dataform.v1beta1.Dataform/ReadFile', $actualFuncCall); + $actualValue = $actualRequestObject->getWorkspace(); + $this->assertProtobufEquals($formattedWorkspace, $actualValue); + $actualValue = $actualRequestObject->getPath(); + $this->assertProtobufEquals($path, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function readFileExceptionTest() + { + $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 + $formattedWorkspace = $gapicClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + $path = 'path3433509'; + $request = (new ReadFileRequest()) + ->setWorkspace($formattedWorkspace) + ->setPath($path); + try { + $gapicClient->readFile($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 removeDirectoryTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedWorkspace = $gapicClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + $path = 'path3433509'; + $request = (new RemoveDirectoryRequest()) + ->setWorkspace($formattedWorkspace) + ->setPath($path); + $gapicClient->removeDirectory($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dataform.v1beta1.Dataform/RemoveDirectory', $actualFuncCall); + $actualValue = $actualRequestObject->getWorkspace(); + $this->assertProtobufEquals($formattedWorkspace, $actualValue); + $actualValue = $actualRequestObject->getPath(); + $this->assertProtobufEquals($path, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function removeDirectoryExceptionTest() + { + $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 + $formattedWorkspace = $gapicClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + $path = 'path3433509'; + $request = (new RemoveDirectoryRequest()) + ->setWorkspace($formattedWorkspace) + ->setPath($path); + try { + $gapicClient->removeDirectory($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 removeFileTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedWorkspace = $gapicClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + $path = 'path3433509'; + $request = (new RemoveFileRequest()) + ->setWorkspace($formattedWorkspace) + ->setPath($path); + $gapicClient->removeFile($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dataform.v1beta1.Dataform/RemoveFile', $actualFuncCall); + $actualValue = $actualRequestObject->getWorkspace(); + $this->assertProtobufEquals($formattedWorkspace, $actualValue); + $actualValue = $actualRequestObject->getPath(); + $this->assertProtobufEquals($path, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function removeFileExceptionTest() + { + $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 + $formattedWorkspace = $gapicClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + $path = 'path3433509'; + $request = (new RemoveFileRequest()) + ->setWorkspace($formattedWorkspace) + ->setPath($path); + try { + $gapicClient->removeFile($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 resetWorkspaceChangesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + $request = (new ResetWorkspaceChangesRequest()) + ->setName($formattedName); + $gapicClient->resetWorkspaceChanges($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dataform.v1beta1.Dataform/ResetWorkspaceChanges', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function resetWorkspaceChangesExceptionTest() + { + $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->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + $request = (new ResetWorkspaceChangesRequest()) + ->setName($formattedName); + try { + $gapicClient->resetWorkspaceChanges($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 updateRepositoryTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $expectedResponse = new Repository(); + $expectedResponse->setName($name); + $transport->addResponse($expectedResponse); + // Mock request + $repository = new Repository(); + $request = (new UpdateRepositoryRequest()) + ->setRepository($repository); + $response = $gapicClient->updateRepository($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dataform.v1beta1.Dataform/UpdateRepository', $actualFuncCall); + $actualValue = $actualRequestObject->getRepository(); + $this->assertProtobufEquals($repository, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateRepositoryExceptionTest() + { + $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 + $repository = new Repository(); + $request = (new UpdateRepositoryRequest()) + ->setRepository($repository); + try { + $gapicClient->updateRepository($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 writeFileTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new WriteFileResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedWorkspace = $gapicClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + $path = 'path3433509'; + $contents = '26'; + $request = (new WriteFileRequest()) + ->setWorkspace($formattedWorkspace) + ->setPath($path) + ->setContents($contents); + $response = $gapicClient->writeFile($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dataform.v1beta1.Dataform/WriteFile', $actualFuncCall); + $actualValue = $actualRequestObject->getWorkspace(); + $this->assertProtobufEquals($formattedWorkspace, $actualValue); + $actualValue = $actualRequestObject->getPath(); + $this->assertProtobufEquals($path, $actualValue); + $actualValue = $actualRequestObject->getContents(); + $this->assertProtobufEquals($contents, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function writeFileExceptionTest() + { + $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 + $formattedWorkspace = $gapicClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + $path = 'path3433509'; + $contents = '26'; + $request = (new WriteFileRequest()) + ->setWorkspace($formattedWorkspace) + ->setPath($path) + ->setContents($contents); + try { + $gapicClient->writeFile($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 getLocationTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $locationId = 'locationId552319461'; + $displayName = 'displayName1615086568'; + $expectedResponse = new Location(); + $expectedResponse->setName($name2); + $expectedResponse->setLocationId($locationId); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + $request = new GetLocationRequest(); + $response = $gapicClient->getLocation($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/GetLocation', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getLocationExceptionTest() + { + $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); + $request = new GetLocationRequest(); + try { + $gapicClient->getLocation($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 listLocationsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $locationsElement = new Location(); + $locations = [ + $locationsElement, + ]; + $expectedResponse = new ListLocationsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setLocations($locations); + $transport->addResponse($expectedResponse); + $request = new ListLocationsRequest(); + $response = $gapicClient->listLocations($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getLocations()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/ListLocations', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listLocationsExceptionTest() + { + $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); + $request = new ListLocationsRequest(); + try { + $gapicClient->listLocations($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 cancelWorkflowInvocationAsyncTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->workflowInvocationName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKFLOW_INVOCATION]'); + $request = (new CancelWorkflowInvocationRequest()) + ->setName($formattedName); + $gapicClient->cancelWorkflowInvocationAsync($request)->wait(); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dataform.v1beta1.Dataform/CancelWorkflowInvocation', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/owl-bot-staging/Dataform/v1beta1/tests/Unit/V1beta1/DataformClientTest.php b/owl-bot-staging/Dataform/v1beta1/tests/Unit/V1beta1/DataformClientTest.php new file mode 100644 index 000000000000..fd10131f7975 --- /dev/null +++ b/owl-bot-staging/Dataform/v1beta1/tests/Unit/V1beta1/DataformClientTest.php @@ -0,0 +1,2486 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return DataformClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new DataformClient($options); + } + + /** @test */ + public function cancelWorkflowInvocationTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->workflowInvocationName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKFLOW_INVOCATION]'); + $gapicClient->cancelWorkflowInvocation($formattedName); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dataform.v1beta1.Dataform/CancelWorkflowInvocation', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function cancelWorkflowInvocationExceptionTest() + { + $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->workflowInvocationName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKFLOW_INVOCATION]'); + try { + $gapicClient->cancelWorkflowInvocation($formattedName); + // 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 commitWorkspaceChangesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + $author = new CommitAuthor(); + $authorName = 'authorName-1501539658'; + $author->setName($authorName); + $authorEmailAddress = 'authorEmailAddress-6398493'; + $author->setEmailAddress($authorEmailAddress); + $gapicClient->commitWorkspaceChanges($formattedName, $author); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dataform.v1beta1.Dataform/CommitWorkspaceChanges', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $actualValue = $actualRequestObject->getAuthor(); + $this->assertProtobufEquals($author, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function commitWorkspaceChangesExceptionTest() + { + $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->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + $author = new CommitAuthor(); + $authorName = 'authorName-1501539658'; + $author->setName($authorName); + $authorEmailAddress = 'authorEmailAddress-6398493'; + $author->setEmailAddress($authorEmailAddress); + try { + $gapicClient->commitWorkspaceChanges($formattedName, $author); + // 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 createCompilationResultTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $gitCommitish = 'gitCommitish-459981894'; + $dataformCoreVersion = 'dataformCoreVersion1918089577'; + $expectedResponse = new CompilationResult(); + $expectedResponse->setName($name); + $expectedResponse->setGitCommitish($gitCommitish); + $expectedResponse->setDataformCoreVersion($dataformCoreVersion); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->repositoryName('[PROJECT]', '[LOCATION]', '[REPOSITORY]'); + $compilationResult = new CompilationResult(); + $response = $gapicClient->createCompilationResult($formattedParent, $compilationResult); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dataform.v1beta1.Dataform/CreateCompilationResult', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getCompilationResult(); + $this->assertProtobufEquals($compilationResult, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createCompilationResultExceptionTest() + { + $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->repositoryName('[PROJECT]', '[LOCATION]', '[REPOSITORY]'); + $compilationResult = new CompilationResult(); + try { + $gapicClient->createCompilationResult($formattedParent, $compilationResult); + // 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 createRepositoryTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $expectedResponse = new Repository(); + $expectedResponse->setName($name); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $repository = new Repository(); + $repositoryId = 'repositoryId1101683248'; + $response = $gapicClient->createRepository($formattedParent, $repository, $repositoryId); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dataform.v1beta1.Dataform/CreateRepository', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getRepository(); + $this->assertProtobufEquals($repository, $actualValue); + $actualValue = $actualRequestObject->getRepositoryId(); + $this->assertProtobufEquals($repositoryId, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createRepositoryExceptionTest() + { + $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->locationName('[PROJECT]', '[LOCATION]'); + $repository = new Repository(); + $repositoryId = 'repositoryId1101683248'; + try { + $gapicClient->createRepository($formattedParent, $repository, $repositoryId); + // 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 createWorkflowInvocationTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $compilationResult = 'compilationResult-2035984871'; + $expectedResponse = new WorkflowInvocation(); + $expectedResponse->setName($name); + $expectedResponse->setCompilationResult($compilationResult); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->repositoryName('[PROJECT]', '[LOCATION]', '[REPOSITORY]'); + $workflowInvocation = new WorkflowInvocation(); + $response = $gapicClient->createWorkflowInvocation($formattedParent, $workflowInvocation); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dataform.v1beta1.Dataform/CreateWorkflowInvocation', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getWorkflowInvocation(); + $this->assertProtobufEquals($workflowInvocation, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createWorkflowInvocationExceptionTest() + { + $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->repositoryName('[PROJECT]', '[LOCATION]', '[REPOSITORY]'); + $workflowInvocation = new WorkflowInvocation(); + try { + $gapicClient->createWorkflowInvocation($formattedParent, $workflowInvocation); + // 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 createWorkspaceTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $expectedResponse = new Workspace(); + $expectedResponse->setName($name); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->repositoryName('[PROJECT]', '[LOCATION]', '[REPOSITORY]'); + $workspace = new Workspace(); + $workspaceId = 'workspaceId1578483973'; + $response = $gapicClient->createWorkspace($formattedParent, $workspace, $workspaceId); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dataform.v1beta1.Dataform/CreateWorkspace', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getWorkspace(); + $this->assertProtobufEquals($workspace, $actualValue); + $actualValue = $actualRequestObject->getWorkspaceId(); + $this->assertProtobufEquals($workspaceId, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createWorkspaceExceptionTest() + { + $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->repositoryName('[PROJECT]', '[LOCATION]', '[REPOSITORY]'); + $workspace = new Workspace(); + $workspaceId = 'workspaceId1578483973'; + try { + $gapicClient->createWorkspace($formattedParent, $workspace, $workspaceId); + // 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 deleteRepositoryTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->repositoryName('[PROJECT]', '[LOCATION]', '[REPOSITORY]'); + $gapicClient->deleteRepository($formattedName); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dataform.v1beta1.Dataform/DeleteRepository', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteRepositoryExceptionTest() + { + $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->repositoryName('[PROJECT]', '[LOCATION]', '[REPOSITORY]'); + try { + $gapicClient->deleteRepository($formattedName); + // 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 deleteWorkflowInvocationTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->workflowInvocationName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKFLOW_INVOCATION]'); + $gapicClient->deleteWorkflowInvocation($formattedName); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dataform.v1beta1.Dataform/DeleteWorkflowInvocation', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteWorkflowInvocationExceptionTest() + { + $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->workflowInvocationName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKFLOW_INVOCATION]'); + try { + $gapicClient->deleteWorkflowInvocation($formattedName); + // 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 deleteWorkspaceTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + $gapicClient->deleteWorkspace($formattedName); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dataform.v1beta1.Dataform/DeleteWorkspace', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteWorkspaceExceptionTest() + { + $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->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + try { + $gapicClient->deleteWorkspace($formattedName); + // 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 fetchFileDiffTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $formattedDiff = 'formattedDiff-1687410264'; + $expectedResponse = new FetchFileDiffResponse(); + $expectedResponse->setFormattedDiff($formattedDiff); + $transport->addResponse($expectedResponse); + // Mock request + $formattedWorkspace = $gapicClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + $path = 'path3433509'; + $response = $gapicClient->fetchFileDiff($formattedWorkspace, $path); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dataform.v1beta1.Dataform/FetchFileDiff', $actualFuncCall); + $actualValue = $actualRequestObject->getWorkspace(); + $this->assertProtobufEquals($formattedWorkspace, $actualValue); + $actualValue = $actualRequestObject->getPath(); + $this->assertProtobufEquals($path, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function fetchFileDiffExceptionTest() + { + $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 + $formattedWorkspace = $gapicClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + $path = 'path3433509'; + try { + $gapicClient->fetchFileDiff($formattedWorkspace, $path); + // 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 fetchFileGitStatusesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new FetchFileGitStatusesResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + $response = $gapicClient->fetchFileGitStatuses($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dataform.v1beta1.Dataform/FetchFileGitStatuses', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function fetchFileGitStatusesExceptionTest() + { + $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->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + try { + $gapicClient->fetchFileGitStatuses($formattedName); + // 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 fetchGitAheadBehindTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $commitsAhead = 1216483806; + $commitsBehind = 917751619; + $expectedResponse = new FetchGitAheadBehindResponse(); + $expectedResponse->setCommitsAhead($commitsAhead); + $expectedResponse->setCommitsBehind($commitsBehind); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + $response = $gapicClient->fetchGitAheadBehind($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dataform.v1beta1.Dataform/FetchGitAheadBehind', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function fetchGitAheadBehindExceptionTest() + { + $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->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + try { + $gapicClient->fetchGitAheadBehind($formattedName); + // 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 fetchRemoteBranchesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new FetchRemoteBranchesResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->repositoryName('[PROJECT]', '[LOCATION]', '[REPOSITORY]'); + $response = $gapicClient->fetchRemoteBranches($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dataform.v1beta1.Dataform/FetchRemoteBranches', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function fetchRemoteBranchesExceptionTest() + { + $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->repositoryName('[PROJECT]', '[LOCATION]', '[REPOSITORY]'); + try { + $gapicClient->fetchRemoteBranches($formattedName); + // 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 getCompilationResultTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $gitCommitish = 'gitCommitish-459981894'; + $dataformCoreVersion = 'dataformCoreVersion1918089577'; + $expectedResponse = new CompilationResult(); + $expectedResponse->setName($name2); + $expectedResponse->setGitCommitish($gitCommitish); + $expectedResponse->setDataformCoreVersion($dataformCoreVersion); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->compilationResultName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[COMPILATION_RESULT]'); + $response = $gapicClient->getCompilationResult($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dataform.v1beta1.Dataform/GetCompilationResult', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getCompilationResultExceptionTest() + { + $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->compilationResultName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[COMPILATION_RESULT]'); + try { + $gapicClient->getCompilationResult($formattedName); + // 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 getRepositoryTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $expectedResponse = new Repository(); + $expectedResponse->setName($name2); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->repositoryName('[PROJECT]', '[LOCATION]', '[REPOSITORY]'); + $response = $gapicClient->getRepository($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dataform.v1beta1.Dataform/GetRepository', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getRepositoryExceptionTest() + { + $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->repositoryName('[PROJECT]', '[LOCATION]', '[REPOSITORY]'); + try { + $gapicClient->getRepository($formattedName); + // 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 getWorkflowInvocationTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $compilationResult = 'compilationResult-2035984871'; + $expectedResponse = new WorkflowInvocation(); + $expectedResponse->setName($name2); + $expectedResponse->setCompilationResult($compilationResult); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->workflowInvocationName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKFLOW_INVOCATION]'); + $response = $gapicClient->getWorkflowInvocation($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dataform.v1beta1.Dataform/GetWorkflowInvocation', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getWorkflowInvocationExceptionTest() + { + $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->workflowInvocationName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKFLOW_INVOCATION]'); + try { + $gapicClient->getWorkflowInvocation($formattedName); + // 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 getWorkspaceTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $expectedResponse = new Workspace(); + $expectedResponse->setName($name2); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + $response = $gapicClient->getWorkspace($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dataform.v1beta1.Dataform/GetWorkspace', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getWorkspaceExceptionTest() + { + $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->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + try { + $gapicClient->getWorkspace($formattedName); + // 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 installNpmPackagesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new InstallNpmPackagesResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedWorkspace = $gapicClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + $response = $gapicClient->installNpmPackages($formattedWorkspace); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dataform.v1beta1.Dataform/InstallNpmPackages', $actualFuncCall); + $actualValue = $actualRequestObject->getWorkspace(); + $this->assertProtobufEquals($formattedWorkspace, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function installNpmPackagesExceptionTest() + { + $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 + $formattedWorkspace = $gapicClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + try { + $gapicClient->installNpmPackages($formattedWorkspace); + // 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 listCompilationResultsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $compilationResultsElement = new CompilationResult(); + $compilationResults = [ + $compilationResultsElement, + ]; + $expectedResponse = new ListCompilationResultsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setCompilationResults($compilationResults); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->repositoryName('[PROJECT]', '[LOCATION]', '[REPOSITORY]'); + $response = $gapicClient->listCompilationResults($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getCompilationResults()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dataform.v1beta1.Dataform/ListCompilationResults', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listCompilationResultsExceptionTest() + { + $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->repositoryName('[PROJECT]', '[LOCATION]', '[REPOSITORY]'); + try { + $gapicClient->listCompilationResults($formattedParent); + // 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 listRepositoriesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $repositoriesElement = new Repository(); + $repositories = [ + $repositoriesElement, + ]; + $expectedResponse = new ListRepositoriesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setRepositories($repositories); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->listRepositories($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getRepositories()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dataform.v1beta1.Dataform/ListRepositories', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listRepositoriesExceptionTest() + { + $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->locationName('[PROJECT]', '[LOCATION]'); + try { + $gapicClient->listRepositories($formattedParent); + // 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 listWorkflowInvocationsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $workflowInvocationsElement = new WorkflowInvocation(); + $workflowInvocations = [ + $workflowInvocationsElement, + ]; + $expectedResponse = new ListWorkflowInvocationsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setWorkflowInvocations($workflowInvocations); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->repositoryName('[PROJECT]', '[LOCATION]', '[REPOSITORY]'); + $response = $gapicClient->listWorkflowInvocations($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getWorkflowInvocations()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dataform.v1beta1.Dataform/ListWorkflowInvocations', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listWorkflowInvocationsExceptionTest() + { + $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->repositoryName('[PROJECT]', '[LOCATION]', '[REPOSITORY]'); + try { + $gapicClient->listWorkflowInvocations($formattedParent); + // 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 listWorkspacesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $workspacesElement = new Workspace(); + $workspaces = [ + $workspacesElement, + ]; + $expectedResponse = new ListWorkspacesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setWorkspaces($workspaces); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->repositoryName('[PROJECT]', '[LOCATION]', '[REPOSITORY]'); + $response = $gapicClient->listWorkspaces($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getWorkspaces()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dataform.v1beta1.Dataform/ListWorkspaces', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listWorkspacesExceptionTest() + { + $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->repositoryName('[PROJECT]', '[LOCATION]', '[REPOSITORY]'); + try { + $gapicClient->listWorkspaces($formattedParent); + // 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 makeDirectoryTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new MakeDirectoryResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedWorkspace = $gapicClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + $path = 'path3433509'; + $response = $gapicClient->makeDirectory($formattedWorkspace, $path); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dataform.v1beta1.Dataform/MakeDirectory', $actualFuncCall); + $actualValue = $actualRequestObject->getWorkspace(); + $this->assertProtobufEquals($formattedWorkspace, $actualValue); + $actualValue = $actualRequestObject->getPath(); + $this->assertProtobufEquals($path, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function makeDirectoryExceptionTest() + { + $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 + $formattedWorkspace = $gapicClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + $path = 'path3433509'; + try { + $gapicClient->makeDirectory($formattedWorkspace, $path); + // 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 moveDirectoryTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new MoveDirectoryResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedWorkspace = $gapicClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + $path = 'path3433509'; + $newPath = 'newPath1377204068'; + $response = $gapicClient->moveDirectory($formattedWorkspace, $path, $newPath); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dataform.v1beta1.Dataform/MoveDirectory', $actualFuncCall); + $actualValue = $actualRequestObject->getWorkspace(); + $this->assertProtobufEquals($formattedWorkspace, $actualValue); + $actualValue = $actualRequestObject->getPath(); + $this->assertProtobufEquals($path, $actualValue); + $actualValue = $actualRequestObject->getNewPath(); + $this->assertProtobufEquals($newPath, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function moveDirectoryExceptionTest() + { + $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 + $formattedWorkspace = $gapicClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + $path = 'path3433509'; + $newPath = 'newPath1377204068'; + try { + $gapicClient->moveDirectory($formattedWorkspace, $path, $newPath); + // 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 moveFileTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new MoveFileResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedWorkspace = $gapicClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + $path = 'path3433509'; + $newPath = 'newPath1377204068'; + $response = $gapicClient->moveFile($formattedWorkspace, $path, $newPath); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dataform.v1beta1.Dataform/MoveFile', $actualFuncCall); + $actualValue = $actualRequestObject->getWorkspace(); + $this->assertProtobufEquals($formattedWorkspace, $actualValue); + $actualValue = $actualRequestObject->getPath(); + $this->assertProtobufEquals($path, $actualValue); + $actualValue = $actualRequestObject->getNewPath(); + $this->assertProtobufEquals($newPath, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function moveFileExceptionTest() + { + $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 + $formattedWorkspace = $gapicClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + $path = 'path3433509'; + $newPath = 'newPath1377204068'; + try { + $gapicClient->moveFile($formattedWorkspace, $path, $newPath); + // 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 pullGitCommitsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + $author = new CommitAuthor(); + $authorName = 'authorName-1501539658'; + $author->setName($authorName); + $authorEmailAddress = 'authorEmailAddress-6398493'; + $author->setEmailAddress($authorEmailAddress); + $gapicClient->pullGitCommits($formattedName, $author); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dataform.v1beta1.Dataform/PullGitCommits', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $actualValue = $actualRequestObject->getAuthor(); + $this->assertProtobufEquals($author, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function pullGitCommitsExceptionTest() + { + $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->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + $author = new CommitAuthor(); + $authorName = 'authorName-1501539658'; + $author->setName($authorName); + $authorEmailAddress = 'authorEmailAddress-6398493'; + $author->setEmailAddress($authorEmailAddress); + try { + $gapicClient->pullGitCommits($formattedName, $author); + // 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 pushGitCommitsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + $gapicClient->pushGitCommits($formattedName); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dataform.v1beta1.Dataform/PushGitCommits', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function pushGitCommitsExceptionTest() + { + $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->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + try { + $gapicClient->pushGitCommits($formattedName); + // 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 queryCompilationResultActionsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $compilationResultActionsElement = new CompilationResultAction(); + $compilationResultActions = [ + $compilationResultActionsElement, + ]; + $expectedResponse = new QueryCompilationResultActionsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setCompilationResultActions($compilationResultActions); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->compilationResultName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[COMPILATION_RESULT]'); + $response = $gapicClient->queryCompilationResultActions($formattedName); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getCompilationResultActions()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dataform.v1beta1.Dataform/QueryCompilationResultActions', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function queryCompilationResultActionsExceptionTest() + { + $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->compilationResultName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[COMPILATION_RESULT]'); + try { + $gapicClient->queryCompilationResultActions($formattedName); + // 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 queryDirectoryContentsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $directoryEntriesElement = new DirectoryEntry(); + $directoryEntries = [ + $directoryEntriesElement, + ]; + $expectedResponse = new QueryDirectoryContentsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setDirectoryEntries($directoryEntries); + $transport->addResponse($expectedResponse); + // Mock request + $formattedWorkspace = $gapicClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + $response = $gapicClient->queryDirectoryContents($formattedWorkspace); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getDirectoryEntries()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dataform.v1beta1.Dataform/QueryDirectoryContents', $actualFuncCall); + $actualValue = $actualRequestObject->getWorkspace(); + $this->assertProtobufEquals($formattedWorkspace, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function queryDirectoryContentsExceptionTest() + { + $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 + $formattedWorkspace = $gapicClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + try { + $gapicClient->queryDirectoryContents($formattedWorkspace); + // 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 queryWorkflowInvocationActionsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $workflowInvocationActionsElement = new WorkflowInvocationAction(); + $workflowInvocationActions = [ + $workflowInvocationActionsElement, + ]; + $expectedResponse = new QueryWorkflowInvocationActionsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setWorkflowInvocationActions($workflowInvocationActions); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->workflowInvocationName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKFLOW_INVOCATION]'); + $response = $gapicClient->queryWorkflowInvocationActions($formattedName); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getWorkflowInvocationActions()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dataform.v1beta1.Dataform/QueryWorkflowInvocationActions', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function queryWorkflowInvocationActionsExceptionTest() + { + $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->workflowInvocationName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKFLOW_INVOCATION]'); + try { + $gapicClient->queryWorkflowInvocationActions($formattedName); + // 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 readFileTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $fileContents = '125'; + $expectedResponse = new ReadFileResponse(); + $expectedResponse->setFileContents($fileContents); + $transport->addResponse($expectedResponse); + // Mock request + $formattedWorkspace = $gapicClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + $path = 'path3433509'; + $response = $gapicClient->readFile($formattedWorkspace, $path); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dataform.v1beta1.Dataform/ReadFile', $actualFuncCall); + $actualValue = $actualRequestObject->getWorkspace(); + $this->assertProtobufEquals($formattedWorkspace, $actualValue); + $actualValue = $actualRequestObject->getPath(); + $this->assertProtobufEquals($path, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function readFileExceptionTest() + { + $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 + $formattedWorkspace = $gapicClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + $path = 'path3433509'; + try { + $gapicClient->readFile($formattedWorkspace, $path); + // 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 removeDirectoryTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedWorkspace = $gapicClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + $path = 'path3433509'; + $gapicClient->removeDirectory($formattedWorkspace, $path); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dataform.v1beta1.Dataform/RemoveDirectory', $actualFuncCall); + $actualValue = $actualRequestObject->getWorkspace(); + $this->assertProtobufEquals($formattedWorkspace, $actualValue); + $actualValue = $actualRequestObject->getPath(); + $this->assertProtobufEquals($path, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function removeDirectoryExceptionTest() + { + $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 + $formattedWorkspace = $gapicClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + $path = 'path3433509'; + try { + $gapicClient->removeDirectory($formattedWorkspace, $path); + // 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 removeFileTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedWorkspace = $gapicClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + $path = 'path3433509'; + $gapicClient->removeFile($formattedWorkspace, $path); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dataform.v1beta1.Dataform/RemoveFile', $actualFuncCall); + $actualValue = $actualRequestObject->getWorkspace(); + $this->assertProtobufEquals($formattedWorkspace, $actualValue); + $actualValue = $actualRequestObject->getPath(); + $this->assertProtobufEquals($path, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function removeFileExceptionTest() + { + $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 + $formattedWorkspace = $gapicClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + $path = 'path3433509'; + try { + $gapicClient->removeFile($formattedWorkspace, $path); + // 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 resetWorkspaceChangesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + $gapicClient->resetWorkspaceChanges($formattedName); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dataform.v1beta1.Dataform/ResetWorkspaceChanges', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function resetWorkspaceChangesExceptionTest() + { + $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->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + try { + $gapicClient->resetWorkspaceChanges($formattedName); + // 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 updateRepositoryTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $expectedResponse = new Repository(); + $expectedResponse->setName($name); + $transport->addResponse($expectedResponse); + // Mock request + $repository = new Repository(); + $response = $gapicClient->updateRepository($repository); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dataform.v1beta1.Dataform/UpdateRepository', $actualFuncCall); + $actualValue = $actualRequestObject->getRepository(); + $this->assertProtobufEquals($repository, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateRepositoryExceptionTest() + { + $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 + $repository = new Repository(); + try { + $gapicClient->updateRepository($repository); + // 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 writeFileTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new WriteFileResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedWorkspace = $gapicClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + $path = 'path3433509'; + $contents = '26'; + $response = $gapicClient->writeFile($formattedWorkspace, $path, $contents); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dataform.v1beta1.Dataform/WriteFile', $actualFuncCall); + $actualValue = $actualRequestObject->getWorkspace(); + $this->assertProtobufEquals($formattedWorkspace, $actualValue); + $actualValue = $actualRequestObject->getPath(); + $this->assertProtobufEquals($path, $actualValue); + $actualValue = $actualRequestObject->getContents(); + $this->assertProtobufEquals($contents, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function writeFileExceptionTest() + { + $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 + $formattedWorkspace = $gapicClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]'); + $path = 'path3433509'; + $contents = '26'; + try { + $gapicClient->writeFile($formattedWorkspace, $path, $contents); + // 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 getLocationTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $locationId = 'locationId552319461'; + $displayName = 'displayName1615086568'; + $expectedResponse = new Location(); + $expectedResponse->setName($name2); + $expectedResponse->setLocationId($locationId); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + $response = $gapicClient->getLocation(); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/GetLocation', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getLocationExceptionTest() + { + $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); + try { + $gapicClient->getLocation(); + // 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 listLocationsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $locationsElement = new Location(); + $locations = [ + $locationsElement, + ]; + $expectedResponse = new ListLocationsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setLocations($locations); + $transport->addResponse($expectedResponse); + $response = $gapicClient->listLocations(); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getLocations()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/ListLocations', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listLocationsExceptionTest() + { + $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); + try { + $gapicClient->listLocations(); + // 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()); + } +} diff --git a/owl-bot-staging/DataprocMetastore/logging/v1/proto/src/GPBMetadata/Google/Cloud/Metastore/Logging/V1/LogStreams.php b/owl-bot-staging/DataprocMetastore/logging/v1/proto/src/GPBMetadata/Google/Cloud/Metastore/Logging/V1/LogStreams.php new file mode 100644 index 000000000000..a4316d75c387 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/logging/v1/proto/src/GPBMetadata/Google/Cloud/Metastore/Logging/V1/LogStreams.php @@ -0,0 +1,31 @@ +internalAddGeneratedFile( + ' +© +3google/cloud/metastore/logging/v1/log_streams.proto!google.cloud.metastore.logging.v1"# +RequestsLogEntry +message ( ") +SystemActivityLogEntry +message ( Bw +!google.cloud.metastore.logging.v1BLogStreamsProtoPZ?cloud.google.com/go/metastore/logging/apiv1/loggingpb;loggingpbbproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/owl-bot-staging/DataprocMetastore/logging/v1/proto/src/Google/Cloud/Metastore/Logging/V1/RequestsLogEntry.php b/owl-bot-staging/DataprocMetastore/logging/v1/proto/src/Google/Cloud/Metastore/Logging/V1/RequestsLogEntry.php new file mode 100644 index 000000000000..a9dfe603bdac --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/logging/v1/proto/src/Google/Cloud/Metastore/Logging/V1/RequestsLogEntry.php @@ -0,0 +1,68 @@ +google.cloud.metastore.logging.v1.RequestsLogEntry + */ +class RequestsLogEntry extends \Google\Protobuf\Internal\Message +{ + /** + * A free-text string describing the request. + * + * Generated from protobuf field string message = 1; + */ + protected $message = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $message + * A free-text string describing the request. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\Logging\V1\LogStreams::initOnce(); + parent::__construct($data); + } + + /** + * A free-text string describing the request. + * + * Generated from protobuf field string message = 1; + * @return string + */ + public function getMessage() + { + return $this->message; + } + + /** + * A free-text string describing the request. + * + * Generated from protobuf field string message = 1; + * @param string $var + * @return $this + */ + public function setMessage($var) + { + GPBUtil::checkString($var, True); + $this->message = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/logging/v1/proto/src/Google/Cloud/Metastore/Logging/V1/SystemActivityLogEntry.php b/owl-bot-staging/DataprocMetastore/logging/v1/proto/src/Google/Cloud/Metastore/Logging/V1/SystemActivityLogEntry.php new file mode 100644 index 000000000000..585d960a9d80 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/logging/v1/proto/src/Google/Cloud/Metastore/Logging/V1/SystemActivityLogEntry.php @@ -0,0 +1,68 @@ +google.cloud.metastore.logging.v1.SystemActivityLogEntry + */ +class SystemActivityLogEntry extends \Google\Protobuf\Internal\Message +{ + /** + * A free-text string describing the system activity. + * + * Generated from protobuf field string message = 1; + */ + protected $message = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $message + * A free-text string describing the system activity. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\Logging\V1\LogStreams::initOnce(); + parent::__construct($data); + } + + /** + * A free-text string describing the system activity. + * + * Generated from protobuf field string message = 1; + * @return string + */ + public function getMessage() + { + return $this->message; + } + + /** + * A free-text string describing the system activity. + * + * Generated from protobuf field string message = 1; + * @param string $var + * @return $this + */ + public function setMessage($var) + { + GPBUtil::checkString($var, True); + $this->message = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1/proto/src/GPBMetadata/Google/Cloud/Metastore/V1/Metastore.php b/owl-bot-staging/DataprocMetastore/v1/proto/src/GPBMetadata/Google/Cloud/Metastore/V1/Metastore.php new file mode 100644 index 000000000000..6464c825796a Binary files /dev/null and b/owl-bot-staging/DataprocMetastore/v1/proto/src/GPBMetadata/Google/Cloud/Metastore/V1/Metastore.php differ diff --git a/owl-bot-staging/DataprocMetastore/v1/proto/src/GPBMetadata/Google/Cloud/Metastore/V1/MetastoreFederation.php b/owl-bot-staging/DataprocMetastore/v1/proto/src/GPBMetadata/Google/Cloud/Metastore/V1/MetastoreFederation.php new file mode 100644 index 000000000000..79f53ca17937 Binary files /dev/null and b/owl-bot-staging/DataprocMetastore/v1/proto/src/GPBMetadata/Google/Cloud/Metastore/V1/MetastoreFederation.php differ diff --git a/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/AuxiliaryVersionConfig.php b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/AuxiliaryVersionConfig.php new file mode 100644 index 000000000000..f140b4c76616 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/AuxiliaryVersionConfig.php @@ -0,0 +1,169 @@ +google.cloud.metastore.v1.AuxiliaryVersionConfig + */ +class AuxiliaryVersionConfig extends \Google\Protobuf\Internal\Message +{ + /** + * The Hive metastore version of the auxiliary service. It must be less + * than the primary Hive metastore service's version. + * + * Generated from protobuf field string version = 1; + */ + protected $version = ''; + /** + * A mapping of Hive metastore configuration key-value pairs to apply to the + * auxiliary Hive metastore (configured in `hive-site.xml`) in addition to + * the primary version's overrides. If keys are present in both the auxiliary + * version's overrides and the primary version's overrides, the value from + * the auxiliary version's overrides takes precedence. + * + * Generated from protobuf field map config_overrides = 2; + */ + private $config_overrides; + /** + * Output only. The network configuration contains the endpoint URI(s) of the + * auxiliary Hive metastore service. + * + * Generated from protobuf field .google.cloud.metastore.v1.NetworkConfig network_config = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $network_config = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $version + * The Hive metastore version of the auxiliary service. It must be less + * than the primary Hive metastore service's version. + * @type array|\Google\Protobuf\Internal\MapField $config_overrides + * A mapping of Hive metastore configuration key-value pairs to apply to the + * auxiliary Hive metastore (configured in `hive-site.xml`) in addition to + * the primary version's overrides. If keys are present in both the auxiliary + * version's overrides and the primary version's overrides, the value from + * the auxiliary version's overrides takes precedence. + * @type \Google\Cloud\Metastore\V1\NetworkConfig $network_config + * Output only. The network configuration contains the endpoint URI(s) of the + * auxiliary Hive metastore service. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * The Hive metastore version of the auxiliary service. It must be less + * than the primary Hive metastore service's version. + * + * Generated from protobuf field string version = 1; + * @return string + */ + public function getVersion() + { + return $this->version; + } + + /** + * The Hive metastore version of the auxiliary service. It must be less + * than the primary Hive metastore service's version. + * + * Generated from protobuf field string version = 1; + * @param string $var + * @return $this + */ + public function setVersion($var) + { + GPBUtil::checkString($var, True); + $this->version = $var; + + return $this; + } + + /** + * A mapping of Hive metastore configuration key-value pairs to apply to the + * auxiliary Hive metastore (configured in `hive-site.xml`) in addition to + * the primary version's overrides. If keys are present in both the auxiliary + * version's overrides and the primary version's overrides, the value from + * the auxiliary version's overrides takes precedence. + * + * Generated from protobuf field map config_overrides = 2; + * @return \Google\Protobuf\Internal\MapField + */ + public function getConfigOverrides() + { + return $this->config_overrides; + } + + /** + * A mapping of Hive metastore configuration key-value pairs to apply to the + * auxiliary Hive metastore (configured in `hive-site.xml`) in addition to + * the primary version's overrides. If keys are present in both the auxiliary + * version's overrides and the primary version's overrides, the value from + * the auxiliary version's overrides takes precedence. + * + * Generated from protobuf field map config_overrides = 2; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setConfigOverrides($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->config_overrides = $arr; + + return $this; + } + + /** + * Output only. The network configuration contains the endpoint URI(s) of the + * auxiliary Hive metastore service. + * + * Generated from protobuf field .google.cloud.metastore.v1.NetworkConfig network_config = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\Metastore\V1\NetworkConfig|null + */ + public function getNetworkConfig() + { + return $this->network_config; + } + + public function hasNetworkConfig() + { + return isset($this->network_config); + } + + public function clearNetworkConfig() + { + unset($this->network_config); + } + + /** + * Output only. The network configuration contains the endpoint URI(s) of the + * auxiliary Hive metastore service. + * + * Generated from protobuf field .google.cloud.metastore.v1.NetworkConfig network_config = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\Metastore\V1\NetworkConfig $var + * @return $this + */ + public function setNetworkConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Metastore\V1\NetworkConfig::class); + $this->network_config = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/BackendMetastore.php b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/BackendMetastore.php new file mode 100644 index 000000000000..ec94c364d40e --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/BackendMetastore.php @@ -0,0 +1,125 @@ +google.cloud.metastore.v1.BackendMetastore + */ +class BackendMetastore extends \Google\Protobuf\Internal\Message +{ + /** + * The relative resource name of the metastore that is being federated. + * The formats of the relative resource names for the currently supported + * metastores are listed below: + * * BigQuery + * * `projects/{project_id}` + * * Dataproc Metastore + * * `projects/{project_id}/locations/{location}/services/{service_id}` + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * The type of the backend metastore. + * + * Generated from protobuf field .google.cloud.metastore.v1.BackendMetastore.MetastoreType metastore_type = 2; + */ + protected $metastore_type = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The relative resource name of the metastore that is being federated. + * The formats of the relative resource names for the currently supported + * metastores are listed below: + * * BigQuery + * * `projects/{project_id}` + * * Dataproc Metastore + * * `projects/{project_id}/locations/{location}/services/{service_id}` + * @type int $metastore_type + * The type of the backend metastore. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1\MetastoreFederation::initOnce(); + parent::__construct($data); + } + + /** + * The relative resource name of the metastore that is being federated. + * The formats of the relative resource names for the currently supported + * metastores are listed below: + * * BigQuery + * * `projects/{project_id}` + * * Dataproc Metastore + * * `projects/{project_id}/locations/{location}/services/{service_id}` + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The relative resource name of the metastore that is being federated. + * The formats of the relative resource names for the currently supported + * metastores are listed below: + * * BigQuery + * * `projects/{project_id}` + * * Dataproc Metastore + * * `projects/{project_id}/locations/{location}/services/{service_id}` + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The type of the backend metastore. + * + * Generated from protobuf field .google.cloud.metastore.v1.BackendMetastore.MetastoreType metastore_type = 2; + * @return int + */ + public function getMetastoreType() + { + return $this->metastore_type; + } + + /** + * The type of the backend metastore. + * + * Generated from protobuf field .google.cloud.metastore.v1.BackendMetastore.MetastoreType metastore_type = 2; + * @param int $var + * @return $this + */ + public function setMetastoreType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Metastore\V1\BackendMetastore\MetastoreType::class); + $this->metastore_type = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/BackendMetastore/MetastoreType.php b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/BackendMetastore/MetastoreType.php new file mode 100644 index 000000000000..20df0d2971ba --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/BackendMetastore/MetastoreType.php @@ -0,0 +1,57 @@ +google.cloud.metastore.v1.BackendMetastore.MetastoreType + */ +class MetastoreType +{ + /** + * The metastore type is not set. + * + * Generated from protobuf enum METASTORE_TYPE_UNSPECIFIED = 0; + */ + const METASTORE_TYPE_UNSPECIFIED = 0; + /** + * The backend metastore is Dataproc Metastore. + * + * Generated from protobuf enum DATAPROC_METASTORE = 3; + */ + const DATAPROC_METASTORE = 3; + + private static $valueToName = [ + self::METASTORE_TYPE_UNSPECIFIED => 'METASTORE_TYPE_UNSPECIFIED', + self::DATAPROC_METASTORE => 'DATAPROC_METASTORE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(MetastoreType::class, \Google\Cloud\Metastore\V1\BackendMetastore_MetastoreType::class); + diff --git a/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/BackendMetastore_MetastoreType.php b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/BackendMetastore_MetastoreType.php new file mode 100644 index 000000000000..932f83c2c5f7 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/BackendMetastore_MetastoreType.php @@ -0,0 +1,16 @@ +google.cloud.metastore.v1.Backup + */ +class Backup extends \Google\Protobuf\Internal\Message +{ + /** + * Immutable. The relative resource name of the backup, in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + */ + protected $name = ''; + /** + * Output only. The time when the backup was started. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. The time when the backup finished creating. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $end_time = null; + /** + * Output only. The current state of the backup. + * + * Generated from protobuf field .google.cloud.metastore.v1.Backup.State state = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Output only. The revision of the service at the time of backup. + * + * Generated from protobuf field .google.cloud.metastore.v1.Service service_revision = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $service_revision = null; + /** + * The description of the backup. + * + * Generated from protobuf field string description = 6; + */ + protected $description = ''; + /** + * Output only. Services that are restoring from the backup. + * + * Generated from protobuf field repeated string restoring_services = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $restoring_services; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Immutable. The relative resource name of the backup, in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}` + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The time when the backup was started. + * @type \Google\Protobuf\Timestamp $end_time + * Output only. The time when the backup finished creating. + * @type int $state + * Output only. The current state of the backup. + * @type \Google\Cloud\Metastore\V1\Service $service_revision + * Output only. The revision of the service at the time of backup. + * @type string $description + * The description of the backup. + * @type array|\Google\Protobuf\Internal\RepeatedField $restoring_services + * Output only. Services that are restoring from the backup. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Immutable. The relative resource name of the backup, in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Immutable. The relative resource name of the backup, in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. The time when the backup was started. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.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 when the backup was started. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.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 when the backup finished creating. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 3 [(.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 when the backup finished creating. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 3 [(.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 current state of the backup. + * + * Generated from protobuf field .google.cloud.metastore.v1.Backup.State state = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. The current state of the backup. + * + * Generated from protobuf field .google.cloud.metastore.v1.Backup.State state = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Metastore\V1\Backup\State::class); + $this->state = $var; + + return $this; + } + + /** + * Output only. The revision of the service at the time of backup. + * + * Generated from protobuf field .google.cloud.metastore.v1.Service service_revision = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\Metastore\V1\Service|null + */ + public function getServiceRevision() + { + return $this->service_revision; + } + + public function hasServiceRevision() + { + return isset($this->service_revision); + } + + public function clearServiceRevision() + { + unset($this->service_revision); + } + + /** + * Output only. The revision of the service at the time of backup. + * + * Generated from protobuf field .google.cloud.metastore.v1.Service service_revision = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\Metastore\V1\Service $var + * @return $this + */ + public function setServiceRevision($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Metastore\V1\Service::class); + $this->service_revision = $var; + + return $this; + } + + /** + * The description of the backup. + * + * Generated from protobuf field string description = 6; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * The description of the backup. + * + * Generated from protobuf field string description = 6; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * Output only. Services that are restoring from the backup. + * + * Generated from protobuf field repeated string restoring_services = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRestoringServices() + { + return $this->restoring_services; + } + + /** + * Output only. Services that are restoring from the backup. + * + * Generated from protobuf field repeated string restoring_services = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRestoringServices($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->restoring_services = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/Backup/State.php b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/Backup/State.php new file mode 100644 index 000000000000..22fbd2881e27 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/Backup/State.php @@ -0,0 +1,85 @@ +google.cloud.metastore.v1.Backup.State + */ +class State +{ + /** + * The state of the backup is unknown. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The backup is being created. + * + * Generated from protobuf enum CREATING = 1; + */ + const CREATING = 1; + /** + * The backup is being deleted. + * + * Generated from protobuf enum DELETING = 2; + */ + const DELETING = 2; + /** + * The backup is active and ready to use. + * + * Generated from protobuf enum ACTIVE = 3; + */ + const ACTIVE = 3; + /** + * The backup failed. + * + * Generated from protobuf enum FAILED = 4; + */ + const FAILED = 4; + /** + * The backup is being restored. + * + * Generated from protobuf enum RESTORING = 5; + */ + const RESTORING = 5; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::CREATING => 'CREATING', + self::DELETING => 'DELETING', + self::ACTIVE => 'ACTIVE', + self::FAILED => 'FAILED', + self::RESTORING => 'RESTORING', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\Metastore\V1\Backup_State::class); + diff --git a/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/Backup_State.php b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/Backup_State.php new file mode 100644 index 000000000000..9889e8a4f3b6 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/Backup_State.php @@ -0,0 +1,16 @@ +google.cloud.metastore.v1.CreateBackupRequest + */ +class CreateBackupRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The relative resource name of the service in which to create a + * backup of the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The ID of the backup, which is used as the final component of the + * backup's name. + * This value must be between 1 and 64 characters long, begin with a letter, + * end with a letter or number, and consist of alpha-numeric ASCII characters + * or hyphens. + * + * Generated from protobuf field string backup_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $backup_id = ''; + /** + * Required. The backup to create. The `name` field is ignored. The ID of the + * created backup must be provided in the request's `backup_id` field. + * + * Generated from protobuf field .google.cloud.metastore.v1.Backup backup = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $backup = null; + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * @param string $parent Required. The relative resource name of the service in which to create a + * backup of the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. Please see + * {@see DataprocMetastoreClient::serviceName()} for help formatting this field. + * @param \Google\Cloud\Metastore\V1\Backup $backup Required. The backup to create. The `name` field is ignored. The ID of the + * created backup must be provided in the request's `backup_id` field. + * @param string $backupId Required. The ID of the backup, which is used as the final component of the + * backup's name. + * + * This value must be between 1 and 64 characters long, begin with a letter, + * end with a letter or number, and consist of alpha-numeric ASCII characters + * or hyphens. + * + * @return \Google\Cloud\Metastore\V1\CreateBackupRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\Metastore\V1\Backup $backup, string $backupId): self + { + return (new self()) + ->setParent($parent) + ->setBackup($backup) + ->setBackupId($backupId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The relative resource name of the service in which to create a + * backup of the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * @type string $backup_id + * Required. The ID of the backup, which is used as the final component of the + * backup's name. + * This value must be between 1 and 64 characters long, begin with a letter, + * end with a letter or number, and consist of alpha-numeric ASCII characters + * or hyphens. + * @type \Google\Cloud\Metastore\V1\Backup $backup + * Required. The backup to create. The `name` field is ignored. The ID of the + * created backup must be provided in the request's `backup_id` field. + * @type string $request_id + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Required. The relative resource name of the service in which to create a + * backup of the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * + * 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. The relative resource name of the service in which to create a + * backup of the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * + * 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. The ID of the backup, which is used as the final component of the + * backup's name. + * This value must be between 1 and 64 characters long, begin with a letter, + * end with a letter or number, and consist of alpha-numeric ASCII characters + * or hyphens. + * + * Generated from protobuf field string backup_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getBackupId() + { + return $this->backup_id; + } + + /** + * Required. The ID of the backup, which is used as the final component of the + * backup's name. + * This value must be between 1 and 64 characters long, begin with a letter, + * end with a letter or number, and consist of alpha-numeric ASCII characters + * or hyphens. + * + * Generated from protobuf field string backup_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setBackupId($var) + { + GPBUtil::checkString($var, True); + $this->backup_id = $var; + + return $this; + } + + /** + * Required. The backup to create. The `name` field is ignored. The ID of the + * created backup must be provided in the request's `backup_id` field. + * + * Generated from protobuf field .google.cloud.metastore.v1.Backup backup = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Metastore\V1\Backup|null + */ + public function getBackup() + { + return $this->backup; + } + + public function hasBackup() + { + return isset($this->backup); + } + + public function clearBackup() + { + unset($this->backup); + } + + /** + * Required. The backup to create. The `name` field is ignored. The ID of the + * created backup must be provided in the request's `backup_id` field. + * + * Generated from protobuf field .google.cloud.metastore.v1.Backup backup = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Metastore\V1\Backup $var + * @return $this + */ + public function setBackup($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Metastore\V1\Backup::class); + $this->backup = $var; + + return $this; + } + + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @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/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/CreateFederationRequest.php b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/CreateFederationRequest.php new file mode 100644 index 000000000000..3b708f708665 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/CreateFederationRequest.php @@ -0,0 +1,275 @@ +google.cloud.metastore.v1.CreateFederationRequest + */ +class CreateFederationRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The relative resource name of the location in which to create a + * federation service, in the following form: + * `projects/{project_number}/locations/{location_id}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The ID of the metastore federation, which is used as the final + * component of the metastore federation's name. + * This value must be between 2 and 63 characters long inclusive, begin with a + * letter, end with a letter or number, and consist of alpha-numeric + * ASCII characters or hyphens. + * + * Generated from protobuf field string federation_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $federation_id = ''; + /** + * Required. The Metastore Federation to create. The `name` field is + * ignored. The ID of the created metastore federation must be + * provided in the request's `federation_id` field. + * + * Generated from protobuf field .google.cloud.metastore.v1.Federation federation = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $federation = null; + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * @param string $parent Required. The relative resource name of the location in which to create a + * federation service, in the following form: + * + * `projects/{project_number}/locations/{location_id}`. Please see + * {@see DataprocMetastoreFederationClient::locationName()} for help formatting this field. + * @param \Google\Cloud\Metastore\V1\Federation $federation Required. The Metastore Federation to create. The `name` field is + * ignored. The ID of the created metastore federation must be + * provided in the request's `federation_id` field. + * @param string $federationId Required. The ID of the metastore federation, which is used as the final + * component of the metastore federation's name. + * + * This value must be between 2 and 63 characters long inclusive, begin with a + * letter, end with a letter or number, and consist of alpha-numeric + * ASCII characters or hyphens. + * + * @return \Google\Cloud\Metastore\V1\CreateFederationRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\Metastore\V1\Federation $federation, string $federationId): self + { + return (new self()) + ->setParent($parent) + ->setFederation($federation) + ->setFederationId($federationId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The relative resource name of the location in which to create a + * federation service, in the following form: + * `projects/{project_number}/locations/{location_id}`. + * @type string $federation_id + * Required. The ID of the metastore federation, which is used as the final + * component of the metastore federation's name. + * This value must be between 2 and 63 characters long inclusive, begin with a + * letter, end with a letter or number, and consist of alpha-numeric + * ASCII characters or hyphens. + * @type \Google\Cloud\Metastore\V1\Federation $federation + * Required. The Metastore Federation to create. The `name` field is + * ignored. The ID of the created metastore federation must be + * provided in the request's `federation_id` field. + * @type string $request_id + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1\MetastoreFederation::initOnce(); + parent::__construct($data); + } + + /** + * Required. The relative resource name of the location in which to create a + * federation service, in the following form: + * `projects/{project_number}/locations/{location_id}`. + * + * 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. The relative resource name of the location in which to create a + * federation service, in the following form: + * `projects/{project_number}/locations/{location_id}`. + * + * 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. The ID of the metastore federation, which is used as the final + * component of the metastore federation's name. + * This value must be between 2 and 63 characters long inclusive, begin with a + * letter, end with a letter or number, and consist of alpha-numeric + * ASCII characters or hyphens. + * + * Generated from protobuf field string federation_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getFederationId() + { + return $this->federation_id; + } + + /** + * Required. The ID of the metastore federation, which is used as the final + * component of the metastore federation's name. + * This value must be between 2 and 63 characters long inclusive, begin with a + * letter, end with a letter or number, and consist of alpha-numeric + * ASCII characters or hyphens. + * + * Generated from protobuf field string federation_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setFederationId($var) + { + GPBUtil::checkString($var, True); + $this->federation_id = $var; + + return $this; + } + + /** + * Required. The Metastore Federation to create. The `name` field is + * ignored. The ID of the created metastore federation must be + * provided in the request's `federation_id` field. + * + * Generated from protobuf field .google.cloud.metastore.v1.Federation federation = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Metastore\V1\Federation|null + */ + public function getFederation() + { + return $this->federation; + } + + public function hasFederation() + { + return isset($this->federation); + } + + public function clearFederation() + { + unset($this->federation); + } + + /** + * Required. The Metastore Federation to create. The `name` field is + * ignored. The ID of the created metastore federation must be + * provided in the request's `federation_id` field. + * + * Generated from protobuf field .google.cloud.metastore.v1.Federation federation = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Metastore\V1\Federation $var + * @return $this + */ + public function setFederation($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Metastore\V1\Federation::class); + $this->federation = $var; + + return $this; + } + + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @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/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/CreateMetadataImportRequest.php b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/CreateMetadataImportRequest.php new file mode 100644 index 000000000000..abffe4c45a8b --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/CreateMetadataImportRequest.php @@ -0,0 +1,276 @@ +google.cloud.metastore.v1.CreateMetadataImportRequest + */ +class CreateMetadataImportRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The relative resource name of the service in which to create a + * metastore import, in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The ID of the metadata import, which is used as the final + * component of the metadata import's name. + * This value must be between 1 and 64 characters long, begin with a letter, + * end with a letter or number, and consist of alpha-numeric ASCII characters + * or hyphens. + * + * Generated from protobuf field string metadata_import_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $metadata_import_id = ''; + /** + * Required. The metadata import to create. The `name` field is ignored. The + * ID of the created metadata import must be provided in the request's + * `metadata_import_id` field. + * + * Generated from protobuf field .google.cloud.metastore.v1.MetadataImport metadata_import = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $metadata_import = null; + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * @param string $parent Required. The relative resource name of the service in which to create a + * metastore import, in the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. Please see + * {@see DataprocMetastoreClient::serviceName()} for help formatting this field. + * @param \Google\Cloud\Metastore\V1\MetadataImport $metadataImport Required. The metadata import to create. The `name` field is ignored. The + * ID of the created metadata import must be provided in the request's + * `metadata_import_id` field. + * @param string $metadataImportId Required. The ID of the metadata import, which is used as the final + * component of the metadata import's name. + * + * This value must be between 1 and 64 characters long, begin with a letter, + * end with a letter or number, and consist of alpha-numeric ASCII characters + * or hyphens. + * + * @return \Google\Cloud\Metastore\V1\CreateMetadataImportRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\Metastore\V1\MetadataImport $metadataImport, string $metadataImportId): self + { + return (new self()) + ->setParent($parent) + ->setMetadataImport($metadataImport) + ->setMetadataImportId($metadataImportId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The relative resource name of the service in which to create a + * metastore import, in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * @type string $metadata_import_id + * Required. The ID of the metadata import, which is used as the final + * component of the metadata import's name. + * This value must be between 1 and 64 characters long, begin with a letter, + * end with a letter or number, and consist of alpha-numeric ASCII characters + * or hyphens. + * @type \Google\Cloud\Metastore\V1\MetadataImport $metadata_import + * Required. The metadata import to create. The `name` field is ignored. The + * ID of the created metadata import must be provided in the request's + * `metadata_import_id` field. + * @type string $request_id + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Required. The relative resource name of the service in which to create a + * metastore import, in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * + * 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. The relative resource name of the service in which to create a + * metastore import, in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * + * 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. The ID of the metadata import, which is used as the final + * component of the metadata import's name. + * This value must be between 1 and 64 characters long, begin with a letter, + * end with a letter or number, and consist of alpha-numeric ASCII characters + * or hyphens. + * + * Generated from protobuf field string metadata_import_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getMetadataImportId() + { + return $this->metadata_import_id; + } + + /** + * Required. The ID of the metadata import, which is used as the final + * component of the metadata import's name. + * This value must be between 1 and 64 characters long, begin with a letter, + * end with a letter or number, and consist of alpha-numeric ASCII characters + * or hyphens. + * + * Generated from protobuf field string metadata_import_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setMetadataImportId($var) + { + GPBUtil::checkString($var, True); + $this->metadata_import_id = $var; + + return $this; + } + + /** + * Required. The metadata import to create. The `name` field is ignored. The + * ID of the created metadata import must be provided in the request's + * `metadata_import_id` field. + * + * Generated from protobuf field .google.cloud.metastore.v1.MetadataImport metadata_import = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Metastore\V1\MetadataImport|null + */ + public function getMetadataImport() + { + return $this->metadata_import; + } + + public function hasMetadataImport() + { + return isset($this->metadata_import); + } + + public function clearMetadataImport() + { + unset($this->metadata_import); + } + + /** + * Required. The metadata import to create. The `name` field is ignored. The + * ID of the created metadata import must be provided in the request's + * `metadata_import_id` field. + * + * Generated from protobuf field .google.cloud.metastore.v1.MetadataImport metadata_import = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Metastore\V1\MetadataImport $var + * @return $this + */ + public function setMetadataImport($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Metastore\V1\MetadataImport::class); + $this->metadata_import = $var; + + return $this; + } + + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @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/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/CreateServiceRequest.php b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/CreateServiceRequest.php new file mode 100644 index 000000000000..b762fd7142f0 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/CreateServiceRequest.php @@ -0,0 +1,276 @@ +google.cloud.metastore.v1.CreateServiceRequest + */ +class CreateServiceRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The relative resource name of the location in which to create a + * metastore service, in the following form: + * `projects/{project_number}/locations/{location_id}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The ID of the metastore service, which is used as the final + * component of the metastore service's name. + * This value must be between 2 and 63 characters long inclusive, begin with a + * letter, end with a letter or number, and consist of alpha-numeric + * ASCII characters or hyphens. + * + * Generated from protobuf field string service_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $service_id = ''; + /** + * Required. The Metastore service to create. The `name` field is + * ignored. The ID of the created metastore service must be provided in + * the request's `service_id` field. + * + * Generated from protobuf field .google.cloud.metastore.v1.Service service = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $service = null; + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * @param string $parent Required. The relative resource name of the location in which to create a + * metastore service, in the following form: + * + * `projects/{project_number}/locations/{location_id}`. Please see + * {@see DataprocMetastoreClient::locationName()} for help formatting this field. + * @param \Google\Cloud\Metastore\V1\Service $service Required. The Metastore service to create. The `name` field is + * ignored. The ID of the created metastore service must be provided in + * the request's `service_id` field. + * @param string $serviceId Required. The ID of the metastore service, which is used as the final + * component of the metastore service's name. + * + * This value must be between 2 and 63 characters long inclusive, begin with a + * letter, end with a letter or number, and consist of alpha-numeric + * ASCII characters or hyphens. + * + * @return \Google\Cloud\Metastore\V1\CreateServiceRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\Metastore\V1\Service $service, string $serviceId): self + { + return (new self()) + ->setParent($parent) + ->setService($service) + ->setServiceId($serviceId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The relative resource name of the location in which to create a + * metastore service, in the following form: + * `projects/{project_number}/locations/{location_id}`. + * @type string $service_id + * Required. The ID of the metastore service, which is used as the final + * component of the metastore service's name. + * This value must be between 2 and 63 characters long inclusive, begin with a + * letter, end with a letter or number, and consist of alpha-numeric + * ASCII characters or hyphens. + * @type \Google\Cloud\Metastore\V1\Service $service + * Required. The Metastore service to create. The `name` field is + * ignored. The ID of the created metastore service must be provided in + * the request's `service_id` field. + * @type string $request_id + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Required. The relative resource name of the location in which to create a + * metastore service, in the following form: + * `projects/{project_number}/locations/{location_id}`. + * + * 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. The relative resource name of the location in which to create a + * metastore service, in the following form: + * `projects/{project_number}/locations/{location_id}`. + * + * 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. The ID of the metastore service, which is used as the final + * component of the metastore service's name. + * This value must be between 2 and 63 characters long inclusive, begin with a + * letter, end with a letter or number, and consist of alpha-numeric + * ASCII characters or hyphens. + * + * Generated from protobuf field string service_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getServiceId() + { + return $this->service_id; + } + + /** + * Required. The ID of the metastore service, which is used as the final + * component of the metastore service's name. + * This value must be between 2 and 63 characters long inclusive, begin with a + * letter, end with a letter or number, and consist of alpha-numeric + * ASCII characters or hyphens. + * + * Generated from protobuf field string service_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setServiceId($var) + { + GPBUtil::checkString($var, True); + $this->service_id = $var; + + return $this; + } + + /** + * Required. The Metastore service to create. The `name` field is + * ignored. The ID of the created metastore service must be provided in + * the request's `service_id` field. + * + * Generated from protobuf field .google.cloud.metastore.v1.Service service = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Metastore\V1\Service|null + */ + public function getService() + { + return $this->service; + } + + public function hasService() + { + return isset($this->service); + } + + public function clearService() + { + unset($this->service); + } + + /** + * Required. The Metastore service to create. The `name` field is + * ignored. The ID of the created metastore service must be provided in + * the request's `service_id` field. + * + * Generated from protobuf field .google.cloud.metastore.v1.Service service = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Metastore\V1\Service $var + * @return $this + */ + public function setService($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Metastore\V1\Service::class); + $this->service = $var; + + return $this; + } + + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @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/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/DatabaseDumpSpec.php b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/DatabaseDumpSpec.php new file mode 100644 index 000000000000..31e9d35f9269 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/DatabaseDumpSpec.php @@ -0,0 +1,33 @@ +google.cloud.metastore.v1.DatabaseDumpSpec + */ +class DatabaseDumpSpec extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1\Metastore::initOnce(); + parent::__construct($data); + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/DatabaseDumpSpec/Type.php b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/DatabaseDumpSpec/Type.php new file mode 100644 index 000000000000..2fdb77518f4a --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/DatabaseDumpSpec/Type.php @@ -0,0 +1,64 @@ +google.cloud.metastore.v1.DatabaseDumpSpec.Type + */ +class Type +{ + /** + * The type of the database dump is unknown. + * + * Generated from protobuf enum TYPE_UNSPECIFIED = 0; + */ + const TYPE_UNSPECIFIED = 0; + /** + * Database dump is a MySQL dump file. + * + * Generated from protobuf enum MYSQL = 1; + */ + const MYSQL = 1; + /** + * Database dump contains Avro files. + * + * Generated from protobuf enum AVRO = 2; + */ + const AVRO = 2; + + private static $valueToName = [ + self::TYPE_UNSPECIFIED => 'TYPE_UNSPECIFIED', + self::MYSQL => 'MYSQL', + self::AVRO => 'AVRO', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Type::class, \Google\Cloud\Metastore\V1\DatabaseDumpSpec_Type::class); + diff --git a/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/DatabaseDumpSpec_Type.php b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/DatabaseDumpSpec_Type.php new file mode 100644 index 000000000000..1524b973829b --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/DatabaseDumpSpec_Type.php @@ -0,0 +1,16 @@ +_simpleRequest('/google.cloud.metastore.v1.DataprocMetastoreFederation/ListFederations', + $argument, + ['\Google\Cloud\Metastore\V1\ListFederationsResponse', 'decode'], + $metadata, $options); + } + + /** + * Gets the details of a single federation. + * @param \Google\Cloud\Metastore\V1\GetFederationRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function GetFederation(\Google\Cloud\Metastore\V1\GetFederationRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.metastore.v1.DataprocMetastoreFederation/GetFederation', + $argument, + ['\Google\Cloud\Metastore\V1\Federation', 'decode'], + $metadata, $options); + } + + /** + * Creates a metastore federation in a project and location. + * @param \Google\Cloud\Metastore\V1\CreateFederationRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function CreateFederation(\Google\Cloud\Metastore\V1\CreateFederationRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.metastore.v1.DataprocMetastoreFederation/CreateFederation', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Updates the fields of a federation. + * @param \Google\Cloud\Metastore\V1\UpdateFederationRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function UpdateFederation(\Google\Cloud\Metastore\V1\UpdateFederationRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.metastore.v1.DataprocMetastoreFederation/UpdateFederation', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Deletes a single federation. + * @param \Google\Cloud\Metastore\V1\DeleteFederationRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function DeleteFederation(\Google\Cloud\Metastore\V1\DeleteFederationRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.metastore.v1.DataprocMetastoreFederation/DeleteFederation', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + +} diff --git a/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/DataprocMetastoreGrpcClient.php b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/DataprocMetastoreGrpcClient.php new file mode 100644 index 000000000000..30ae341127b0 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/DataprocMetastoreGrpcClient.php @@ -0,0 +1,277 @@ +_simpleRequest('/google.cloud.metastore.v1.DataprocMetastore/ListServices', + $argument, + ['\Google\Cloud\Metastore\V1\ListServicesResponse', 'decode'], + $metadata, $options); + } + + /** + * Gets the details of a single service. + * @param \Google\Cloud\Metastore\V1\GetServiceRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function GetService(\Google\Cloud\Metastore\V1\GetServiceRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.metastore.v1.DataprocMetastore/GetService', + $argument, + ['\Google\Cloud\Metastore\V1\Service', 'decode'], + $metadata, $options); + } + + /** + * Creates a metastore service in a project and location. + * @param \Google\Cloud\Metastore\V1\CreateServiceRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function CreateService(\Google\Cloud\Metastore\V1\CreateServiceRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.metastore.v1.DataprocMetastore/CreateService', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Updates the parameters of a single service. + * @param \Google\Cloud\Metastore\V1\UpdateServiceRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function UpdateService(\Google\Cloud\Metastore\V1\UpdateServiceRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.metastore.v1.DataprocMetastore/UpdateService', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Deletes a single service. + * @param \Google\Cloud\Metastore\V1\DeleteServiceRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function DeleteService(\Google\Cloud\Metastore\V1\DeleteServiceRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.metastore.v1.DataprocMetastore/DeleteService', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Lists imports in a service. + * @param \Google\Cloud\Metastore\V1\ListMetadataImportsRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function ListMetadataImports(\Google\Cloud\Metastore\V1\ListMetadataImportsRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.metastore.v1.DataprocMetastore/ListMetadataImports', + $argument, + ['\Google\Cloud\Metastore\V1\ListMetadataImportsResponse', 'decode'], + $metadata, $options); + } + + /** + * Gets details of a single import. + * @param \Google\Cloud\Metastore\V1\GetMetadataImportRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function GetMetadataImport(\Google\Cloud\Metastore\V1\GetMetadataImportRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.metastore.v1.DataprocMetastore/GetMetadataImport', + $argument, + ['\Google\Cloud\Metastore\V1\MetadataImport', 'decode'], + $metadata, $options); + } + + /** + * Creates a new MetadataImport in a given project and location. + * @param \Google\Cloud\Metastore\V1\CreateMetadataImportRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function CreateMetadataImport(\Google\Cloud\Metastore\V1\CreateMetadataImportRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.metastore.v1.DataprocMetastore/CreateMetadataImport', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Updates a single import. + * Only the description field of MetadataImport is supported to be updated. + * @param \Google\Cloud\Metastore\V1\UpdateMetadataImportRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function UpdateMetadataImport(\Google\Cloud\Metastore\V1\UpdateMetadataImportRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.metastore.v1.DataprocMetastore/UpdateMetadataImport', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Exports metadata from a service. + * @param \Google\Cloud\Metastore\V1\ExportMetadataRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function ExportMetadata(\Google\Cloud\Metastore\V1\ExportMetadataRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.metastore.v1.DataprocMetastore/ExportMetadata', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Restores a service from a backup. + * @param \Google\Cloud\Metastore\V1\RestoreServiceRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function RestoreService(\Google\Cloud\Metastore\V1\RestoreServiceRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.metastore.v1.DataprocMetastore/RestoreService', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Lists backups in a service. + * @param \Google\Cloud\Metastore\V1\ListBackupsRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function ListBackups(\Google\Cloud\Metastore\V1\ListBackupsRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.metastore.v1.DataprocMetastore/ListBackups', + $argument, + ['\Google\Cloud\Metastore\V1\ListBackupsResponse', 'decode'], + $metadata, $options); + } + + /** + * Gets details of a single backup. + * @param \Google\Cloud\Metastore\V1\GetBackupRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function GetBackup(\Google\Cloud\Metastore\V1\GetBackupRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.metastore.v1.DataprocMetastore/GetBackup', + $argument, + ['\Google\Cloud\Metastore\V1\Backup', 'decode'], + $metadata, $options); + } + + /** + * Creates a new backup in a given project and location. + * @param \Google\Cloud\Metastore\V1\CreateBackupRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function CreateBackup(\Google\Cloud\Metastore\V1\CreateBackupRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.metastore.v1.DataprocMetastore/CreateBackup', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Deletes a single backup. + * @param \Google\Cloud\Metastore\V1\DeleteBackupRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function DeleteBackup(\Google\Cloud\Metastore\V1\DeleteBackupRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.metastore.v1.DataprocMetastore/DeleteBackup', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + +} diff --git a/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/DeleteBackupRequest.php b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/DeleteBackupRequest.php new file mode 100644 index 000000000000..5b641755320f --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/DeleteBackupRequest.php @@ -0,0 +1,163 @@ +google.cloud.metastore.v1.DeleteBackupRequest + */ +class DeleteBackupRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The relative resource name of the backup to delete, in the + * following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * @param string $name Required. The relative resource name of the backup to delete, in the + * following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. Please see + * {@see DataprocMetastoreClient::backupName()} for help formatting this field. + * + * @return \Google\Cloud\Metastore\V1\DeleteBackupRequest + * + * @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 relative resource name of the backup to delete, in the + * following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + * @type string $request_id + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Required. The relative resource name of the backup to delete, in the + * following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + * + * 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 relative resource name of the backup to delete, in the + * following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + * + * 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; + } + + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @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/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/DeleteFederationRequest.php b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/DeleteFederationRequest.php new file mode 100644 index 000000000000..5492072ac7b1 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/DeleteFederationRequest.php @@ -0,0 +1,162 @@ +google.cloud.metastore.v1.DeleteFederationRequest + */ +class DeleteFederationRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The relative resource name of the metastore federation to delete, + * in the following form: + * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * @param string $name Required. The relative resource name of the metastore federation to delete, + * in the following form: + * + * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. Please see + * {@see DataprocMetastoreFederationClient::federationName()} for help formatting this field. + * + * @return \Google\Cloud\Metastore\V1\DeleteFederationRequest + * + * @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 relative resource name of the metastore federation to delete, + * in the following form: + * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + * @type string $request_id + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1\MetastoreFederation::initOnce(); + parent::__construct($data); + } + + /** + * Required. The relative resource name of the metastore federation to delete, + * in the following form: + * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + * + * 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 relative resource name of the metastore federation to delete, + * in the following form: + * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + * + * 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; + } + + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @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/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/DeleteServiceRequest.php b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/DeleteServiceRequest.php new file mode 100644 index 000000000000..971257d0b8fa --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/DeleteServiceRequest.php @@ -0,0 +1,163 @@ +google.cloud.metastore.v1.DeleteServiceRequest + */ +class DeleteServiceRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The relative resource name of the metastore service to delete, in + * the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * @param string $name Required. The relative resource name of the metastore service to delete, in + * the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. Please see + * {@see DataprocMetastoreClient::serviceName()} for help formatting this field. + * + * @return \Google\Cloud\Metastore\V1\DeleteServiceRequest + * + * @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 relative resource name of the metastore service to delete, in + * the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * @type string $request_id + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Required. The relative resource name of the metastore service to delete, in + * the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * + * 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 relative resource name of the metastore service to delete, in + * the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * + * 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; + } + + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @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/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/EncryptionConfig.php b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/EncryptionConfig.php new file mode 100644 index 000000000000..d88c0dcc6ac4 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/EncryptionConfig.php @@ -0,0 +1,75 @@ +google.cloud.metastore.v1.EncryptionConfig + */ +class EncryptionConfig extends \Google\Protobuf\Internal\Message +{ + /** + * The fully qualified customer provided Cloud KMS key name to use for + * customer data encryption, in the following form: + * `projects/{project_number}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}`. + * + * Generated from protobuf field string kms_key = 1; + */ + protected $kms_key = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $kms_key + * The fully qualified customer provided Cloud KMS key name to use for + * customer data encryption, in the following form: + * `projects/{project_number}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * The fully qualified customer provided Cloud KMS key name to use for + * customer data encryption, in the following form: + * `projects/{project_number}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}`. + * + * Generated from protobuf field string kms_key = 1; + * @return string + */ + public function getKmsKey() + { + return $this->kms_key; + } + + /** + * The fully qualified customer provided Cloud KMS key name to use for + * customer data encryption, in the following form: + * `projects/{project_number}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}`. + * + * Generated from protobuf field string kms_key = 1; + * @param string $var + * @return $this + */ + public function setKmsKey($var) + { + GPBUtil::checkString($var, True); + $this->kms_key = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/ExportMetadataRequest.php b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/ExportMetadataRequest.php new file mode 100644 index 000000000000..68b1e61c213a --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/ExportMetadataRequest.php @@ -0,0 +1,232 @@ +google.cloud.metastore.v1.ExportMetadataRequest + */ +class ExportMetadataRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The relative resource name of the metastore service to run + * export, in the following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * + * Generated from protobuf field string service = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $service = ''; + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + /** + * Optional. The type of the database dump. If unspecified, defaults to + * `MYSQL`. + * + * Generated from protobuf field .google.cloud.metastore.v1.DatabaseDumpSpec.Type database_dump_type = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $database_dump_type = 0; + protected $destination; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $destination_gcs_folder + * A Cloud Storage URI of a folder, in the format + * `gs:///`. A sub-folder + * `` containing exported files will be created below it. + * @type string $service + * Required. The relative resource name of the metastore service to run + * export, in the following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * @type string $request_id + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @type int $database_dump_type + * Optional. The type of the database dump. If unspecified, defaults to + * `MYSQL`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * A Cloud Storage URI of a folder, in the format + * `gs:///`. A sub-folder + * `` containing exported files will be created below it. + * + * Generated from protobuf field string destination_gcs_folder = 2; + * @return string + */ + public function getDestinationGcsFolder() + { + return $this->readOneof(2); + } + + public function hasDestinationGcsFolder() + { + return $this->hasOneof(2); + } + + /** + * A Cloud Storage URI of a folder, in the format + * `gs:///`. A sub-folder + * `` containing exported files will be created below it. + * + * Generated from protobuf field string destination_gcs_folder = 2; + * @param string $var + * @return $this + */ + public function setDestinationGcsFolder($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * Required. The relative resource name of the metastore service to run + * export, in the following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * + * Generated from protobuf field string service = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getService() + { + return $this->service; + } + + /** + * Required. The relative resource name of the metastore service to run + * export, in the following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * + * Generated from protobuf field string service = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setService($var) + { + GPBUtil::checkString($var, True); + $this->service = $var; + + return $this; + } + + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + + /** + * Optional. The type of the database dump. If unspecified, defaults to + * `MYSQL`. + * + * Generated from protobuf field .google.cloud.metastore.v1.DatabaseDumpSpec.Type database_dump_type = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getDatabaseDumpType() + { + return $this->database_dump_type; + } + + /** + * Optional. The type of the database dump. If unspecified, defaults to + * `MYSQL`. + * + * Generated from protobuf field .google.cloud.metastore.v1.DatabaseDumpSpec.Type database_dump_type = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setDatabaseDumpType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Metastore\V1\DatabaseDumpSpec\Type::class); + $this->database_dump_type = $var; + + return $this; + } + + /** + * @return string + */ + public function getDestination() + { + return $this->whichOneof("destination"); + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/Federation.php b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/Federation.php new file mode 100644 index 000000000000..d4f3fbfa8951 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/Federation.php @@ -0,0 +1,433 @@ +google.cloud.metastore.v1.Federation + */ +class Federation extends \Google\Protobuf\Internal\Message +{ + /** + * Immutable. The relative resource name of the federation, of the + * form: + * projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + */ + protected $name = ''; + /** + * Output only. The time when the metastore federation was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. The time when the metastore federation was last updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * User-defined labels for the metastore federation. + * + * Generated from protobuf field map labels = 4; + */ + private $labels; + /** + * Immutable. The Apache Hive metastore version of the federation. All backend + * metastore versions must be compatible with the federation version. + * + * Generated from protobuf field string version = 5 [(.google.api.field_behavior) = IMMUTABLE]; + */ + protected $version = ''; + /** + * A map from `BackendMetastore` rank to `BackendMetastore`s from which the + * federation service serves metadata at query time. The map key represents + * the order in which `BackendMetastore`s should be evaluated to resolve + * database names at query time and should be greater than or equal to zero. A + * `BackendMetastore` with a lower number will be evaluated before a + * `BackendMetastore` with a higher number. + * + * Generated from protobuf field map backend_metastores = 6; + */ + private $backend_metastores; + /** + * Output only. The federation endpoint. + * + * Generated from protobuf field string endpoint_uri = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $endpoint_uri = ''; + /** + * Output only. The current state of the federation. + * + * Generated from protobuf field .google.cloud.metastore.v1.Federation.State state = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Output only. Additional information about the current state of the + * metastore federation, if available. + * + * Generated from protobuf field string state_message = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state_message = ''; + /** + * Output only. The globally unique resource identifier of the metastore + * federation. + * + * Generated from protobuf field string uid = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $uid = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Immutable. The relative resource name of the federation, of the + * form: + * projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The time when the metastore federation was created. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. The time when the metastore federation was last updated. + * @type array|\Google\Protobuf\Internal\MapField $labels + * User-defined labels for the metastore federation. + * @type string $version + * Immutable. The Apache Hive metastore version of the federation. All backend + * metastore versions must be compatible with the federation version. + * @type array|\Google\Protobuf\Internal\MapField $backend_metastores + * A map from `BackendMetastore` rank to `BackendMetastore`s from which the + * federation service serves metadata at query time. The map key represents + * the order in which `BackendMetastore`s should be evaluated to resolve + * database names at query time and should be greater than or equal to zero. A + * `BackendMetastore` with a lower number will be evaluated before a + * `BackendMetastore` with a higher number. + * @type string $endpoint_uri + * Output only. The federation endpoint. + * @type int $state + * Output only. The current state of the federation. + * @type string $state_message + * Output only. Additional information about the current state of the + * metastore federation, if available. + * @type string $uid + * Output only. The globally unique resource identifier of the metastore + * federation. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1\MetastoreFederation::initOnce(); + parent::__construct($data); + } + + /** + * Immutable. The relative resource name of the federation, of the + * form: + * projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Immutable. The relative resource name of the federation, of the + * form: + * projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. The time when the metastore federation was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.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 when the metastore federation was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.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 when the metastore federation was last updated. + * + * 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 when the metastore federation was last updated. + * + * 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; + } + + /** + * User-defined labels for the metastore federation. + * + * Generated from protobuf field map labels = 4; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * User-defined labels for the metastore federation. + * + * Generated from protobuf field map labels = 4; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + + /** + * Immutable. The Apache Hive metastore version of the federation. All backend + * metastore versions must be compatible with the federation version. + * + * Generated from protobuf field string version = 5 [(.google.api.field_behavior) = IMMUTABLE]; + * @return string + */ + public function getVersion() + { + return $this->version; + } + + /** + * Immutable. The Apache Hive metastore version of the federation. All backend + * metastore versions must be compatible with the federation version. + * + * Generated from protobuf field string version = 5 [(.google.api.field_behavior) = IMMUTABLE]; + * @param string $var + * @return $this + */ + public function setVersion($var) + { + GPBUtil::checkString($var, True); + $this->version = $var; + + return $this; + } + + /** + * A map from `BackendMetastore` rank to `BackendMetastore`s from which the + * federation service serves metadata at query time. The map key represents + * the order in which `BackendMetastore`s should be evaluated to resolve + * database names at query time and should be greater than or equal to zero. A + * `BackendMetastore` with a lower number will be evaluated before a + * `BackendMetastore` with a higher number. + * + * Generated from protobuf field map backend_metastores = 6; + * @return \Google\Protobuf\Internal\MapField + */ + public function getBackendMetastores() + { + return $this->backend_metastores; + } + + /** + * A map from `BackendMetastore` rank to `BackendMetastore`s from which the + * federation service serves metadata at query time. The map key represents + * the order in which `BackendMetastore`s should be evaluated to resolve + * database names at query time and should be greater than or equal to zero. A + * `BackendMetastore` with a lower number will be evaluated before a + * `BackendMetastore` with a higher number. + * + * Generated from protobuf field map backend_metastores = 6; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setBackendMetastores($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::INT32, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Metastore\V1\BackendMetastore::class); + $this->backend_metastores = $arr; + + return $this; + } + + /** + * Output only. The federation endpoint. + * + * Generated from protobuf field string endpoint_uri = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getEndpointUri() + { + return $this->endpoint_uri; + } + + /** + * Output only. The federation endpoint. + * + * Generated from protobuf field string endpoint_uri = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setEndpointUri($var) + { + GPBUtil::checkString($var, True); + $this->endpoint_uri = $var; + + return $this; + } + + /** + * Output only. The current state of the federation. + * + * Generated from protobuf field .google.cloud.metastore.v1.Federation.State state = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. The current state of the federation. + * + * Generated from protobuf field .google.cloud.metastore.v1.Federation.State state = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Metastore\V1\Federation\State::class); + $this->state = $var; + + return $this; + } + + /** + * Output only. Additional information about the current state of the + * metastore federation, if available. + * + * Generated from protobuf field string state_message = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getStateMessage() + { + return $this->state_message; + } + + /** + * Output only. Additional information about the current state of the + * metastore federation, if available. + * + * Generated from protobuf field string state_message = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setStateMessage($var) + { + GPBUtil::checkString($var, True); + $this->state_message = $var; + + return $this; + } + + /** + * Output only. The globally unique resource identifier of the metastore + * federation. + * + * Generated from protobuf field string uid = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getUid() + { + return $this->uid; + } + + /** + * Output only. The globally unique resource identifier of the metastore + * federation. + * + * Generated from protobuf field string uid = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setUid($var) + { + GPBUtil::checkString($var, True); + $this->uid = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/Federation/State.php b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/Federation/State.php new file mode 100644 index 000000000000..b1fe841ab588 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/Federation/State.php @@ -0,0 +1,87 @@ +google.cloud.metastore.v1.Federation.State + */ +class State +{ + /** + * The state of the metastore federation is unknown. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The metastore federation is in the process of being created. + * + * Generated from protobuf enum CREATING = 1; + */ + const CREATING = 1; + /** + * The metastore federation is running and ready to serve queries. + * + * Generated from protobuf enum ACTIVE = 2; + */ + const ACTIVE = 2; + /** + * The metastore federation is being updated. It remains usable but cannot + * accept additional update requests or be deleted at this time. + * + * Generated from protobuf enum UPDATING = 3; + */ + const UPDATING = 3; + /** + * The metastore federation is undergoing deletion. It cannot be used. + * + * Generated from protobuf enum DELETING = 4; + */ + const DELETING = 4; + /** + * The metastore federation has encountered an error and cannot be used. The + * metastore federation should be deleted. + * + * Generated from protobuf enum ERROR = 5; + */ + const ERROR = 5; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::CREATING => 'CREATING', + self::ACTIVE => 'ACTIVE', + self::UPDATING => 'UPDATING', + self::DELETING => 'DELETING', + self::ERROR => 'ERROR', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\Metastore\V1\Federation_State::class); + diff --git a/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/Federation_State.php b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/Federation_State.php new file mode 100644 index 000000000000..ac8b56785fdc --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/Federation_State.php @@ -0,0 +1,16 @@ +google.cloud.metastore.v1.GetBackupRequest + */ +class GetBackupRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The relative resource name of the backup to retrieve, in the + * following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The relative resource name of the backup to retrieve, in the + * following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. Please see + * {@see DataprocMetastoreClient::backupName()} for help formatting this field. + * + * @return \Google\Cloud\Metastore\V1\GetBackupRequest + * + * @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 relative resource name of the backup to retrieve, in the + * following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Required. The relative resource name of the backup to retrieve, in the + * following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + * + * 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 relative resource name of the backup to retrieve, in the + * following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + * + * 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; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/GetFederationRequest.php b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/GetFederationRequest.php new file mode 100644 index 000000000000..d0676d640ec1 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/GetFederationRequest.php @@ -0,0 +1,92 @@ +google.cloud.metastore.v1.GetFederationRequest + */ +class GetFederationRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The relative resource name of the metastore federation to + * retrieve, in the following form: + * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The relative resource name of the metastore federation to + * retrieve, in the following form: + * + * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. Please see + * {@see DataprocMetastoreFederationClient::federationName()} for help formatting this field. + * + * @return \Google\Cloud\Metastore\V1\GetFederationRequest + * + * @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 relative resource name of the metastore federation to + * retrieve, in the following form: + * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1\MetastoreFederation::initOnce(); + parent::__construct($data); + } + + /** + * Required. The relative resource name of the metastore federation to + * retrieve, in the following form: + * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + * + * 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 relative resource name of the metastore federation to + * retrieve, in the following form: + * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + * + * 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; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/GetMetadataImportRequest.php b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/GetMetadataImportRequest.php new file mode 100644 index 000000000000..461911cb0d1c --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/GetMetadataImportRequest.php @@ -0,0 +1,93 @@ +google.cloud.metastore.v1.GetMetadataImportRequest + */ +class GetMetadataImportRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The relative resource name of the metadata import to retrieve, in + * the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{import_id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The relative resource name of the metadata import to retrieve, in + * the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{import_id}`. Please see + * {@see DataprocMetastoreClient::metadataImportName()} for help formatting this field. + * + * @return \Google\Cloud\Metastore\V1\GetMetadataImportRequest + * + * @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 relative resource name of the metadata import to retrieve, in + * the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{import_id}`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Required. The relative resource name of the metadata import to retrieve, in + * the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{import_id}`. + * + * 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 relative resource name of the metadata import to retrieve, in + * the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{import_id}`. + * + * 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; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/GetServiceRequest.php b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/GetServiceRequest.php new file mode 100644 index 000000000000..23a082ef5699 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/GetServiceRequest.php @@ -0,0 +1,93 @@ +google.cloud.metastore.v1.GetServiceRequest + */ +class GetServiceRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The relative resource name of the metastore service to retrieve, + * in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The relative resource name of the metastore service to retrieve, + * in the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. Please see + * {@see DataprocMetastoreClient::serviceName()} for help formatting this field. + * + * @return \Google\Cloud\Metastore\V1\GetServiceRequest + * + * @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 relative resource name of the metastore service to retrieve, + * in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Required. The relative resource name of the metastore service to retrieve, + * in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * + * 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 relative resource name of the metastore service to retrieve, + * in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * + * 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; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/HiveMetastoreConfig.php b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/HiveMetastoreConfig.php new file mode 100644 index 000000000000..fc729ddfff5d --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/HiveMetastoreConfig.php @@ -0,0 +1,240 @@ +google.cloud.metastore.v1.HiveMetastoreConfig + */ +class HiveMetastoreConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Immutable. The Hive metastore schema version. + * + * Generated from protobuf field string version = 1 [(.google.api.field_behavior) = IMMUTABLE]; + */ + protected $version = ''; + /** + * A mapping of Hive metastore configuration key-value pairs to apply to the + * Hive metastore (configured in `hive-site.xml`). The mappings + * override system defaults (some keys cannot be overridden). These + * overrides are also applied to auxiliary versions and can be further + * customized in the auxiliary version's `AuxiliaryVersionConfig`. + * + * Generated from protobuf field map config_overrides = 2; + */ + private $config_overrides; + /** + * Information used to configure the Hive metastore service as a service + * principal in a Kerberos realm. To disable Kerberos, use the `UpdateService` + * method and specify this field's path + * (`hive_metastore_config.kerberos_config`) in the request's `update_mask` + * while omitting this field from the request's `service`. + * + * Generated from protobuf field .google.cloud.metastore.v1.KerberosConfig kerberos_config = 3; + */ + protected $kerberos_config = null; + /** + * A mapping of Hive metastore version to the auxiliary version + * configuration. When specified, a secondary Hive metastore service is + * created along with the primary service. All auxiliary versions must be less + * than the service's primary version. The key is the auxiliary service name + * and it must match the regular expression [a-z]([-a-z0-9]*[a-z0-9])?. This + * means that the first character must be a lowercase letter, and all the + * following characters must be hyphens, lowercase letters, or digits, except + * the last character, which cannot be a hyphen. + * + * Generated from protobuf field map auxiliary_versions = 5; + */ + private $auxiliary_versions; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $version + * Immutable. The Hive metastore schema version. + * @type array|\Google\Protobuf\Internal\MapField $config_overrides + * A mapping of Hive metastore configuration key-value pairs to apply to the + * Hive metastore (configured in `hive-site.xml`). The mappings + * override system defaults (some keys cannot be overridden). These + * overrides are also applied to auxiliary versions and can be further + * customized in the auxiliary version's `AuxiliaryVersionConfig`. + * @type \Google\Cloud\Metastore\V1\KerberosConfig $kerberos_config + * Information used to configure the Hive metastore service as a service + * principal in a Kerberos realm. To disable Kerberos, use the `UpdateService` + * method and specify this field's path + * (`hive_metastore_config.kerberos_config`) in the request's `update_mask` + * while omitting this field from the request's `service`. + * @type array|\Google\Protobuf\Internal\MapField $auxiliary_versions + * A mapping of Hive metastore version to the auxiliary version + * configuration. When specified, a secondary Hive metastore service is + * created along with the primary service. All auxiliary versions must be less + * than the service's primary version. The key is the auxiliary service name + * and it must match the regular expression [a-z]([-a-z0-9]*[a-z0-9])?. This + * means that the first character must be a lowercase letter, and all the + * following characters must be hyphens, lowercase letters, or digits, except + * the last character, which cannot be a hyphen. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Immutable. The Hive metastore schema version. + * + * Generated from protobuf field string version = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * @return string + */ + public function getVersion() + { + return $this->version; + } + + /** + * Immutable. The Hive metastore schema version. + * + * Generated from protobuf field string version = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * @param string $var + * @return $this + */ + public function setVersion($var) + { + GPBUtil::checkString($var, True); + $this->version = $var; + + return $this; + } + + /** + * A mapping of Hive metastore configuration key-value pairs to apply to the + * Hive metastore (configured in `hive-site.xml`). The mappings + * override system defaults (some keys cannot be overridden). These + * overrides are also applied to auxiliary versions and can be further + * customized in the auxiliary version's `AuxiliaryVersionConfig`. + * + * Generated from protobuf field map config_overrides = 2; + * @return \Google\Protobuf\Internal\MapField + */ + public function getConfigOverrides() + { + return $this->config_overrides; + } + + /** + * A mapping of Hive metastore configuration key-value pairs to apply to the + * Hive metastore (configured in `hive-site.xml`). The mappings + * override system defaults (some keys cannot be overridden). These + * overrides are also applied to auxiliary versions and can be further + * customized in the auxiliary version's `AuxiliaryVersionConfig`. + * + * Generated from protobuf field map config_overrides = 2; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setConfigOverrides($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->config_overrides = $arr; + + return $this; + } + + /** + * Information used to configure the Hive metastore service as a service + * principal in a Kerberos realm. To disable Kerberos, use the `UpdateService` + * method and specify this field's path + * (`hive_metastore_config.kerberos_config`) in the request's `update_mask` + * while omitting this field from the request's `service`. + * + * Generated from protobuf field .google.cloud.metastore.v1.KerberosConfig kerberos_config = 3; + * @return \Google\Cloud\Metastore\V1\KerberosConfig|null + */ + public function getKerberosConfig() + { + return $this->kerberos_config; + } + + public function hasKerberosConfig() + { + return isset($this->kerberos_config); + } + + public function clearKerberosConfig() + { + unset($this->kerberos_config); + } + + /** + * Information used to configure the Hive metastore service as a service + * principal in a Kerberos realm. To disable Kerberos, use the `UpdateService` + * method and specify this field's path + * (`hive_metastore_config.kerberos_config`) in the request's `update_mask` + * while omitting this field from the request's `service`. + * + * Generated from protobuf field .google.cloud.metastore.v1.KerberosConfig kerberos_config = 3; + * @param \Google\Cloud\Metastore\V1\KerberosConfig $var + * @return $this + */ + public function setKerberosConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Metastore\V1\KerberosConfig::class); + $this->kerberos_config = $var; + + return $this; + } + + /** + * A mapping of Hive metastore version to the auxiliary version + * configuration. When specified, a secondary Hive metastore service is + * created along with the primary service. All auxiliary versions must be less + * than the service's primary version. The key is the auxiliary service name + * and it must match the regular expression [a-z]([-a-z0-9]*[a-z0-9])?. This + * means that the first character must be a lowercase letter, and all the + * following characters must be hyphens, lowercase letters, or digits, except + * the last character, which cannot be a hyphen. + * + * Generated from protobuf field map auxiliary_versions = 5; + * @return \Google\Protobuf\Internal\MapField + */ + public function getAuxiliaryVersions() + { + return $this->auxiliary_versions; + } + + /** + * A mapping of Hive metastore version to the auxiliary version + * configuration. When specified, a secondary Hive metastore service is + * created along with the primary service. All auxiliary versions must be less + * than the service's primary version. The key is the auxiliary service name + * and it must match the regular expression [a-z]([-a-z0-9]*[a-z0-9])?. This + * means that the first character must be a lowercase letter, and all the + * following characters must be hyphens, lowercase letters, or digits, except + * the last character, which cannot be a hyphen. + * + * Generated from protobuf field map auxiliary_versions = 5; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setAuxiliaryVersions($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Metastore\V1\AuxiliaryVersionConfig::class); + $this->auxiliary_versions = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/KerberosConfig.php b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/KerberosConfig.php new file mode 100644 index 000000000000..df4b6eb6fc32 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/KerberosConfig.php @@ -0,0 +1,165 @@ +google.cloud.metastore.v1.KerberosConfig + */ +class KerberosConfig extends \Google\Protobuf\Internal\Message +{ + /** + * A Kerberos keytab file that can be used to authenticate a service principal + * with a Kerberos Key Distribution Center (KDC). + * + * Generated from protobuf field .google.cloud.metastore.v1.Secret keytab = 1; + */ + protected $keytab = null; + /** + * A Kerberos principal that exists in the both the keytab the KDC + * to authenticate as. A typical principal is of the form + * `primary/instance@REALM`, but there is no exact format. + * + * Generated from protobuf field string principal = 2; + */ + protected $principal = ''; + /** + * A Cloud Storage URI that specifies the path to a + * krb5.conf file. It is of the form `gs://{bucket_name}/path/to/krb5.conf`, + * although the file does not need to be named krb5.conf explicitly. + * + * Generated from protobuf field string krb5_config_gcs_uri = 3; + */ + protected $krb5_config_gcs_uri = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Metastore\V1\Secret $keytab + * A Kerberos keytab file that can be used to authenticate a service principal + * with a Kerberos Key Distribution Center (KDC). + * @type string $principal + * A Kerberos principal that exists in the both the keytab the KDC + * to authenticate as. A typical principal is of the form + * `primary/instance@REALM`, but there is no exact format. + * @type string $krb5_config_gcs_uri + * A Cloud Storage URI that specifies the path to a + * krb5.conf file. It is of the form `gs://{bucket_name}/path/to/krb5.conf`, + * although the file does not need to be named krb5.conf explicitly. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * A Kerberos keytab file that can be used to authenticate a service principal + * with a Kerberos Key Distribution Center (KDC). + * + * Generated from protobuf field .google.cloud.metastore.v1.Secret keytab = 1; + * @return \Google\Cloud\Metastore\V1\Secret|null + */ + public function getKeytab() + { + return $this->keytab; + } + + public function hasKeytab() + { + return isset($this->keytab); + } + + public function clearKeytab() + { + unset($this->keytab); + } + + /** + * A Kerberos keytab file that can be used to authenticate a service principal + * with a Kerberos Key Distribution Center (KDC). + * + * Generated from protobuf field .google.cloud.metastore.v1.Secret keytab = 1; + * @param \Google\Cloud\Metastore\V1\Secret $var + * @return $this + */ + public function setKeytab($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Metastore\V1\Secret::class); + $this->keytab = $var; + + return $this; + } + + /** + * A Kerberos principal that exists in the both the keytab the KDC + * to authenticate as. A typical principal is of the form + * `primary/instance@REALM`, but there is no exact format. + * + * Generated from protobuf field string principal = 2; + * @return string + */ + public function getPrincipal() + { + return $this->principal; + } + + /** + * A Kerberos principal that exists in the both the keytab the KDC + * to authenticate as. A typical principal is of the form + * `primary/instance@REALM`, but there is no exact format. + * + * Generated from protobuf field string principal = 2; + * @param string $var + * @return $this + */ + public function setPrincipal($var) + { + GPBUtil::checkString($var, True); + $this->principal = $var; + + return $this; + } + + /** + * A Cloud Storage URI that specifies the path to a + * krb5.conf file. It is of the form `gs://{bucket_name}/path/to/krb5.conf`, + * although the file does not need to be named krb5.conf explicitly. + * + * Generated from protobuf field string krb5_config_gcs_uri = 3; + * @return string + */ + public function getKrb5ConfigGcsUri() + { + return $this->krb5_config_gcs_uri; + } + + /** + * A Cloud Storage URI that specifies the path to a + * krb5.conf file. It is of the form `gs://{bucket_name}/path/to/krb5.conf`, + * although the file does not need to be named krb5.conf explicitly. + * + * Generated from protobuf field string krb5_config_gcs_uri = 3; + * @param string $var + * @return $this + */ + public function setKrb5ConfigGcsUri($var) + { + GPBUtil::checkString($var, True); + $this->krb5_config_gcs_uri = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/ListBackupsRequest.php b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/ListBackupsRequest.php new file mode 100644 index 000000000000..b73891dd55c0 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/ListBackupsRequest.php @@ -0,0 +1,269 @@ +google.cloud.metastore.v1.ListBackupsRequest + */ +class ListBackupsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The relative resource name of the service whose backups to + * list, in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. The maximum number of backups to return. The response may contain + * less than the maximum number. If unspecified, no more than 500 backups are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Optional. A page token, received from a previous + * [DataprocMetastore.ListBackups][google.cloud.metastore.v1.DataprocMetastore.ListBackups] + * call. Provide this token to retrieve the subsequent page. + * To retrieve the first page, supply an empty page token. + * When paginating, other parameters provided to + * [DataprocMetastore.ListBackups][google.cloud.metastore.v1.DataprocMetastore.ListBackups] + * must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = ''; + /** + * Optional. The filter to apply to list results. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $filter = ''; + /** + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $order_by = ''; + + /** + * @param string $parent Required. The relative resource name of the service whose backups to + * list, in the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. Please see + * {@see DataprocMetastoreClient::serviceName()} for help formatting this field. + * + * @return \Google\Cloud\Metastore\V1\ListBackupsRequest + * + * @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. The relative resource name of the service whose backups to + * list, in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. + * @type int $page_size + * Optional. The maximum number of backups to return. The response may contain + * less than the maximum number. If unspecified, no more than 500 backups are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + * @type string $page_token + * Optional. A page token, received from a previous + * [DataprocMetastore.ListBackups][google.cloud.metastore.v1.DataprocMetastore.ListBackups] + * call. Provide this token to retrieve the subsequent page. + * To retrieve the first page, supply an empty page token. + * When paginating, other parameters provided to + * [DataprocMetastore.ListBackups][google.cloud.metastore.v1.DataprocMetastore.ListBackups] + * must match the call that provided the page token. + * @type string $filter + * Optional. The filter to apply to list results. + * @type string $order_by + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Required. The relative resource name of the service whose backups to + * list, in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. + * + * 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. The relative resource name of the service whose backups to + * list, in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. + * + * 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. The maximum number of backups to return. The response may contain + * less than the maximum number. If unspecified, no more than 500 backups are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. The maximum number of backups to return. The response may contain + * less than the maximum number. If unspecified, no more than 500 backups are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + * + * 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 page token, received from a previous + * [DataprocMetastore.ListBackups][google.cloud.metastore.v1.DataprocMetastore.ListBackups] + * call. Provide this token to retrieve the subsequent page. + * To retrieve the first page, supply an empty page token. + * When paginating, other parameters provided to + * [DataprocMetastore.ListBackups][google.cloud.metastore.v1.DataprocMetastore.ListBackups] + * must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. A page token, received from a previous + * [DataprocMetastore.ListBackups][google.cloud.metastore.v1.DataprocMetastore.ListBackups] + * call. Provide this token to retrieve the subsequent page. + * To retrieve the first page, supply an empty page token. + * When paginating, other parameters provided to + * [DataprocMetastore.ListBackups][google.cloud.metastore.v1.DataprocMetastore.ListBackups] + * must match the call that provided the page token. + * + * 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. The filter to apply to list results. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Optional. The filter to apply to list results. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/ListBackupsResponse.php b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/ListBackupsResponse.php new file mode 100644 index 000000000000..d4c62d5e2a3e --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/ListBackupsResponse.php @@ -0,0 +1,140 @@ +google.cloud.metastore.v1.ListBackupsResponse + */ +class ListBackupsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The backups of the specified service. + * + * Generated from protobuf field repeated .google.cloud.metastore.v1.Backup backups = 1; + */ + private $backups; + /** + * A token that can be sent as `page_token` to retrieve the next page. If this + * field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + */ + private $unreachable; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Metastore\V1\Backup>|\Google\Protobuf\Internal\RepeatedField $backups + * The backups of the specified service. + * @type string $next_page_token + * A token that can be sent as `page_token` to retrieve the next page. If this + * field is omitted, there are no subsequent pages. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Locations that could not be reached. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * The backups of the specified service. + * + * Generated from protobuf field repeated .google.cloud.metastore.v1.Backup backups = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getBackups() + { + return $this->backups; + } + + /** + * The backups of the specified service. + * + * Generated from protobuf field repeated .google.cloud.metastore.v1.Backup backups = 1; + * @param array<\Google\Cloud\Metastore\V1\Backup>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setBackups($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Metastore\V1\Backup::class); + $this->backups = $arr; + + return $this; + } + + /** + * A token that can be sent as `page_token` to retrieve the next page. If this + * field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token that can be sent as `page_token` to retrieve the next page. If this + * field is omitted, there are no subsequent pages. + * + * 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; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUnreachable($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->unreachable = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/ListFederationsRequest.php b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/ListFederationsRequest.php new file mode 100644 index 000000000000..0113d75b1995 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/ListFederationsRequest.php @@ -0,0 +1,267 @@ +google.cloud.metastore.v1.ListFederationsRequest + */ +class ListFederationsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The relative resource name of the location of metastore + * federations to list, in the following form: + * `projects/{project_number}/locations/{location_id}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. The maximum number of federations to return. The response may + * contain less than the maximum number. If unspecified, no more than 500 + * services are returned. The maximum value is 1000; values above 1000 are + * changed to 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Optional. A page token, received from a previous ListFederationServices + * call. Provide this token to retrieve the subsequent page. + * To retrieve the first page, supply an empty page token. + * When paginating, other parameters provided to + * ListFederationServices must match the call that provided the + * page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = ''; + /** + * Optional. The filter to apply to list results. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $filter = ''; + /** + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $order_by = ''; + + /** + * @param string $parent Required. The relative resource name of the location of metastore + * federations to list, in the following form: + * `projects/{project_number}/locations/{location_id}`. Please see + * {@see DataprocMetastoreFederationClient::locationName()} for help formatting this field. + * + * @return \Google\Cloud\Metastore\V1\ListFederationsRequest + * + * @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. The relative resource name of the location of metastore + * federations to list, in the following form: + * `projects/{project_number}/locations/{location_id}`. + * @type int $page_size + * Optional. The maximum number of federations to return. The response may + * contain less than the maximum number. If unspecified, no more than 500 + * services are returned. The maximum value is 1000; values above 1000 are + * changed to 1000. + * @type string $page_token + * Optional. A page token, received from a previous ListFederationServices + * call. Provide this token to retrieve the subsequent page. + * To retrieve the first page, supply an empty page token. + * When paginating, other parameters provided to + * ListFederationServices must match the call that provided the + * page token. + * @type string $filter + * Optional. The filter to apply to list results. + * @type string $order_by + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1\MetastoreFederation::initOnce(); + parent::__construct($data); + } + + /** + * Required. The relative resource name of the location of metastore + * federations to list, in the following form: + * `projects/{project_number}/locations/{location_id}`. + * + * 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. The relative resource name of the location of metastore + * federations to list, in the following form: + * `projects/{project_number}/locations/{location_id}`. + * + * 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. The maximum number of federations to return. The response may + * contain less than the maximum number. If unspecified, no more than 500 + * services are returned. The maximum value is 1000; values above 1000 are + * changed to 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. The maximum number of federations to return. The response may + * contain less than the maximum number. If unspecified, no more than 500 + * services are returned. The maximum value is 1000; values above 1000 are + * changed to 1000. + * + * 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 page token, received from a previous ListFederationServices + * call. Provide this token to retrieve the subsequent page. + * To retrieve the first page, supply an empty page token. + * When paginating, other parameters provided to + * ListFederationServices must match the call that provided the + * page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. A page token, received from a previous ListFederationServices + * call. Provide this token to retrieve the subsequent page. + * To retrieve the first page, supply an empty page token. + * When paginating, other parameters provided to + * ListFederationServices must match the call that provided the + * page token. + * + * 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. The filter to apply to list results. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Optional. The filter to apply to list results. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/ListFederationsResponse.php b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/ListFederationsResponse.php new file mode 100644 index 000000000000..6b9e36e583ce --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/ListFederationsResponse.php @@ -0,0 +1,139 @@ +google.cloud.metastore.v1.ListFederationsResponse + */ +class ListFederationsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The services in the specified location. + * + * Generated from protobuf field repeated .google.cloud.metastore.v1.Federation federations = 1; + */ + private $federations; + /** + * A token that can be sent as `page_token` to retrieve the next page. If this + * field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + */ + private $unreachable; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Metastore\V1\Federation>|\Google\Protobuf\Internal\RepeatedField $federations + * The services in the specified location. + * @type string $next_page_token + * A token that can be sent as `page_token` to retrieve the next page. If this + * field is omitted, there are no subsequent pages. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Locations that could not be reached. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1\MetastoreFederation::initOnce(); + parent::__construct($data); + } + + /** + * The services in the specified location. + * + * Generated from protobuf field repeated .google.cloud.metastore.v1.Federation federations = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getFederations() + { + return $this->federations; + } + + /** + * The services in the specified location. + * + * Generated from protobuf field repeated .google.cloud.metastore.v1.Federation federations = 1; + * @param array<\Google\Cloud\Metastore\V1\Federation>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setFederations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Metastore\V1\Federation::class); + $this->federations = $arr; + + return $this; + } + + /** + * A token that can be sent as `page_token` to retrieve the next page. If this + * field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token that can be sent as `page_token` to retrieve the next page. If this + * field is omitted, there are no subsequent pages. + * + * 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; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUnreachable($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->unreachable = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/ListMetadataImportsRequest.php b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/ListMetadataImportsRequest.php new file mode 100644 index 000000000000..582bf2479535 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/ListMetadataImportsRequest.php @@ -0,0 +1,269 @@ +google.cloud.metastore.v1.ListMetadataImportsRequest + */ +class ListMetadataImportsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The relative resource name of the service whose metadata imports + * to list, in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. The maximum number of imports to return. The response may contain + * less than the maximum number. If unspecified, no more than 500 imports are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Optional. A page token, received from a previous + * [DataprocMetastore.ListServices][google.cloud.metastore.v1.DataprocMetastore.ListServices] + * call. Provide this token to retrieve the subsequent page. + * To retrieve the first page, supply an empty page token. + * When paginating, other parameters provided to + * [DataprocMetastore.ListServices][google.cloud.metastore.v1.DataprocMetastore.ListServices] + * must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = ''; + /** + * Optional. The filter to apply to list results. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $filter = ''; + /** + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $order_by = ''; + + /** + * @param string $parent Required. The relative resource name of the service whose metadata imports + * to list, in the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. Please see + * {@see DataprocMetastoreClient::serviceName()} for help formatting this field. + * + * @return \Google\Cloud\Metastore\V1\ListMetadataImportsRequest + * + * @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. The relative resource name of the service whose metadata imports + * to list, in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. + * @type int $page_size + * Optional. The maximum number of imports to return. The response may contain + * less than the maximum number. If unspecified, no more than 500 imports are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + * @type string $page_token + * Optional. A page token, received from a previous + * [DataprocMetastore.ListServices][google.cloud.metastore.v1.DataprocMetastore.ListServices] + * call. Provide this token to retrieve the subsequent page. + * To retrieve the first page, supply an empty page token. + * When paginating, other parameters provided to + * [DataprocMetastore.ListServices][google.cloud.metastore.v1.DataprocMetastore.ListServices] + * must match the call that provided the page token. + * @type string $filter + * Optional. The filter to apply to list results. + * @type string $order_by + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Required. The relative resource name of the service whose metadata imports + * to list, in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. + * + * 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. The relative resource name of the service whose metadata imports + * to list, in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. + * + * 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. The maximum number of imports to return. The response may contain + * less than the maximum number. If unspecified, no more than 500 imports are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. The maximum number of imports to return. The response may contain + * less than the maximum number. If unspecified, no more than 500 imports are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + * + * 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 page token, received from a previous + * [DataprocMetastore.ListServices][google.cloud.metastore.v1.DataprocMetastore.ListServices] + * call. Provide this token to retrieve the subsequent page. + * To retrieve the first page, supply an empty page token. + * When paginating, other parameters provided to + * [DataprocMetastore.ListServices][google.cloud.metastore.v1.DataprocMetastore.ListServices] + * must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. A page token, received from a previous + * [DataprocMetastore.ListServices][google.cloud.metastore.v1.DataprocMetastore.ListServices] + * call. Provide this token to retrieve the subsequent page. + * To retrieve the first page, supply an empty page token. + * When paginating, other parameters provided to + * [DataprocMetastore.ListServices][google.cloud.metastore.v1.DataprocMetastore.ListServices] + * must match the call that provided the page token. + * + * 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. The filter to apply to list results. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Optional. The filter to apply to list results. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/ListMetadataImportsResponse.php b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/ListMetadataImportsResponse.php new file mode 100644 index 000000000000..361360dd7312 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/ListMetadataImportsResponse.php @@ -0,0 +1,140 @@ +google.cloud.metastore.v1.ListMetadataImportsResponse + */ +class ListMetadataImportsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The imports in the specified service. + * + * Generated from protobuf field repeated .google.cloud.metastore.v1.MetadataImport metadata_imports = 1; + */ + private $metadata_imports; + /** + * A token that can be sent as `page_token` to retrieve the next page. If this + * field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + */ + private $unreachable; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Metastore\V1\MetadataImport>|\Google\Protobuf\Internal\RepeatedField $metadata_imports + * The imports in the specified service. + * @type string $next_page_token + * A token that can be sent as `page_token` to retrieve the next page. If this + * field is omitted, there are no subsequent pages. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Locations that could not be reached. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * The imports in the specified service. + * + * Generated from protobuf field repeated .google.cloud.metastore.v1.MetadataImport metadata_imports = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getMetadataImports() + { + return $this->metadata_imports; + } + + /** + * The imports in the specified service. + * + * Generated from protobuf field repeated .google.cloud.metastore.v1.MetadataImport metadata_imports = 1; + * @param array<\Google\Cloud\Metastore\V1\MetadataImport>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setMetadataImports($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Metastore\V1\MetadataImport::class); + $this->metadata_imports = $arr; + + return $this; + } + + /** + * A token that can be sent as `page_token` to retrieve the next page. If this + * field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token that can be sent as `page_token` to retrieve the next page. If this + * field is omitted, there are no subsequent pages. + * + * 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; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUnreachable($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->unreachable = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/ListServicesRequest.php b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/ListServicesRequest.php new file mode 100644 index 000000000000..3821776ec78d --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/ListServicesRequest.php @@ -0,0 +1,273 @@ +google.cloud.metastore.v1.ListServicesRequest + */ +class ListServicesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The relative resource name of the location of metastore services + * to list, in the following form: + * `projects/{project_number}/locations/{location_id}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. The maximum number of services to return. The response may + * contain less than the maximum number. If unspecified, no more than 500 + * services are returned. The maximum value is 1000; values above 1000 are + * changed to 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Optional. A page token, received from a previous + * [DataprocMetastore.ListServices][google.cloud.metastore.v1.DataprocMetastore.ListServices] + * call. Provide this token to retrieve the subsequent page. + * To retrieve the first page, supply an empty page token. + * When paginating, other parameters provided to + * [DataprocMetastore.ListServices][google.cloud.metastore.v1.DataprocMetastore.ListServices] + * must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = ''; + /** + * Optional. The filter to apply to list results. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $filter = ''; + /** + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $order_by = ''; + + /** + * @param string $parent Required. The relative resource name of the location of metastore services + * to list, in the following form: + * + * `projects/{project_number}/locations/{location_id}`. Please see + * {@see DataprocMetastoreClient::locationName()} for help formatting this field. + * + * @return \Google\Cloud\Metastore\V1\ListServicesRequest + * + * @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. The relative resource name of the location of metastore services + * to list, in the following form: + * `projects/{project_number}/locations/{location_id}`. + * @type int $page_size + * Optional. The maximum number of services to return. The response may + * contain less than the maximum number. If unspecified, no more than 500 + * services are returned. The maximum value is 1000; values above 1000 are + * changed to 1000. + * @type string $page_token + * Optional. A page token, received from a previous + * [DataprocMetastore.ListServices][google.cloud.metastore.v1.DataprocMetastore.ListServices] + * call. Provide this token to retrieve the subsequent page. + * To retrieve the first page, supply an empty page token. + * When paginating, other parameters provided to + * [DataprocMetastore.ListServices][google.cloud.metastore.v1.DataprocMetastore.ListServices] + * must match the call that provided the page token. + * @type string $filter + * Optional. The filter to apply to list results. + * @type string $order_by + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Required. The relative resource name of the location of metastore services + * to list, in the following form: + * `projects/{project_number}/locations/{location_id}`. + * + * 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. The relative resource name of the location of metastore services + * to list, in the following form: + * `projects/{project_number}/locations/{location_id}`. + * + * 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. The maximum number of services to return. The response may + * contain less than the maximum number. If unspecified, no more than 500 + * services are returned. The maximum value is 1000; values above 1000 are + * changed to 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. The maximum number of services to return. The response may + * contain less than the maximum number. If unspecified, no more than 500 + * services are returned. The maximum value is 1000; values above 1000 are + * changed to 1000. + * + * 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 page token, received from a previous + * [DataprocMetastore.ListServices][google.cloud.metastore.v1.DataprocMetastore.ListServices] + * call. Provide this token to retrieve the subsequent page. + * To retrieve the first page, supply an empty page token. + * When paginating, other parameters provided to + * [DataprocMetastore.ListServices][google.cloud.metastore.v1.DataprocMetastore.ListServices] + * must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. A page token, received from a previous + * [DataprocMetastore.ListServices][google.cloud.metastore.v1.DataprocMetastore.ListServices] + * call. Provide this token to retrieve the subsequent page. + * To retrieve the first page, supply an empty page token. + * When paginating, other parameters provided to + * [DataprocMetastore.ListServices][google.cloud.metastore.v1.DataprocMetastore.ListServices] + * must match the call that provided the page token. + * + * 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. The filter to apply to list results. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Optional. The filter to apply to list results. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/ListServicesResponse.php b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/ListServicesResponse.php new file mode 100644 index 000000000000..40a31f47a158 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/ListServicesResponse.php @@ -0,0 +1,140 @@ +google.cloud.metastore.v1.ListServicesResponse + */ +class ListServicesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The services in the specified location. + * + * Generated from protobuf field repeated .google.cloud.metastore.v1.Service services = 1; + */ + private $services; + /** + * A token that can be sent as `page_token` to retrieve the next page. If this + * field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + */ + private $unreachable; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Metastore\V1\Service>|\Google\Protobuf\Internal\RepeatedField $services + * The services in the specified location. + * @type string $next_page_token + * A token that can be sent as `page_token` to retrieve the next page. If this + * field is omitted, there are no subsequent pages. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Locations that could not be reached. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * The services in the specified location. + * + * Generated from protobuf field repeated .google.cloud.metastore.v1.Service services = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getServices() + { + return $this->services; + } + + /** + * The services in the specified location. + * + * Generated from protobuf field repeated .google.cloud.metastore.v1.Service services = 1; + * @param array<\Google\Cloud\Metastore\V1\Service>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setServices($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Metastore\V1\Service::class); + $this->services = $arr; + + return $this; + } + + /** + * A token that can be sent as `page_token` to retrieve the next page. If this + * field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token that can be sent as `page_token` to retrieve the next page. If this + * field is omitted, there are no subsequent pages. + * + * 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; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUnreachable($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->unreachable = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/LocationMetadata.php b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/LocationMetadata.php new file mode 100644 index 000000000000..a36d20f571ce --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/LocationMetadata.php @@ -0,0 +1,75 @@ +google.cloud.metastore.v1.LocationMetadata + */ +class LocationMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * The versions of Hive Metastore that can be used when creating a new + * metastore service in this location. The server guarantees that exactly one + * `HiveMetastoreVersion` in the list will set `is_default`. + * + * Generated from protobuf field repeated .google.cloud.metastore.v1.LocationMetadata.HiveMetastoreVersion supported_hive_metastore_versions = 1; + */ + private $supported_hive_metastore_versions; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Metastore\V1\LocationMetadata\HiveMetastoreVersion>|\Google\Protobuf\Internal\RepeatedField $supported_hive_metastore_versions + * The versions of Hive Metastore that can be used when creating a new + * metastore service in this location. The server guarantees that exactly one + * `HiveMetastoreVersion` in the list will set `is_default`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * The versions of Hive Metastore that can be used when creating a new + * metastore service in this location. The server guarantees that exactly one + * `HiveMetastoreVersion` in the list will set `is_default`. + * + * Generated from protobuf field repeated .google.cloud.metastore.v1.LocationMetadata.HiveMetastoreVersion supported_hive_metastore_versions = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSupportedHiveMetastoreVersions() + { + return $this->supported_hive_metastore_versions; + } + + /** + * The versions of Hive Metastore that can be used when creating a new + * metastore service in this location. The server guarantees that exactly one + * `HiveMetastoreVersion` in the list will set `is_default`. + * + * Generated from protobuf field repeated .google.cloud.metastore.v1.LocationMetadata.HiveMetastoreVersion supported_hive_metastore_versions = 1; + * @param array<\Google\Cloud\Metastore\V1\LocationMetadata\HiveMetastoreVersion>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSupportedHiveMetastoreVersions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Metastore\V1\LocationMetadata\HiveMetastoreVersion::class); + $this->supported_hive_metastore_versions = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/LocationMetadata/HiveMetastoreVersion.php b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/LocationMetadata/HiveMetastoreVersion.php new file mode 100644 index 000000000000..58687bbf80df --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/LocationMetadata/HiveMetastoreVersion.php @@ -0,0 +1,108 @@ +google.cloud.metastore.v1.LocationMetadata.HiveMetastoreVersion + */ +class HiveMetastoreVersion extends \Google\Protobuf\Internal\Message +{ + /** + * The semantic version of the Hive Metastore software. + * + * Generated from protobuf field string version = 1; + */ + protected $version = ''; + /** + * Whether `version` will be chosen by the server if a metastore service is + * created with a `HiveMetastoreConfig` that omits the `version`. + * + * Generated from protobuf field bool is_default = 2; + */ + protected $is_default = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $version + * The semantic version of the Hive Metastore software. + * @type bool $is_default + * Whether `version` will be chosen by the server if a metastore service is + * created with a `HiveMetastoreConfig` that omits the `version`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * The semantic version of the Hive Metastore software. + * + * Generated from protobuf field string version = 1; + * @return string + */ + public function getVersion() + { + return $this->version; + } + + /** + * The semantic version of the Hive Metastore software. + * + * Generated from protobuf field string version = 1; + * @param string $var + * @return $this + */ + public function setVersion($var) + { + GPBUtil::checkString($var, True); + $this->version = $var; + + return $this; + } + + /** + * Whether `version` will be chosen by the server if a metastore service is + * created with a `HiveMetastoreConfig` that omits the `version`. + * + * Generated from protobuf field bool is_default = 2; + * @return bool + */ + public function getIsDefault() + { + return $this->is_default; + } + + /** + * Whether `version` will be chosen by the server if a metastore service is + * created with a `HiveMetastoreConfig` that omits the `version`. + * + * Generated from protobuf field bool is_default = 2; + * @param bool $var + * @return $this + */ + public function setIsDefault($var) + { + GPBUtil::checkBool($var); + $this->is_default = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(HiveMetastoreVersion::class, \Google\Cloud\Metastore\V1\LocationMetadata_HiveMetastoreVersion::class); + diff --git a/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/LocationMetadata_HiveMetastoreVersion.php b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/LocationMetadata_HiveMetastoreVersion.php new file mode 100644 index 000000000000..52ccdf580e02 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/LocationMetadata_HiveMetastoreVersion.php @@ -0,0 +1,16 @@ +google.cloud.metastore.v1.MaintenanceWindow + */ +class MaintenanceWindow extends \Google\Protobuf\Internal\Message +{ + /** + * The hour of day (0-23) when the window starts. + * + * Generated from protobuf field .google.protobuf.Int32Value hour_of_day = 1; + */ + protected $hour_of_day = null; + /** + * The day of week, when the window starts. + * + * Generated from protobuf field .google.type.DayOfWeek day_of_week = 2; + */ + protected $day_of_week = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Int32Value $hour_of_day + * The hour of day (0-23) when the window starts. + * @type int $day_of_week + * The day of week, when the window starts. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * The hour of day (0-23) when the window starts. + * + * Generated from protobuf field .google.protobuf.Int32Value hour_of_day = 1; + * @return \Google\Protobuf\Int32Value|null + */ + public function getHourOfDay() + { + return $this->hour_of_day; + } + + public function hasHourOfDay() + { + return isset($this->hour_of_day); + } + + public function clearHourOfDay() + { + unset($this->hour_of_day); + } + + /** + * Returns the unboxed value from getHourOfDay() + + * The hour of day (0-23) when the window starts. + * + * Generated from protobuf field .google.protobuf.Int32Value hour_of_day = 1; + * @return int|null + */ + public function getHourOfDayUnwrapped() + { + return $this->readWrapperValue("hour_of_day"); + } + + /** + * The hour of day (0-23) when the window starts. + * + * Generated from protobuf field .google.protobuf.Int32Value hour_of_day = 1; + * @param \Google\Protobuf\Int32Value $var + * @return $this + */ + public function setHourOfDay($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Int32Value::class); + $this->hour_of_day = $var; + + return $this; + } + + /** + * Sets the field by wrapping a primitive type in a Google\Protobuf\Int32Value object. + + * The hour of day (0-23) when the window starts. + * + * Generated from protobuf field .google.protobuf.Int32Value hour_of_day = 1; + * @param int|null $var + * @return $this + */ + public function setHourOfDayUnwrapped($var) + { + $this->writeWrapperValue("hour_of_day", $var); + return $this;} + + /** + * The day of week, when the window starts. + * + * Generated from protobuf field .google.type.DayOfWeek day_of_week = 2; + * @return int + */ + public function getDayOfWeek() + { + return $this->day_of_week; + } + + /** + * The day of week, when the window starts. + * + * Generated from protobuf field .google.type.DayOfWeek day_of_week = 2; + * @param int $var + * @return $this + */ + public function setDayOfWeek($var) + { + GPBUtil::checkEnum($var, \Google\Type\DayOfWeek::class); + $this->day_of_week = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/MetadataExport.php b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/MetadataExport.php new file mode 100644 index 000000000000..b8d76e8d94d4 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/MetadataExport.php @@ -0,0 +1,240 @@ +google.cloud.metastore.v1.MetadataExport + */ +class MetadataExport extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The time when the export started. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $start_time = null; + /** + * Output only. The time when the export ended. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $end_time = null; + /** + * Output only. The current state of the export. + * + * Generated from protobuf field .google.cloud.metastore.v1.MetadataExport.State state = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Output only. The type of the database dump. + * + * Generated from protobuf field .google.cloud.metastore.v1.DatabaseDumpSpec.Type database_dump_type = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $database_dump_type = 0; + protected $destination; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $destination_gcs_uri + * Output only. A Cloud Storage URI of a folder that metadata are exported + * to, in the form of + * `gs:////`, where + * `` is automatically generated. + * @type \Google\Protobuf\Timestamp $start_time + * Output only. The time when the export started. + * @type \Google\Protobuf\Timestamp $end_time + * Output only. The time when the export ended. + * @type int $state + * Output only. The current state of the export. + * @type int $database_dump_type + * Output only. The type of the database dump. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Output only. A Cloud Storage URI of a folder that metadata are exported + * to, in the form of + * `gs:////`, where + * `` is automatically generated. + * + * Generated from protobuf field string destination_gcs_uri = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getDestinationGcsUri() + { + return $this->readOneof(4); + } + + public function hasDestinationGcsUri() + { + return $this->hasOneof(4); + } + + /** + * Output only. A Cloud Storage URI of a folder that metadata are exported + * to, in the form of + * `gs:////`, where + * `` is automatically generated. + * + * Generated from protobuf field string destination_gcs_uri = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setDestinationGcsUri($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * Output only. The time when the export started. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getStartTime() + { + return $this->start_time; + } + + public function hasStartTime() + { + return isset($this->start_time); + } + + public function clearStartTime() + { + unset($this->start_time); + } + + /** + * Output only. The time when the export started. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setStartTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->start_time = $var; + + return $this; + } + + /** + * Output only. The time when the export ended. + * + * 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 when the export ended. + * + * 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 current state of the export. + * + * Generated from protobuf field .google.cloud.metastore.v1.MetadataExport.State state = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. The current state of the export. + * + * Generated from protobuf field .google.cloud.metastore.v1.MetadataExport.State state = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Metastore\V1\MetadataExport\State::class); + $this->state = $var; + + return $this; + } + + /** + * Output only. The type of the database dump. + * + * Generated from protobuf field .google.cloud.metastore.v1.DatabaseDumpSpec.Type database_dump_type = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getDatabaseDumpType() + { + return $this->database_dump_type; + } + + /** + * Output only. The type of the database dump. + * + * Generated from protobuf field .google.cloud.metastore.v1.DatabaseDumpSpec.Type database_dump_type = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setDatabaseDumpType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Metastore\V1\DatabaseDumpSpec\Type::class); + $this->database_dump_type = $var; + + return $this; + } + + /** + * @return string + */ + public function getDestination() + { + return $this->whichOneof("destination"); + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/MetadataExport/State.php b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/MetadataExport/State.php new file mode 100644 index 000000000000..9edc49059ec8 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/MetadataExport/State.php @@ -0,0 +1,78 @@ +google.cloud.metastore.v1.MetadataExport.State + */ +class State +{ + /** + * The state of the metadata export is unknown. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The metadata export is running. + * + * Generated from protobuf enum RUNNING = 1; + */ + const RUNNING = 1; + /** + * The metadata export completed successfully. + * + * Generated from protobuf enum SUCCEEDED = 2; + */ + const SUCCEEDED = 2; + /** + * The metadata export failed. + * + * Generated from protobuf enum FAILED = 3; + */ + const FAILED = 3; + /** + * The metadata export is cancelled. + * + * Generated from protobuf enum CANCELLED = 4; + */ + const CANCELLED = 4; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::RUNNING => 'RUNNING', + self::SUCCEEDED => 'SUCCEEDED', + self::FAILED => 'FAILED', + self::CANCELLED => 'CANCELLED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\Metastore\V1\MetadataExport_State::class); + diff --git a/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/MetadataExport_State.php b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/MetadataExport_State.php new file mode 100644 index 000000000000..1bbb018dbd5e --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/MetadataExport_State.php @@ -0,0 +1,16 @@ +google.cloud.metastore.v1.MetadataImport + */ +class MetadataImport extends \Google\Protobuf\Internal\Message +{ + /** + * Immutable. The relative resource name of the metadata import, of the form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{metadata_import_id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + */ + protected $name = ''; + /** + * The description of the metadata import. + * + * Generated from protobuf field string description = 2; + */ + protected $description = ''; + /** + * Output only. The time when the metadata import was started. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. The time when the metadata import was last updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * Output only. The time when the metadata import finished. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $end_time = null; + /** + * Output only. The current state of the metadata import. + * + * Generated from protobuf field .google.cloud.metastore.v1.MetadataImport.State state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + protected $metadata; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Metastore\V1\MetadataImport\DatabaseDump $database_dump + * Immutable. A database dump from a pre-existing metastore's database. + * @type string $name + * Immutable. The relative resource name of the metadata import, of the form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{metadata_import_id}`. + * @type string $description + * The description of the metadata import. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The time when the metadata import was started. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. The time when the metadata import was last updated. + * @type \Google\Protobuf\Timestamp $end_time + * Output only. The time when the metadata import finished. + * @type int $state + * Output only. The current state of the metadata import. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Immutable. A database dump from a pre-existing metastore's database. + * + * Generated from protobuf field .google.cloud.metastore.v1.MetadataImport.DatabaseDump database_dump = 6 [(.google.api.field_behavior) = IMMUTABLE]; + * @return \Google\Cloud\Metastore\V1\MetadataImport\DatabaseDump|null + */ + public function getDatabaseDump() + { + return $this->readOneof(6); + } + + public function hasDatabaseDump() + { + return $this->hasOneof(6); + } + + /** + * Immutable. A database dump from a pre-existing metastore's database. + * + * Generated from protobuf field .google.cloud.metastore.v1.MetadataImport.DatabaseDump database_dump = 6 [(.google.api.field_behavior) = IMMUTABLE]; + * @param \Google\Cloud\Metastore\V1\MetadataImport\DatabaseDump $var + * @return $this + */ + public function setDatabaseDump($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Metastore\V1\MetadataImport\DatabaseDump::class); + $this->writeOneof(6, $var); + + return $this; + } + + /** + * Immutable. The relative resource name of the metadata import, of the form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{metadata_import_id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Immutable. The relative resource name of the metadata import, of the form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{metadata_import_id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The description of the metadata import. + * + * Generated from protobuf field string description = 2; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * The description of the metadata import. + * + * Generated from protobuf field string description = 2; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * Output only. The time when the metadata import was started. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 3 [(.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 when the metadata import was started. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 3 [(.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 when the metadata import was last updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 4 [(.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 when the metadata import was last updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 4 [(.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 time when the metadata import finished. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 7 [(.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 when the metadata import finished. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 7 [(.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 current state of the metadata import. + * + * Generated from protobuf field .google.cloud.metastore.v1.MetadataImport.State state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. The current state of the metadata import. + * + * Generated from protobuf field .google.cloud.metastore.v1.MetadataImport.State state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Metastore\V1\MetadataImport\State::class); + $this->state = $var; + + return $this; + } + + /** + * @return string + */ + public function getMetadata() + { + return $this->whichOneof("metadata"); + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/MetadataImport/DatabaseDump.php b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/MetadataImport/DatabaseDump.php new file mode 100644 index 000000000000..dd3ab9de1707 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/MetadataImport/DatabaseDump.php @@ -0,0 +1,152 @@ +google.cloud.metastore.v1.MetadataImport.DatabaseDump + */ +class DatabaseDump extends \Google\Protobuf\Internal\Message +{ + /** + * The type of the database. + * + * Generated from protobuf field .google.cloud.metastore.v1.MetadataImport.DatabaseDump.DatabaseType database_type = 1 [deprecated = true]; + * @deprecated + */ + protected $database_type = 0; + /** + * A Cloud Storage object or folder URI that specifies the source from which + * to import metadata. It must begin with `gs://`. + * + * Generated from protobuf field string gcs_uri = 2; + */ + protected $gcs_uri = ''; + /** + * Optional. The type of the database dump. If unspecified, defaults to + * `MYSQL`. + * + * Generated from protobuf field .google.cloud.metastore.v1.DatabaseDumpSpec.Type type = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $type = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $database_type + * The type of the database. + * @type string $gcs_uri + * A Cloud Storage object or folder URI that specifies the source from which + * to import metadata. It must begin with `gs://`. + * @type int $type + * Optional. The type of the database dump. If unspecified, defaults to + * `MYSQL`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * The type of the database. + * + * Generated from protobuf field .google.cloud.metastore.v1.MetadataImport.DatabaseDump.DatabaseType database_type = 1 [deprecated = true]; + * @return int + * @deprecated + */ + public function getDatabaseType() + { + @trigger_error('database_type is deprecated.', E_USER_DEPRECATED); + return $this->database_type; + } + + /** + * The type of the database. + * + * Generated from protobuf field .google.cloud.metastore.v1.MetadataImport.DatabaseDump.DatabaseType database_type = 1 [deprecated = true]; + * @param int $var + * @return $this + * @deprecated + */ + public function setDatabaseType($var) + { + @trigger_error('database_type is deprecated.', E_USER_DEPRECATED); + GPBUtil::checkEnum($var, \Google\Cloud\Metastore\V1\MetadataImport\DatabaseDump\DatabaseType::class); + $this->database_type = $var; + + return $this; + } + + /** + * A Cloud Storage object or folder URI that specifies the source from which + * to import metadata. It must begin with `gs://`. + * + * Generated from protobuf field string gcs_uri = 2; + * @return string + */ + public function getGcsUri() + { + return $this->gcs_uri; + } + + /** + * A Cloud Storage object or folder URI that specifies the source from which + * to import metadata. It must begin with `gs://`. + * + * Generated from protobuf field string gcs_uri = 2; + * @param string $var + * @return $this + */ + public function setGcsUri($var) + { + GPBUtil::checkString($var, True); + $this->gcs_uri = $var; + + return $this; + } + + /** + * Optional. The type of the database dump. If unspecified, defaults to + * `MYSQL`. + * + * Generated from protobuf field .google.cloud.metastore.v1.DatabaseDumpSpec.Type type = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * Optional. The type of the database dump. If unspecified, defaults to + * `MYSQL`. + * + * Generated from protobuf field .google.cloud.metastore.v1.DatabaseDumpSpec.Type type = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Metastore\V1\DatabaseDumpSpec\Type::class); + $this->type = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(DatabaseDump::class, \Google\Cloud\Metastore\V1\MetadataImport_DatabaseDump::class); + diff --git a/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/MetadataImport/DatabaseDump/DatabaseType.php b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/MetadataImport/DatabaseDump/DatabaseType.php new file mode 100644 index 000000000000..c5d6380893d5 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/MetadataImport/DatabaseDump/DatabaseType.php @@ -0,0 +1,57 @@ +google.cloud.metastore.v1.MetadataImport.DatabaseDump.DatabaseType + */ +class DatabaseType +{ + /** + * The type of the source database is unknown. + * + * Generated from protobuf enum DATABASE_TYPE_UNSPECIFIED = 0; + */ + const DATABASE_TYPE_UNSPECIFIED = 0; + /** + * The type of the source database is MySQL. + * + * Generated from protobuf enum MYSQL = 1; + */ + const MYSQL = 1; + + private static $valueToName = [ + self::DATABASE_TYPE_UNSPECIFIED => 'DATABASE_TYPE_UNSPECIFIED', + self::MYSQL => 'MYSQL', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(DatabaseType::class, \Google\Cloud\Metastore\V1\MetadataImport_DatabaseDump_DatabaseType::class); + diff --git a/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/MetadataImport/State.php b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/MetadataImport/State.php new file mode 100644 index 000000000000..627621ca37c4 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/MetadataImport/State.php @@ -0,0 +1,79 @@ +google.cloud.metastore.v1.MetadataImport.State + */ +class State +{ + /** + * The state of the metadata import is unknown. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The metadata import is running. + * + * Generated from protobuf enum RUNNING = 1; + */ + const RUNNING = 1; + /** + * The metadata import completed successfully. + * + * Generated from protobuf enum SUCCEEDED = 2; + */ + const SUCCEEDED = 2; + /** + * The metadata import is being updated. + * + * Generated from protobuf enum UPDATING = 3; + */ + const UPDATING = 3; + /** + * The metadata import failed, and attempted metadata changes were rolled + * back. + * + * Generated from protobuf enum FAILED = 4; + */ + const FAILED = 4; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::RUNNING => 'RUNNING', + self::SUCCEEDED => 'SUCCEEDED', + self::UPDATING => 'UPDATING', + self::FAILED => 'FAILED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\Metastore\V1\MetadataImport_State::class); + diff --git a/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/MetadataImport_DatabaseDump.php b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/MetadataImport_DatabaseDump.php new file mode 100644 index 000000000000..36c27aad31f9 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/MetadataImport_DatabaseDump.php @@ -0,0 +1,16 @@ +google.cloud.metastore.v1.MetadataManagementActivity + */ +class MetadataManagementActivity extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The latest metadata exports of the metastore service. + * + * Generated from protobuf field repeated .google.cloud.metastore.v1.MetadataExport metadata_exports = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $metadata_exports; + /** + * Output only. The latest restores of the metastore service. + * + * Generated from protobuf field repeated .google.cloud.metastore.v1.Restore restores = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $restores; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Metastore\V1\MetadataExport>|\Google\Protobuf\Internal\RepeatedField $metadata_exports + * Output only. The latest metadata exports of the metastore service. + * @type array<\Google\Cloud\Metastore\V1\Restore>|\Google\Protobuf\Internal\RepeatedField $restores + * Output only. The latest restores of the metastore service. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The latest metadata exports of the metastore service. + * + * Generated from protobuf field repeated .google.cloud.metastore.v1.MetadataExport metadata_exports = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getMetadataExports() + { + return $this->metadata_exports; + } + + /** + * Output only. The latest metadata exports of the metastore service. + * + * Generated from protobuf field repeated .google.cloud.metastore.v1.MetadataExport metadata_exports = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array<\Google\Cloud\Metastore\V1\MetadataExport>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setMetadataExports($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Metastore\V1\MetadataExport::class); + $this->metadata_exports = $arr; + + return $this; + } + + /** + * Output only. The latest restores of the metastore service. + * + * Generated from protobuf field repeated .google.cloud.metastore.v1.Restore restores = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRestores() + { + return $this->restores; + } + + /** + * Output only. The latest restores of the metastore service. + * + * Generated from protobuf field repeated .google.cloud.metastore.v1.Restore restores = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array<\Google\Cloud\Metastore\V1\Restore>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRestores($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Metastore\V1\Restore::class); + $this->restores = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/NetworkConfig.php b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/NetworkConfig.php new file mode 100644 index 000000000000..0b1d4cba0157 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/NetworkConfig.php @@ -0,0 +1,71 @@ +google.cloud.metastore.v1.NetworkConfig + */ +class NetworkConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Immutable. The consumer-side network configuration for the Dataproc + * Metastore instance. + * + * Generated from protobuf field repeated .google.cloud.metastore.v1.NetworkConfig.Consumer consumers = 1 [(.google.api.field_behavior) = IMMUTABLE]; + */ + private $consumers; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Metastore\V1\NetworkConfig\Consumer>|\Google\Protobuf\Internal\RepeatedField $consumers + * Immutable. The consumer-side network configuration for the Dataproc + * Metastore instance. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Immutable. The consumer-side network configuration for the Dataproc + * Metastore instance. + * + * Generated from protobuf field repeated .google.cloud.metastore.v1.NetworkConfig.Consumer consumers = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getConsumers() + { + return $this->consumers; + } + + /** + * Immutable. The consumer-side network configuration for the Dataproc + * Metastore instance. + * + * Generated from protobuf field repeated .google.cloud.metastore.v1.NetworkConfig.Consumer consumers = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * @param array<\Google\Cloud\Metastore\V1\NetworkConfig\Consumer>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setConsumers($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Metastore\V1\NetworkConfig\Consumer::class); + $this->consumers = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/NetworkConfig/Consumer.php b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/NetworkConfig/Consumer.php new file mode 100644 index 000000000000..9a69fad5d124 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/NetworkConfig/Consumer.php @@ -0,0 +1,134 @@ +google.cloud.metastore.v1.NetworkConfig.Consumer + */ +class Consumer extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The URI of the endpoint used to access the metastore + * service. + * + * Generated from protobuf field string endpoint_uri = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $endpoint_uri = ''; + protected $vpc_resource; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $subnetwork + * Immutable. The subnetwork of the customer project from which an IP + * address is reserved and used as the Dataproc Metastore service's + * endpoint. It is accessible to hosts in the subnet and to all + * hosts in a subnet in the same region and same network. There must + * be at least one IP address available in the subnet's primary range. The + * subnet is specified in the following form: + * `projects/{project_number}/regions/{region_id}/subnetworks/{subnetwork_id}` + * @type string $endpoint_uri + * Output only. The URI of the endpoint used to access the metastore + * service. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Immutable. The subnetwork of the customer project from which an IP + * address is reserved and used as the Dataproc Metastore service's + * endpoint. It is accessible to hosts in the subnet and to all + * hosts in a subnet in the same region and same network. There must + * be at least one IP address available in the subnet's primary range. The + * subnet is specified in the following form: + * `projects/{project_number}/regions/{region_id}/subnetworks/{subnetwork_id}` + * + * Generated from protobuf field string subnetwork = 1 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.resource_reference) = { + * @return string + */ + public function getSubnetwork() + { + return $this->readOneof(1); + } + + public function hasSubnetwork() + { + return $this->hasOneof(1); + } + + /** + * Immutable. The subnetwork of the customer project from which an IP + * address is reserved and used as the Dataproc Metastore service's + * endpoint. It is accessible to hosts in the subnet and to all + * hosts in a subnet in the same region and same network. There must + * be at least one IP address available in the subnet's primary range. The + * subnet is specified in the following form: + * `projects/{project_number}/regions/{region_id}/subnetworks/{subnetwork_id}` + * + * Generated from protobuf field string subnetwork = 1 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setSubnetwork($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * Output only. The URI of the endpoint used to access the metastore + * service. + * + * Generated from protobuf field string endpoint_uri = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getEndpointUri() + { + return $this->endpoint_uri; + } + + /** + * Output only. The URI of the endpoint used to access the metastore + * service. + * + * Generated from protobuf field string endpoint_uri = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setEndpointUri($var) + { + GPBUtil::checkString($var, True); + $this->endpoint_uri = $var; + + return $this; + } + + /** + * @return string + */ + public function getVpcResource() + { + return $this->whichOneof("vpc_resource"); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Consumer::class, \Google\Cloud\Metastore\V1\NetworkConfig_Consumer::class); + diff --git a/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/NetworkConfig_Consumer.php b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/NetworkConfig_Consumer.php new file mode 100644 index 000000000000..414791f9fbbf --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/NetworkConfig_Consumer.php @@ -0,0 +1,16 @@ +google.cloud.metastore.v1.OperationMetadata + */ +class OperationMetadata 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. Server-defined resource path for the target of the operation. + * + * Generated from protobuf field string target = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $target = ''; + /** + * Output only. Name of the verb executed by the operation. + * + * Generated from protobuf field string verb = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $verb = ''; + /** + * Output only. Human-readable status of the operation, if any. + * + * Generated from protobuf field string status_message = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $status_message = ''; + /** + * Output only. Identifies whether the caller has requested cancellation + * of the operation. Operations that have successfully been cancelled + * have [Operation.error][] value with a + * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + * `Code.CANCELLED`. + * + * Generated from protobuf field bool requested_cancellation = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $requested_cancellation = false; + /** + * Output only. API version used to start the operation. + * + * Generated from protobuf field string api_version = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $api_version = ''; + + /** + * 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 string $target + * Output only. Server-defined resource path for the target of the operation. + * @type string $verb + * Output only. Name of the verb executed by the operation. + * @type string $status_message + * Output only. Human-readable status of the operation, if any. + * @type bool $requested_cancellation + * Output only. Identifies whether the caller has requested cancellation + * of the operation. Operations that have successfully been cancelled + * have [Operation.error][] value with a + * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + * `Code.CANCELLED`. + * @type string $api_version + * Output only. API version used to start the operation. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1\Metastore::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. Server-defined resource path for the target of the operation. + * + * Generated from protobuf field string target = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getTarget() + { + return $this->target; + } + + /** + * Output only. Server-defined resource path for the target of the operation. + * + * Generated from protobuf field string target = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setTarget($var) + { + GPBUtil::checkString($var, True); + $this->target = $var; + + return $this; + } + + /** + * Output only. Name of the verb executed by the operation. + * + * Generated from protobuf field string verb = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getVerb() + { + return $this->verb; + } + + /** + * Output only. Name of the verb executed by the operation. + * + * Generated from protobuf field string verb = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setVerb($var) + { + GPBUtil::checkString($var, True); + $this->verb = $var; + + return $this; + } + + /** + * Output only. Human-readable status of the operation, if any. + * + * Generated from protobuf field string status_message = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getStatusMessage() + { + return $this->status_message; + } + + /** + * Output only. Human-readable status of the operation, if any. + * + * Generated from protobuf field string status_message = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setStatusMessage($var) + { + GPBUtil::checkString($var, True); + $this->status_message = $var; + + return $this; + } + + /** + * Output only. Identifies whether the caller has requested cancellation + * of the operation. Operations that have successfully been cancelled + * have [Operation.error][] value with a + * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + * `Code.CANCELLED`. + * + * Generated from protobuf field bool requested_cancellation = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return bool + */ + public function getRequestedCancellation() + { + return $this->requested_cancellation; + } + + /** + * Output only. Identifies whether the caller has requested cancellation + * of the operation. Operations that have successfully been cancelled + * have [Operation.error][] value with a + * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + * `Code.CANCELLED`. + * + * Generated from protobuf field bool requested_cancellation = 6 [(.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. API version used to start the operation. + * + * Generated from protobuf field string api_version = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getApiVersion() + { + return $this->api_version; + } + + /** + * Output only. API version used to start the operation. + * + * Generated from protobuf field string api_version = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setApiVersion($var) + { + GPBUtil::checkString($var, True); + $this->api_version = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/Restore.php b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/Restore.php new file mode 100644 index 000000000000..40f6b3f7dfa7 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/Restore.php @@ -0,0 +1,269 @@ +google.cloud.metastore.v1.Restore + */ +class Restore extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The time when the restore started. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $start_time = null; + /** + * Output only. The time when the restore ended. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $end_time = null; + /** + * Output only. The current state of the restore. + * + * Generated from protobuf field .google.cloud.metastore.v1.Restore.State state = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Output only. The relative resource name of the metastore service backup to + * restore from, in the following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + * + * Generated from protobuf field string backup = 4 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + */ + protected $backup = ''; + /** + * Output only. The type of restore. + * + * Generated from protobuf field .google.cloud.metastore.v1.Restore.RestoreType type = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $type = 0; + /** + * Output only. The restore details containing the revision of the service to + * be restored to, in format of JSON. + * + * Generated from protobuf field string details = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $details = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Timestamp $start_time + * Output only. The time when the restore started. + * @type \Google\Protobuf\Timestamp $end_time + * Output only. The time when the restore ended. + * @type int $state + * Output only. The current state of the restore. + * @type string $backup + * Output only. The relative resource name of the metastore service backup to + * restore from, in the following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + * @type int $type + * Output only. The type of restore. + * @type string $details + * Output only. The restore details containing the revision of the service to + * be restored to, in format of JSON. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The time when the restore started. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getStartTime() + { + return $this->start_time; + } + + public function hasStartTime() + { + return isset($this->start_time); + } + + public function clearStartTime() + { + unset($this->start_time); + } + + /** + * Output only. The time when the restore started. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setStartTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->start_time = $var; + + return $this; + } + + /** + * Output only. The time when the restore ended. + * + * 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 when the restore ended. + * + * 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 current state of the restore. + * + * Generated from protobuf field .google.cloud.metastore.v1.Restore.State state = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. The current state of the restore. + * + * Generated from protobuf field .google.cloud.metastore.v1.Restore.State state = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Metastore\V1\Restore\State::class); + $this->state = $var; + + return $this; + } + + /** + * Output only. The relative resource name of the metastore service backup to + * restore from, in the following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + * + * Generated from protobuf field string backup = 4 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + * @return string + */ + public function getBackup() + { + return $this->backup; + } + + /** + * Output only. The relative resource name of the metastore service backup to + * restore from, in the following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + * + * Generated from protobuf field string backup = 4 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setBackup($var) + { + GPBUtil::checkString($var, True); + $this->backup = $var; + + return $this; + } + + /** + * Output only. The type of restore. + * + * Generated from protobuf field .google.cloud.metastore.v1.Restore.RestoreType type = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * Output only. The type of restore. + * + * Generated from protobuf field .google.cloud.metastore.v1.Restore.RestoreType type = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Metastore\V1\Restore\RestoreType::class); + $this->type = $var; + + return $this; + } + + /** + * Output only. The restore details containing the revision of the service to + * be restored to, in format of JSON. + * + * Generated from protobuf field string details = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getDetails() + { + return $this->details; + } + + /** + * Output only. The restore details containing the revision of the service to + * be restored to, in format of JSON. + * + * Generated from protobuf field string details = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setDetails($var) + { + GPBUtil::checkString($var, True); + $this->details = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/Restore/RestoreType.php b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/Restore/RestoreType.php new file mode 100644 index 000000000000..1dbf9a631af0 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/Restore/RestoreType.php @@ -0,0 +1,64 @@ +google.cloud.metastore.v1.Restore.RestoreType + */ +class RestoreType +{ + /** + * The restore type is unknown. + * + * Generated from protobuf enum RESTORE_TYPE_UNSPECIFIED = 0; + */ + const RESTORE_TYPE_UNSPECIFIED = 0; + /** + * The service's metadata and configuration are restored. + * + * Generated from protobuf enum FULL = 1; + */ + const FULL = 1; + /** + * Only the service's metadata is restored. + * + * Generated from protobuf enum METADATA_ONLY = 2; + */ + const METADATA_ONLY = 2; + + private static $valueToName = [ + self::RESTORE_TYPE_UNSPECIFIED => 'RESTORE_TYPE_UNSPECIFIED', + self::FULL => 'FULL', + self::METADATA_ONLY => 'METADATA_ONLY', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(RestoreType::class, \Google\Cloud\Metastore\V1\Restore_RestoreType::class); + diff --git a/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/Restore/State.php b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/Restore/State.php new file mode 100644 index 000000000000..e00016549808 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/Restore/State.php @@ -0,0 +1,78 @@ +google.cloud.metastore.v1.Restore.State + */ +class State +{ + /** + * The state of the metadata restore is unknown. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The metadata restore is running. + * + * Generated from protobuf enum RUNNING = 1; + */ + const RUNNING = 1; + /** + * The metadata restore completed successfully. + * + * Generated from protobuf enum SUCCEEDED = 2; + */ + const SUCCEEDED = 2; + /** + * The metadata restore failed. + * + * Generated from protobuf enum FAILED = 3; + */ + const FAILED = 3; + /** + * The metadata restore is cancelled. + * + * Generated from protobuf enum CANCELLED = 4; + */ + const CANCELLED = 4; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::RUNNING => 'RUNNING', + self::SUCCEEDED => 'SUCCEEDED', + self::FAILED => 'FAILED', + self::CANCELLED => 'CANCELLED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\Metastore\V1\Restore_State::class); + diff --git a/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/RestoreServiceRequest.php b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/RestoreServiceRequest.php new file mode 100644 index 000000000000..b55b901f0c82 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/RestoreServiceRequest.php @@ -0,0 +1,244 @@ +google.cloud.metastore.v1.RestoreServiceRequest + */ +class RestoreServiceRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The relative resource name of the metastore service to run + * restore, in the following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * + * Generated from protobuf field string service = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $service = ''; + /** + * Required. The relative resource name of the metastore service backup to + * restore from, in the following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + * + * Generated from protobuf field string backup = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $backup = ''; + /** + * Optional. The type of restore. If unspecified, defaults to `METADATA_ONLY`. + * + * Generated from protobuf field .google.cloud.metastore.v1.Restore.RestoreType restore_type = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $restore_type = 0; + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * @param string $service Required. The relative resource name of the metastore service to run + * restore, in the following form: + * + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. Please see + * {@see DataprocMetastoreClient::serviceName()} for help formatting this field. + * @param string $backup Required. The relative resource name of the metastore service backup to + * restore from, in the following form: + * + * `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. Please see + * {@see DataprocMetastoreClient::backupName()} for help formatting this field. + * + * @return \Google\Cloud\Metastore\V1\RestoreServiceRequest + * + * @experimental + */ + public static function build(string $service, string $backup): self + { + return (new self()) + ->setService($service) + ->setBackup($backup); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $service + * Required. The relative resource name of the metastore service to run + * restore, in the following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * @type string $backup + * Required. The relative resource name of the metastore service backup to + * restore from, in the following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + * @type int $restore_type + * Optional. The type of restore. If unspecified, defaults to `METADATA_ONLY`. + * @type string $request_id + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Required. The relative resource name of the metastore service to run + * restore, in the following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * + * Generated from protobuf field string service = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getService() + { + return $this->service; + } + + /** + * Required. The relative resource name of the metastore service to run + * restore, in the following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * + * Generated from protobuf field string service = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setService($var) + { + GPBUtil::checkString($var, True); + $this->service = $var; + + return $this; + } + + /** + * Required. The relative resource name of the metastore service backup to + * restore from, in the following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + * + * Generated from protobuf field string backup = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getBackup() + { + return $this->backup; + } + + /** + * Required. The relative resource name of the metastore service backup to + * restore from, in the following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + * + * Generated from protobuf field string backup = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setBackup($var) + { + GPBUtil::checkString($var, True); + $this->backup = $var; + + return $this; + } + + /** + * Optional. The type of restore. If unspecified, defaults to `METADATA_ONLY`. + * + * Generated from protobuf field .google.cloud.metastore.v1.Restore.RestoreType restore_type = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getRestoreType() + { + return $this->restore_type; + } + + /** + * Optional. The type of restore. If unspecified, defaults to `METADATA_ONLY`. + * + * Generated from protobuf field .google.cloud.metastore.v1.Restore.RestoreType restore_type = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setRestoreType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Metastore\V1\Restore\RestoreType::class); + $this->restore_type = $var; + + return $this; + } + + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @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/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/Restore_RestoreType.php b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/Restore_RestoreType.php new file mode 100644 index 000000000000..31910ab62964 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/Restore_RestoreType.php @@ -0,0 +1,16 @@ +google.cloud.metastore.v1.ScalingConfig + */ +class ScalingConfig extends \Google\Protobuf\Internal\Message +{ + protected $scaling_model; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $instance_size + * An enum of readable instance sizes, with each instance size mapping to a + * float value (e.g. InstanceSize.EXTRA_SMALL = scaling_factor(0.1)) + * @type float $scaling_factor + * Scaling factor, increments of 0.1 for values less than 1.0, and + * increments of 1.0 for values greater than 1.0. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * An enum of readable instance sizes, with each instance size mapping to a + * float value (e.g. InstanceSize.EXTRA_SMALL = scaling_factor(0.1)) + * + * Generated from protobuf field .google.cloud.metastore.v1.ScalingConfig.InstanceSize instance_size = 1; + * @return int + */ + public function getInstanceSize() + { + return $this->readOneof(1); + } + + public function hasInstanceSize() + { + return $this->hasOneof(1); + } + + /** + * An enum of readable instance sizes, with each instance size mapping to a + * float value (e.g. InstanceSize.EXTRA_SMALL = scaling_factor(0.1)) + * + * Generated from protobuf field .google.cloud.metastore.v1.ScalingConfig.InstanceSize instance_size = 1; + * @param int $var + * @return $this + */ + public function setInstanceSize($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Metastore\V1\ScalingConfig\InstanceSize::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * Scaling factor, increments of 0.1 for values less than 1.0, and + * increments of 1.0 for values greater than 1.0. + * + * Generated from protobuf field float scaling_factor = 2; + * @return float + */ + public function getScalingFactor() + { + return $this->readOneof(2); + } + + public function hasScalingFactor() + { + return $this->hasOneof(2); + } + + /** + * Scaling factor, increments of 0.1 for values less than 1.0, and + * increments of 1.0 for values greater than 1.0. + * + * Generated from protobuf field float scaling_factor = 2; + * @param float $var + * @return $this + */ + public function setScalingFactor($var) + { + GPBUtil::checkFloat($var); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * @return string + */ + public function getScalingModel() + { + return $this->whichOneof("scaling_model"); + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/ScalingConfig/InstanceSize.php b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/ScalingConfig/InstanceSize.php new file mode 100644 index 000000000000..742e323a97fb --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/ScalingConfig/InstanceSize.php @@ -0,0 +1,85 @@ +google.cloud.metastore.v1.ScalingConfig.InstanceSize + */ +class InstanceSize +{ + /** + * Unspecified instance size + * + * Generated from protobuf enum INSTANCE_SIZE_UNSPECIFIED = 0; + */ + const INSTANCE_SIZE_UNSPECIFIED = 0; + /** + * Extra small instance size, maps to a scaling factor of 0.1. + * + * Generated from protobuf enum EXTRA_SMALL = 1; + */ + const EXTRA_SMALL = 1; + /** + * Small instance size, maps to a scaling factor of 0.5. + * + * Generated from protobuf enum SMALL = 2; + */ + const SMALL = 2; + /** + * Medium instance size, maps to a scaling factor of 1.0. + * + * Generated from protobuf enum MEDIUM = 3; + */ + const MEDIUM = 3; + /** + * Large instance size, maps to a scaling factor of 3.0. + * + * Generated from protobuf enum LARGE = 4; + */ + const LARGE = 4; + /** + * Extra large instance size, maps to a scaling factor of 6.0. + * + * Generated from protobuf enum EXTRA_LARGE = 5; + */ + const EXTRA_LARGE = 5; + + private static $valueToName = [ + self::INSTANCE_SIZE_UNSPECIFIED => 'INSTANCE_SIZE_UNSPECIFIED', + self::EXTRA_SMALL => 'EXTRA_SMALL', + self::SMALL => 'SMALL', + self::MEDIUM => 'MEDIUM', + self::LARGE => 'LARGE', + self::EXTRA_LARGE => 'EXTRA_LARGE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(InstanceSize::class, \Google\Cloud\Metastore\V1\ScalingConfig_InstanceSize::class); + diff --git a/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/ScalingConfig_InstanceSize.php b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/ScalingConfig_InstanceSize.php new file mode 100644 index 000000000000..6b43e68b2ec2 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/ScalingConfig_InstanceSize.php @@ -0,0 +1,16 @@ +google.cloud.metastore.v1.Secret + */ +class Secret extends \Google\Protobuf\Internal\Message +{ + protected $value; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $cloud_secret + * The relative resource name of a Secret Manager secret version, in the + * following form: + * `projects/{project_number}/secrets/{secret_id}/versions/{version_id}`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * The relative resource name of a Secret Manager secret version, in the + * following form: + * `projects/{project_number}/secrets/{secret_id}/versions/{version_id}`. + * + * Generated from protobuf field string cloud_secret = 2; + * @return string + */ + public function getCloudSecret() + { + return $this->readOneof(2); + } + + public function hasCloudSecret() + { + return $this->hasOneof(2); + } + + /** + * The relative resource name of a Secret Manager secret version, in the + * following form: + * `projects/{project_number}/secrets/{secret_id}/versions/{version_id}`. + * + * Generated from protobuf field string cloud_secret = 2; + * @param string $var + * @return $this + */ + public function setCloudSecret($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * @return string + */ + public function getValue() + { + return $this->whichOneof("value"); + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/Service.php b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/Service.php new file mode 100644 index 000000000000..36f66eaa77ac --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/Service.php @@ -0,0 +1,894 @@ +google.cloud.metastore.v1.Service + */ +class Service extends \Google\Protobuf\Internal\Message +{ + /** + * Immutable. The relative resource name of the metastore service, in the + * following format: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + */ + protected $name = ''; + /** + * Output only. The time when the metastore service was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. The time when the metastore service was last updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * User-defined labels for the metastore service. + * + * Generated from protobuf field map labels = 4; + */ + private $labels; + /** + * Immutable. The relative resource name of the VPC network on which the + * instance can be accessed. It is specified in the following form: + * `projects/{project_number}/global/networks/{network_id}`. + * + * Generated from protobuf field string network = 7 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.resource_reference) = { + */ + protected $network = ''; + /** + * Output only. The URI of the endpoint used to access the metastore service. + * + * Generated from protobuf field string endpoint_uri = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $endpoint_uri = ''; + /** + * The TCP port at which the metastore service is reached. Default: 9083. + * + * Generated from protobuf field int32 port = 9; + */ + protected $port = 0; + /** + * Output only. The current state of the metastore service. + * + * Generated from protobuf field .google.cloud.metastore.v1.Service.State state = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Output only. Additional information about the current state of the + * metastore service, if available. + * + * Generated from protobuf field string state_message = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state_message = ''; + /** + * Output only. A Cloud Storage URI (starting with `gs://`) that specifies + * where artifacts related to the metastore service are stored. + * + * Generated from protobuf field string artifact_gcs_uri = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $artifact_gcs_uri = ''; + /** + * The tier of the service. + * + * Generated from protobuf field .google.cloud.metastore.v1.Service.Tier tier = 13; + */ + protected $tier = 0; + /** + * The one hour maintenance window of the metastore service. This specifies + * when the service can be restarted for maintenance purposes in UTC time. + * Maintenance window is not needed for services with the SPANNER + * database type. + * + * Generated from protobuf field .google.cloud.metastore.v1.MaintenanceWindow maintenance_window = 15; + */ + protected $maintenance_window = null; + /** + * Output only. The globally unique resource identifier of the metastore + * service. + * + * Generated from protobuf field string uid = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $uid = ''; + /** + * Output only. The metadata management activities of the metastore service. + * + * Generated from protobuf field .google.cloud.metastore.v1.MetadataManagementActivity metadata_management_activity = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $metadata_management_activity = null; + /** + * Immutable. The release channel of the service. + * If unspecified, defaults to `STABLE`. + * + * Generated from protobuf field .google.cloud.metastore.v1.Service.ReleaseChannel release_channel = 19 [(.google.api.field_behavior) = IMMUTABLE]; + */ + protected $release_channel = 0; + /** + * Immutable. Information used to configure the Dataproc Metastore service to + * encrypt customer data at rest. Cannot be updated. + * + * Generated from protobuf field .google.cloud.metastore.v1.EncryptionConfig encryption_config = 20 [(.google.api.field_behavior) = IMMUTABLE]; + */ + protected $encryption_config = null; + /** + * The configuration specifying the network settings for the + * Dataproc Metastore service. + * + * Generated from protobuf field .google.cloud.metastore.v1.NetworkConfig network_config = 21; + */ + protected $network_config = null; + /** + * Immutable. The database type that the Metastore service stores its data. + * + * Generated from protobuf field .google.cloud.metastore.v1.Service.DatabaseType database_type = 22 [(.google.api.field_behavior) = IMMUTABLE]; + */ + protected $database_type = 0; + /** + * The configuration specifying telemetry settings for the Dataproc Metastore + * service. If unspecified defaults to `JSON`. + * + * Generated from protobuf field .google.cloud.metastore.v1.TelemetryConfig telemetry_config = 23; + */ + protected $telemetry_config = null; + /** + * Scaling configuration of the metastore service. + * + * Generated from protobuf field .google.cloud.metastore.v1.ScalingConfig scaling_config = 24; + */ + protected $scaling_config = null; + protected $metastore_config; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Metastore\V1\HiveMetastoreConfig $hive_metastore_config + * Configuration information specific to running Hive metastore + * software as the metastore service. + * @type string $name + * Immutable. The relative resource name of the metastore service, in the + * following format: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The time when the metastore service was created. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. The time when the metastore service was last updated. + * @type array|\Google\Protobuf\Internal\MapField $labels + * User-defined labels for the metastore service. + * @type string $network + * Immutable. The relative resource name of the VPC network on which the + * instance can be accessed. It is specified in the following form: + * `projects/{project_number}/global/networks/{network_id}`. + * @type string $endpoint_uri + * Output only. The URI of the endpoint used to access the metastore service. + * @type int $port + * The TCP port at which the metastore service is reached. Default: 9083. + * @type int $state + * Output only. The current state of the metastore service. + * @type string $state_message + * Output only. Additional information about the current state of the + * metastore service, if available. + * @type string $artifact_gcs_uri + * Output only. A Cloud Storage URI (starting with `gs://`) that specifies + * where artifacts related to the metastore service are stored. + * @type int $tier + * The tier of the service. + * @type \Google\Cloud\Metastore\V1\MaintenanceWindow $maintenance_window + * The one hour maintenance window of the metastore service. This specifies + * when the service can be restarted for maintenance purposes in UTC time. + * Maintenance window is not needed for services with the SPANNER + * database type. + * @type string $uid + * Output only. The globally unique resource identifier of the metastore + * service. + * @type \Google\Cloud\Metastore\V1\MetadataManagementActivity $metadata_management_activity + * Output only. The metadata management activities of the metastore service. + * @type int $release_channel + * Immutable. The release channel of the service. + * If unspecified, defaults to `STABLE`. + * @type \Google\Cloud\Metastore\V1\EncryptionConfig $encryption_config + * Immutable. Information used to configure the Dataproc Metastore service to + * encrypt customer data at rest. Cannot be updated. + * @type \Google\Cloud\Metastore\V1\NetworkConfig $network_config + * The configuration specifying the network settings for the + * Dataproc Metastore service. + * @type int $database_type + * Immutable. The database type that the Metastore service stores its data. + * @type \Google\Cloud\Metastore\V1\TelemetryConfig $telemetry_config + * The configuration specifying telemetry settings for the Dataproc Metastore + * service. If unspecified defaults to `JSON`. + * @type \Google\Cloud\Metastore\V1\ScalingConfig $scaling_config + * Scaling configuration of the metastore service. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Configuration information specific to running Hive metastore + * software as the metastore service. + * + * Generated from protobuf field .google.cloud.metastore.v1.HiveMetastoreConfig hive_metastore_config = 5; + * @return \Google\Cloud\Metastore\V1\HiveMetastoreConfig|null + */ + public function getHiveMetastoreConfig() + { + return $this->readOneof(5); + } + + public function hasHiveMetastoreConfig() + { + return $this->hasOneof(5); + } + + /** + * Configuration information specific to running Hive metastore + * software as the metastore service. + * + * Generated from protobuf field .google.cloud.metastore.v1.HiveMetastoreConfig hive_metastore_config = 5; + * @param \Google\Cloud\Metastore\V1\HiveMetastoreConfig $var + * @return $this + */ + public function setHiveMetastoreConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Metastore\V1\HiveMetastoreConfig::class); + $this->writeOneof(5, $var); + + return $this; + } + + /** + * Immutable. The relative resource name of the metastore service, in the + * following format: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Immutable. The relative resource name of the metastore service, in the + * following format: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. The time when the metastore service was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.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 when the metastore service was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.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 when the metastore service was last updated. + * + * 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 when the metastore service was last updated. + * + * 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; + } + + /** + * User-defined labels for the metastore service. + * + * Generated from protobuf field map labels = 4; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * User-defined labels for the metastore service. + * + * Generated from protobuf field map labels = 4; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + + /** + * Immutable. The relative resource name of the VPC network on which the + * instance can be accessed. It is specified in the following form: + * `projects/{project_number}/global/networks/{network_id}`. + * + * Generated from protobuf field string network = 7 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.resource_reference) = { + * @return string + */ + public function getNetwork() + { + return $this->network; + } + + /** + * Immutable. The relative resource name of the VPC network on which the + * instance can be accessed. It is specified in the following form: + * `projects/{project_number}/global/networks/{network_id}`. + * + * Generated from protobuf field string network = 7 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setNetwork($var) + { + GPBUtil::checkString($var, True); + $this->network = $var; + + return $this; + } + + /** + * Output only. The URI of the endpoint used to access the metastore service. + * + * Generated from protobuf field string endpoint_uri = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getEndpointUri() + { + return $this->endpoint_uri; + } + + /** + * Output only. The URI of the endpoint used to access the metastore service. + * + * Generated from protobuf field string endpoint_uri = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setEndpointUri($var) + { + GPBUtil::checkString($var, True); + $this->endpoint_uri = $var; + + return $this; + } + + /** + * The TCP port at which the metastore service is reached. Default: 9083. + * + * Generated from protobuf field int32 port = 9; + * @return int + */ + public function getPort() + { + return $this->port; + } + + /** + * The TCP port at which the metastore service is reached. Default: 9083. + * + * Generated from protobuf field int32 port = 9; + * @param int $var + * @return $this + */ + public function setPort($var) + { + GPBUtil::checkInt32($var); + $this->port = $var; + + return $this; + } + + /** + * Output only. The current state of the metastore service. + * + * Generated from protobuf field .google.cloud.metastore.v1.Service.State state = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. The current state of the metastore service. + * + * Generated from protobuf field .google.cloud.metastore.v1.Service.State state = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Metastore\V1\Service\State::class); + $this->state = $var; + + return $this; + } + + /** + * Output only. Additional information about the current state of the + * metastore service, if available. + * + * Generated from protobuf field string state_message = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getStateMessage() + { + return $this->state_message; + } + + /** + * Output only. Additional information about the current state of the + * metastore service, if available. + * + * Generated from protobuf field string state_message = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setStateMessage($var) + { + GPBUtil::checkString($var, True); + $this->state_message = $var; + + return $this; + } + + /** + * Output only. A Cloud Storage URI (starting with `gs://`) that specifies + * where artifacts related to the metastore service are stored. + * + * Generated from protobuf field string artifact_gcs_uri = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getArtifactGcsUri() + { + return $this->artifact_gcs_uri; + } + + /** + * Output only. A Cloud Storage URI (starting with `gs://`) that specifies + * where artifacts related to the metastore service are stored. + * + * Generated from protobuf field string artifact_gcs_uri = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setArtifactGcsUri($var) + { + GPBUtil::checkString($var, True); + $this->artifact_gcs_uri = $var; + + return $this; + } + + /** + * The tier of the service. + * + * Generated from protobuf field .google.cloud.metastore.v1.Service.Tier tier = 13; + * @return int + */ + public function getTier() + { + return $this->tier; + } + + /** + * The tier of the service. + * + * Generated from protobuf field .google.cloud.metastore.v1.Service.Tier tier = 13; + * @param int $var + * @return $this + */ + public function setTier($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Metastore\V1\Service\Tier::class); + $this->tier = $var; + + return $this; + } + + /** + * The one hour maintenance window of the metastore service. This specifies + * when the service can be restarted for maintenance purposes in UTC time. + * Maintenance window is not needed for services with the SPANNER + * database type. + * + * Generated from protobuf field .google.cloud.metastore.v1.MaintenanceWindow maintenance_window = 15; + * @return \Google\Cloud\Metastore\V1\MaintenanceWindow|null + */ + public function getMaintenanceWindow() + { + return $this->maintenance_window; + } + + public function hasMaintenanceWindow() + { + return isset($this->maintenance_window); + } + + public function clearMaintenanceWindow() + { + unset($this->maintenance_window); + } + + /** + * The one hour maintenance window of the metastore service. This specifies + * when the service can be restarted for maintenance purposes in UTC time. + * Maintenance window is not needed for services with the SPANNER + * database type. + * + * Generated from protobuf field .google.cloud.metastore.v1.MaintenanceWindow maintenance_window = 15; + * @param \Google\Cloud\Metastore\V1\MaintenanceWindow $var + * @return $this + */ + public function setMaintenanceWindow($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Metastore\V1\MaintenanceWindow::class); + $this->maintenance_window = $var; + + return $this; + } + + /** + * Output only. The globally unique resource identifier of the metastore + * service. + * + * Generated from protobuf field string uid = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getUid() + { + return $this->uid; + } + + /** + * Output only. The globally unique resource identifier of the metastore + * service. + * + * Generated from protobuf field string uid = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setUid($var) + { + GPBUtil::checkString($var, True); + $this->uid = $var; + + return $this; + } + + /** + * Output only. The metadata management activities of the metastore service. + * + * Generated from protobuf field .google.cloud.metastore.v1.MetadataManagementActivity metadata_management_activity = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\Metastore\V1\MetadataManagementActivity|null + */ + public function getMetadataManagementActivity() + { + return $this->metadata_management_activity; + } + + public function hasMetadataManagementActivity() + { + return isset($this->metadata_management_activity); + } + + public function clearMetadataManagementActivity() + { + unset($this->metadata_management_activity); + } + + /** + * Output only. The metadata management activities of the metastore service. + * + * Generated from protobuf field .google.cloud.metastore.v1.MetadataManagementActivity metadata_management_activity = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\Metastore\V1\MetadataManagementActivity $var + * @return $this + */ + public function setMetadataManagementActivity($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Metastore\V1\MetadataManagementActivity::class); + $this->metadata_management_activity = $var; + + return $this; + } + + /** + * Immutable. The release channel of the service. + * If unspecified, defaults to `STABLE`. + * + * Generated from protobuf field .google.cloud.metastore.v1.Service.ReleaseChannel release_channel = 19 [(.google.api.field_behavior) = IMMUTABLE]; + * @return int + */ + public function getReleaseChannel() + { + return $this->release_channel; + } + + /** + * Immutable. The release channel of the service. + * If unspecified, defaults to `STABLE`. + * + * Generated from protobuf field .google.cloud.metastore.v1.Service.ReleaseChannel release_channel = 19 [(.google.api.field_behavior) = IMMUTABLE]; + * @param int $var + * @return $this + */ + public function setReleaseChannel($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Metastore\V1\Service\ReleaseChannel::class); + $this->release_channel = $var; + + return $this; + } + + /** + * Immutable. Information used to configure the Dataproc Metastore service to + * encrypt customer data at rest. Cannot be updated. + * + * Generated from protobuf field .google.cloud.metastore.v1.EncryptionConfig encryption_config = 20 [(.google.api.field_behavior) = IMMUTABLE]; + * @return \Google\Cloud\Metastore\V1\EncryptionConfig|null + */ + public function getEncryptionConfig() + { + return $this->encryption_config; + } + + public function hasEncryptionConfig() + { + return isset($this->encryption_config); + } + + public function clearEncryptionConfig() + { + unset($this->encryption_config); + } + + /** + * Immutable. Information used to configure the Dataproc Metastore service to + * encrypt customer data at rest. Cannot be updated. + * + * Generated from protobuf field .google.cloud.metastore.v1.EncryptionConfig encryption_config = 20 [(.google.api.field_behavior) = IMMUTABLE]; + * @param \Google\Cloud\Metastore\V1\EncryptionConfig $var + * @return $this + */ + public function setEncryptionConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Metastore\V1\EncryptionConfig::class); + $this->encryption_config = $var; + + return $this; + } + + /** + * The configuration specifying the network settings for the + * Dataproc Metastore service. + * + * Generated from protobuf field .google.cloud.metastore.v1.NetworkConfig network_config = 21; + * @return \Google\Cloud\Metastore\V1\NetworkConfig|null + */ + public function getNetworkConfig() + { + return $this->network_config; + } + + public function hasNetworkConfig() + { + return isset($this->network_config); + } + + public function clearNetworkConfig() + { + unset($this->network_config); + } + + /** + * The configuration specifying the network settings for the + * Dataproc Metastore service. + * + * Generated from protobuf field .google.cloud.metastore.v1.NetworkConfig network_config = 21; + * @param \Google\Cloud\Metastore\V1\NetworkConfig $var + * @return $this + */ + public function setNetworkConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Metastore\V1\NetworkConfig::class); + $this->network_config = $var; + + return $this; + } + + /** + * Immutable. The database type that the Metastore service stores its data. + * + * Generated from protobuf field .google.cloud.metastore.v1.Service.DatabaseType database_type = 22 [(.google.api.field_behavior) = IMMUTABLE]; + * @return int + */ + public function getDatabaseType() + { + return $this->database_type; + } + + /** + * Immutable. The database type that the Metastore service stores its data. + * + * Generated from protobuf field .google.cloud.metastore.v1.Service.DatabaseType database_type = 22 [(.google.api.field_behavior) = IMMUTABLE]; + * @param int $var + * @return $this + */ + public function setDatabaseType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Metastore\V1\Service\DatabaseType::class); + $this->database_type = $var; + + return $this; + } + + /** + * The configuration specifying telemetry settings for the Dataproc Metastore + * service. If unspecified defaults to `JSON`. + * + * Generated from protobuf field .google.cloud.metastore.v1.TelemetryConfig telemetry_config = 23; + * @return \Google\Cloud\Metastore\V1\TelemetryConfig|null + */ + public function getTelemetryConfig() + { + return $this->telemetry_config; + } + + public function hasTelemetryConfig() + { + return isset($this->telemetry_config); + } + + public function clearTelemetryConfig() + { + unset($this->telemetry_config); + } + + /** + * The configuration specifying telemetry settings for the Dataproc Metastore + * service. If unspecified defaults to `JSON`. + * + * Generated from protobuf field .google.cloud.metastore.v1.TelemetryConfig telemetry_config = 23; + * @param \Google\Cloud\Metastore\V1\TelemetryConfig $var + * @return $this + */ + public function setTelemetryConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Metastore\V1\TelemetryConfig::class); + $this->telemetry_config = $var; + + return $this; + } + + /** + * Scaling configuration of the metastore service. + * + * Generated from protobuf field .google.cloud.metastore.v1.ScalingConfig scaling_config = 24; + * @return \Google\Cloud\Metastore\V1\ScalingConfig|null + */ + public function getScalingConfig() + { + return $this->scaling_config; + } + + public function hasScalingConfig() + { + return isset($this->scaling_config); + } + + public function clearScalingConfig() + { + unset($this->scaling_config); + } + + /** + * Scaling configuration of the metastore service. + * + * Generated from protobuf field .google.cloud.metastore.v1.ScalingConfig scaling_config = 24; + * @param \Google\Cloud\Metastore\V1\ScalingConfig $var + * @return $this + */ + public function setScalingConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Metastore\V1\ScalingConfig::class); + $this->scaling_config = $var; + + return $this; + } + + /** + * @return string + */ + public function getMetastoreConfig() + { + return $this->whichOneof("metastore_config"); + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/Service/DatabaseType.php b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/Service/DatabaseType.php new file mode 100644 index 000000000000..825ddf6b0f47 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/Service/DatabaseType.php @@ -0,0 +1,64 @@ +google.cloud.metastore.v1.Service.DatabaseType + */ +class DatabaseType +{ + /** + * The DATABASE_TYPE is not set. + * + * Generated from protobuf enum DATABASE_TYPE_UNSPECIFIED = 0; + */ + const DATABASE_TYPE_UNSPECIFIED = 0; + /** + * MySQL is used to persist the metastore data. + * + * Generated from protobuf enum MYSQL = 1; + */ + const MYSQL = 1; + /** + * Spanner is used to persist the metastore data. + * + * Generated from protobuf enum SPANNER = 2; + */ + const SPANNER = 2; + + private static $valueToName = [ + self::DATABASE_TYPE_UNSPECIFIED => 'DATABASE_TYPE_UNSPECIFIED', + self::MYSQL => 'MYSQL', + self::SPANNER => 'SPANNER', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(DatabaseType::class, \Google\Cloud\Metastore\V1\Service_DatabaseType::class); + diff --git a/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/Service/ReleaseChannel.php b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/Service/ReleaseChannel.php new file mode 100644 index 000000000000..5f79d822e3bc --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/Service/ReleaseChannel.php @@ -0,0 +1,69 @@ +google.cloud.metastore.v1.Service.ReleaseChannel + */ +class ReleaseChannel +{ + /** + * Release channel is not specified. + * + * Generated from protobuf enum RELEASE_CHANNEL_UNSPECIFIED = 0; + */ + const RELEASE_CHANNEL_UNSPECIFIED = 0; + /** + * The `CANARY` release channel contains the newest features, which may be + * unstable and subject to unresolved issues with no known workarounds. + * Services using the `CANARY` release channel are not subject to any SLAs. + * + * Generated from protobuf enum CANARY = 1; + */ + const CANARY = 1; + /** + * The `STABLE` release channel contains features that are considered stable + * and have been validated for production use. + * + * Generated from protobuf enum STABLE = 2; + */ + const STABLE = 2; + + private static $valueToName = [ + self::RELEASE_CHANNEL_UNSPECIFIED => 'RELEASE_CHANNEL_UNSPECIFIED', + self::CANARY => 'CANARY', + self::STABLE => 'STABLE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ReleaseChannel::class, \Google\Cloud\Metastore\V1\Service_ReleaseChannel::class); + diff --git a/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/Service/State.php b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/Service/State.php new file mode 100644 index 000000000000..335f72a766a0 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/Service/State.php @@ -0,0 +1,102 @@ +google.cloud.metastore.v1.Service.State + */ +class State +{ + /** + * The state of the metastore service is unknown. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The metastore service is in the process of being created. + * + * Generated from protobuf enum CREATING = 1; + */ + const CREATING = 1; + /** + * The metastore service is running and ready to serve queries. + * + * Generated from protobuf enum ACTIVE = 2; + */ + const ACTIVE = 2; + /** + * The metastore service is entering suspension. Its query-serving + * availability may cease unexpectedly. + * + * Generated from protobuf enum SUSPENDING = 3; + */ + const SUSPENDING = 3; + /** + * The metastore service is suspended and unable to serve queries. + * + * Generated from protobuf enum SUSPENDED = 4; + */ + const SUSPENDED = 4; + /** + * The metastore service is being updated. It remains usable but cannot + * accept additional update requests or be deleted at this time. + * + * Generated from protobuf enum UPDATING = 5; + */ + const UPDATING = 5; + /** + * The metastore service is undergoing deletion. It cannot be used. + * + * Generated from protobuf enum DELETING = 6; + */ + const DELETING = 6; + /** + * The metastore service has encountered an error and cannot be used. The + * metastore service should be deleted. + * + * Generated from protobuf enum ERROR = 7; + */ + const ERROR = 7; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::CREATING => 'CREATING', + self::ACTIVE => 'ACTIVE', + self::SUSPENDING => 'SUSPENDING', + self::SUSPENDED => 'SUSPENDED', + self::UPDATING => 'UPDATING', + self::DELETING => 'DELETING', + self::ERROR => 'ERROR', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\Metastore\V1\Service_State::class); + diff --git a/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/Service/Tier.php b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/Service/Tier.php new file mode 100644 index 000000000000..6603ae6a7018 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/Service/Tier.php @@ -0,0 +1,66 @@ +google.cloud.metastore.v1.Service.Tier + */ +class Tier +{ + /** + * The tier is not set. + * + * Generated from protobuf enum TIER_UNSPECIFIED = 0; + */ + const TIER_UNSPECIFIED = 0; + /** + * The developer tier provides limited scalability and no fault tolerance. + * Good for low-cost proof-of-concept. + * + * Generated from protobuf enum DEVELOPER = 1; + */ + const DEVELOPER = 1; + /** + * The enterprise tier provides multi-zone high availability, and sufficient + * scalability for enterprise-level Dataproc Metastore workloads. + * + * Generated from protobuf enum ENTERPRISE = 3; + */ + const ENTERPRISE = 3; + + private static $valueToName = [ + self::TIER_UNSPECIFIED => 'TIER_UNSPECIFIED', + self::DEVELOPER => 'DEVELOPER', + self::ENTERPRISE => 'ENTERPRISE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Tier::class, \Google\Cloud\Metastore\V1\Service_Tier::class); + diff --git a/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/Service_DatabaseType.php b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/Service_DatabaseType.php new file mode 100644 index 000000000000..284be95d2f53 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/Service_DatabaseType.php @@ -0,0 +1,16 @@ +google.cloud.metastore.v1.TelemetryConfig + */ +class TelemetryConfig extends \Google\Protobuf\Internal\Message +{ + /** + * The output format of the Dataproc Metastore service's logs. + * + * Generated from protobuf field .google.cloud.metastore.v1.TelemetryConfig.LogFormat log_format = 1; + */ + protected $log_format = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $log_format + * The output format of the Dataproc Metastore service's logs. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * The output format of the Dataproc Metastore service's logs. + * + * Generated from protobuf field .google.cloud.metastore.v1.TelemetryConfig.LogFormat log_format = 1; + * @return int + */ + public function getLogFormat() + { + return $this->log_format; + } + + /** + * The output format of the Dataproc Metastore service's logs. + * + * Generated from protobuf field .google.cloud.metastore.v1.TelemetryConfig.LogFormat log_format = 1; + * @param int $var + * @return $this + */ + public function setLogFormat($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Metastore\V1\TelemetryConfig\LogFormat::class); + $this->log_format = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/TelemetryConfig/LogFormat.php b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/TelemetryConfig/LogFormat.php new file mode 100644 index 000000000000..071414412d7d --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/TelemetryConfig/LogFormat.php @@ -0,0 +1,62 @@ +google.cloud.metastore.v1.TelemetryConfig.LogFormat + */ +class LogFormat +{ + /** + * The LOG_FORMAT is not set. + * + * Generated from protobuf enum LOG_FORMAT_UNSPECIFIED = 0; + */ + const LOG_FORMAT_UNSPECIFIED = 0; + /** + * Logging output uses the legacy `textPayload` format. + * + * Generated from protobuf enum LEGACY = 1; + */ + const LEGACY = 1; + /** + * Logging output uses the `jsonPayload` format. + * + * Generated from protobuf enum JSON = 2; + */ + const JSON = 2; + + private static $valueToName = [ + self::LOG_FORMAT_UNSPECIFIED => 'LOG_FORMAT_UNSPECIFIED', + self::LEGACY => 'LEGACY', + self::JSON => 'JSON', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(LogFormat::class, \Google\Cloud\Metastore\V1\TelemetryConfig_LogFormat::class); + diff --git a/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/TelemetryConfig_LogFormat.php b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/TelemetryConfig_LogFormat.php new file mode 100644 index 000000000000..2675da399d1e --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/TelemetryConfig_LogFormat.php @@ -0,0 +1,16 @@ +google.cloud.metastore.v1.UpdateFederationRequest + */ +class UpdateFederationRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. A field mask used to specify the fields to be overwritten in the + * metastore federation resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $update_mask = null; + /** + * Required. The metastore federation to update. The server only merges fields + * in the service if they are specified in `update_mask`. + * The metastore federation's `name` field is used to identify the + * metastore service to be updated. + * + * Generated from protobuf field .google.cloud.metastore.v1.Federation federation = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $federation = null; + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * @param \Google\Cloud\Metastore\V1\Federation $federation Required. The metastore federation to update. The server only merges fields + * in the service if they are specified in `update_mask`. + * + * The metastore federation's `name` field is used to identify the + * metastore service to be updated. + * @param \Google\Protobuf\FieldMask $updateMask Required. A field mask used to specify the fields to be overwritten in the + * metastore federation resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + * + * @return \Google\Cloud\Metastore\V1\UpdateFederationRequest + * + * @experimental + */ + public static function build(\Google\Cloud\Metastore\V1\Federation $federation, \Google\Protobuf\FieldMask $updateMask): self + { + return (new self()) + ->setFederation($federation) + ->setUpdateMask($updateMask); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\FieldMask $update_mask + * Required. A field mask used to specify the fields to be overwritten in the + * metastore federation resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + * @type \Google\Cloud\Metastore\V1\Federation $federation + * Required. The metastore federation to update. The server only merges fields + * in the service if they are specified in `update_mask`. + * The metastore federation's `name` field is used to identify the + * metastore service to be updated. + * @type string $request_id + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1\MetastoreFederation::initOnce(); + parent::__construct($data); + } + + /** + * Required. A field mask used to specify the fields to be overwritten in the + * metastore federation resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Required. A field mask used to specify the fields to be overwritten in the + * metastore federation resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + + /** + * Required. The metastore federation to update. The server only merges fields + * in the service if they are specified in `update_mask`. + * The metastore federation's `name` field is used to identify the + * metastore service to be updated. + * + * Generated from protobuf field .google.cloud.metastore.v1.Federation federation = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Metastore\V1\Federation|null + */ + public function getFederation() + { + return $this->federation; + } + + public function hasFederation() + { + return isset($this->federation); + } + + public function clearFederation() + { + unset($this->federation); + } + + /** + * Required. The metastore federation to update. The server only merges fields + * in the service if they are specified in `update_mask`. + * The metastore federation's `name` field is used to identify the + * metastore service to be updated. + * + * Generated from protobuf field .google.cloud.metastore.v1.Federation federation = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Metastore\V1\Federation $var + * @return $this + */ + public function setFederation($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Metastore\V1\Federation::class); + $this->federation = $var; + + return $this; + } + + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @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/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/UpdateMetadataImportRequest.php b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/UpdateMetadataImportRequest.php new file mode 100644 index 000000000000..0779fd76ed43 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/UpdateMetadataImportRequest.php @@ -0,0 +1,238 @@ +google.cloud.metastore.v1.UpdateMetadataImportRequest + */ +class UpdateMetadataImportRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. A field mask used to specify the fields to be overwritten in the + * metadata import resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $update_mask = null; + /** + * Required. The metadata import to update. The server only merges fields + * in the import if they are specified in `update_mask`. + * The metadata import's `name` field is used to identify the metastore + * import to be updated. + * + * Generated from protobuf field .google.cloud.metastore.v1.MetadataImport metadata_import = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $metadata_import = null; + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * @param \Google\Cloud\Metastore\V1\MetadataImport $metadataImport Required. The metadata import to update. The server only merges fields + * in the import if they are specified in `update_mask`. + * + * The metadata import's `name` field is used to identify the metastore + * import to be updated. + * @param \Google\Protobuf\FieldMask $updateMask Required. A field mask used to specify the fields to be overwritten in the + * metadata import resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + * + * @return \Google\Cloud\Metastore\V1\UpdateMetadataImportRequest + * + * @experimental + */ + public static function build(\Google\Cloud\Metastore\V1\MetadataImport $metadataImport, \Google\Protobuf\FieldMask $updateMask): self + { + return (new self()) + ->setMetadataImport($metadataImport) + ->setUpdateMask($updateMask); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\FieldMask $update_mask + * Required. A field mask used to specify the fields to be overwritten in the + * metadata import resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + * @type \Google\Cloud\Metastore\V1\MetadataImport $metadata_import + * Required. The metadata import to update. The server only merges fields + * in the import if they are specified in `update_mask`. + * The metadata import's `name` field is used to identify the metastore + * import to be updated. + * @type string $request_id + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Required. A field mask used to specify the fields to be overwritten in the + * metadata import resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Required. A field mask used to specify the fields to be overwritten in the + * metadata import resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + + /** + * Required. The metadata import to update. The server only merges fields + * in the import if they are specified in `update_mask`. + * The metadata import's `name` field is used to identify the metastore + * import to be updated. + * + * Generated from protobuf field .google.cloud.metastore.v1.MetadataImport metadata_import = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Metastore\V1\MetadataImport|null + */ + public function getMetadataImport() + { + return $this->metadata_import; + } + + public function hasMetadataImport() + { + return isset($this->metadata_import); + } + + public function clearMetadataImport() + { + unset($this->metadata_import); + } + + /** + * Required. The metadata import to update. The server only merges fields + * in the import if they are specified in `update_mask`. + * The metadata import's `name` field is used to identify the metastore + * import to be updated. + * + * Generated from protobuf field .google.cloud.metastore.v1.MetadataImport metadata_import = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Metastore\V1\MetadataImport $var + * @return $this + */ + public function setMetadataImport($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Metastore\V1\MetadataImport::class); + $this->metadata_import = $var; + + return $this; + } + + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @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/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/UpdateServiceRequest.php b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/UpdateServiceRequest.php new file mode 100644 index 000000000000..c5723944ac75 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/proto/src/Google/Cloud/Metastore/V1/UpdateServiceRequest.php @@ -0,0 +1,238 @@ +google.cloud.metastore.v1.UpdateServiceRequest + */ +class UpdateServiceRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. A field mask used to specify the fields to be overwritten in the + * metastore service resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $update_mask = null; + /** + * Required. The metastore service to update. The server only merges fields + * in the service if they are specified in `update_mask`. + * The metastore service's `name` field is used to identify the metastore + * service to be updated. + * + * Generated from protobuf field .google.cloud.metastore.v1.Service service = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $service = null; + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * @param \Google\Cloud\Metastore\V1\Service $service Required. The metastore service to update. The server only merges fields + * in the service if they are specified in `update_mask`. + * + * The metastore service's `name` field is used to identify the metastore + * service to be updated. + * @param \Google\Protobuf\FieldMask $updateMask Required. A field mask used to specify the fields to be overwritten in the + * metastore service resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + * + * @return \Google\Cloud\Metastore\V1\UpdateServiceRequest + * + * @experimental + */ + public static function build(\Google\Cloud\Metastore\V1\Service $service, \Google\Protobuf\FieldMask $updateMask): self + { + return (new self()) + ->setService($service) + ->setUpdateMask($updateMask); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\FieldMask $update_mask + * Required. A field mask used to specify the fields to be overwritten in the + * metastore service resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + * @type \Google\Cloud\Metastore\V1\Service $service + * Required. The metastore service to update. The server only merges fields + * in the service if they are specified in `update_mask`. + * The metastore service's `name` field is used to identify the metastore + * service to be updated. + * @type string $request_id + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Required. A field mask used to specify the fields to be overwritten in the + * metastore service resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Required. A field mask used to specify the fields to be overwritten in the + * metastore service resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + + /** + * Required. The metastore service to update. The server only merges fields + * in the service if they are specified in `update_mask`. + * The metastore service's `name` field is used to identify the metastore + * service to be updated. + * + * Generated from protobuf field .google.cloud.metastore.v1.Service service = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Metastore\V1\Service|null + */ + public function getService() + { + return $this->service; + } + + public function hasService() + { + return isset($this->service); + } + + public function clearService() + { + unset($this->service); + } + + /** + * Required. The metastore service to update. The server only merges fields + * in the service if they are specified in `update_mask`. + * The metastore service's `name` field is used to identify the metastore + * service to be updated. + * + * Generated from protobuf field .google.cloud.metastore.v1.Service service = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Metastore\V1\Service $var + * @return $this + */ + public function setService($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Metastore\V1\Service::class); + $this->service = $var; + + return $this; + } + + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @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/DataprocMetastore/v1/samples/V1/DataprocMetastoreClient/create_backup.php b/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreClient/create_backup.php new file mode 100644 index 000000000000..0c2445804427 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreClient/create_backup.php @@ -0,0 +1,96 @@ +setParent($formattedParent) + ->setBackupId($backupId) + ->setBackup($backup); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $dataprocMetastoreClient->createBackup($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Backup $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 +{ + $formattedParent = DataprocMetastoreClient::serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $backupId = '[BACKUP_ID]'; + + create_backup_sample($formattedParent, $backupId); +} +// [END metastore_v1_generated_DataprocMetastore_CreateBackup_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreClient/create_metadata_import.php b/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreClient/create_metadata_import.php new file mode 100644 index 000000000000..4cf61987390f --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreClient/create_metadata_import.php @@ -0,0 +1,96 @@ +setParent($formattedParent) + ->setMetadataImportId($metadataImportId) + ->setMetadataImport($metadataImport); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $dataprocMetastoreClient->createMetadataImport($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var MetadataImport $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 +{ + $formattedParent = DataprocMetastoreClient::serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $metadataImportId = '[METADATA_IMPORT_ID]'; + + create_metadata_import_sample($formattedParent, $metadataImportId); +} +// [END metastore_v1_generated_DataprocMetastore_CreateMetadataImport_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreClient/create_service.php b/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreClient/create_service.php new file mode 100644 index 000000000000..c99318a76693 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreClient/create_service.php @@ -0,0 +1,96 @@ +setParent($formattedParent) + ->setServiceId($serviceId) + ->setService($service); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $dataprocMetastoreClient->createService($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Service $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 +{ + $formattedParent = DataprocMetastoreClient::locationName('[PROJECT]', '[LOCATION]'); + $serviceId = '[SERVICE_ID]'; + + create_service_sample($formattedParent, $serviceId); +} +// [END metastore_v1_generated_DataprocMetastore_CreateService_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreClient/delete_backup.php b/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreClient/delete_backup.php new file mode 100644 index 000000000000..2ade8ff790f5 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreClient/delete_backup.php @@ -0,0 +1,88 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $dataprocMetastoreClient->deleteBackup($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + printf('Operation completed successfully.' . PHP_EOL); + } 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 = DataprocMetastoreClient::backupName( + '[PROJECT]', + '[LOCATION]', + '[SERVICE]', + '[BACKUP]' + ); + + delete_backup_sample($formattedName); +} +// [END metastore_v1_generated_DataprocMetastore_DeleteBackup_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreClient/delete_service.php b/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreClient/delete_service.php new file mode 100644 index 000000000000..eadf0bc599e8 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreClient/delete_service.php @@ -0,0 +1,83 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $dataprocMetastoreClient->deleteService($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + printf('Operation completed successfully.' . PHP_EOL); + } 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 = DataprocMetastoreClient::serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + + delete_service_sample($formattedName); +} +// [END metastore_v1_generated_DataprocMetastore_DeleteService_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreClient/export_metadata.php b/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreClient/export_metadata.php new file mode 100644 index 000000000000..71747b9fce80 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreClient/export_metadata.php @@ -0,0 +1,86 @@ +setService($formattedService); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $dataprocMetastoreClient->exportMetadata($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var MetadataExport $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 +{ + $formattedService = DataprocMetastoreClient::serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + + export_metadata_sample($formattedService); +} +// [END metastore_v1_generated_DataprocMetastore_ExportMetadata_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreClient/get_backup.php b/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreClient/get_backup.php new file mode 100644 index 000000000000..5ad2570cb926 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreClient/get_backup.php @@ -0,0 +1,79 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var Backup $response */ + $response = $dataprocMetastoreClient->getBackup($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 = DataprocMetastoreClient::backupName( + '[PROJECT]', + '[LOCATION]', + '[SERVICE]', + '[BACKUP]' + ); + + get_backup_sample($formattedName); +} +// [END metastore_v1_generated_DataprocMetastore_GetBackup_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreClient/get_iam_policy.php b/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreClient/get_iam_policy.php new file mode 100644 index 000000000000..ff2b200937bd --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreClient/get_iam_policy.php @@ -0,0 +1,72 @@ +setResource($resource); + + // Call the API and handle any network failures. + try { + /** @var Policy $response */ + $response = $dataprocMetastoreClient->getIamPolicy($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 +{ + $resource = '[RESOURCE]'; + + get_iam_policy_sample($resource); +} +// [END metastore_v1_generated_DataprocMetastore_GetIamPolicy_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreClient/get_location.php b/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreClient/get_location.php new file mode 100644 index 000000000000..10355f90bde7 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreClient/get_location.php @@ -0,0 +1,57 @@ +getLocation($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END metastore_v1_generated_DataprocMetastore_GetLocation_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreClient/get_metadata_import.php b/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreClient/get_metadata_import.php new file mode 100644 index 000000000000..8f05d3e8dc65 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreClient/get_metadata_import.php @@ -0,0 +1,79 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var MetadataImport $response */ + $response = $dataprocMetastoreClient->getMetadataImport($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 = DataprocMetastoreClient::metadataImportName( + '[PROJECT]', + '[LOCATION]', + '[SERVICE]', + '[METADATA_IMPORT]' + ); + + get_metadata_import_sample($formattedName); +} +// [END metastore_v1_generated_DataprocMetastore_GetMetadataImport_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreClient/get_service.php b/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreClient/get_service.php new file mode 100644 index 000000000000..3ebf6c826a83 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreClient/get_service.php @@ -0,0 +1,74 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var Service $response */ + $response = $dataprocMetastoreClient->getService($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 = DataprocMetastoreClient::serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + + get_service_sample($formattedName); +} +// [END metastore_v1_generated_DataprocMetastore_GetService_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreClient/list_backups.php b/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreClient/list_backups.php new file mode 100644 index 000000000000..f7a6f008e91e --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreClient/list_backups.php @@ -0,0 +1,79 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $dataprocMetastoreClient->listBackups($request); + + /** @var Backup $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 = DataprocMetastoreClient::serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + + list_backups_sample($formattedParent); +} +// [END metastore_v1_generated_DataprocMetastore_ListBackups_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreClient/list_locations.php b/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreClient/list_locations.php new file mode 100644 index 000000000000..f5a53eca3bbc --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreClient/list_locations.php @@ -0,0 +1,62 @@ +listLocations($request); + + /** @var Location $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()); + } +} +// [END metastore_v1_generated_DataprocMetastore_ListLocations_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreClient/list_metadata_imports.php b/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreClient/list_metadata_imports.php new file mode 100644 index 000000000000..21854595053b --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreClient/list_metadata_imports.php @@ -0,0 +1,79 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $dataprocMetastoreClient->listMetadataImports($request); + + /** @var MetadataImport $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 = DataprocMetastoreClient::serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + + list_metadata_imports_sample($formattedParent); +} +// [END metastore_v1_generated_DataprocMetastore_ListMetadataImports_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreClient/list_services.php b/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreClient/list_services.php new file mode 100644 index 000000000000..49c1d902e0cc --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreClient/list_services.php @@ -0,0 +1,79 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $dataprocMetastoreClient->listServices($request); + + /** @var Service $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 = DataprocMetastoreClient::locationName('[PROJECT]', '[LOCATION]'); + + list_services_sample($formattedParent); +} +// [END metastore_v1_generated_DataprocMetastore_ListServices_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreClient/restore_service.php b/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreClient/restore_service.php new file mode 100644 index 000000000000..32d7a2306429 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreClient/restore_service.php @@ -0,0 +1,98 @@ +setService($formattedService) + ->setBackup($formattedBackup); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $dataprocMetastoreClient->restoreService($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Restore $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 +{ + $formattedService = DataprocMetastoreClient::serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $formattedBackup = DataprocMetastoreClient::backupName( + '[PROJECT]', + '[LOCATION]', + '[SERVICE]', + '[BACKUP]' + ); + + restore_service_sample($formattedService, $formattedBackup); +} +// [END metastore_v1_generated_DataprocMetastore_RestoreService_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreClient/set_iam_policy.php b/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreClient/set_iam_policy.php new file mode 100644 index 000000000000..121d4cbe31c0 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreClient/set_iam_policy.php @@ -0,0 +1,77 @@ +setResource($resource) + ->setPolicy($policy); + + // Call the API and handle any network failures. + try { + /** @var Policy $response */ + $response = $dataprocMetastoreClient->setIamPolicy($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 +{ + $resource = '[RESOURCE]'; + + set_iam_policy_sample($resource); +} +// [END metastore_v1_generated_DataprocMetastore_SetIamPolicy_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreClient/test_iam_permissions.php b/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreClient/test_iam_permissions.php new file mode 100644 index 000000000000..0de4b26974e3 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreClient/test_iam_permissions.php @@ -0,0 +1,84 @@ +setResource($resource) + ->setPermissions($permissions); + + // Call the API and handle any network failures. + try { + /** @var TestIamPermissionsResponse $response */ + $response = $dataprocMetastoreClient->testIamPermissions($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 +{ + $resource = '[RESOURCE]'; + $permissionsElement = '[PERMISSIONS]'; + + test_iam_permissions_sample($resource, $permissionsElement); +} +// [END metastore_v1_generated_DataprocMetastore_TestIamPermissions_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreClient/update_metadata_import.php b/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreClient/update_metadata_import.php new file mode 100644 index 000000000000..256fffcf68bb --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreClient/update_metadata_import.php @@ -0,0 +1,75 @@ +setUpdateMask($updateMask) + ->setMetadataImport($metadataImport); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $dataprocMetastoreClient->updateMetadataImport($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var MetadataImport $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()); + } +} +// [END metastore_v1_generated_DataprocMetastore_UpdateMetadataImport_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreClient/update_service.php b/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreClient/update_service.php new file mode 100644 index 000000000000..b2efbd27c329 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreClient/update_service.php @@ -0,0 +1,74 @@ +setUpdateMask($updateMask) + ->setService($service); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $dataprocMetastoreClient->updateService($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Service $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()); + } +} +// [END metastore_v1_generated_DataprocMetastore_UpdateService_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreFederationClient/create_federation.php b/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreFederationClient/create_federation.php new file mode 100644 index 000000000000..7f95c0a44129 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreFederationClient/create_federation.php @@ -0,0 +1,96 @@ +setParent($formattedParent) + ->setFederationId($federationId) + ->setFederation($federation); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $dataprocMetastoreFederationClient->createFederation($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Federation $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 +{ + $formattedParent = DataprocMetastoreFederationClient::locationName('[PROJECT]', '[LOCATION]'); + $federationId = '[FEDERATION_ID]'; + + create_federation_sample($formattedParent, $federationId); +} +// [END metastore_v1_generated_DataprocMetastoreFederation_CreateFederation_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreFederationClient/delete_federation.php b/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreFederationClient/delete_federation.php new file mode 100644 index 000000000000..3d71504b0c1f --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreFederationClient/delete_federation.php @@ -0,0 +1,87 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $dataprocMetastoreFederationClient->deleteFederation($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + printf('Operation completed successfully.' . PHP_EOL); + } 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 = DataprocMetastoreFederationClient::federationName( + '[PROJECT]', + '[LOCATION]', + '[FEDERATION]' + ); + + delete_federation_sample($formattedName); +} +// [END metastore_v1_generated_DataprocMetastoreFederation_DeleteFederation_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreFederationClient/get_federation.php b/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreFederationClient/get_federation.php new file mode 100644 index 000000000000..bf619b58bbf6 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreFederationClient/get_federation.php @@ -0,0 +1,78 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var Federation $response */ + $response = $dataprocMetastoreFederationClient->getFederation($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 = DataprocMetastoreFederationClient::federationName( + '[PROJECT]', + '[LOCATION]', + '[FEDERATION]' + ); + + get_federation_sample($formattedName); +} +// [END metastore_v1_generated_DataprocMetastoreFederation_GetFederation_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreFederationClient/get_iam_policy.php b/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreFederationClient/get_iam_policy.php new file mode 100644 index 000000000000..f0d1d9f042cf --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreFederationClient/get_iam_policy.php @@ -0,0 +1,72 @@ +setResource($resource); + + // Call the API and handle any network failures. + try { + /** @var Policy $response */ + $response = $dataprocMetastoreFederationClient->getIamPolicy($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 +{ + $resource = '[RESOURCE]'; + + get_iam_policy_sample($resource); +} +// [END metastore_v1_generated_DataprocMetastoreFederation_GetIamPolicy_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreFederationClient/get_location.php b/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreFederationClient/get_location.php new file mode 100644 index 000000000000..a1af3288dcca --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreFederationClient/get_location.php @@ -0,0 +1,57 @@ +getLocation($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END metastore_v1_generated_DataprocMetastoreFederation_GetLocation_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreFederationClient/list_federations.php b/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreFederationClient/list_federations.php new file mode 100644 index 000000000000..2d46f916433a --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreFederationClient/list_federations.php @@ -0,0 +1,78 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $dataprocMetastoreFederationClient->listFederations($request); + + /** @var Federation $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 = DataprocMetastoreFederationClient::locationName('[PROJECT]', '[LOCATION]'); + + list_federations_sample($formattedParent); +} +// [END metastore_v1_generated_DataprocMetastoreFederation_ListFederations_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreFederationClient/list_locations.php b/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreFederationClient/list_locations.php new file mode 100644 index 000000000000..b712c9799315 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreFederationClient/list_locations.php @@ -0,0 +1,62 @@ +listLocations($request); + + /** @var Location $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()); + } +} +// [END metastore_v1_generated_DataprocMetastoreFederation_ListLocations_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreFederationClient/set_iam_policy.php b/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreFederationClient/set_iam_policy.php new file mode 100644 index 000000000000..3704dbdc607b --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreFederationClient/set_iam_policy.php @@ -0,0 +1,77 @@ +setResource($resource) + ->setPolicy($policy); + + // Call the API and handle any network failures. + try { + /** @var Policy $response */ + $response = $dataprocMetastoreFederationClient->setIamPolicy($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 +{ + $resource = '[RESOURCE]'; + + set_iam_policy_sample($resource); +} +// [END metastore_v1_generated_DataprocMetastoreFederation_SetIamPolicy_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreFederationClient/test_iam_permissions.php b/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreFederationClient/test_iam_permissions.php new file mode 100644 index 000000000000..4e202f857ca6 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreFederationClient/test_iam_permissions.php @@ -0,0 +1,84 @@ +setResource($resource) + ->setPermissions($permissions); + + // Call the API and handle any network failures. + try { + /** @var TestIamPermissionsResponse $response */ + $response = $dataprocMetastoreFederationClient->testIamPermissions($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 +{ + $resource = '[RESOURCE]'; + $permissionsElement = '[PERMISSIONS]'; + + test_iam_permissions_sample($resource, $permissionsElement); +} +// [END metastore_v1_generated_DataprocMetastoreFederation_TestIamPermissions_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreFederationClient/update_federation.php b/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreFederationClient/update_federation.php new file mode 100644 index 000000000000..38e96e951961 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/samples/V1/DataprocMetastoreFederationClient/update_federation.php @@ -0,0 +1,74 @@ +setUpdateMask($updateMask) + ->setFederation($federation); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $dataprocMetastoreFederationClient->updateFederation($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Federation $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()); + } +} +// [END metastore_v1_generated_DataprocMetastoreFederation_UpdateFederation_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1/src/V1/Client/BaseClient/DataprocMetastoreBaseClient.php b/owl-bot-staging/DataprocMetastore/v1/src/V1/Client/BaseClient/DataprocMetastoreBaseClient.php new file mode 100644 index 000000000000..ab3258fefdbd --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/src/V1/Client/BaseClient/DataprocMetastoreBaseClient.php @@ -0,0 +1,899 @@ + self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../../resources/dataproc_metastore_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../../resources/dataproc_metastore_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../../resources/dataproc_metastore_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../../resources/dataproc_metastore_rest_client_config.php', + ], + ], + ]; + } + + /** + * 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 backup + * resource. + * + * @param string $project + * @param string $location + * @param string $service + * @param string $backup + * + * @return string The formatted backup resource. + */ + public static function backupName(string $project, string $location, string $service, string $backup): string + { + return self::getPathTemplate('backup')->render([ + 'project' => $project, + 'location' => $location, + 'service' => $service, + 'backup' => $backup, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a location + * resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted location resource. + */ + public static function locationName(string $project, string $location): string + { + return self::getPathTemplate('location')->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * metadata_import resource. + * + * @param string $project + * @param string $location + * @param string $service + * @param string $metadataImport + * + * @return string The formatted metadata_import resource. + */ + public static function metadataImportName(string $project, string $location, string $service, string $metadataImport): string + { + return self::getPathTemplate('metadataImport')->render([ + 'project' => $project, + 'location' => $location, + 'service' => $service, + 'metadata_import' => $metadataImport, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a network + * resource. + * + * @param string $project + * @param string $network + * + * @return string The formatted network resource. + */ + public static function networkName(string $project, string $network): string + { + return self::getPathTemplate('network')->render([ + 'project' => $project, + 'network' => $network, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a service + * resource. + * + * @param string $project + * @param string $location + * @param string $service + * + * @return string The formatted service resource. + */ + public static function serviceName(string $project, string $location, string $service): string + { + return self::getPathTemplate('service')->render([ + 'project' => $project, + 'location' => $location, + 'service' => $service, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a subnetwork + * resource. + * + * @param string $project + * @param string $region + * @param string $subnetwork + * + * @return string The formatted subnetwork resource. + */ + public static function subnetworkName(string $project, string $region, string $subnetwork): string + { + return self::getPathTemplate('subnetwork')->render([ + 'project' => $project, + 'region' => $region, + 'subnetwork' => $subnetwork, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - backup: projects/{project}/locations/{location}/services/{service}/backups/{backup} + * - location: projects/{project}/locations/{location} + * - metadataImport: projects/{project}/locations/{location}/services/{service}/metadataImports/{metadata_import} + * - network: projects/{project}/global/networks/{network} + * - service: projects/{project}/locations/{location}/services/{service} + * - subnetwork: projects/{project}/regions/{region}/subnetworks/{subnetwork} + * + * 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 'metastore.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. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *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' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods 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 backup in a given project and location. + * + * The async variant is {@see self::createBackupAsync()} . + * + * @param CreateBackupRequest $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 createBackup(CreateBackupRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('CreateBackup', $request, $callOptions)->wait(); + } + + /** + * Creates a new MetadataImport in a given project and location. + * + * The async variant is {@see self::createMetadataImportAsync()} . + * + * @param CreateMetadataImportRequest $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 createMetadataImport(CreateMetadataImportRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('CreateMetadataImport', $request, $callOptions)->wait(); + } + + /** + * Creates a metastore service in a project and location. + * + * The async variant is {@see self::createServiceAsync()} . + * + * @param CreateServiceRequest $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 createService(CreateServiceRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('CreateService', $request, $callOptions)->wait(); + } + + /** + * Deletes a single backup. + * + * The async variant is {@see self::deleteBackupAsync()} . + * + * @param DeleteBackupRequest $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 deleteBackup(DeleteBackupRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('DeleteBackup', $request, $callOptions)->wait(); + } + + /** + * Deletes a single service. + * + * The async variant is {@see self::deleteServiceAsync()} . + * + * @param DeleteServiceRequest $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 deleteService(DeleteServiceRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('DeleteService', $request, $callOptions)->wait(); + } + + /** + * Exports metadata from a service. + * + * The async variant is {@see self::exportMetadataAsync()} . + * + * @param ExportMetadataRequest $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 exportMetadata(ExportMetadataRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('ExportMetadata', $request, $callOptions)->wait(); + } + + /** + * Gets details of a single backup. + * + * The async variant is {@see self::getBackupAsync()} . + * + * @param GetBackupRequest $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 Backup + * + * @throws ApiException Thrown if the API call fails. + */ + public function getBackup(GetBackupRequest $request, array $callOptions = []): Backup + { + return $this->startApiCall('GetBackup', $request, $callOptions)->wait(); + } + + /** + * Gets details of a single import. + * + * The async variant is {@see self::getMetadataImportAsync()} . + * + * @param GetMetadataImportRequest $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 MetadataImport + * + * @throws ApiException Thrown if the API call fails. + */ + public function getMetadataImport(GetMetadataImportRequest $request, array $callOptions = []): MetadataImport + { + return $this->startApiCall('GetMetadataImport', $request, $callOptions)->wait(); + } + + /** + * Gets the details of a single service. + * + * The async variant is {@see self::getServiceAsync()} . + * + * @param GetServiceRequest $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 Service + * + * @throws ApiException Thrown if the API call fails. + */ + public function getService(GetServiceRequest $request, array $callOptions = []): Service + { + return $this->startApiCall('GetService', $request, $callOptions)->wait(); + } + + /** + * Lists backups in a service. + * + * The async variant is {@see self::listBackupsAsync()} . + * + * @param ListBackupsRequest $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 listBackups(ListBackupsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListBackups', $request, $callOptions); + } + + /** + * Lists imports in a service. + * + * The async variant is {@see self::listMetadataImportsAsync()} . + * + * @param ListMetadataImportsRequest $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 listMetadataImports(ListMetadataImportsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListMetadataImports', $request, $callOptions); + } + + /** + * Lists services in a project and location. + * + * The async variant is {@see self::listServicesAsync()} . + * + * @param ListServicesRequest $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 listServices(ListServicesRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListServices', $request, $callOptions); + } + + /** + * Restores a service from a backup. + * + * The async variant is {@see self::restoreServiceAsync()} . + * + * @param RestoreServiceRequest $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 restoreService(RestoreServiceRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('RestoreService', $request, $callOptions)->wait(); + } + + /** + * Updates a single import. + * Only the description field of MetadataImport is supported to be updated. + * + * The async variant is {@see self::updateMetadataImportAsync()} . + * + * @param UpdateMetadataImportRequest $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 updateMetadataImport(UpdateMetadataImportRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('UpdateMetadataImport', $request, $callOptions)->wait(); + } + + /** + * Updates the parameters of a single service. + * + * The async variant is {@see self::updateServiceAsync()} . + * + * @param UpdateServiceRequest $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 updateService(UpdateServiceRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('UpdateService', $request, $callOptions)->wait(); + } + + /** + * Gets information about a location. + * + * The async variant is {@see self::getLocationAsync()} . + * + * @param GetLocationRequest $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 Location + * + * @throws ApiException Thrown if the API call fails. + */ + public function getLocation(GetLocationRequest $request, array $callOptions = []): Location + { + return $this->startApiCall('GetLocation', $request, $callOptions)->wait(); + } + + /** + * Lists information about the supported locations for this service. + * + * The async variant is {@see self::listLocationsAsync()} . + * + * @param ListLocationsRequest $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 listLocations(ListLocationsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListLocations', $request, $callOptions); + } + + /** + * Gets the access control policy for a resource. Returns an empty policy + if the resource exists and does not have a policy set. + * + * The async variant is {@see self::getIamPolicyAsync()} . + * + * @param GetIamPolicyRequest $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 Policy + * + * @throws ApiException Thrown if the API call fails. + */ + public function getIamPolicy(GetIamPolicyRequest $request, array $callOptions = []): Policy + { + return $this->startApiCall('GetIamPolicy', $request, $callOptions)->wait(); + } + + /** + * Sets the access control policy on the specified resource. Replaces + any existing policy. + + Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` + errors. + * + * The async variant is {@see self::setIamPolicyAsync()} . + * + * @param SetIamPolicyRequest $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 Policy + * + * @throws ApiException Thrown if the API call fails. + */ + public function setIamPolicy(SetIamPolicyRequest $request, array $callOptions = []): Policy + { + return $this->startApiCall('SetIamPolicy', $request, $callOptions)->wait(); + } + + /** + * Returns permissions that a caller has on the specified resource. If the + resource does not exist, this will return an empty set of + permissions, not a `NOT_FOUND` error. + + Note: This operation is designed to be used for building + permission-aware UIs and command-line tools, not for authorization + checking. This operation may "fail open" without warning. + * + * The async variant is {@see self::testIamPermissionsAsync()} . + * + * @param TestIamPermissionsRequest $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 TestIamPermissionsResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function testIamPermissions(TestIamPermissionsRequest $request, array $callOptions = []): TestIamPermissionsResponse + { + return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); + } +} diff --git a/owl-bot-staging/DataprocMetastore/v1/src/V1/Client/BaseClient/DataprocMetastoreFederationBaseClient.php b/owl-bot-staging/DataprocMetastore/v1/src/V1/Client/BaseClient/DataprocMetastoreFederationBaseClient.php new file mode 100644 index 000000000000..36ababa04e23 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/src/V1/Client/BaseClient/DataprocMetastoreFederationBaseClient.php @@ -0,0 +1,550 @@ + self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../../resources/dataproc_metastore_federation_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../../resources/dataproc_metastore_federation_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../../resources/dataproc_metastore_federation_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../../resources/dataproc_metastore_federation_rest_client_config.php', + ], + ], + ]; + } + + /** + * 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 federation + * resource. + * + * @param string $project + * @param string $location + * @param string $federation + * + * @return string The formatted federation resource. + */ + public static function federationName(string $project, string $location, string $federation): string + { + return self::getPathTemplate('federation')->render([ + 'project' => $project, + 'location' => $location, + 'federation' => $federation, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a location + * resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted location resource. + */ + public static function locationName(string $project, string $location): string + { + return self::getPathTemplate('location')->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - federation: projects/{project}/locations/{location}/federations/{federation} + * - location: projects/{project}/locations/{location} + * + * 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 'metastore.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. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *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' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods 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 metastore federation in a project and location. + * + * The async variant is {@see self::createFederationAsync()} . + * + * @param CreateFederationRequest $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 createFederation(CreateFederationRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('CreateFederation', $request, $callOptions)->wait(); + } + + /** + * Deletes a single federation. + * + * The async variant is {@see self::deleteFederationAsync()} . + * + * @param DeleteFederationRequest $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 deleteFederation(DeleteFederationRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('DeleteFederation', $request, $callOptions)->wait(); + } + + /** + * Gets the details of a single federation. + * + * The async variant is {@see self::getFederationAsync()} . + * + * @param GetFederationRequest $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 Federation + * + * @throws ApiException Thrown if the API call fails. + */ + public function getFederation(GetFederationRequest $request, array $callOptions = []): Federation + { + return $this->startApiCall('GetFederation', $request, $callOptions)->wait(); + } + + /** + * Lists federations in a project and location. + * + * The async variant is {@see self::listFederationsAsync()} . + * + * @param ListFederationsRequest $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 listFederations(ListFederationsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListFederations', $request, $callOptions); + } + + /** + * Updates the fields of a federation. + * + * The async variant is {@see self::updateFederationAsync()} . + * + * @param UpdateFederationRequest $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 updateFederation(UpdateFederationRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('UpdateFederation', $request, $callOptions)->wait(); + } + + /** + * Gets information about a location. + * + * The async variant is {@see self::getLocationAsync()} . + * + * @param GetLocationRequest $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 Location + * + * @throws ApiException Thrown if the API call fails. + */ + public function getLocation(GetLocationRequest $request, array $callOptions = []): Location + { + return $this->startApiCall('GetLocation', $request, $callOptions)->wait(); + } + + /** + * Lists information about the supported locations for this service. + * + * The async variant is {@see self::listLocationsAsync()} . + * + * @param ListLocationsRequest $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 listLocations(ListLocationsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListLocations', $request, $callOptions); + } + + /** + * Gets the access control policy for a resource. Returns an empty policy + if the resource exists and does not have a policy set. + * + * The async variant is {@see self::getIamPolicyAsync()} . + * + * @param GetIamPolicyRequest $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 Policy + * + * @throws ApiException Thrown if the API call fails. + */ + public function getIamPolicy(GetIamPolicyRequest $request, array $callOptions = []): Policy + { + return $this->startApiCall('GetIamPolicy', $request, $callOptions)->wait(); + } + + /** + * Sets the access control policy on the specified resource. Replaces + any existing policy. + + Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` + errors. + * + * The async variant is {@see self::setIamPolicyAsync()} . + * + * @param SetIamPolicyRequest $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 Policy + * + * @throws ApiException Thrown if the API call fails. + */ + public function setIamPolicy(SetIamPolicyRequest $request, array $callOptions = []): Policy + { + return $this->startApiCall('SetIamPolicy', $request, $callOptions)->wait(); + } + + /** + * Returns permissions that a caller has on the specified resource. If the + resource does not exist, this will return an empty set of + permissions, not a `NOT_FOUND` error. + + Note: This operation is designed to be used for building + permission-aware UIs and command-line tools, not for authorization + checking. This operation may "fail open" without warning. + * + * The async variant is {@see self::testIamPermissionsAsync()} . + * + * @param TestIamPermissionsRequest $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 TestIamPermissionsResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function testIamPermissions(TestIamPermissionsRequest $request, array $callOptions = []): TestIamPermissionsResponse + { + return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); + } +} diff --git a/owl-bot-staging/DataprocMetastore/v1/src/V1/Client/DataprocMetastoreClient.php b/owl-bot-staging/DataprocMetastore/v1/src/V1/Client/DataprocMetastoreClient.php new file mode 100644 index 000000000000..6b5a5912c86c --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/src/V1/Client/DataprocMetastoreClient.php @@ -0,0 +1,40 @@ +locationName('[PROJECT]', '[LOCATION]'); + * $federationId = 'federation_id'; + * $federation = new Federation(); + * $operationResponse = $dataprocMetastoreFederationClient->createFederation($formattedParent, $federationId, $federation); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $dataprocMetastoreFederationClient->createFederation($formattedParent, $federationId, $federation); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $dataprocMetastoreFederationClient->resumeOperation($operationName, 'createFederation'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $dataprocMetastoreFederationClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + */ +class DataprocMetastoreFederationGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.metastore.v1.DataprocMetastoreFederation'; + + /** The default address of the service. */ + const SERVICE_ADDRESS = 'metastore.googleapis.com'; + + /** The default port of the service. */ + const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + ]; + + private static $federationNameTemplate; + + private static $locationNameTemplate; + + private static $pathTemplateMap; + + private $operationsClient; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/dataproc_metastore_federation_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/dataproc_metastore_federation_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/dataproc_metastore_federation_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/dataproc_metastore_federation_rest_client_config.php', + ], + ], + ]; + } + + private static function getFederationNameTemplate() + { + if (self::$federationNameTemplate == null) { + self::$federationNameTemplate = new PathTemplate('projects/{project}/locations/{location}/federations/{federation}'); + } + + return self::$federationNameTemplate; + } + + private static function getLocationNameTemplate() + { + if (self::$locationNameTemplate == null) { + self::$locationNameTemplate = new PathTemplate('projects/{project}/locations/{location}'); + } + + return self::$locationNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'federation' => self::getFederationNameTemplate(), + 'location' => self::getLocationNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a federation + * resource. + * + * @param string $project + * @param string $location + * @param string $federation + * + * @return string The formatted federation resource. + */ + public static function federationName($project, $location, $federation) + { + return self::getFederationNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'federation' => $federation, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a location + * resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted location resource. + */ + public static function locationName($project, $location) + { + return self::getLocationNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - federation: projects/{project}/locations/{location}/federations/{federation} + * - location: projects/{project}/locations/{location} + * + * 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($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * 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; + } + + /** + * 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 'metastore.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. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *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' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods 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); + } + + /** + * Creates a metastore federation in a project and location. + * + * Sample code: + * ``` + * $dataprocMetastoreFederationClient = new DataprocMetastoreFederationClient(); + * try { + * $formattedParent = $dataprocMetastoreFederationClient->locationName('[PROJECT]', '[LOCATION]'); + * $federationId = 'federation_id'; + * $federation = new Federation(); + * $operationResponse = $dataprocMetastoreFederationClient->createFederation($formattedParent, $federationId, $federation); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $dataprocMetastoreFederationClient->createFederation($formattedParent, $federationId, $federation); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $dataprocMetastoreFederationClient->resumeOperation($operationName, 'createFederation'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $dataprocMetastoreFederationClient->close(); + * } + * ``` + * + * @param string $parent Required. The relative resource name of the location in which to create a + * federation service, in the following form: + * + * `projects/{project_number}/locations/{location_id}`. + * @param string $federationId Required. The ID of the metastore federation, which is used as the final + * component of the metastore federation's name. + * + * This value must be between 2 and 63 characters long inclusive, begin with a + * letter, end with a letter or number, and consist of alpha-numeric + * ASCII characters or hyphens. + * @param Federation $federation Required. The Metastore Federation to create. The `name` field is + * ignored. The ID of the created metastore federation must be + * provided in the request's `federation_id` field. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function createFederation($parent, $federationId, $federation, array $optionalArgs = []) + { + $request = new CreateFederationRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setFederationId($federationId); + $request->setFederation($federation); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateFederation', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Deletes a single federation. + * + * Sample code: + * ``` + * $dataprocMetastoreFederationClient = new DataprocMetastoreFederationClient(); + * try { + * $formattedName = $dataprocMetastoreFederationClient->federationName('[PROJECT]', '[LOCATION]', '[FEDERATION]'); + * $operationResponse = $dataprocMetastoreFederationClient->deleteFederation($formattedName); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $dataprocMetastoreFederationClient->deleteFederation($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $dataprocMetastoreFederationClient->resumeOperation($operationName, 'deleteFederation'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $dataprocMetastoreFederationClient->close(); + * } + * ``` + * + * @param string $name Required. The relative resource name of the metastore federation to delete, + * in the following form: + * + * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function deleteFederation($name, array $optionalArgs = []) + { + $request = new DeleteFederationRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('DeleteFederation', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Gets the details of a single federation. + * + * Sample code: + * ``` + * $dataprocMetastoreFederationClient = new DataprocMetastoreFederationClient(); + * try { + * $formattedName = $dataprocMetastoreFederationClient->federationName('[PROJECT]', '[LOCATION]', '[FEDERATION]'); + * $response = $dataprocMetastoreFederationClient->getFederation($formattedName); + * } finally { + * $dataprocMetastoreFederationClient->close(); + * } + * ``` + * + * @param string $name Required. The relative resource name of the metastore federation to + * retrieve, in the following form: + * + * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + * @param array $optionalArgs { + * 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 \Google\Cloud\Metastore\V1\Federation + * + * @throws ApiException if the remote call fails + */ + public function getFederation($name, array $optionalArgs = []) + { + $request = new GetFederationRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetFederation', Federation::class, $optionalArgs, $request)->wait(); + } + + /** + * Lists federations in a project and location. + * + * Sample code: + * ``` + * $dataprocMetastoreFederationClient = new DataprocMetastoreFederationClient(); + * try { + * $formattedParent = $dataprocMetastoreFederationClient->locationName('[PROJECT]', '[LOCATION]'); + * // Iterate over pages of elements + * $pagedResponse = $dataprocMetastoreFederationClient->listFederations($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $dataprocMetastoreFederationClient->listFederations($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $dataprocMetastoreFederationClient->close(); + * } + * ``` + * + * @param string $parent Required. The relative resource name of the location of metastore + * federations to list, in the following form: + * `projects/{project_number}/locations/{location_id}`. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type string $filter + * Optional. The filter to apply to list results. + * @type string $orderBy + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @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 \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listFederations($parent, array $optionalArgs = []) + { + $request = new ListFederationsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListFederations', $optionalArgs, ListFederationsResponse::class, $request); + } + + /** + * Updates the fields of a federation. + * + * Sample code: + * ``` + * $dataprocMetastoreFederationClient = new DataprocMetastoreFederationClient(); + * try { + * $updateMask = new FieldMask(); + * $federation = new Federation(); + * $operationResponse = $dataprocMetastoreFederationClient->updateFederation($updateMask, $federation); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $dataprocMetastoreFederationClient->updateFederation($updateMask, $federation); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $dataprocMetastoreFederationClient->resumeOperation($operationName, 'updateFederation'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $dataprocMetastoreFederationClient->close(); + * } + * ``` + * + * @param FieldMask $updateMask Required. A field mask used to specify the fields to be overwritten in the + * metastore federation resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + * @param Federation $federation Required. The metastore federation to update. The server only merges fields + * in the service if they are specified in `update_mask`. + * + * The metastore federation's `name` field is used to identify the + * metastore service to be updated. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function updateFederation($updateMask, $federation, array $optionalArgs = []) + { + $request = new UpdateFederationRequest(); + $requestParamHeaders = []; + $request->setUpdateMask($updateMask); + $request->setFederation($federation); + $requestParamHeaders['federation.name'] = $federation->getName(); + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('UpdateFederation', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Gets information about a location. + * + * Sample code: + * ``` + * $dataprocMetastoreFederationClient = new DataprocMetastoreFederationClient(); + * try { + * $response = $dataprocMetastoreFederationClient->getLocation(); + * } finally { + * $dataprocMetastoreFederationClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * Resource name for the location. + * @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 \Google\Cloud\Location\Location + * + * @throws ApiException if the remote call fails + */ + public function getLocation(array $optionalArgs = []) + { + $request = new GetLocationRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetLocation', Location::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.cloud.location.Locations')->wait(); + } + + /** + * Lists information about the supported locations for this service. + * + * Sample code: + * ``` + * $dataprocMetastoreFederationClient = new DataprocMetastoreFederationClient(); + * try { + * // Iterate over pages of elements + * $pagedResponse = $dataprocMetastoreFederationClient->listLocations(); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $dataprocMetastoreFederationClient->listLocations(); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $dataprocMetastoreFederationClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * The resource that owns the locations collection, if applicable. + * @type string $filter + * The standard list filter. + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @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 \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listLocations(array $optionalArgs = []) + { + $request = new ListLocationsRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListLocations', $optionalArgs, ListLocationsResponse::class, $request, 'google.cloud.location.Locations'); + } + + /** + * Gets the access control policy for a resource. Returns an empty policy + if the resource exists and does not have a policy set. + * + * Sample code: + * ``` + * $dataprocMetastoreFederationClient = new DataprocMetastoreFederationClient(); + * try { + * $resource = 'resource'; + * $response = $dataprocMetastoreFederationClient->getIamPolicy($resource); + * } finally { + * $dataprocMetastoreFederationClient->close(); + * } + * ``` + * + * @param string $resource REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param array $optionalArgs { + * Optional. + * + * @type GetPolicyOptions $options + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. + * @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 \Google\Cloud\Iam\V1\Policy + * + * @throws ApiException if the remote call fails + */ + public function getIamPolicy($resource, array $optionalArgs = []) + { + $request = new GetIamPolicyRequest(); + $requestParamHeaders = []; + $request->setResource($resource); + $requestParamHeaders['resource'] = $resource; + if (isset($optionalArgs['options'])) { + $request->setOptions($optionalArgs['options']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetIamPolicy', Policy::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.iam.v1.IAMPolicy')->wait(); + } + + /** + * Sets the access control policy on the specified resource. Replaces + any existing policy. + + Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` + errors. + * + * Sample code: + * ``` + * $dataprocMetastoreFederationClient = new DataprocMetastoreFederationClient(); + * try { + * $resource = 'resource'; + * $policy = new Policy(); + * $response = $dataprocMetastoreFederationClient->setIamPolicy($resource, $policy); + * } finally { + * $dataprocMetastoreFederationClient->close(); + * } + * ``` + * + * @param string $resource REQUIRED: The resource for which the policy is being specified. + * See the operation documentation for the appropriate value for this field. + * @param Policy $policy REQUIRED: The complete policy to be applied to the `resource`. The size of + * the policy is limited to a few 10s of KB. An empty policy is a + * valid policy but certain Cloud Platform services (such as Projects) + * might reject them. + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only + * the fields in the mask will be modified. If no mask is provided, the + * following default mask is used: + * + * `paths: "bindings, etag"` + * @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 \Google\Cloud\Iam\V1\Policy + * + * @throws ApiException if the remote call fails + */ + public function setIamPolicy($resource, $policy, array $optionalArgs = []) + { + $request = new SetIamPolicyRequest(); + $requestParamHeaders = []; + $request->setResource($resource); + $request->setPolicy($policy); + $requestParamHeaders['resource'] = $resource; + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('SetIamPolicy', Policy::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.iam.v1.IAMPolicy')->wait(); + } + + /** + * Returns permissions that a caller has on the specified resource. If the + resource does not exist, this will return an empty set of + permissions, not a `NOT_FOUND` error. + + Note: This operation is designed to be used for building + permission-aware UIs and command-line tools, not for authorization + checking. This operation may "fail open" without warning. + * + * Sample code: + * ``` + * $dataprocMetastoreFederationClient = new DataprocMetastoreFederationClient(); + * try { + * $resource = 'resource'; + * $permissions = []; + * $response = $dataprocMetastoreFederationClient->testIamPermissions($resource, $permissions); + * } finally { + * $dataprocMetastoreFederationClient->close(); + * } + * ``` + * + * @param string $resource REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param string[] $permissions The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @param array $optionalArgs { + * 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 \Google\Cloud\Iam\V1\TestIamPermissionsResponse + * + * @throws ApiException if the remote call fails + */ + public function testIamPermissions($resource, $permissions, array $optionalArgs = []) + { + $request = new TestIamPermissionsRequest(); + $requestParamHeaders = []; + $request->setResource($resource); + $request->setPermissions($permissions); + $requestParamHeaders['resource'] = $resource; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('TestIamPermissions', TestIamPermissionsResponse::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.iam.v1.IAMPolicy')->wait(); + } +} diff --git a/owl-bot-staging/DataprocMetastore/v1/src/V1/Gapic/DataprocMetastoreGapicClient.php b/owl-bot-staging/DataprocMetastore/v1/src/V1/Gapic/DataprocMetastoreGapicClient.php new file mode 100644 index 000000000000..de50ae7aa8e6 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/src/V1/Gapic/DataprocMetastoreGapicClient.php @@ -0,0 +1,2008 @@ +serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + * $backupId = 'backup_id'; + * $backup = new Backup(); + * $operationResponse = $dataprocMetastoreClient->createBackup($formattedParent, $backupId, $backup); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $dataprocMetastoreClient->createBackup($formattedParent, $backupId, $backup); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $dataprocMetastoreClient->resumeOperation($operationName, 'createBackup'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $dataprocMetastoreClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + */ +class DataprocMetastoreGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.metastore.v1.DataprocMetastore'; + + /** The default address of the service. */ + const SERVICE_ADDRESS = 'metastore.googleapis.com'; + + /** The default port of the service. */ + const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + ]; + + private static $backupNameTemplate; + + private static $locationNameTemplate; + + private static $metadataImportNameTemplate; + + private static $networkNameTemplate; + + private static $serviceNameTemplate; + + private static $subnetworkNameTemplate; + + private static $pathTemplateMap; + + private $operationsClient; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/dataproc_metastore_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/dataproc_metastore_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/dataproc_metastore_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/dataproc_metastore_rest_client_config.php', + ], + ], + ]; + } + + private static function getBackupNameTemplate() + { + if (self::$backupNameTemplate == null) { + self::$backupNameTemplate = new PathTemplate('projects/{project}/locations/{location}/services/{service}/backups/{backup}'); + } + + return self::$backupNameTemplate; + } + + private static function getLocationNameTemplate() + { + if (self::$locationNameTemplate == null) { + self::$locationNameTemplate = new PathTemplate('projects/{project}/locations/{location}'); + } + + return self::$locationNameTemplate; + } + + private static function getMetadataImportNameTemplate() + { + if (self::$metadataImportNameTemplate == null) { + self::$metadataImportNameTemplate = new PathTemplate('projects/{project}/locations/{location}/services/{service}/metadataImports/{metadata_import}'); + } + + return self::$metadataImportNameTemplate; + } + + private static function getNetworkNameTemplate() + { + if (self::$networkNameTemplate == null) { + self::$networkNameTemplate = new PathTemplate('projects/{project}/global/networks/{network}'); + } + + return self::$networkNameTemplate; + } + + private static function getServiceNameTemplate() + { + if (self::$serviceNameTemplate == null) { + self::$serviceNameTemplate = new PathTemplate('projects/{project}/locations/{location}/services/{service}'); + } + + return self::$serviceNameTemplate; + } + + private static function getSubnetworkNameTemplate() + { + if (self::$subnetworkNameTemplate == null) { + self::$subnetworkNameTemplate = new PathTemplate('projects/{project}/regions/{region}/subnetworks/{subnetwork}'); + } + + return self::$subnetworkNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'backup' => self::getBackupNameTemplate(), + 'location' => self::getLocationNameTemplate(), + 'metadataImport' => self::getMetadataImportNameTemplate(), + 'network' => self::getNetworkNameTemplate(), + 'service' => self::getServiceNameTemplate(), + 'subnetwork' => self::getSubnetworkNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a backup + * resource. + * + * @param string $project + * @param string $location + * @param string $service + * @param string $backup + * + * @return string The formatted backup resource. + */ + public static function backupName($project, $location, $service, $backup) + { + return self::getBackupNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'service' => $service, + 'backup' => $backup, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a location + * resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted location resource. + */ + public static function locationName($project, $location) + { + return self::getLocationNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * metadata_import resource. + * + * @param string $project + * @param string $location + * @param string $service + * @param string $metadataImport + * + * @return string The formatted metadata_import resource. + */ + public static function metadataImportName($project, $location, $service, $metadataImport) + { + return self::getMetadataImportNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'service' => $service, + 'metadata_import' => $metadataImport, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a network + * resource. + * + * @param string $project + * @param string $network + * + * @return string The formatted network resource. + */ + public static function networkName($project, $network) + { + return self::getNetworkNameTemplate()->render([ + 'project' => $project, + 'network' => $network, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a service + * resource. + * + * @param string $project + * @param string $location + * @param string $service + * + * @return string The formatted service resource. + */ + public static function serviceName($project, $location, $service) + { + return self::getServiceNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'service' => $service, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a subnetwork + * resource. + * + * @param string $project + * @param string $region + * @param string $subnetwork + * + * @return string The formatted subnetwork resource. + */ + public static function subnetworkName($project, $region, $subnetwork) + { + return self::getSubnetworkNameTemplate()->render([ + 'project' => $project, + 'region' => $region, + 'subnetwork' => $subnetwork, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - backup: projects/{project}/locations/{location}/services/{service}/backups/{backup} + * - location: projects/{project}/locations/{location} + * - metadataImport: projects/{project}/locations/{location}/services/{service}/metadataImports/{metadata_import} + * - network: projects/{project}/global/networks/{network} + * - service: projects/{project}/locations/{location}/services/{service} + * - subnetwork: projects/{project}/regions/{region}/subnetworks/{subnetwork} + * + * 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($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * 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; + } + + /** + * 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 'metastore.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. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *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' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods 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); + } + + /** + * Creates a new backup in a given project and location. + * + * Sample code: + * ``` + * $dataprocMetastoreClient = new DataprocMetastoreClient(); + * try { + * $formattedParent = $dataprocMetastoreClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + * $backupId = 'backup_id'; + * $backup = new Backup(); + * $operationResponse = $dataprocMetastoreClient->createBackup($formattedParent, $backupId, $backup); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $dataprocMetastoreClient->createBackup($formattedParent, $backupId, $backup); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $dataprocMetastoreClient->resumeOperation($operationName, 'createBackup'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $dataprocMetastoreClient->close(); + * } + * ``` + * + * @param string $parent Required. The relative resource name of the service in which to create a + * backup of the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * @param string $backupId Required. The ID of the backup, which is used as the final component of the + * backup's name. + * + * This value must be between 1 and 64 characters long, begin with a letter, + * end with a letter or number, and consist of alpha-numeric ASCII characters + * or hyphens. + * @param Backup $backup Required. The backup to create. The `name` field is ignored. The ID of the + * created backup must be provided in the request's `backup_id` field. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function createBackup($parent, $backupId, $backup, array $optionalArgs = []) + { + $request = new CreateBackupRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setBackupId($backupId); + $request->setBackup($backup); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateBackup', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Creates a new MetadataImport in a given project and location. + * + * Sample code: + * ``` + * $dataprocMetastoreClient = new DataprocMetastoreClient(); + * try { + * $formattedParent = $dataprocMetastoreClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + * $metadataImportId = 'metadata_import_id'; + * $metadataImport = new MetadataImport(); + * $operationResponse = $dataprocMetastoreClient->createMetadataImport($formattedParent, $metadataImportId, $metadataImport); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $dataprocMetastoreClient->createMetadataImport($formattedParent, $metadataImportId, $metadataImport); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $dataprocMetastoreClient->resumeOperation($operationName, 'createMetadataImport'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $dataprocMetastoreClient->close(); + * } + * ``` + * + * @param string $parent Required. The relative resource name of the service in which to create a + * metastore import, in the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * @param string $metadataImportId Required. The ID of the metadata import, which is used as the final + * component of the metadata import's name. + * + * This value must be between 1 and 64 characters long, begin with a letter, + * end with a letter or number, and consist of alpha-numeric ASCII characters + * or hyphens. + * @param MetadataImport $metadataImport Required. The metadata import to create. The `name` field is ignored. The + * ID of the created metadata import must be provided in the request's + * `metadata_import_id` field. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function createMetadataImport($parent, $metadataImportId, $metadataImport, array $optionalArgs = []) + { + $request = new CreateMetadataImportRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setMetadataImportId($metadataImportId); + $request->setMetadataImport($metadataImport); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateMetadataImport', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Creates a metastore service in a project and location. + * + * Sample code: + * ``` + * $dataprocMetastoreClient = new DataprocMetastoreClient(); + * try { + * $formattedParent = $dataprocMetastoreClient->locationName('[PROJECT]', '[LOCATION]'); + * $serviceId = 'service_id'; + * $service = new Service(); + * $operationResponse = $dataprocMetastoreClient->createService($formattedParent, $serviceId, $service); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $dataprocMetastoreClient->createService($formattedParent, $serviceId, $service); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $dataprocMetastoreClient->resumeOperation($operationName, 'createService'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $dataprocMetastoreClient->close(); + * } + * ``` + * + * @param string $parent Required. The relative resource name of the location in which to create a + * metastore service, in the following form: + * + * `projects/{project_number}/locations/{location_id}`. + * @param string $serviceId Required. The ID of the metastore service, which is used as the final + * component of the metastore service's name. + * + * This value must be between 2 and 63 characters long inclusive, begin with a + * letter, end with a letter or number, and consist of alpha-numeric + * ASCII characters or hyphens. + * @param Service $service Required. The Metastore service to create. The `name` field is + * ignored. The ID of the created metastore service must be provided in + * the request's `service_id` field. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function createService($parent, $serviceId, $service, array $optionalArgs = []) + { + $request = new CreateServiceRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setServiceId($serviceId); + $request->setService($service); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateService', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Deletes a single backup. + * + * Sample code: + * ``` + * $dataprocMetastoreClient = new DataprocMetastoreClient(); + * try { + * $formattedName = $dataprocMetastoreClient->backupName('[PROJECT]', '[LOCATION]', '[SERVICE]', '[BACKUP]'); + * $operationResponse = $dataprocMetastoreClient->deleteBackup($formattedName); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $dataprocMetastoreClient->deleteBackup($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $dataprocMetastoreClient->resumeOperation($operationName, 'deleteBackup'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $dataprocMetastoreClient->close(); + * } + * ``` + * + * @param string $name Required. The relative resource name of the backup to delete, in the + * following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function deleteBackup($name, array $optionalArgs = []) + { + $request = new DeleteBackupRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('DeleteBackup', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Deletes a single service. + * + * Sample code: + * ``` + * $dataprocMetastoreClient = new DataprocMetastoreClient(); + * try { + * $formattedName = $dataprocMetastoreClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + * $operationResponse = $dataprocMetastoreClient->deleteService($formattedName); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $dataprocMetastoreClient->deleteService($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $dataprocMetastoreClient->resumeOperation($operationName, 'deleteService'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $dataprocMetastoreClient->close(); + * } + * ``` + * + * @param string $name Required. The relative resource name of the metastore service to delete, in + * the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function deleteService($name, array $optionalArgs = []) + { + $request = new DeleteServiceRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('DeleteService', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Exports metadata from a service. + * + * Sample code: + * ``` + * $dataprocMetastoreClient = new DataprocMetastoreClient(); + * try { + * $formattedService = $dataprocMetastoreClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + * $operationResponse = $dataprocMetastoreClient->exportMetadata($formattedService); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $dataprocMetastoreClient->exportMetadata($formattedService); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $dataprocMetastoreClient->resumeOperation($operationName, 'exportMetadata'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $dataprocMetastoreClient->close(); + * } + * ``` + * + * @param string $service Required. The relative resource name of the metastore service to run + * export, in the following form: + * + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * @param array $optionalArgs { + * Optional. + * + * @type string $destinationGcsFolder + * A Cloud Storage URI of a folder, in the format + * `gs:///`. A sub-folder + * `` containing exported files will be created below it. + * @type string $requestId + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @type int $databaseDumpType + * Optional. The type of the database dump. If unspecified, defaults to + * `MYSQL`. + * For allowed values, use constants defined on {@see \Google\Cloud\Metastore\V1\DatabaseDumpSpec\Type} + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function exportMetadata($service, array $optionalArgs = []) + { + $request = new ExportMetadataRequest(); + $requestParamHeaders = []; + $request->setService($service); + $requestParamHeaders['service'] = $service; + if (isset($optionalArgs['destinationGcsFolder'])) { + $request->setDestinationGcsFolder($optionalArgs['destinationGcsFolder']); + } + + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + if (isset($optionalArgs['databaseDumpType'])) { + $request->setDatabaseDumpType($optionalArgs['databaseDumpType']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('ExportMetadata', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Gets details of a single backup. + * + * Sample code: + * ``` + * $dataprocMetastoreClient = new DataprocMetastoreClient(); + * try { + * $formattedName = $dataprocMetastoreClient->backupName('[PROJECT]', '[LOCATION]', '[SERVICE]', '[BACKUP]'); + * $response = $dataprocMetastoreClient->getBackup($formattedName); + * } finally { + * $dataprocMetastoreClient->close(); + * } + * ``` + * + * @param string $name Required. The relative resource name of the backup to retrieve, in the + * following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + * @param array $optionalArgs { + * 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 \Google\Cloud\Metastore\V1\Backup + * + * @throws ApiException if the remote call fails + */ + public function getBackup($name, array $optionalArgs = []) + { + $request = new GetBackupRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetBackup', Backup::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets details of a single import. + * + * Sample code: + * ``` + * $dataprocMetastoreClient = new DataprocMetastoreClient(); + * try { + * $formattedName = $dataprocMetastoreClient->metadataImportName('[PROJECT]', '[LOCATION]', '[SERVICE]', '[METADATA_IMPORT]'); + * $response = $dataprocMetastoreClient->getMetadataImport($formattedName); + * } finally { + * $dataprocMetastoreClient->close(); + * } + * ``` + * + * @param string $name Required. The relative resource name of the metadata import to retrieve, in + * the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{import_id}`. + * @param array $optionalArgs { + * 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 \Google\Cloud\Metastore\V1\MetadataImport + * + * @throws ApiException if the remote call fails + */ + public function getMetadataImport($name, array $optionalArgs = []) + { + $request = new GetMetadataImportRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetMetadataImport', MetadataImport::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets the details of a single service. + * + * Sample code: + * ``` + * $dataprocMetastoreClient = new DataprocMetastoreClient(); + * try { + * $formattedName = $dataprocMetastoreClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + * $response = $dataprocMetastoreClient->getService($formattedName); + * } finally { + * $dataprocMetastoreClient->close(); + * } + * ``` + * + * @param string $name Required. The relative resource name of the metastore service to retrieve, + * in the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * @param array $optionalArgs { + * 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 \Google\Cloud\Metastore\V1\Service + * + * @throws ApiException if the remote call fails + */ + public function getService($name, array $optionalArgs = []) + { + $request = new GetServiceRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetService', Service::class, $optionalArgs, $request)->wait(); + } + + /** + * Lists backups in a service. + * + * Sample code: + * ``` + * $dataprocMetastoreClient = new DataprocMetastoreClient(); + * try { + * $formattedParent = $dataprocMetastoreClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + * // Iterate over pages of elements + * $pagedResponse = $dataprocMetastoreClient->listBackups($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $dataprocMetastoreClient->listBackups($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $dataprocMetastoreClient->close(); + * } + * ``` + * + * @param string $parent Required. The relative resource name of the service whose backups to + * list, in the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type string $filter + * Optional. The filter to apply to list results. + * @type string $orderBy + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @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 \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listBackups($parent, array $optionalArgs = []) + { + $request = new ListBackupsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListBackups', $optionalArgs, ListBackupsResponse::class, $request); + } + + /** + * Lists imports in a service. + * + * Sample code: + * ``` + * $dataprocMetastoreClient = new DataprocMetastoreClient(); + * try { + * $formattedParent = $dataprocMetastoreClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + * // Iterate over pages of elements + * $pagedResponse = $dataprocMetastoreClient->listMetadataImports($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $dataprocMetastoreClient->listMetadataImports($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $dataprocMetastoreClient->close(); + * } + * ``` + * + * @param string $parent Required. The relative resource name of the service whose metadata imports + * to list, in the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type string $filter + * Optional. The filter to apply to list results. + * @type string $orderBy + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @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 \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listMetadataImports($parent, array $optionalArgs = []) + { + $request = new ListMetadataImportsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListMetadataImports', $optionalArgs, ListMetadataImportsResponse::class, $request); + } + + /** + * Lists services in a project and location. + * + * Sample code: + * ``` + * $dataprocMetastoreClient = new DataprocMetastoreClient(); + * try { + * $formattedParent = $dataprocMetastoreClient->locationName('[PROJECT]', '[LOCATION]'); + * // Iterate over pages of elements + * $pagedResponse = $dataprocMetastoreClient->listServices($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $dataprocMetastoreClient->listServices($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $dataprocMetastoreClient->close(); + * } + * ``` + * + * @param string $parent Required. The relative resource name of the location of metastore services + * to list, in the following form: + * + * `projects/{project_number}/locations/{location_id}`. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type string $filter + * Optional. The filter to apply to list results. + * @type string $orderBy + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @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 \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listServices($parent, array $optionalArgs = []) + { + $request = new ListServicesRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListServices', $optionalArgs, ListServicesResponse::class, $request); + } + + /** + * Restores a service from a backup. + * + * Sample code: + * ``` + * $dataprocMetastoreClient = new DataprocMetastoreClient(); + * try { + * $formattedService = $dataprocMetastoreClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + * $formattedBackup = $dataprocMetastoreClient->backupName('[PROJECT]', '[LOCATION]', '[SERVICE]', '[BACKUP]'); + * $operationResponse = $dataprocMetastoreClient->restoreService($formattedService, $formattedBackup); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $dataprocMetastoreClient->restoreService($formattedService, $formattedBackup); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $dataprocMetastoreClient->resumeOperation($operationName, 'restoreService'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $dataprocMetastoreClient->close(); + * } + * ``` + * + * @param string $service Required. The relative resource name of the metastore service to run + * restore, in the following form: + * + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * @param string $backup Required. The relative resource name of the metastore service backup to + * restore from, in the following form: + * + * `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + * @param array $optionalArgs { + * Optional. + * + * @type int $restoreType + * Optional. The type of restore. If unspecified, defaults to `METADATA_ONLY`. + * For allowed values, use constants defined on {@see \Google\Cloud\Metastore\V1\Restore\RestoreType} + * @type string $requestId + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function restoreService($service, $backup, array $optionalArgs = []) + { + $request = new RestoreServiceRequest(); + $requestParamHeaders = []; + $request->setService($service); + $request->setBackup($backup); + $requestParamHeaders['service'] = $service; + if (isset($optionalArgs['restoreType'])) { + $request->setRestoreType($optionalArgs['restoreType']); + } + + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('RestoreService', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Updates a single import. + * Only the description field of MetadataImport is supported to be updated. + * + * Sample code: + * ``` + * $dataprocMetastoreClient = new DataprocMetastoreClient(); + * try { + * $updateMask = new FieldMask(); + * $metadataImport = new MetadataImport(); + * $operationResponse = $dataprocMetastoreClient->updateMetadataImport($updateMask, $metadataImport); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $dataprocMetastoreClient->updateMetadataImport($updateMask, $metadataImport); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $dataprocMetastoreClient->resumeOperation($operationName, 'updateMetadataImport'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $dataprocMetastoreClient->close(); + * } + * ``` + * + * @param FieldMask $updateMask Required. A field mask used to specify the fields to be overwritten in the + * metadata import resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + * @param MetadataImport $metadataImport Required. The metadata import to update. The server only merges fields + * in the import if they are specified in `update_mask`. + * + * The metadata import's `name` field is used to identify the metastore + * import to be updated. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function updateMetadataImport($updateMask, $metadataImport, array $optionalArgs = []) + { + $request = new UpdateMetadataImportRequest(); + $requestParamHeaders = []; + $request->setUpdateMask($updateMask); + $request->setMetadataImport($metadataImport); + $requestParamHeaders['metadata_import.name'] = $metadataImport->getName(); + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('UpdateMetadataImport', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Updates the parameters of a single service. + * + * Sample code: + * ``` + * $dataprocMetastoreClient = new DataprocMetastoreClient(); + * try { + * $updateMask = new FieldMask(); + * $service = new Service(); + * $operationResponse = $dataprocMetastoreClient->updateService($updateMask, $service); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $dataprocMetastoreClient->updateService($updateMask, $service); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $dataprocMetastoreClient->resumeOperation($operationName, 'updateService'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $dataprocMetastoreClient->close(); + * } + * ``` + * + * @param FieldMask $updateMask Required. A field mask used to specify the fields to be overwritten in the + * metastore service resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + * @param Service $service Required. The metastore service to update. The server only merges fields + * in the service if they are specified in `update_mask`. + * + * The metastore service's `name` field is used to identify the metastore + * service to be updated. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function updateService($updateMask, $service, array $optionalArgs = []) + { + $request = new UpdateServiceRequest(); + $requestParamHeaders = []; + $request->setUpdateMask($updateMask); + $request->setService($service); + $requestParamHeaders['service.name'] = $service->getName(); + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('UpdateService', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Gets information about a location. + * + * Sample code: + * ``` + * $dataprocMetastoreClient = new DataprocMetastoreClient(); + * try { + * $response = $dataprocMetastoreClient->getLocation(); + * } finally { + * $dataprocMetastoreClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * Resource name for the location. + * @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 \Google\Cloud\Location\Location + * + * @throws ApiException if the remote call fails + */ + public function getLocation(array $optionalArgs = []) + { + $request = new GetLocationRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetLocation', Location::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.cloud.location.Locations')->wait(); + } + + /** + * Lists information about the supported locations for this service. + * + * Sample code: + * ``` + * $dataprocMetastoreClient = new DataprocMetastoreClient(); + * try { + * // Iterate over pages of elements + * $pagedResponse = $dataprocMetastoreClient->listLocations(); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $dataprocMetastoreClient->listLocations(); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $dataprocMetastoreClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * The resource that owns the locations collection, if applicable. + * @type string $filter + * The standard list filter. + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @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 \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listLocations(array $optionalArgs = []) + { + $request = new ListLocationsRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListLocations', $optionalArgs, ListLocationsResponse::class, $request, 'google.cloud.location.Locations'); + } + + /** + * Gets the access control policy for a resource. Returns an empty policy + if the resource exists and does not have a policy set. + * + * Sample code: + * ``` + * $dataprocMetastoreClient = new DataprocMetastoreClient(); + * try { + * $resource = 'resource'; + * $response = $dataprocMetastoreClient->getIamPolicy($resource); + * } finally { + * $dataprocMetastoreClient->close(); + * } + * ``` + * + * @param string $resource REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param array $optionalArgs { + * Optional. + * + * @type GetPolicyOptions $options + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. + * @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 \Google\Cloud\Iam\V1\Policy + * + * @throws ApiException if the remote call fails + */ + public function getIamPolicy($resource, array $optionalArgs = []) + { + $request = new GetIamPolicyRequest(); + $requestParamHeaders = []; + $request->setResource($resource); + $requestParamHeaders['resource'] = $resource; + if (isset($optionalArgs['options'])) { + $request->setOptions($optionalArgs['options']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetIamPolicy', Policy::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.iam.v1.IAMPolicy')->wait(); + } + + /** + * Sets the access control policy on the specified resource. Replaces + any existing policy. + + Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` + errors. + * + * Sample code: + * ``` + * $dataprocMetastoreClient = new DataprocMetastoreClient(); + * try { + * $resource = 'resource'; + * $policy = new Policy(); + * $response = $dataprocMetastoreClient->setIamPolicy($resource, $policy); + * } finally { + * $dataprocMetastoreClient->close(); + * } + * ``` + * + * @param string $resource REQUIRED: The resource for which the policy is being specified. + * See the operation documentation for the appropriate value for this field. + * @param Policy $policy REQUIRED: The complete policy to be applied to the `resource`. The size of + * the policy is limited to a few 10s of KB. An empty policy is a + * valid policy but certain Cloud Platform services (such as Projects) + * might reject them. + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only + * the fields in the mask will be modified. If no mask is provided, the + * following default mask is used: + * + * `paths: "bindings, etag"` + * @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 \Google\Cloud\Iam\V1\Policy + * + * @throws ApiException if the remote call fails + */ + public function setIamPolicy($resource, $policy, array $optionalArgs = []) + { + $request = new SetIamPolicyRequest(); + $requestParamHeaders = []; + $request->setResource($resource); + $request->setPolicy($policy); + $requestParamHeaders['resource'] = $resource; + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('SetIamPolicy', Policy::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.iam.v1.IAMPolicy')->wait(); + } + + /** + * Returns permissions that a caller has on the specified resource. If the + resource does not exist, this will return an empty set of + permissions, not a `NOT_FOUND` error. + + Note: This operation is designed to be used for building + permission-aware UIs and command-line tools, not for authorization + checking. This operation may "fail open" without warning. + * + * Sample code: + * ``` + * $dataprocMetastoreClient = new DataprocMetastoreClient(); + * try { + * $resource = 'resource'; + * $permissions = []; + * $response = $dataprocMetastoreClient->testIamPermissions($resource, $permissions); + * } finally { + * $dataprocMetastoreClient->close(); + * } + * ``` + * + * @param string $resource REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param string[] $permissions The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @param array $optionalArgs { + * 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 \Google\Cloud\Iam\V1\TestIamPermissionsResponse + * + * @throws ApiException if the remote call fails + */ + public function testIamPermissions($resource, $permissions, array $optionalArgs = []) + { + $request = new TestIamPermissionsRequest(); + $requestParamHeaders = []; + $request->setResource($resource); + $request->setPermissions($permissions); + $requestParamHeaders['resource'] = $resource; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('TestIamPermissions', TestIamPermissionsResponse::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.iam.v1.IAMPolicy')->wait(); + } +} diff --git a/owl-bot-staging/DataprocMetastore/v1/src/V1/gapic_metadata.json b/owl-bot-staging/DataprocMetastore/v1/src/V1/gapic_metadata.json new file mode 100644 index 000000000000..554fc0dcd321 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/src/V1/gapic_metadata.json @@ -0,0 +1,177 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services\/RPCs to the corresponding library clients\/methods", + "language": "php", + "protoPackage": "google.cloud.metastore.v1", + "libraryPackage": "Google\\Cloud\\Metastore\\V1", + "services": { + "DataprocMetastore": { + "clients": { + "grpc": { + "libraryClient": "DataprocMetastoreGapicClient", + "rpcs": { + "CreateBackup": { + "methods": [ + "createBackup" + ] + }, + "CreateMetadataImport": { + "methods": [ + "createMetadataImport" + ] + }, + "CreateService": { + "methods": [ + "createService" + ] + }, + "DeleteBackup": { + "methods": [ + "deleteBackup" + ] + }, + "DeleteService": { + "methods": [ + "deleteService" + ] + }, + "ExportMetadata": { + "methods": [ + "exportMetadata" + ] + }, + "GetBackup": { + "methods": [ + "getBackup" + ] + }, + "GetMetadataImport": { + "methods": [ + "getMetadataImport" + ] + }, + "GetService": { + "methods": [ + "getService" + ] + }, + "ListBackups": { + "methods": [ + "listBackups" + ] + }, + "ListMetadataImports": { + "methods": [ + "listMetadataImports" + ] + }, + "ListServices": { + "methods": [ + "listServices" + ] + }, + "RestoreService": { + "methods": [ + "restoreService" + ] + }, + "UpdateMetadataImport": { + "methods": [ + "updateMetadataImport" + ] + }, + "UpdateService": { + "methods": [ + "updateService" + ] + }, + "GetLocation": { + "methods": [ + "getLocation" + ] + }, + "ListLocations": { + "methods": [ + "listLocations" + ] + }, + "GetIamPolicy": { + "methods": [ + "getIamPolicy" + ] + }, + "SetIamPolicy": { + "methods": [ + "setIamPolicy" + ] + }, + "TestIamPermissions": { + "methods": [ + "testIamPermissions" + ] + } + } + } + } + }, + "DataprocMetastoreFederation": { + "clients": { + "grpc": { + "libraryClient": "DataprocMetastoreFederationGapicClient", + "rpcs": { + "CreateFederation": { + "methods": [ + "createFederation" + ] + }, + "DeleteFederation": { + "methods": [ + "deleteFederation" + ] + }, + "GetFederation": { + "methods": [ + "getFederation" + ] + }, + "ListFederations": { + "methods": [ + "listFederations" + ] + }, + "UpdateFederation": { + "methods": [ + "updateFederation" + ] + }, + "GetLocation": { + "methods": [ + "getLocation" + ] + }, + "ListLocations": { + "methods": [ + "listLocations" + ] + }, + "GetIamPolicy": { + "methods": [ + "getIamPolicy" + ] + }, + "SetIamPolicy": { + "methods": [ + "setIamPolicy" + ] + }, + "TestIamPermissions": { + "methods": [ + "testIamPermissions" + ] + } + } + } + } + } + } +} \ No newline at end of file diff --git a/owl-bot-staging/DataprocMetastore/v1/src/V1/resources/dataproc_metastore_client_config.json b/owl-bot-staging/DataprocMetastore/v1/src/V1/resources/dataproc_metastore_client_config.json new file mode 100644 index 000000000000..7416b10ae3c3 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/src/V1/resources/dataproc_metastore_client_config.json @@ -0,0 +1,144 @@ +{ + "interfaces": { + "google.cloud.metastore.v1.DataprocMetastore": { + "retry_codes": { + "no_retry_codes": [], + "retry_policy_1_codes": [ + "UNAVAILABLE" + ], + "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": 1.3, + "max_retry_delay_millis": 10000, + "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": { + "CreateBackup": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "CreateMetadataImport": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "CreateService": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "DeleteBackup": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "DeleteService": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "ExportMetadata": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "GetBackup": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetMetadataImport": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetService": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListBackups": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListMetadataImports": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListServices": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "RestoreService": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "UpdateMetadataImport": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "UpdateService": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "GetLocation": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListLocations": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetIamPolicy": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "SetIamPolicy": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "TestIamPermissions": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + } + } + } + } +} diff --git a/owl-bot-staging/DataprocMetastore/v1/src/V1/resources/dataproc_metastore_descriptor_config.php b/owl-bot-staging/DataprocMetastore/v1/src/V1/resources/dataproc_metastore_descriptor_config.php new file mode 100644 index 000000000000..e7782fa07039 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/src/V1/resources/dataproc_metastore_descriptor_config.php @@ -0,0 +1,358 @@ + [ + 'google.cloud.metastore.v1.DataprocMetastore' => [ + 'CreateBackup' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Metastore\V1\Backup', + 'metadataReturnType' => '\Google\Cloud\Metastore\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'CreateMetadataImport' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Metastore\V1\MetadataImport', + 'metadataReturnType' => '\Google\Cloud\Metastore\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'CreateService' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Metastore\V1\Service', + 'metadataReturnType' => '\Google\Cloud\Metastore\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'DeleteBackup' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\Metastore\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'DeleteService' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\Metastore\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'ExportMetadata' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Metastore\V1\MetadataExport', + 'metadataReturnType' => '\Google\Cloud\Metastore\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'service', + 'fieldAccessors' => [ + 'getService', + ], + ], + ], + ], + 'RestoreService' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Metastore\V1\Restore', + 'metadataReturnType' => '\Google\Cloud\Metastore\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'service', + 'fieldAccessors' => [ + 'getService', + ], + ], + ], + ], + 'UpdateMetadataImport' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Metastore\V1\MetadataImport', + 'metadataReturnType' => '\Google\Cloud\Metastore\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'metadata_import.name', + 'fieldAccessors' => [ + 'getMetadataImport', + 'getName', + ], + ], + ], + ], + 'UpdateService' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Metastore\V1\Service', + 'metadataReturnType' => '\Google\Cloud\Metastore\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'service.name', + 'fieldAccessors' => [ + 'getService', + 'getName', + ], + ], + ], + ], + 'GetBackup' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Metastore\V1\Backup', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetMetadataImport' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Metastore\V1\MetadataImport', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetService' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Metastore\V1\Service', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'ListBackups' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getBackups', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Metastore\V1\ListBackupsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListMetadataImports' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getMetadataImports', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Metastore\V1\ListMetadataImportsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListServices' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getServices', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Metastore\V1\ListServicesResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'GetLocation' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Location\Location', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + 'interfaceOverride' => 'google.cloud.location.Locations', + ], + 'ListLocations' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getLocations', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Location\ListLocationsResponse', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + 'interfaceOverride' => 'google.cloud.location.Locations', + ], + 'GetIamPolicy' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Iam\V1\Policy', + 'headerParams' => [ + [ + 'keyName' => 'resource', + 'fieldAccessors' => [ + 'getResource', + ], + ], + ], + 'interfaceOverride' => 'google.iam.v1.IAMPolicy', + ], + 'SetIamPolicy' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Iam\V1\Policy', + 'headerParams' => [ + [ + 'keyName' => 'resource', + 'fieldAccessors' => [ + 'getResource', + ], + ], + ], + 'interfaceOverride' => 'google.iam.v1.IAMPolicy', + ], + 'TestIamPermissions' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Iam\V1\TestIamPermissionsResponse', + 'headerParams' => [ + [ + 'keyName' => 'resource', + 'fieldAccessors' => [ + 'getResource', + ], + ], + ], + 'interfaceOverride' => 'google.iam.v1.IAMPolicy', + ], + 'templateMap' => [ + 'backup' => 'projects/{project}/locations/{location}/services/{service}/backups/{backup}', + 'location' => 'projects/{project}/locations/{location}', + 'metadataImport' => 'projects/{project}/locations/{location}/services/{service}/metadataImports/{metadata_import}', + 'network' => 'projects/{project}/global/networks/{network}', + 'service' => 'projects/{project}/locations/{location}/services/{service}', + 'subnetwork' => 'projects/{project}/regions/{region}/subnetworks/{subnetwork}', + ], + ], + ], +]; diff --git a/owl-bot-staging/DataprocMetastore/v1/src/V1/resources/dataproc_metastore_federation_client_config.json b/owl-bot-staging/DataprocMetastore/v1/src/V1/resources/dataproc_metastore_federation_client_config.json new file mode 100644 index 000000000000..ffae7827578f --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/src/V1/resources/dataproc_metastore_federation_client_config.json @@ -0,0 +1,72 @@ +{ + "interfaces": { + "google.cloud.metastore.v1.DataprocMetastoreFederation": { + "retry_codes": { + "no_retry_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 + } + }, + "methods": { + "CreateFederation": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "DeleteFederation": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "GetFederation": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "ListFederations": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "UpdateFederation": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "GetLocation": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "ListLocations": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "GetIamPolicy": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "SetIamPolicy": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "TestIamPermissions": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + } + } + } + } +} diff --git a/owl-bot-staging/DataprocMetastore/v1/src/V1/resources/dataproc_metastore_federation_descriptor_config.php b/owl-bot-staging/DataprocMetastore/v1/src/V1/resources/dataproc_metastore_federation_descriptor_config.php new file mode 100644 index 000000000000..5ec02fe35edb --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/src/V1/resources/dataproc_metastore_federation_descriptor_config.php @@ -0,0 +1,175 @@ + [ + 'google.cloud.metastore.v1.DataprocMetastoreFederation' => [ + 'CreateFederation' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Metastore\V1\Federation', + 'metadataReturnType' => '\Google\Cloud\Metastore\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'DeleteFederation' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\Metastore\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'UpdateFederation' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Metastore\V1\Federation', + 'metadataReturnType' => '\Google\Cloud\Metastore\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'federation.name', + 'fieldAccessors' => [ + 'getFederation', + 'getName', + ], + ], + ], + ], + 'GetFederation' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Metastore\V1\Federation', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'ListFederations' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getFederations', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Metastore\V1\ListFederationsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'GetLocation' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Location\Location', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + 'interfaceOverride' => 'google.cloud.location.Locations', + ], + 'ListLocations' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getLocations', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Location\ListLocationsResponse', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + 'interfaceOverride' => 'google.cloud.location.Locations', + ], + 'GetIamPolicy' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Iam\V1\Policy', + 'headerParams' => [ + [ + 'keyName' => 'resource', + 'fieldAccessors' => [ + 'getResource', + ], + ], + ], + 'interfaceOverride' => 'google.iam.v1.IAMPolicy', + ], + 'SetIamPolicy' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Iam\V1\Policy', + 'headerParams' => [ + [ + 'keyName' => 'resource', + 'fieldAccessors' => [ + 'getResource', + ], + ], + ], + 'interfaceOverride' => 'google.iam.v1.IAMPolicy', + ], + 'TestIamPermissions' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Iam\V1\TestIamPermissionsResponse', + 'headerParams' => [ + [ + 'keyName' => 'resource', + 'fieldAccessors' => [ + 'getResource', + ], + ], + ], + 'interfaceOverride' => 'google.iam.v1.IAMPolicy', + ], + 'templateMap' => [ + 'federation' => 'projects/{project}/locations/{location}/federations/{federation}', + 'location' => 'projects/{project}/locations/{location}', + ], + ], + ], +]; diff --git a/owl-bot-staging/DataprocMetastore/v1/src/V1/resources/dataproc_metastore_federation_rest_client_config.php b/owl-bot-staging/DataprocMetastore/v1/src/V1/resources/dataproc_metastore_federation_rest_client_config.php new file mode 100644 index 000000000000..d0d2069126b3 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/src/V1/resources/dataproc_metastore_federation_rest_client_config.php @@ -0,0 +1,210 @@ + [ + 'google.cloud.location.Locations' => [ + 'GetLocation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListLocations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*}/locations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + 'google.cloud.metastore.v1.DataprocMetastoreFederation' => [ + 'CreateFederation' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/federations', + 'body' => 'federation', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'federation_id', + ], + ], + 'DeleteFederation' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/federations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetFederation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/federations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListFederations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/federations', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'UpdateFederation' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{federation.name=projects/*/locations/*/federations/*}', + 'body' => 'federation', + 'placeholders' => [ + 'federation.name' => [ + 'getters' => [ + 'getFederation', + 'getName', + ], + ], + ], + 'queryParams' => [ + 'update_mask', + ], + ], + ], + 'google.iam.v1.IAMPolicy' => [ + 'GetIamPolicy' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/services/*}:getIamPolicy', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/services/*/backups/*}:getIamPolicy', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/federations/*}:getIamPolicy', + ], + ], + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + 'SetIamPolicy' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/services/*}:setIamPolicy', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/services/*/backups/*}:setIamPolicy', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/federations/*}:setIamPolicy', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + 'TestIamPermissions' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/services/*}:testIamPermissions', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/federations/*}:testIamPermissions', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + ], + 'google.longrunning.Operations' => [ + 'CancelOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}:cancel', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteOperation' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetOperation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListOperations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*}/operations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/DataprocMetastore/v1/src/V1/resources/dataproc_metastore_rest_client_config.php b/owl-bot-staging/DataprocMetastore/v1/src/V1/resources/dataproc_metastore_rest_client_config.php new file mode 100644 index 000000000000..267f7ae7af9b --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/src/V1/resources/dataproc_metastore_rest_client_config.php @@ -0,0 +1,335 @@ + [ + 'google.cloud.location.Locations' => [ + 'GetLocation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListLocations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*}/locations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + 'google.cloud.metastore.v1.DataprocMetastore' => [ + 'CreateBackup' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/services/*}/backups', + 'body' => 'backup', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'backup_id', + ], + ], + 'CreateMetadataImport' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/services/*}/metadataImports', + 'body' => 'metadata_import', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'metadata_import_id', + ], + ], + 'CreateService' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/services', + 'body' => 'service', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'service_id', + ], + ], + 'DeleteBackup' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/services/*/backups/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteService' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/services/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ExportMetadata' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{service=projects/*/locations/*/services/*}:exportMetadata', + 'body' => '*', + 'placeholders' => [ + 'service' => [ + 'getters' => [ + 'getService', + ], + ], + ], + ], + 'GetBackup' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/services/*/backups/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetMetadataImport' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/services/*/metadataImports/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetService' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/services/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListBackups' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/services/*}/backups', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListMetadataImports' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/services/*}/metadataImports', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListServices' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/services', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'RestoreService' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{service=projects/*/locations/*/services/*}:restore', + 'body' => '*', + 'placeholders' => [ + 'service' => [ + 'getters' => [ + 'getService', + ], + ], + ], + ], + 'UpdateMetadataImport' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{metadata_import.name=projects/*/locations/*/services/*/metadataImports/*}', + 'body' => 'metadata_import', + 'placeholders' => [ + 'metadata_import.name' => [ + 'getters' => [ + 'getMetadataImport', + 'getName', + ], + ], + ], + 'queryParams' => [ + 'update_mask', + ], + ], + 'UpdateService' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{service.name=projects/*/locations/*/services/*}', + 'body' => 'service', + 'placeholders' => [ + 'service.name' => [ + 'getters' => [ + 'getService', + 'getName', + ], + ], + ], + 'queryParams' => [ + 'update_mask', + ], + ], + ], + 'google.iam.v1.IAMPolicy' => [ + 'GetIamPolicy' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/services/*}:getIamPolicy', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/services/*/backups/*}:getIamPolicy', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/federations/*}:getIamPolicy', + ], + ], + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + 'SetIamPolicy' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/services/*}:setIamPolicy', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/services/*/backups/*}:setIamPolicy', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/federations/*}:setIamPolicy', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + 'TestIamPermissions' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/services/*}:testIamPermissions', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/federations/*}:testIamPermissions', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + ], + 'google.longrunning.Operations' => [ + 'CancelOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}:cancel', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteOperation' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetOperation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListOperations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*}/operations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/DataprocMetastore/v1/tests/Unit/V1/Client/DataprocMetastoreClientTest.php b/owl-bot-staging/DataprocMetastore/v1/tests/Unit/V1/Client/DataprocMetastoreClientTest.php new file mode 100644 index 000000000000..dda9f44cd452 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/tests/Unit/V1/Client/DataprocMetastoreClientTest.php @@ -0,0 +1,2117 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return DataprocMetastoreClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new DataprocMetastoreClient($options); + } + + /** @test */ + public function createBackupTest() + { + $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/createBackupTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $expectedResponse = new Backup(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createBackupTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $backupId = 'backupId1355353272'; + $backup = new Backup(); + $request = (new CreateBackupRequest()) + ->setParent($formattedParent) + ->setBackupId($backupId) + ->setBackup($backup); + $response = $gapicClient->createBackup($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.cloud.metastore.v1.DataprocMetastore/CreateBackup', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getBackupId(); + $this->assertProtobufEquals($backupId, $actualValue); + $actualValue = $actualApiRequestObject->getBackup(); + $this->assertProtobufEquals($backup, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createBackupTest'); + $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 createBackupExceptionTest() + { + $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/createBackupTest'); + $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 + $formattedParent = $gapicClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $backupId = 'backupId1355353272'; + $backup = new Backup(); + $request = (new CreateBackupRequest()) + ->setParent($formattedParent) + ->setBackupId($backupId) + ->setBackup($backup); + $response = $gapicClient->createBackup($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createBackupTest'); + 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 createMetadataImportTest() + { + $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/createMetadataImportTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $expectedResponse = new MetadataImport(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createMetadataImportTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $metadataImportId = 'metadataImportId-476076315'; + $metadataImport = new MetadataImport(); + $request = (new CreateMetadataImportRequest()) + ->setParent($formattedParent) + ->setMetadataImportId($metadataImportId) + ->setMetadataImport($metadataImport); + $response = $gapicClient->createMetadataImport($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.cloud.metastore.v1.DataprocMetastore/CreateMetadataImport', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getMetadataImportId(); + $this->assertProtobufEquals($metadataImportId, $actualValue); + $actualValue = $actualApiRequestObject->getMetadataImport(); + $this->assertProtobufEquals($metadataImport, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createMetadataImportTest'); + $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 createMetadataImportExceptionTest() + { + $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/createMetadataImportTest'); + $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 + $formattedParent = $gapicClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $metadataImportId = 'metadataImportId-476076315'; + $metadataImport = new MetadataImport(); + $request = (new CreateMetadataImportRequest()) + ->setParent($formattedParent) + ->setMetadataImportId($metadataImportId) + ->setMetadataImport($metadataImport); + $response = $gapicClient->createMetadataImport($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createMetadataImportTest'); + 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 createServiceTest() + { + $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/createServiceTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $network = 'network1843485230'; + $endpointUri = 'endpointUri-850313278'; + $port = 3446913; + $stateMessage = 'stateMessage29641305'; + $artifactGcsUri = 'artifactGcsUri1337121495'; + $uid = 'uid115792'; + $expectedResponse = new Service(); + $expectedResponse->setName($name); + $expectedResponse->setNetwork($network); + $expectedResponse->setEndpointUri($endpointUri); + $expectedResponse->setPort($port); + $expectedResponse->setStateMessage($stateMessage); + $expectedResponse->setArtifactGcsUri($artifactGcsUri); + $expectedResponse->setUid($uid); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createServiceTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $serviceId = 'serviceId-1724763419'; + $service = new Service(); + $request = (new CreateServiceRequest()) + ->setParent($formattedParent) + ->setServiceId($serviceId) + ->setService($service); + $response = $gapicClient->createService($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.cloud.metastore.v1.DataprocMetastore/CreateService', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getServiceId(); + $this->assertProtobufEquals($serviceId, $actualValue); + $actualValue = $actualApiRequestObject->getService(); + $this->assertProtobufEquals($service, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createServiceTest'); + $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 createServiceExceptionTest() + { + $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/createServiceTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $serviceId = 'serviceId-1724763419'; + $service = new Service(); + $request = (new CreateServiceRequest()) + ->setParent($formattedParent) + ->setServiceId($serviceId) + ->setService($service); + $response = $gapicClient->createService($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createServiceTest'); + 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 deleteBackupTest() + { + $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/deleteBackupTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteBackupTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->backupName('[PROJECT]', '[LOCATION]', '[SERVICE]', '[BACKUP]'); + $request = (new DeleteBackupRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteBackup($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.cloud.metastore.v1.DataprocMetastore/DeleteBackup', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteBackupTest'); + $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 deleteBackupExceptionTest() + { + $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/deleteBackupTest'); + $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->backupName('[PROJECT]', '[LOCATION]', '[SERVICE]', '[BACKUP]'); + $request = (new DeleteBackupRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteBackup($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteBackupTest'); + 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 deleteServiceTest() + { + $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/deleteServiceTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteServiceTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $request = (new DeleteServiceRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteService($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.cloud.metastore.v1.DataprocMetastore/DeleteService', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteServiceTest'); + $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 deleteServiceExceptionTest() + { + $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/deleteServiceTest'); + $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->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $request = (new DeleteServiceRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteService($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteServiceTest'); + 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 exportMetadataTest() + { + $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/exportMetadataTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $destinationGcsUri = 'destinationGcsUri1386421523'; + $expectedResponse = new MetadataExport(); + $expectedResponse->setDestinationGcsUri($destinationGcsUri); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/exportMetadataTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedService = $gapicClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $request = (new ExportMetadataRequest()) + ->setService($formattedService); + $response = $gapicClient->exportMetadata($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.cloud.metastore.v1.DataprocMetastore/ExportMetadata', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getService(); + $this->assertProtobufEquals($formattedService, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/exportMetadataTest'); + $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 exportMetadataExceptionTest() + { + $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/exportMetadataTest'); + $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 + $formattedService = $gapicClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $request = (new ExportMetadataRequest()) + ->setService($formattedService); + $response = $gapicClient->exportMetadata($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/exportMetadataTest'); + 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 getBackupTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $description = 'description-1724546052'; + $expectedResponse = new Backup(); + $expectedResponse->setName($name2); + $expectedResponse->setDescription($description); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->backupName('[PROJECT]', '[LOCATION]', '[SERVICE]', '[BACKUP]'); + $request = (new GetBackupRequest()) + ->setName($formattedName); + $response = $gapicClient->getBackup($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.metastore.v1.DataprocMetastore/GetBackup', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getBackupExceptionTest() + { + $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->backupName('[PROJECT]', '[LOCATION]', '[SERVICE]', '[BACKUP]'); + $request = (new GetBackupRequest()) + ->setName($formattedName); + try { + $gapicClient->getBackup($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 getMetadataImportTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $description = 'description-1724546052'; + $expectedResponse = new MetadataImport(); + $expectedResponse->setName($name2); + $expectedResponse->setDescription($description); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->metadataImportName('[PROJECT]', '[LOCATION]', '[SERVICE]', '[METADATA_IMPORT]'); + $request = (new GetMetadataImportRequest()) + ->setName($formattedName); + $response = $gapicClient->getMetadataImport($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.metastore.v1.DataprocMetastore/GetMetadataImport', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getMetadataImportExceptionTest() + { + $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->metadataImportName('[PROJECT]', '[LOCATION]', '[SERVICE]', '[METADATA_IMPORT]'); + $request = (new GetMetadataImportRequest()) + ->setName($formattedName); + try { + $gapicClient->getMetadataImport($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 getServiceTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $network = 'network1843485230'; + $endpointUri = 'endpointUri-850313278'; + $port = 3446913; + $stateMessage = 'stateMessage29641305'; + $artifactGcsUri = 'artifactGcsUri1337121495'; + $uid = 'uid115792'; + $expectedResponse = new Service(); + $expectedResponse->setName($name2); + $expectedResponse->setNetwork($network); + $expectedResponse->setEndpointUri($endpointUri); + $expectedResponse->setPort($port); + $expectedResponse->setStateMessage($stateMessage); + $expectedResponse->setArtifactGcsUri($artifactGcsUri); + $expectedResponse->setUid($uid); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $request = (new GetServiceRequest()) + ->setName($formattedName); + $response = $gapicClient->getService($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.metastore.v1.DataprocMetastore/GetService', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getServiceExceptionTest() + { + $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->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $request = (new GetServiceRequest()) + ->setName($formattedName); + try { + $gapicClient->getService($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 listBackupsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $backupsElement = new Backup(); + $backups = [ + $backupsElement, + ]; + $expectedResponse = new ListBackupsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setBackups($backups); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $request = (new ListBackupsRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listBackups($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getBackups()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.metastore.v1.DataprocMetastore/ListBackups', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listBackupsExceptionTest() + { + $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->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $request = (new ListBackupsRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listBackups($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 listMetadataImportsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $metadataImportsElement = new MetadataImport(); + $metadataImports = [ + $metadataImportsElement, + ]; + $expectedResponse = new ListMetadataImportsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setMetadataImports($metadataImports); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $request = (new ListMetadataImportsRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listMetadataImports($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getMetadataImports()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.metastore.v1.DataprocMetastore/ListMetadataImports', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listMetadataImportsExceptionTest() + { + $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->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $request = (new ListMetadataImportsRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listMetadataImports($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 listServicesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $servicesElement = new Service(); + $services = [ + $servicesElement, + ]; + $expectedResponse = new ListServicesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setServices($services); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListServicesRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listServices($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getServices()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.metastore.v1.DataprocMetastore/ListServices', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listServicesExceptionTest() + { + $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->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListServicesRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listServices($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 restoreServiceTest() + { + $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/restoreServiceTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $backup2 = 'backup22121930997'; + $details = 'details1557721666'; + $expectedResponse = new Restore(); + $expectedResponse->setBackup($backup2); + $expectedResponse->setDetails($details); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/restoreServiceTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedService = $gapicClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $formattedBackup = $gapicClient->backupName('[PROJECT]', '[LOCATION]', '[SERVICE]', '[BACKUP]'); + $request = (new RestoreServiceRequest()) + ->setService($formattedService) + ->setBackup($formattedBackup); + $response = $gapicClient->restoreService($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.cloud.metastore.v1.DataprocMetastore/RestoreService', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getService(); + $this->assertProtobufEquals($formattedService, $actualValue); + $actualValue = $actualApiRequestObject->getBackup(); + $this->assertProtobufEquals($formattedBackup, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/restoreServiceTest'); + $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 restoreServiceExceptionTest() + { + $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/restoreServiceTest'); + $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 + $formattedService = $gapicClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $formattedBackup = $gapicClient->backupName('[PROJECT]', '[LOCATION]', '[SERVICE]', '[BACKUP]'); + $request = (new RestoreServiceRequest()) + ->setService($formattedService) + ->setBackup($formattedBackup); + $response = $gapicClient->restoreService($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/restoreServiceTest'); + 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 updateMetadataImportTest() + { + $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/updateMetadataImportTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $expectedResponse = new MetadataImport(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateMetadataImportTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $updateMask = new FieldMask(); + $metadataImport = new MetadataImport(); + $request = (new UpdateMetadataImportRequest()) + ->setUpdateMask($updateMask) + ->setMetadataImport($metadataImport); + $response = $gapicClient->updateMetadataImport($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.cloud.metastore.v1.DataprocMetastore/UpdateMetadataImport', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $actualValue = $actualApiRequestObject->getMetadataImport(); + $this->assertProtobufEquals($metadataImport, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateMetadataImportTest'); + $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 updateMetadataImportExceptionTest() + { + $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/updateMetadataImportTest'); + $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 + $updateMask = new FieldMask(); + $metadataImport = new MetadataImport(); + $request = (new UpdateMetadataImportRequest()) + ->setUpdateMask($updateMask) + ->setMetadataImport($metadataImport); + $response = $gapicClient->updateMetadataImport($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateMetadataImportTest'); + 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 updateServiceTest() + { + $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/updateServiceTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $network = 'network1843485230'; + $endpointUri = 'endpointUri-850313278'; + $port = 3446913; + $stateMessage = 'stateMessage29641305'; + $artifactGcsUri = 'artifactGcsUri1337121495'; + $uid = 'uid115792'; + $expectedResponse = new Service(); + $expectedResponse->setName($name); + $expectedResponse->setNetwork($network); + $expectedResponse->setEndpointUri($endpointUri); + $expectedResponse->setPort($port); + $expectedResponse->setStateMessage($stateMessage); + $expectedResponse->setArtifactGcsUri($artifactGcsUri); + $expectedResponse->setUid($uid); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateServiceTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $updateMask = new FieldMask(); + $service = new Service(); + $request = (new UpdateServiceRequest()) + ->setUpdateMask($updateMask) + ->setService($service); + $response = $gapicClient->updateService($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.cloud.metastore.v1.DataprocMetastore/UpdateService', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $actualValue = $actualApiRequestObject->getService(); + $this->assertProtobufEquals($service, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateServiceTest'); + $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 updateServiceExceptionTest() + { + $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/updateServiceTest'); + $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 + $updateMask = new FieldMask(); + $service = new Service(); + $request = (new UpdateServiceRequest()) + ->setUpdateMask($updateMask) + ->setService($service); + $response = $gapicClient->updateService($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateServiceTest'); + 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 getLocationTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $locationId = 'locationId552319461'; + $displayName = 'displayName1615086568'; + $expectedResponse = new Location(); + $expectedResponse->setName($name2); + $expectedResponse->setLocationId($locationId); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + $request = new GetLocationRequest(); + $response = $gapicClient->getLocation($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/GetLocation', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getLocationExceptionTest() + { + $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); + $request = new GetLocationRequest(); + try { + $gapicClient->getLocation($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 listLocationsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $locationsElement = new Location(); + $locations = [ + $locationsElement, + ]; + $expectedResponse = new ListLocationsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setLocations($locations); + $transport->addResponse($expectedResponse); + $request = new ListLocationsRequest(); + $response = $gapicClient->listLocations($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getLocations()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/ListLocations', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listLocationsExceptionTest() + { + $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); + $request = new ListLocationsRequest(); + try { + $gapicClient->listLocations($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 getIamPolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $version = 351608024; + $etag = '21'; + $expectedResponse = new Policy(); + $expectedResponse->setVersion($version); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $request = (new GetIamPolicyRequest()) + ->setResource($resource); + $response = $gapicClient->getIamPolicy($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.iam.v1.IAMPolicy/GetIamPolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getIamPolicyExceptionTest() + { + $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 + $resource = 'resource-341064690'; + $request = (new GetIamPolicyRequest()) + ->setResource($resource); + try { + $gapicClient->getIamPolicy($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 setIamPolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $version = 351608024; + $etag = '21'; + $expectedResponse = new Policy(); + $expectedResponse->setVersion($version); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $policy = new Policy(); + $request = (new SetIamPolicyRequest()) + ->setResource($resource) + ->setPolicy($policy); + $response = $gapicClient->setIamPolicy($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.iam.v1.IAMPolicy/SetIamPolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $actualValue = $actualRequestObject->getPolicy(); + $this->assertProtobufEquals($policy, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function setIamPolicyExceptionTest() + { + $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 + $resource = 'resource-341064690'; + $policy = new Policy(); + $request = (new SetIamPolicyRequest()) + ->setResource($resource) + ->setPolicy($policy); + try { + $gapicClient->setIamPolicy($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 testIamPermissionsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new TestIamPermissionsResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $permissions = []; + $request = (new TestIamPermissionsRequest()) + ->setResource($resource) + ->setPermissions($permissions); + $response = $gapicClient->testIamPermissions($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.iam.v1.IAMPolicy/TestIamPermissions', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $actualValue = $actualRequestObject->getPermissions(); + $this->assertProtobufEquals($permissions, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function testIamPermissionsExceptionTest() + { + $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 + $resource = 'resource-341064690'; + $permissions = []; + $request = (new TestIamPermissionsRequest()) + ->setResource($resource) + ->setPermissions($permissions); + try { + $gapicClient->testIamPermissions($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 createBackupAsyncTest() + { + $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/createBackupTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $expectedResponse = new Backup(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createBackupTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $backupId = 'backupId1355353272'; + $backup = new Backup(); + $request = (new CreateBackupRequest()) + ->setParent($formattedParent) + ->setBackupId($backupId) + ->setBackup($backup); + $response = $gapicClient->createBackupAsync($request)->wait(); + $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.cloud.metastore.v1.DataprocMetastore/CreateBackup', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getBackupId(); + $this->assertProtobufEquals($backupId, $actualValue); + $actualValue = $actualApiRequestObject->getBackup(); + $this->assertProtobufEquals($backup, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createBackupTest'); + $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()); + } +} diff --git a/owl-bot-staging/DataprocMetastore/v1/tests/Unit/V1/Client/DataprocMetastoreFederationClientTest.php b/owl-bot-staging/DataprocMetastore/v1/tests/Unit/V1/Client/DataprocMetastoreFederationClientTest.php new file mode 100644 index 000000000000..0c81a2c672e1 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/tests/Unit/V1/Client/DataprocMetastoreFederationClientTest.php @@ -0,0 +1,1039 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return DataprocMetastoreFederationClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new DataprocMetastoreFederationClient($options); + } + + /** @test */ + public function createFederationTest() + { + $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/createFederationTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $version = 'version351608024'; + $endpointUri = 'endpointUri-850313278'; + $stateMessage = 'stateMessage29641305'; + $uid = 'uid115792'; + $expectedResponse = new Federation(); + $expectedResponse->setName($name); + $expectedResponse->setVersion($version); + $expectedResponse->setEndpointUri($endpointUri); + $expectedResponse->setStateMessage($stateMessage); + $expectedResponse->setUid($uid); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createFederationTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $federationId = 'federationId-1338699881'; + $federation = new Federation(); + $request = (new CreateFederationRequest()) + ->setParent($formattedParent) + ->setFederationId($federationId) + ->setFederation($federation); + $response = $gapicClient->createFederation($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.cloud.metastore.v1.DataprocMetastoreFederation/CreateFederation', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getFederationId(); + $this->assertProtobufEquals($federationId, $actualValue); + $actualValue = $actualApiRequestObject->getFederation(); + $this->assertProtobufEquals($federation, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createFederationTest'); + $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 createFederationExceptionTest() + { + $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/createFederationTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $federationId = 'federationId-1338699881'; + $federation = new Federation(); + $request = (new CreateFederationRequest()) + ->setParent($formattedParent) + ->setFederationId($federationId) + ->setFederation($federation); + $response = $gapicClient->createFederation($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createFederationTest'); + 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 deleteFederationTest() + { + $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/deleteFederationTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteFederationTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->federationName('[PROJECT]', '[LOCATION]', '[FEDERATION]'); + $request = (new DeleteFederationRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteFederation($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.cloud.metastore.v1.DataprocMetastoreFederation/DeleteFederation', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteFederationTest'); + $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 deleteFederationExceptionTest() + { + $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/deleteFederationTest'); + $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->federationName('[PROJECT]', '[LOCATION]', '[FEDERATION]'); + $request = (new DeleteFederationRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteFederation($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteFederationTest'); + 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 getFederationTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $version = 'version351608024'; + $endpointUri = 'endpointUri-850313278'; + $stateMessage = 'stateMessage29641305'; + $uid = 'uid115792'; + $expectedResponse = new Federation(); + $expectedResponse->setName($name2); + $expectedResponse->setVersion($version); + $expectedResponse->setEndpointUri($endpointUri); + $expectedResponse->setStateMessage($stateMessage); + $expectedResponse->setUid($uid); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->federationName('[PROJECT]', '[LOCATION]', '[FEDERATION]'); + $request = (new GetFederationRequest()) + ->setName($formattedName); + $response = $gapicClient->getFederation($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.metastore.v1.DataprocMetastoreFederation/GetFederation', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getFederationExceptionTest() + { + $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->federationName('[PROJECT]', '[LOCATION]', '[FEDERATION]'); + $request = (new GetFederationRequest()) + ->setName($formattedName); + try { + $gapicClient->getFederation($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 listFederationsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $federationsElement = new Federation(); + $federations = [ + $federationsElement, + ]; + $expectedResponse = new ListFederationsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setFederations($federations); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListFederationsRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listFederations($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getFederations()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.metastore.v1.DataprocMetastoreFederation/ListFederations', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listFederationsExceptionTest() + { + $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->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListFederationsRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listFederations($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 updateFederationTest() + { + $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/updateFederationTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $version = 'version351608024'; + $endpointUri = 'endpointUri-850313278'; + $stateMessage = 'stateMessage29641305'; + $uid = 'uid115792'; + $expectedResponse = new Federation(); + $expectedResponse->setName($name); + $expectedResponse->setVersion($version); + $expectedResponse->setEndpointUri($endpointUri); + $expectedResponse->setStateMessage($stateMessage); + $expectedResponse->setUid($uid); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateFederationTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $updateMask = new FieldMask(); + $federation = new Federation(); + $request = (new UpdateFederationRequest()) + ->setUpdateMask($updateMask) + ->setFederation($federation); + $response = $gapicClient->updateFederation($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.cloud.metastore.v1.DataprocMetastoreFederation/UpdateFederation', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $actualValue = $actualApiRequestObject->getFederation(); + $this->assertProtobufEquals($federation, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateFederationTest'); + $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 updateFederationExceptionTest() + { + $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/updateFederationTest'); + $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 + $updateMask = new FieldMask(); + $federation = new Federation(); + $request = (new UpdateFederationRequest()) + ->setUpdateMask($updateMask) + ->setFederation($federation); + $response = $gapicClient->updateFederation($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateFederationTest'); + 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 getLocationTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $locationId = 'locationId552319461'; + $displayName = 'displayName1615086568'; + $expectedResponse = new Location(); + $expectedResponse->setName($name2); + $expectedResponse->setLocationId($locationId); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + $request = new GetLocationRequest(); + $response = $gapicClient->getLocation($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/GetLocation', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getLocationExceptionTest() + { + $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); + $request = new GetLocationRequest(); + try { + $gapicClient->getLocation($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 listLocationsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $locationsElement = new Location(); + $locations = [ + $locationsElement, + ]; + $expectedResponse = new ListLocationsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setLocations($locations); + $transport->addResponse($expectedResponse); + $request = new ListLocationsRequest(); + $response = $gapicClient->listLocations($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getLocations()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/ListLocations', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listLocationsExceptionTest() + { + $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); + $request = new ListLocationsRequest(); + try { + $gapicClient->listLocations($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 getIamPolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $version = 351608024; + $etag = '21'; + $expectedResponse = new Policy(); + $expectedResponse->setVersion($version); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $request = (new GetIamPolicyRequest()) + ->setResource($resource); + $response = $gapicClient->getIamPolicy($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.iam.v1.IAMPolicy/GetIamPolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getIamPolicyExceptionTest() + { + $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 + $resource = 'resource-341064690'; + $request = (new GetIamPolicyRequest()) + ->setResource($resource); + try { + $gapicClient->getIamPolicy($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 setIamPolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $version = 351608024; + $etag = '21'; + $expectedResponse = new Policy(); + $expectedResponse->setVersion($version); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $policy = new Policy(); + $request = (new SetIamPolicyRequest()) + ->setResource($resource) + ->setPolicy($policy); + $response = $gapicClient->setIamPolicy($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.iam.v1.IAMPolicy/SetIamPolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $actualValue = $actualRequestObject->getPolicy(); + $this->assertProtobufEquals($policy, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function setIamPolicyExceptionTest() + { + $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 + $resource = 'resource-341064690'; + $policy = new Policy(); + $request = (new SetIamPolicyRequest()) + ->setResource($resource) + ->setPolicy($policy); + try { + $gapicClient->setIamPolicy($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 testIamPermissionsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new TestIamPermissionsResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $permissions = []; + $request = (new TestIamPermissionsRequest()) + ->setResource($resource) + ->setPermissions($permissions); + $response = $gapicClient->testIamPermissions($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.iam.v1.IAMPolicy/TestIamPermissions', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $actualValue = $actualRequestObject->getPermissions(); + $this->assertProtobufEquals($permissions, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function testIamPermissionsExceptionTest() + { + $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 + $resource = 'resource-341064690'; + $permissions = []; + $request = (new TestIamPermissionsRequest()) + ->setResource($resource) + ->setPermissions($permissions); + try { + $gapicClient->testIamPermissions($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 createFederationAsyncTest() + { + $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/createFederationTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $version = 'version351608024'; + $endpointUri = 'endpointUri-850313278'; + $stateMessage = 'stateMessage29641305'; + $uid = 'uid115792'; + $expectedResponse = new Federation(); + $expectedResponse->setName($name); + $expectedResponse->setVersion($version); + $expectedResponse->setEndpointUri($endpointUri); + $expectedResponse->setStateMessage($stateMessage); + $expectedResponse->setUid($uid); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createFederationTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $federationId = 'federationId-1338699881'; + $federation = new Federation(); + $request = (new CreateFederationRequest()) + ->setParent($formattedParent) + ->setFederationId($federationId) + ->setFederation($federation); + $response = $gapicClient->createFederationAsync($request)->wait(); + $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.cloud.metastore.v1.DataprocMetastoreFederation/CreateFederation', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getFederationId(); + $this->assertProtobufEquals($federationId, $actualValue); + $actualValue = $actualApiRequestObject->getFederation(); + $this->assertProtobufEquals($federation, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createFederationTest'); + $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()); + } +} diff --git a/owl-bot-staging/DataprocMetastore/v1/tests/Unit/V1/DataprocMetastoreClientTest.php b/owl-bot-staging/DataprocMetastore/v1/tests/Unit/V1/DataprocMetastoreClientTest.php new file mode 100644 index 000000000000..4cd2136c33ae --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/tests/Unit/V1/DataprocMetastoreClientTest.php @@ -0,0 +1,1923 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return DataprocMetastoreClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new DataprocMetastoreClient($options); + } + + /** @test */ + public function createBackupTest() + { + $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/createBackupTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $expectedResponse = new Backup(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createBackupTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $backupId = 'backupId1355353272'; + $backup = new Backup(); + $response = $gapicClient->createBackup($formattedParent, $backupId, $backup); + $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.cloud.metastore.v1.DataprocMetastore/CreateBackup', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getBackupId(); + $this->assertProtobufEquals($backupId, $actualValue); + $actualValue = $actualApiRequestObject->getBackup(); + $this->assertProtobufEquals($backup, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createBackupTest'); + $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 createBackupExceptionTest() + { + $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/createBackupTest'); + $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 + $formattedParent = $gapicClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $backupId = 'backupId1355353272'; + $backup = new Backup(); + $response = $gapicClient->createBackup($formattedParent, $backupId, $backup); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createBackupTest'); + 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 createMetadataImportTest() + { + $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/createMetadataImportTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $expectedResponse = new MetadataImport(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createMetadataImportTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $metadataImportId = 'metadataImportId-476076315'; + $metadataImport = new MetadataImport(); + $response = $gapicClient->createMetadataImport($formattedParent, $metadataImportId, $metadataImport); + $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.cloud.metastore.v1.DataprocMetastore/CreateMetadataImport', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getMetadataImportId(); + $this->assertProtobufEquals($metadataImportId, $actualValue); + $actualValue = $actualApiRequestObject->getMetadataImport(); + $this->assertProtobufEquals($metadataImport, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createMetadataImportTest'); + $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 createMetadataImportExceptionTest() + { + $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/createMetadataImportTest'); + $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 + $formattedParent = $gapicClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $metadataImportId = 'metadataImportId-476076315'; + $metadataImport = new MetadataImport(); + $response = $gapicClient->createMetadataImport($formattedParent, $metadataImportId, $metadataImport); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createMetadataImportTest'); + 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 createServiceTest() + { + $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/createServiceTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $network = 'network1843485230'; + $endpointUri = 'endpointUri-850313278'; + $port = 3446913; + $stateMessage = 'stateMessage29641305'; + $artifactGcsUri = 'artifactGcsUri1337121495'; + $uid = 'uid115792'; + $expectedResponse = new Service(); + $expectedResponse->setName($name); + $expectedResponse->setNetwork($network); + $expectedResponse->setEndpointUri($endpointUri); + $expectedResponse->setPort($port); + $expectedResponse->setStateMessage($stateMessage); + $expectedResponse->setArtifactGcsUri($artifactGcsUri); + $expectedResponse->setUid($uid); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createServiceTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $serviceId = 'serviceId-1724763419'; + $service = new Service(); + $response = $gapicClient->createService($formattedParent, $serviceId, $service); + $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.cloud.metastore.v1.DataprocMetastore/CreateService', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getServiceId(); + $this->assertProtobufEquals($serviceId, $actualValue); + $actualValue = $actualApiRequestObject->getService(); + $this->assertProtobufEquals($service, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createServiceTest'); + $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 createServiceExceptionTest() + { + $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/createServiceTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $serviceId = 'serviceId-1724763419'; + $service = new Service(); + $response = $gapicClient->createService($formattedParent, $serviceId, $service); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createServiceTest'); + 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 deleteBackupTest() + { + $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/deleteBackupTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteBackupTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->backupName('[PROJECT]', '[LOCATION]', '[SERVICE]', '[BACKUP]'); + $response = $gapicClient->deleteBackup($formattedName); + $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.cloud.metastore.v1.DataprocMetastore/DeleteBackup', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteBackupTest'); + $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 deleteBackupExceptionTest() + { + $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/deleteBackupTest'); + $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->backupName('[PROJECT]', '[LOCATION]', '[SERVICE]', '[BACKUP]'); + $response = $gapicClient->deleteBackup($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteBackupTest'); + 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 deleteServiceTest() + { + $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/deleteServiceTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteServiceTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $response = $gapicClient->deleteService($formattedName); + $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.cloud.metastore.v1.DataprocMetastore/DeleteService', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteServiceTest'); + $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 deleteServiceExceptionTest() + { + $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/deleteServiceTest'); + $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->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $response = $gapicClient->deleteService($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteServiceTest'); + 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 exportMetadataTest() + { + $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/exportMetadataTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $destinationGcsUri = 'destinationGcsUri1386421523'; + $expectedResponse = new MetadataExport(); + $expectedResponse->setDestinationGcsUri($destinationGcsUri); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/exportMetadataTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedService = $gapicClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $response = $gapicClient->exportMetadata($formattedService); + $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.cloud.metastore.v1.DataprocMetastore/ExportMetadata', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getService(); + $this->assertProtobufEquals($formattedService, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/exportMetadataTest'); + $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 exportMetadataExceptionTest() + { + $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/exportMetadataTest'); + $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 + $formattedService = $gapicClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $response = $gapicClient->exportMetadata($formattedService); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/exportMetadataTest'); + 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 getBackupTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $description = 'description-1724546052'; + $expectedResponse = new Backup(); + $expectedResponse->setName($name2); + $expectedResponse->setDescription($description); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->backupName('[PROJECT]', '[LOCATION]', '[SERVICE]', '[BACKUP]'); + $response = $gapicClient->getBackup($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.metastore.v1.DataprocMetastore/GetBackup', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getBackupExceptionTest() + { + $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->backupName('[PROJECT]', '[LOCATION]', '[SERVICE]', '[BACKUP]'); + try { + $gapicClient->getBackup($formattedName); + // 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 getMetadataImportTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $description = 'description-1724546052'; + $expectedResponse = new MetadataImport(); + $expectedResponse->setName($name2); + $expectedResponse->setDescription($description); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->metadataImportName('[PROJECT]', '[LOCATION]', '[SERVICE]', '[METADATA_IMPORT]'); + $response = $gapicClient->getMetadataImport($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.metastore.v1.DataprocMetastore/GetMetadataImport', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getMetadataImportExceptionTest() + { + $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->metadataImportName('[PROJECT]', '[LOCATION]', '[SERVICE]', '[METADATA_IMPORT]'); + try { + $gapicClient->getMetadataImport($formattedName); + // 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 getServiceTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $network = 'network1843485230'; + $endpointUri = 'endpointUri-850313278'; + $port = 3446913; + $stateMessage = 'stateMessage29641305'; + $artifactGcsUri = 'artifactGcsUri1337121495'; + $uid = 'uid115792'; + $expectedResponse = new Service(); + $expectedResponse->setName($name2); + $expectedResponse->setNetwork($network); + $expectedResponse->setEndpointUri($endpointUri); + $expectedResponse->setPort($port); + $expectedResponse->setStateMessage($stateMessage); + $expectedResponse->setArtifactGcsUri($artifactGcsUri); + $expectedResponse->setUid($uid); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $response = $gapicClient->getService($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.metastore.v1.DataprocMetastore/GetService', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getServiceExceptionTest() + { + $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->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + try { + $gapicClient->getService($formattedName); + // 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 listBackupsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $backupsElement = new Backup(); + $backups = [ + $backupsElement, + ]; + $expectedResponse = new ListBackupsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setBackups($backups); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $response = $gapicClient->listBackups($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getBackups()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.metastore.v1.DataprocMetastore/ListBackups', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listBackupsExceptionTest() + { + $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->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + try { + $gapicClient->listBackups($formattedParent); + // 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 listMetadataImportsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $metadataImportsElement = new MetadataImport(); + $metadataImports = [ + $metadataImportsElement, + ]; + $expectedResponse = new ListMetadataImportsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setMetadataImports($metadataImports); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $response = $gapicClient->listMetadataImports($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getMetadataImports()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.metastore.v1.DataprocMetastore/ListMetadataImports', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listMetadataImportsExceptionTest() + { + $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->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + try { + $gapicClient->listMetadataImports($formattedParent); + // 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 listServicesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $servicesElement = new Service(); + $services = [ + $servicesElement, + ]; + $expectedResponse = new ListServicesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setServices($services); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->listServices($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getServices()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.metastore.v1.DataprocMetastore/ListServices', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listServicesExceptionTest() + { + $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->locationName('[PROJECT]', '[LOCATION]'); + try { + $gapicClient->listServices($formattedParent); + // 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 restoreServiceTest() + { + $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/restoreServiceTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $backup2 = 'backup22121930997'; + $details = 'details1557721666'; + $expectedResponse = new Restore(); + $expectedResponse->setBackup($backup2); + $expectedResponse->setDetails($details); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/restoreServiceTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedService = $gapicClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $formattedBackup = $gapicClient->backupName('[PROJECT]', '[LOCATION]', '[SERVICE]', '[BACKUP]'); + $response = $gapicClient->restoreService($formattedService, $formattedBackup); + $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.cloud.metastore.v1.DataprocMetastore/RestoreService', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getService(); + $this->assertProtobufEquals($formattedService, $actualValue); + $actualValue = $actualApiRequestObject->getBackup(); + $this->assertProtobufEquals($formattedBackup, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/restoreServiceTest'); + $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 restoreServiceExceptionTest() + { + $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/restoreServiceTest'); + $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 + $formattedService = $gapicClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $formattedBackup = $gapicClient->backupName('[PROJECT]', '[LOCATION]', '[SERVICE]', '[BACKUP]'); + $response = $gapicClient->restoreService($formattedService, $formattedBackup); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/restoreServiceTest'); + 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 updateMetadataImportTest() + { + $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/updateMetadataImportTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $expectedResponse = new MetadataImport(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateMetadataImportTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $updateMask = new FieldMask(); + $metadataImport = new MetadataImport(); + $response = $gapicClient->updateMetadataImport($updateMask, $metadataImport); + $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.cloud.metastore.v1.DataprocMetastore/UpdateMetadataImport', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $actualValue = $actualApiRequestObject->getMetadataImport(); + $this->assertProtobufEquals($metadataImport, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateMetadataImportTest'); + $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 updateMetadataImportExceptionTest() + { + $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/updateMetadataImportTest'); + $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 + $updateMask = new FieldMask(); + $metadataImport = new MetadataImport(); + $response = $gapicClient->updateMetadataImport($updateMask, $metadataImport); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateMetadataImportTest'); + 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 updateServiceTest() + { + $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/updateServiceTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $network = 'network1843485230'; + $endpointUri = 'endpointUri-850313278'; + $port = 3446913; + $stateMessage = 'stateMessage29641305'; + $artifactGcsUri = 'artifactGcsUri1337121495'; + $uid = 'uid115792'; + $expectedResponse = new Service(); + $expectedResponse->setName($name); + $expectedResponse->setNetwork($network); + $expectedResponse->setEndpointUri($endpointUri); + $expectedResponse->setPort($port); + $expectedResponse->setStateMessage($stateMessage); + $expectedResponse->setArtifactGcsUri($artifactGcsUri); + $expectedResponse->setUid($uid); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateServiceTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $updateMask = new FieldMask(); + $service = new Service(); + $response = $gapicClient->updateService($updateMask, $service); + $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.cloud.metastore.v1.DataprocMetastore/UpdateService', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $actualValue = $actualApiRequestObject->getService(); + $this->assertProtobufEquals($service, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateServiceTest'); + $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 updateServiceExceptionTest() + { + $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/updateServiceTest'); + $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 + $updateMask = new FieldMask(); + $service = new Service(); + $response = $gapicClient->updateService($updateMask, $service); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateServiceTest'); + 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 getLocationTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $locationId = 'locationId552319461'; + $displayName = 'displayName1615086568'; + $expectedResponse = new Location(); + $expectedResponse->setName($name2); + $expectedResponse->setLocationId($locationId); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + $response = $gapicClient->getLocation(); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/GetLocation', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getLocationExceptionTest() + { + $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); + try { + $gapicClient->getLocation(); + // 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 listLocationsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $locationsElement = new Location(); + $locations = [ + $locationsElement, + ]; + $expectedResponse = new ListLocationsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setLocations($locations); + $transport->addResponse($expectedResponse); + $response = $gapicClient->listLocations(); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getLocations()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/ListLocations', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listLocationsExceptionTest() + { + $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); + try { + $gapicClient->listLocations(); + // 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 getIamPolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $version = 351608024; + $etag = '21'; + $expectedResponse = new Policy(); + $expectedResponse->setVersion($version); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $response = $gapicClient->getIamPolicy($resource); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.iam.v1.IAMPolicy/GetIamPolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getIamPolicyExceptionTest() + { + $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 + $resource = 'resource-341064690'; + try { + $gapicClient->getIamPolicy($resource); + // 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 setIamPolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $version = 351608024; + $etag = '21'; + $expectedResponse = new Policy(); + $expectedResponse->setVersion($version); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $policy = new Policy(); + $response = $gapicClient->setIamPolicy($resource, $policy); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.iam.v1.IAMPolicy/SetIamPolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $actualValue = $actualRequestObject->getPolicy(); + $this->assertProtobufEquals($policy, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function setIamPolicyExceptionTest() + { + $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 + $resource = 'resource-341064690'; + $policy = new Policy(); + try { + $gapicClient->setIamPolicy($resource, $policy); + // 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 testIamPermissionsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new TestIamPermissionsResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $permissions = []; + $response = $gapicClient->testIamPermissions($resource, $permissions); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.iam.v1.IAMPolicy/TestIamPermissions', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $actualValue = $actualRequestObject->getPermissions(); + $this->assertProtobufEquals($permissions, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function testIamPermissionsExceptionTest() + { + $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 + $resource = 'resource-341064690'; + $permissions = []; + try { + $gapicClient->testIamPermissions($resource, $permissions); + // 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()); + } +} diff --git a/owl-bot-staging/DataprocMetastore/v1/tests/Unit/V1/DataprocMetastoreFederationClientTest.php b/owl-bot-staging/DataprocMetastore/v1/tests/Unit/V1/DataprocMetastoreFederationClientTest.php new file mode 100644 index 000000000000..d8bb345b463c --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1/tests/Unit/V1/DataprocMetastoreFederationClientTest.php @@ -0,0 +1,901 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return DataprocMetastoreFederationClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new DataprocMetastoreFederationClient($options); + } + + /** @test */ + public function createFederationTest() + { + $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/createFederationTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $version = 'version351608024'; + $endpointUri = 'endpointUri-850313278'; + $stateMessage = 'stateMessage29641305'; + $uid = 'uid115792'; + $expectedResponse = new Federation(); + $expectedResponse->setName($name); + $expectedResponse->setVersion($version); + $expectedResponse->setEndpointUri($endpointUri); + $expectedResponse->setStateMessage($stateMessage); + $expectedResponse->setUid($uid); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createFederationTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $federationId = 'federationId-1338699881'; + $federation = new Federation(); + $response = $gapicClient->createFederation($formattedParent, $federationId, $federation); + $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.cloud.metastore.v1.DataprocMetastoreFederation/CreateFederation', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getFederationId(); + $this->assertProtobufEquals($federationId, $actualValue); + $actualValue = $actualApiRequestObject->getFederation(); + $this->assertProtobufEquals($federation, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createFederationTest'); + $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 createFederationExceptionTest() + { + $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/createFederationTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $federationId = 'federationId-1338699881'; + $federation = new Federation(); + $response = $gapicClient->createFederation($formattedParent, $federationId, $federation); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createFederationTest'); + 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 deleteFederationTest() + { + $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/deleteFederationTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteFederationTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->federationName('[PROJECT]', '[LOCATION]', '[FEDERATION]'); + $response = $gapicClient->deleteFederation($formattedName); + $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.cloud.metastore.v1.DataprocMetastoreFederation/DeleteFederation', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteFederationTest'); + $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 deleteFederationExceptionTest() + { + $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/deleteFederationTest'); + $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->federationName('[PROJECT]', '[LOCATION]', '[FEDERATION]'); + $response = $gapicClient->deleteFederation($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteFederationTest'); + 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 getFederationTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $version = 'version351608024'; + $endpointUri = 'endpointUri-850313278'; + $stateMessage = 'stateMessage29641305'; + $uid = 'uid115792'; + $expectedResponse = new Federation(); + $expectedResponse->setName($name2); + $expectedResponse->setVersion($version); + $expectedResponse->setEndpointUri($endpointUri); + $expectedResponse->setStateMessage($stateMessage); + $expectedResponse->setUid($uid); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->federationName('[PROJECT]', '[LOCATION]', '[FEDERATION]'); + $response = $gapicClient->getFederation($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.metastore.v1.DataprocMetastoreFederation/GetFederation', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getFederationExceptionTest() + { + $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->federationName('[PROJECT]', '[LOCATION]', '[FEDERATION]'); + try { + $gapicClient->getFederation($formattedName); + // 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 listFederationsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $federationsElement = new Federation(); + $federations = [ + $federationsElement, + ]; + $expectedResponse = new ListFederationsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setFederations($federations); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->listFederations($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getFederations()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.metastore.v1.DataprocMetastoreFederation/ListFederations', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listFederationsExceptionTest() + { + $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->locationName('[PROJECT]', '[LOCATION]'); + try { + $gapicClient->listFederations($formattedParent); + // 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 updateFederationTest() + { + $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/updateFederationTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $version = 'version351608024'; + $endpointUri = 'endpointUri-850313278'; + $stateMessage = 'stateMessage29641305'; + $uid = 'uid115792'; + $expectedResponse = new Federation(); + $expectedResponse->setName($name); + $expectedResponse->setVersion($version); + $expectedResponse->setEndpointUri($endpointUri); + $expectedResponse->setStateMessage($stateMessage); + $expectedResponse->setUid($uid); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateFederationTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $updateMask = new FieldMask(); + $federation = new Federation(); + $response = $gapicClient->updateFederation($updateMask, $federation); + $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.cloud.metastore.v1.DataprocMetastoreFederation/UpdateFederation', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $actualValue = $actualApiRequestObject->getFederation(); + $this->assertProtobufEquals($federation, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateFederationTest'); + $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 updateFederationExceptionTest() + { + $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/updateFederationTest'); + $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 + $updateMask = new FieldMask(); + $federation = new Federation(); + $response = $gapicClient->updateFederation($updateMask, $federation); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateFederationTest'); + 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 getLocationTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $locationId = 'locationId552319461'; + $displayName = 'displayName1615086568'; + $expectedResponse = new Location(); + $expectedResponse->setName($name2); + $expectedResponse->setLocationId($locationId); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + $response = $gapicClient->getLocation(); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/GetLocation', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getLocationExceptionTest() + { + $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); + try { + $gapicClient->getLocation(); + // 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 listLocationsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $locationsElement = new Location(); + $locations = [ + $locationsElement, + ]; + $expectedResponse = new ListLocationsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setLocations($locations); + $transport->addResponse($expectedResponse); + $response = $gapicClient->listLocations(); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getLocations()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/ListLocations', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listLocationsExceptionTest() + { + $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); + try { + $gapicClient->listLocations(); + // 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 getIamPolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $version = 351608024; + $etag = '21'; + $expectedResponse = new Policy(); + $expectedResponse->setVersion($version); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $response = $gapicClient->getIamPolicy($resource); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.iam.v1.IAMPolicy/GetIamPolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getIamPolicyExceptionTest() + { + $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 + $resource = 'resource-341064690'; + try { + $gapicClient->getIamPolicy($resource); + // 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 setIamPolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $version = 351608024; + $etag = '21'; + $expectedResponse = new Policy(); + $expectedResponse->setVersion($version); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $policy = new Policy(); + $response = $gapicClient->setIamPolicy($resource, $policy); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.iam.v1.IAMPolicy/SetIamPolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $actualValue = $actualRequestObject->getPolicy(); + $this->assertProtobufEquals($policy, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function setIamPolicyExceptionTest() + { + $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 + $resource = 'resource-341064690'; + $policy = new Policy(); + try { + $gapicClient->setIamPolicy($resource, $policy); + // 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 testIamPermissionsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new TestIamPermissionsResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $permissions = []; + $response = $gapicClient->testIamPermissions($resource, $permissions); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.iam.v1.IAMPolicy/TestIamPermissions', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $actualValue = $actualRequestObject->getPermissions(); + $this->assertProtobufEquals($permissions, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function testIamPermissionsExceptionTest() + { + $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 + $resource = 'resource-341064690'; + $permissions = []; + try { + $gapicClient->testIamPermissions($resource, $permissions); + // 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()); + } +} diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/GPBMetadata/Google/Cloud/Metastore/V1Alpha/Metastore.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/GPBMetadata/Google/Cloud/Metastore/V1Alpha/Metastore.php new file mode 100644 index 000000000000..8dfc3043af00 Binary files /dev/null and b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/GPBMetadata/Google/Cloud/Metastore/V1Alpha/Metastore.php differ diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/GPBMetadata/Google/Cloud/Metastore/V1Alpha/MetastoreFederation.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/GPBMetadata/Google/Cloud/Metastore/V1Alpha/MetastoreFederation.php new file mode 100644 index 000000000000..0cdc4d04c3c0 Binary files /dev/null and b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/GPBMetadata/Google/Cloud/Metastore/V1Alpha/MetastoreFederation.php differ diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/AlterMetadataResourceLocationRequest.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/AlterMetadataResourceLocationRequest.php new file mode 100644 index 000000000000..31a4013d3717 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/AlterMetadataResourceLocationRequest.php @@ -0,0 +1,164 @@ +google.cloud.metastore.v1alpha.AlterMetadataResourceLocationRequest + */ +class AlterMetadataResourceLocationRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The relative resource name of the metastore service to mutate + * metadata, in the following format: + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * + * Generated from protobuf field string service = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $service = ''; + /** + * Required. The relative metadata resource name in the following format. + * `databases/{database_id}` + * or + * `databases/{database_id}/tables/{table_id}` + * or + * `databases/{database_id}/tables/{table_id}/partitions/{partition_id}` + * + * Generated from protobuf field string resource_name = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $resource_name = ''; + /** + * Required. The new location URI for the metadata resource. + * + * Generated from protobuf field string location_uri = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $location_uri = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $service + * Required. The relative resource name of the metastore service to mutate + * metadata, in the following format: + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * @type string $resource_name + * Required. The relative metadata resource name in the following format. + * `databases/{database_id}` + * or + * `databases/{database_id}/tables/{table_id}` + * or + * `databases/{database_id}/tables/{table_id}/partitions/{partition_id}` + * @type string $location_uri + * Required. The new location URI for the metadata resource. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Alpha\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Required. The relative resource name of the metastore service to mutate + * metadata, in the following format: + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * + * Generated from protobuf field string service = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getService() + { + return $this->service; + } + + /** + * Required. The relative resource name of the metastore service to mutate + * metadata, in the following format: + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * + * Generated from protobuf field string service = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setService($var) + { + GPBUtil::checkString($var, True); + $this->service = $var; + + return $this; + } + + /** + * Required. The relative metadata resource name in the following format. + * `databases/{database_id}` + * or + * `databases/{database_id}/tables/{table_id}` + * or + * `databases/{database_id}/tables/{table_id}/partitions/{partition_id}` + * + * Generated from protobuf field string resource_name = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getResourceName() + { + return $this->resource_name; + } + + /** + * Required. The relative metadata resource name in the following format. + * `databases/{database_id}` + * or + * `databases/{database_id}/tables/{table_id}` + * or + * `databases/{database_id}/tables/{table_id}/partitions/{partition_id}` + * + * Generated from protobuf field string resource_name = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setResourceName($var) + { + GPBUtil::checkString($var, True); + $this->resource_name = $var; + + return $this; + } + + /** + * Required. The new location URI for the metadata resource. + * + * Generated from protobuf field string location_uri = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getLocationUri() + { + return $this->location_uri; + } + + /** + * Required. The new location URI for the metadata resource. + * + * Generated from protobuf field string location_uri = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setLocationUri($var) + { + GPBUtil::checkString($var, True); + $this->location_uri = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/AlterMetadataResourceLocationResponse.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/AlterMetadataResourceLocationResponse.php new file mode 100644 index 000000000000..3ee73fba1b82 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/AlterMetadataResourceLocationResponse.php @@ -0,0 +1,34 @@ +google.cloud.metastore.v1alpha.AlterMetadataResourceLocationResponse + */ +class AlterMetadataResourceLocationResponse extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Alpha\Metastore::initOnce(); + parent::__construct($data); + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/AuxiliaryVersionConfig.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/AuxiliaryVersionConfig.php new file mode 100644 index 000000000000..2e500e1c4c1c --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/AuxiliaryVersionConfig.php @@ -0,0 +1,169 @@ +google.cloud.metastore.v1alpha.AuxiliaryVersionConfig + */ +class AuxiliaryVersionConfig extends \Google\Protobuf\Internal\Message +{ + /** + * The Hive metastore version of the auxiliary service. It must be less + * than the primary Hive metastore service's version. + * + * Generated from protobuf field string version = 1; + */ + protected $version = ''; + /** + * A mapping of Hive metastore configuration key-value pairs to apply to the + * auxiliary Hive metastore (configured in `hive-site.xml`) in addition to + * the primary version's overrides. If keys are present in both the auxiliary + * version's overrides and the primary version's overrides, the value from + * the auxiliary version's overrides takes precedence. + * + * Generated from protobuf field map config_overrides = 2; + */ + private $config_overrides; + /** + * Output only. The network configuration contains the endpoint URI(s) of the + * auxiliary Hive metastore service. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.NetworkConfig network_config = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $network_config = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $version + * The Hive metastore version of the auxiliary service. It must be less + * than the primary Hive metastore service's version. + * @type array|\Google\Protobuf\Internal\MapField $config_overrides + * A mapping of Hive metastore configuration key-value pairs to apply to the + * auxiliary Hive metastore (configured in `hive-site.xml`) in addition to + * the primary version's overrides. If keys are present in both the auxiliary + * version's overrides and the primary version's overrides, the value from + * the auxiliary version's overrides takes precedence. + * @type \Google\Cloud\Metastore\V1alpha\NetworkConfig $network_config + * Output only. The network configuration contains the endpoint URI(s) of the + * auxiliary Hive metastore service. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Alpha\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * The Hive metastore version of the auxiliary service. It must be less + * than the primary Hive metastore service's version. + * + * Generated from protobuf field string version = 1; + * @return string + */ + public function getVersion() + { + return $this->version; + } + + /** + * The Hive metastore version of the auxiliary service. It must be less + * than the primary Hive metastore service's version. + * + * Generated from protobuf field string version = 1; + * @param string $var + * @return $this + */ + public function setVersion($var) + { + GPBUtil::checkString($var, True); + $this->version = $var; + + return $this; + } + + /** + * A mapping of Hive metastore configuration key-value pairs to apply to the + * auxiliary Hive metastore (configured in `hive-site.xml`) in addition to + * the primary version's overrides. If keys are present in both the auxiliary + * version's overrides and the primary version's overrides, the value from + * the auxiliary version's overrides takes precedence. + * + * Generated from protobuf field map config_overrides = 2; + * @return \Google\Protobuf\Internal\MapField + */ + public function getConfigOverrides() + { + return $this->config_overrides; + } + + /** + * A mapping of Hive metastore configuration key-value pairs to apply to the + * auxiliary Hive metastore (configured in `hive-site.xml`) in addition to + * the primary version's overrides. If keys are present in both the auxiliary + * version's overrides and the primary version's overrides, the value from + * the auxiliary version's overrides takes precedence. + * + * Generated from protobuf field map config_overrides = 2; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setConfigOverrides($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->config_overrides = $arr; + + return $this; + } + + /** + * Output only. The network configuration contains the endpoint URI(s) of the + * auxiliary Hive metastore service. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.NetworkConfig network_config = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\Metastore\V1alpha\NetworkConfig|null + */ + public function getNetworkConfig() + { + return $this->network_config; + } + + public function hasNetworkConfig() + { + return isset($this->network_config); + } + + public function clearNetworkConfig() + { + unset($this->network_config); + } + + /** + * Output only. The network configuration contains the endpoint URI(s) of the + * auxiliary Hive metastore service. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.NetworkConfig network_config = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\Metastore\V1alpha\NetworkConfig $var + * @return $this + */ + public function setNetworkConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Metastore\V1alpha\NetworkConfig::class); + $this->network_config = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/BackendMetastore.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/BackendMetastore.php new file mode 100644 index 000000000000..18e9b6dc1e3b --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/BackendMetastore.php @@ -0,0 +1,125 @@ +google.cloud.metastore.v1alpha.BackendMetastore + */ +class BackendMetastore extends \Google\Protobuf\Internal\Message +{ + /** + * The relative resource name of the metastore that is being federated. + * The formats of the relative resource names for the currently supported + * metastores are listed below: + * * BigQuery + * * `projects/{project_id}` + * * Dataproc Metastore + * * `projects/{project_id}/locations/{location}/services/{service_id}` + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * The type of the backend metastore. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.BackendMetastore.MetastoreType metastore_type = 2; + */ + protected $metastore_type = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The relative resource name of the metastore that is being federated. + * The formats of the relative resource names for the currently supported + * metastores are listed below: + * * BigQuery + * * `projects/{project_id}` + * * Dataproc Metastore + * * `projects/{project_id}/locations/{location}/services/{service_id}` + * @type int $metastore_type + * The type of the backend metastore. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Alpha\MetastoreFederation::initOnce(); + parent::__construct($data); + } + + /** + * The relative resource name of the metastore that is being federated. + * The formats of the relative resource names for the currently supported + * metastores are listed below: + * * BigQuery + * * `projects/{project_id}` + * * Dataproc Metastore + * * `projects/{project_id}/locations/{location}/services/{service_id}` + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The relative resource name of the metastore that is being federated. + * The formats of the relative resource names for the currently supported + * metastores are listed below: + * * BigQuery + * * `projects/{project_id}` + * * Dataproc Metastore + * * `projects/{project_id}/locations/{location}/services/{service_id}` + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The type of the backend metastore. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.BackendMetastore.MetastoreType metastore_type = 2; + * @return int + */ + public function getMetastoreType() + { + return $this->metastore_type; + } + + /** + * The type of the backend metastore. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.BackendMetastore.MetastoreType metastore_type = 2; + * @param int $var + * @return $this + */ + public function setMetastoreType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Metastore\V1alpha\BackendMetastore\MetastoreType::class); + $this->metastore_type = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/BackendMetastore/MetastoreType.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/BackendMetastore/MetastoreType.php new file mode 100644 index 000000000000..1c3e2acf3e60 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/BackendMetastore/MetastoreType.php @@ -0,0 +1,71 @@ +google.cloud.metastore.v1alpha.BackendMetastore.MetastoreType + */ +class MetastoreType +{ + /** + * The metastore type is not set. + * + * Generated from protobuf enum METASTORE_TYPE_UNSPECIFIED = 0; + */ + const METASTORE_TYPE_UNSPECIFIED = 0; + /** + * The backend metastore is Dataplex. + * + * Generated from protobuf enum DATAPLEX = 1; + */ + const DATAPLEX = 1; + /** + * The backend metastore is BigQuery. + * + * Generated from protobuf enum BIGQUERY = 2; + */ + const BIGQUERY = 2; + /** + * The backend metastore is Dataproc Metastore. + * + * Generated from protobuf enum DATAPROC_METASTORE = 3; + */ + const DATAPROC_METASTORE = 3; + + private static $valueToName = [ + self::METASTORE_TYPE_UNSPECIFIED => 'METASTORE_TYPE_UNSPECIFIED', + self::DATAPLEX => 'DATAPLEX', + self::BIGQUERY => 'BIGQUERY', + self::DATAPROC_METASTORE => 'DATAPROC_METASTORE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(MetastoreType::class, \Google\Cloud\Metastore\V1alpha\BackendMetastore_MetastoreType::class); + diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/BackendMetastore_MetastoreType.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/BackendMetastore_MetastoreType.php new file mode 100644 index 000000000000..37e16ceea031 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/BackendMetastore_MetastoreType.php @@ -0,0 +1,16 @@ +google.cloud.metastore.v1alpha.Backup + */ +class Backup extends \Google\Protobuf\Internal\Message +{ + /** + * Immutable. The relative resource name of the backup, in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + */ + protected $name = ''; + /** + * Output only. The time when the backup was started. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. The time when the backup finished creating. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $end_time = null; + /** + * Output only. The current state of the backup. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.Backup.State state = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Output only. The revision of the service at the time of backup. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.Service service_revision = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $service_revision = null; + /** + * The description of the backup. + * + * Generated from protobuf field string description = 6; + */ + protected $description = ''; + /** + * Output only. Services that are restoring from the backup. + * + * Generated from protobuf field repeated string restoring_services = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $restoring_services; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Immutable. The relative resource name of the backup, in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}` + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The time when the backup was started. + * @type \Google\Protobuf\Timestamp $end_time + * Output only. The time when the backup finished creating. + * @type int $state + * Output only. The current state of the backup. + * @type \Google\Cloud\Metastore\V1alpha\Service $service_revision + * Output only. The revision of the service at the time of backup. + * @type string $description + * The description of the backup. + * @type array|\Google\Protobuf\Internal\RepeatedField $restoring_services + * Output only. Services that are restoring from the backup. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Alpha\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Immutable. The relative resource name of the backup, in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Immutable. The relative resource name of the backup, in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. The time when the backup was started. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.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 when the backup was started. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.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 when the backup finished creating. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 3 [(.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 when the backup finished creating. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 3 [(.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 current state of the backup. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.Backup.State state = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. The current state of the backup. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.Backup.State state = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Metastore\V1alpha\Backup\State::class); + $this->state = $var; + + return $this; + } + + /** + * Output only. The revision of the service at the time of backup. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.Service service_revision = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\Metastore\V1alpha\Service|null + */ + public function getServiceRevision() + { + return $this->service_revision; + } + + public function hasServiceRevision() + { + return isset($this->service_revision); + } + + public function clearServiceRevision() + { + unset($this->service_revision); + } + + /** + * Output only. The revision of the service at the time of backup. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.Service service_revision = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\Metastore\V1alpha\Service $var + * @return $this + */ + public function setServiceRevision($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Metastore\V1alpha\Service::class); + $this->service_revision = $var; + + return $this; + } + + /** + * The description of the backup. + * + * Generated from protobuf field string description = 6; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * The description of the backup. + * + * Generated from protobuf field string description = 6; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * Output only. Services that are restoring from the backup. + * + * Generated from protobuf field repeated string restoring_services = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRestoringServices() + { + return $this->restoring_services; + } + + /** + * Output only. Services that are restoring from the backup. + * + * Generated from protobuf field repeated string restoring_services = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRestoringServices($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->restoring_services = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/Backup/State.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/Backup/State.php new file mode 100644 index 000000000000..d5770f420c45 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/Backup/State.php @@ -0,0 +1,85 @@ +google.cloud.metastore.v1alpha.Backup.State + */ +class State +{ + /** + * The state of the backup is unknown. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The backup is being created. + * + * Generated from protobuf enum CREATING = 1; + */ + const CREATING = 1; + /** + * The backup is being deleted. + * + * Generated from protobuf enum DELETING = 2; + */ + const DELETING = 2; + /** + * The backup is active and ready to use. + * + * Generated from protobuf enum ACTIVE = 3; + */ + const ACTIVE = 3; + /** + * The backup failed. + * + * Generated from protobuf enum FAILED = 4; + */ + const FAILED = 4; + /** + * The backup is being restored. + * + * Generated from protobuf enum RESTORING = 5; + */ + const RESTORING = 5; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::CREATING => 'CREATING', + self::DELETING => 'DELETING', + self::ACTIVE => 'ACTIVE', + self::FAILED => 'FAILED', + self::RESTORING => 'RESTORING', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\Metastore\V1alpha\Backup_State::class); + diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/Backup_State.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/Backup_State.php new file mode 100644 index 000000000000..4299936d4609 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/Backup_State.php @@ -0,0 +1,16 @@ +google.cloud.metastore.v1alpha.CreateBackupRequest + */ +class CreateBackupRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The relative resource name of the service in which to create a + * backup of the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The ID of the backup, which is used as the final component of the + * backup's name. + * This value must be between 1 and 64 characters long, begin with a letter, + * end with a letter or number, and consist of alpha-numeric ASCII characters + * or hyphens. + * + * Generated from protobuf field string backup_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $backup_id = ''; + /** + * Required. The backup to create. The `name` field is ignored. The ID of the + * created backup must be provided in the request's `backup_id` field. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.Backup backup = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $backup = null; + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The relative resource name of the service in which to create a + * backup of the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * @type string $backup_id + * Required. The ID of the backup, which is used as the final component of the + * backup's name. + * This value must be between 1 and 64 characters long, begin with a letter, + * end with a letter or number, and consist of alpha-numeric ASCII characters + * or hyphens. + * @type \Google\Cloud\Metastore\V1alpha\Backup $backup + * Required. The backup to create. The `name` field is ignored. The ID of the + * created backup must be provided in the request's `backup_id` field. + * @type string $request_id + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Alpha\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Required. The relative resource name of the service in which to create a + * backup of the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * + * 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. The relative resource name of the service in which to create a + * backup of the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * + * 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. The ID of the backup, which is used as the final component of the + * backup's name. + * This value must be between 1 and 64 characters long, begin with a letter, + * end with a letter or number, and consist of alpha-numeric ASCII characters + * or hyphens. + * + * Generated from protobuf field string backup_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getBackupId() + { + return $this->backup_id; + } + + /** + * Required. The ID of the backup, which is used as the final component of the + * backup's name. + * This value must be between 1 and 64 characters long, begin with a letter, + * end with a letter or number, and consist of alpha-numeric ASCII characters + * or hyphens. + * + * Generated from protobuf field string backup_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setBackupId($var) + { + GPBUtil::checkString($var, True); + $this->backup_id = $var; + + return $this; + } + + /** + * Required. The backup to create. The `name` field is ignored. The ID of the + * created backup must be provided in the request's `backup_id` field. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.Backup backup = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Metastore\V1alpha\Backup|null + */ + public function getBackup() + { + return $this->backup; + } + + public function hasBackup() + { + return isset($this->backup); + } + + public function clearBackup() + { + unset($this->backup); + } + + /** + * Required. The backup to create. The `name` field is ignored. The ID of the + * created backup must be provided in the request's `backup_id` field. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.Backup backup = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Metastore\V1alpha\Backup $var + * @return $this + */ + public function setBackup($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Metastore\V1alpha\Backup::class); + $this->backup = $var; + + return $this; + } + + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @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/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/CreateFederationRequest.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/CreateFederationRequest.php new file mode 100644 index 000000000000..f7ae924fc43b --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/CreateFederationRequest.php @@ -0,0 +1,247 @@ +google.cloud.metastore.v1alpha.CreateFederationRequest + */ +class CreateFederationRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The relative resource name of the location in which to create a + * federation service, in the following form: + * `projects/{project_number}/locations/{location_id}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The ID of the metastore federation, which is used as the final + * component of the metastore federation's name. + * This value must be between 2 and 63 characters long inclusive, begin with a + * letter, end with a letter or number, and consist of alpha-numeric + * ASCII characters or hyphens. + * + * Generated from protobuf field string federation_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $federation_id = ''; + /** + * Required. The Metastore Federation to create. The `name` field is + * ignored. The ID of the created metastore federation must be + * provided in the request's `federation_id` field. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.Federation federation = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $federation = null; + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The relative resource name of the location in which to create a + * federation service, in the following form: + * `projects/{project_number}/locations/{location_id}`. + * @type string $federation_id + * Required. The ID of the metastore federation, which is used as the final + * component of the metastore federation's name. + * This value must be between 2 and 63 characters long inclusive, begin with a + * letter, end with a letter or number, and consist of alpha-numeric + * ASCII characters or hyphens. + * @type \Google\Cloud\Metastore\V1alpha\Federation $federation + * Required. The Metastore Federation to create. The `name` field is + * ignored. The ID of the created metastore federation must be + * provided in the request's `federation_id` field. + * @type string $request_id + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Alpha\MetastoreFederation::initOnce(); + parent::__construct($data); + } + + /** + * Required. The relative resource name of the location in which to create a + * federation service, in the following form: + * `projects/{project_number}/locations/{location_id}`. + * + * 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. The relative resource name of the location in which to create a + * federation service, in the following form: + * `projects/{project_number}/locations/{location_id}`. + * + * 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. The ID of the metastore federation, which is used as the final + * component of the metastore federation's name. + * This value must be between 2 and 63 characters long inclusive, begin with a + * letter, end with a letter or number, and consist of alpha-numeric + * ASCII characters or hyphens. + * + * Generated from protobuf field string federation_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getFederationId() + { + return $this->federation_id; + } + + /** + * Required. The ID of the metastore federation, which is used as the final + * component of the metastore federation's name. + * This value must be between 2 and 63 characters long inclusive, begin with a + * letter, end with a letter or number, and consist of alpha-numeric + * ASCII characters or hyphens. + * + * Generated from protobuf field string federation_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setFederationId($var) + { + GPBUtil::checkString($var, True); + $this->federation_id = $var; + + return $this; + } + + /** + * Required. The Metastore Federation to create. The `name` field is + * ignored. The ID of the created metastore federation must be + * provided in the request's `federation_id` field. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.Federation federation = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Metastore\V1alpha\Federation|null + */ + public function getFederation() + { + return $this->federation; + } + + public function hasFederation() + { + return isset($this->federation); + } + + public function clearFederation() + { + unset($this->federation); + } + + /** + * Required. The Metastore Federation to create. The `name` field is + * ignored. The ID of the created metastore federation must be + * provided in the request's `federation_id` field. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.Federation federation = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Metastore\V1alpha\Federation $var + * @return $this + */ + public function setFederation($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Metastore\V1alpha\Federation::class); + $this->federation = $var; + + return $this; + } + + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @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/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/CreateMetadataImportRequest.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/CreateMetadataImportRequest.php new file mode 100644 index 000000000000..2b1815d47c92 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/CreateMetadataImportRequest.php @@ -0,0 +1,248 @@ +google.cloud.metastore.v1alpha.CreateMetadataImportRequest + */ +class CreateMetadataImportRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The relative resource name of the service in which to create a + * metastore import, in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The ID of the metadata import, which is used as the final + * component of the metadata import's name. + * This value must be between 1 and 64 characters long, begin with a letter, + * end with a letter or number, and consist of alpha-numeric ASCII characters + * or hyphens. + * + * Generated from protobuf field string metadata_import_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $metadata_import_id = ''; + /** + * Required. The metadata import to create. The `name` field is ignored. The + * ID of the created metadata import must be provided in the request's + * `metadata_import_id` field. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.MetadataImport metadata_import = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $metadata_import = null; + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The relative resource name of the service in which to create a + * metastore import, in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * @type string $metadata_import_id + * Required. The ID of the metadata import, which is used as the final + * component of the metadata import's name. + * This value must be between 1 and 64 characters long, begin with a letter, + * end with a letter or number, and consist of alpha-numeric ASCII characters + * or hyphens. + * @type \Google\Cloud\Metastore\V1alpha\MetadataImport $metadata_import + * Required. The metadata import to create. The `name` field is ignored. The + * ID of the created metadata import must be provided in the request's + * `metadata_import_id` field. + * @type string $request_id + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Alpha\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Required. The relative resource name of the service in which to create a + * metastore import, in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * + * 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. The relative resource name of the service in which to create a + * metastore import, in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * + * 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. The ID of the metadata import, which is used as the final + * component of the metadata import's name. + * This value must be between 1 and 64 characters long, begin with a letter, + * end with a letter or number, and consist of alpha-numeric ASCII characters + * or hyphens. + * + * Generated from protobuf field string metadata_import_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getMetadataImportId() + { + return $this->metadata_import_id; + } + + /** + * Required. The ID of the metadata import, which is used as the final + * component of the metadata import's name. + * This value must be between 1 and 64 characters long, begin with a letter, + * end with a letter or number, and consist of alpha-numeric ASCII characters + * or hyphens. + * + * Generated from protobuf field string metadata_import_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setMetadataImportId($var) + { + GPBUtil::checkString($var, True); + $this->metadata_import_id = $var; + + return $this; + } + + /** + * Required. The metadata import to create. The `name` field is ignored. The + * ID of the created metadata import must be provided in the request's + * `metadata_import_id` field. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.MetadataImport metadata_import = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Metastore\V1alpha\MetadataImport|null + */ + public function getMetadataImport() + { + return $this->metadata_import; + } + + public function hasMetadataImport() + { + return isset($this->metadata_import); + } + + public function clearMetadataImport() + { + unset($this->metadata_import); + } + + /** + * Required. The metadata import to create. The `name` field is ignored. The + * ID of the created metadata import must be provided in the request's + * `metadata_import_id` field. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.MetadataImport metadata_import = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Metastore\V1alpha\MetadataImport $var + * @return $this + */ + public function setMetadataImport($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Metastore\V1alpha\MetadataImport::class); + $this->metadata_import = $var; + + return $this; + } + + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @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/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/CreateServiceRequest.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/CreateServiceRequest.php new file mode 100644 index 000000000000..de8438d87a9e --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/CreateServiceRequest.php @@ -0,0 +1,248 @@ +google.cloud.metastore.v1alpha.CreateServiceRequest + */ +class CreateServiceRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The relative resource name of the location in which to create a + * metastore service, in the following form: + * `projects/{project_number}/locations/{location_id}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The ID of the metastore service, which is used as the final + * component of the metastore service's name. + * This value must be between 2 and 63 characters long inclusive, begin with a + * letter, end with a letter or number, and consist of alpha-numeric + * ASCII characters or hyphens. + * + * Generated from protobuf field string service_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $service_id = ''; + /** + * Required. The Metastore service to create. The `name` field is + * ignored. The ID of the created metastore service must be provided in + * the request's `service_id` field. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.Service service = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $service = null; + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The relative resource name of the location in which to create a + * metastore service, in the following form: + * `projects/{project_number}/locations/{location_id}`. + * @type string $service_id + * Required. The ID of the metastore service, which is used as the final + * component of the metastore service's name. + * This value must be between 2 and 63 characters long inclusive, begin with a + * letter, end with a letter or number, and consist of alpha-numeric + * ASCII characters or hyphens. + * @type \Google\Cloud\Metastore\V1alpha\Service $service + * Required. The Metastore service to create. The `name` field is + * ignored. The ID of the created metastore service must be provided in + * the request's `service_id` field. + * @type string $request_id + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Alpha\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Required. The relative resource name of the location in which to create a + * metastore service, in the following form: + * `projects/{project_number}/locations/{location_id}`. + * + * 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. The relative resource name of the location in which to create a + * metastore service, in the following form: + * `projects/{project_number}/locations/{location_id}`. + * + * 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. The ID of the metastore service, which is used as the final + * component of the metastore service's name. + * This value must be between 2 and 63 characters long inclusive, begin with a + * letter, end with a letter or number, and consist of alpha-numeric + * ASCII characters or hyphens. + * + * Generated from protobuf field string service_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getServiceId() + { + return $this->service_id; + } + + /** + * Required. The ID of the metastore service, which is used as the final + * component of the metastore service's name. + * This value must be between 2 and 63 characters long inclusive, begin with a + * letter, end with a letter or number, and consist of alpha-numeric + * ASCII characters or hyphens. + * + * Generated from protobuf field string service_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setServiceId($var) + { + GPBUtil::checkString($var, True); + $this->service_id = $var; + + return $this; + } + + /** + * Required. The Metastore service to create. The `name` field is + * ignored. The ID of the created metastore service must be provided in + * the request's `service_id` field. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.Service service = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Metastore\V1alpha\Service|null + */ + public function getService() + { + return $this->service; + } + + public function hasService() + { + return isset($this->service); + } + + public function clearService() + { + unset($this->service); + } + + /** + * Required. The Metastore service to create. The `name` field is + * ignored. The ID of the created metastore service must be provided in + * the request's `service_id` field. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.Service service = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Metastore\V1alpha\Service $var + * @return $this + */ + public function setService($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Metastore\V1alpha\Service::class); + $this->service = $var; + + return $this; + } + + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @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/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/DataCatalogConfig.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/DataCatalogConfig.php new file mode 100644 index 000000000000..f252053725fd --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/DataCatalogConfig.php @@ -0,0 +1,72 @@ +google.cloud.metastore.v1alpha.DataCatalogConfig + */ +class DataCatalogConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Defines whether the metastore metadata should be synced to Data Catalog. + * The default value is to disable syncing metastore metadata to Data Catalog. + * + * Generated from protobuf field bool enabled = 2; + */ + protected $enabled = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $enabled + * Defines whether the metastore metadata should be synced to Data Catalog. + * The default value is to disable syncing metastore metadata to Data Catalog. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Alpha\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Defines whether the metastore metadata should be synced to Data Catalog. + * The default value is to disable syncing metastore metadata to Data Catalog. + * + * Generated from protobuf field bool enabled = 2; + * @return bool + */ + public function getEnabled() + { + return $this->enabled; + } + + /** + * Defines whether the metastore metadata should be synced to Data Catalog. + * The default value is to disable syncing metastore metadata to Data Catalog. + * + * Generated from protobuf field bool enabled = 2; + * @param bool $var + * @return $this + */ + public function setEnabled($var) + { + GPBUtil::checkBool($var); + $this->enabled = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/DatabaseDumpSpec.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/DatabaseDumpSpec.php new file mode 100644 index 000000000000..775ad2d5ca0c --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/DatabaseDumpSpec.php @@ -0,0 +1,33 @@ +google.cloud.metastore.v1alpha.DatabaseDumpSpec + */ +class DatabaseDumpSpec extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Alpha\Metastore::initOnce(); + parent::__construct($data); + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/DatabaseDumpSpec/Type.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/DatabaseDumpSpec/Type.php new file mode 100644 index 000000000000..290359f1c193 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/DatabaseDumpSpec/Type.php @@ -0,0 +1,64 @@ +google.cloud.metastore.v1alpha.DatabaseDumpSpec.Type + */ +class Type +{ + /** + * The type of the database dump is unknown. + * + * Generated from protobuf enum TYPE_UNSPECIFIED = 0; + */ + const TYPE_UNSPECIFIED = 0; + /** + * Database dump is a MySQL dump file. + * + * Generated from protobuf enum MYSQL = 1; + */ + const MYSQL = 1; + /** + * Database dump contains Avro files. + * + * Generated from protobuf enum AVRO = 2; + */ + const AVRO = 2; + + private static $valueToName = [ + self::TYPE_UNSPECIFIED => 'TYPE_UNSPECIFIED', + self::MYSQL => 'MYSQL', + self::AVRO => 'AVRO', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Type::class, \Google\Cloud\Metastore\V1alpha\DatabaseDumpSpec_Type::class); + diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/DatabaseDumpSpec_Type.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/DatabaseDumpSpec_Type.php new file mode 100644 index 000000000000..afa6fae34328 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/DatabaseDumpSpec_Type.php @@ -0,0 +1,16 @@ +google.cloud.metastore.v1alpha.DataplexConfig + */ +class DataplexConfig extends \Google\Protobuf\Internal\Message +{ + /** + * A reference to the Lake resources that this metastore service is attached + * to. The key is the lake resource name. Example: + * `projects/{project_number}/locations/{location_id}/lakes/{lake_id}`. + * + * Generated from protobuf field map lake_resources = 1; + */ + private $lake_resources; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\MapField $lake_resources + * A reference to the Lake resources that this metastore service is attached + * to. The key is the lake resource name. Example: + * `projects/{project_number}/locations/{location_id}/lakes/{lake_id}`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Alpha\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * A reference to the Lake resources that this metastore service is attached + * to. The key is the lake resource name. Example: + * `projects/{project_number}/locations/{location_id}/lakes/{lake_id}`. + * + * Generated from protobuf field map lake_resources = 1; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLakeResources() + { + return $this->lake_resources; + } + + /** + * A reference to the Lake resources that this metastore service is attached + * to. The key is the lake resource name. Example: + * `projects/{project_number}/locations/{location_id}/lakes/{lake_id}`. + * + * Generated from protobuf field map lake_resources = 1; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLakeResources($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Metastore\V1alpha\Lake::class); + $this->lake_resources = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/DataprocMetastoreFederationGrpcClient.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/DataprocMetastoreFederationGrpcClient.php new file mode 100644 index 000000000000..bb78baa97a1a --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/DataprocMetastoreFederationGrpcClient.php @@ -0,0 +1,122 @@ +_simpleRequest('/google.cloud.metastore.v1alpha.DataprocMetastoreFederation/ListFederations', + $argument, + ['\Google\Cloud\Metastore\V1alpha\ListFederationsResponse', 'decode'], + $metadata, $options); + } + + /** + * Gets the details of a single federation. + * @param \Google\Cloud\Metastore\V1alpha\GetFederationRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function GetFederation(\Google\Cloud\Metastore\V1alpha\GetFederationRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.metastore.v1alpha.DataprocMetastoreFederation/GetFederation', + $argument, + ['\Google\Cloud\Metastore\V1alpha\Federation', 'decode'], + $metadata, $options); + } + + /** + * Creates a metastore federation in a project and location. + * @param \Google\Cloud\Metastore\V1alpha\CreateFederationRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function CreateFederation(\Google\Cloud\Metastore\V1alpha\CreateFederationRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.metastore.v1alpha.DataprocMetastoreFederation/CreateFederation', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Updates the fields of a federation. + * @param \Google\Cloud\Metastore\V1alpha\UpdateFederationRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function UpdateFederation(\Google\Cloud\Metastore\V1alpha\UpdateFederationRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.metastore.v1alpha.DataprocMetastoreFederation/UpdateFederation', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Deletes a single federation. + * @param \Google\Cloud\Metastore\V1alpha\DeleteFederationRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function DeleteFederation(\Google\Cloud\Metastore\V1alpha\DeleteFederationRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.metastore.v1alpha.DataprocMetastoreFederation/DeleteFederation', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + +} diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/DataprocMetastoreGrpcClient.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/DataprocMetastoreGrpcClient.php new file mode 100644 index 000000000000..6cd566f3c28e --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/DataprocMetastoreGrpcClient.php @@ -0,0 +1,340 @@ +_simpleRequest('/google.cloud.metastore.v1alpha.DataprocMetastore/ListServices', + $argument, + ['\Google\Cloud\Metastore\V1alpha\ListServicesResponse', 'decode'], + $metadata, $options); + } + + /** + * Gets the details of a single service. + * @param \Google\Cloud\Metastore\V1alpha\GetServiceRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function GetService(\Google\Cloud\Metastore\V1alpha\GetServiceRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.metastore.v1alpha.DataprocMetastore/GetService', + $argument, + ['\Google\Cloud\Metastore\V1alpha\Service', 'decode'], + $metadata, $options); + } + + /** + * Creates a metastore service in a project and location. + * @param \Google\Cloud\Metastore\V1alpha\CreateServiceRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function CreateService(\Google\Cloud\Metastore\V1alpha\CreateServiceRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.metastore.v1alpha.DataprocMetastore/CreateService', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Updates the parameters of a single service. + * @param \Google\Cloud\Metastore\V1alpha\UpdateServiceRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function UpdateService(\Google\Cloud\Metastore\V1alpha\UpdateServiceRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.metastore.v1alpha.DataprocMetastore/UpdateService', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Deletes a single service. + * @param \Google\Cloud\Metastore\V1alpha\DeleteServiceRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function DeleteService(\Google\Cloud\Metastore\V1alpha\DeleteServiceRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.metastore.v1alpha.DataprocMetastore/DeleteService', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Lists imports in a service. + * @param \Google\Cloud\Metastore\V1alpha\ListMetadataImportsRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function ListMetadataImports(\Google\Cloud\Metastore\V1alpha\ListMetadataImportsRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.metastore.v1alpha.DataprocMetastore/ListMetadataImports', + $argument, + ['\Google\Cloud\Metastore\V1alpha\ListMetadataImportsResponse', 'decode'], + $metadata, $options); + } + + /** + * Gets details of a single import. + * @param \Google\Cloud\Metastore\V1alpha\GetMetadataImportRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function GetMetadataImport(\Google\Cloud\Metastore\V1alpha\GetMetadataImportRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.metastore.v1alpha.DataprocMetastore/GetMetadataImport', + $argument, + ['\Google\Cloud\Metastore\V1alpha\MetadataImport', 'decode'], + $metadata, $options); + } + + /** + * Creates a new MetadataImport in a given project and location. + * @param \Google\Cloud\Metastore\V1alpha\CreateMetadataImportRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function CreateMetadataImport(\Google\Cloud\Metastore\V1alpha\CreateMetadataImportRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.metastore.v1alpha.DataprocMetastore/CreateMetadataImport', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Updates a single import. + * Only the description field of MetadataImport is supported to be updated. + * @param \Google\Cloud\Metastore\V1alpha\UpdateMetadataImportRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function UpdateMetadataImport(\Google\Cloud\Metastore\V1alpha\UpdateMetadataImportRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.metastore.v1alpha.DataprocMetastore/UpdateMetadataImport', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Exports metadata from a service. + * @param \Google\Cloud\Metastore\V1alpha\ExportMetadataRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function ExportMetadata(\Google\Cloud\Metastore\V1alpha\ExportMetadataRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.metastore.v1alpha.DataprocMetastore/ExportMetadata', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Restores a service from a backup. + * @param \Google\Cloud\Metastore\V1alpha\RestoreServiceRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function RestoreService(\Google\Cloud\Metastore\V1alpha\RestoreServiceRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.metastore.v1alpha.DataprocMetastore/RestoreService', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Lists backups in a service. + * @param \Google\Cloud\Metastore\V1alpha\ListBackupsRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function ListBackups(\Google\Cloud\Metastore\V1alpha\ListBackupsRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.metastore.v1alpha.DataprocMetastore/ListBackups', + $argument, + ['\Google\Cloud\Metastore\V1alpha\ListBackupsResponse', 'decode'], + $metadata, $options); + } + + /** + * Gets details of a single backup. + * @param \Google\Cloud\Metastore\V1alpha\GetBackupRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function GetBackup(\Google\Cloud\Metastore\V1alpha\GetBackupRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.metastore.v1alpha.DataprocMetastore/GetBackup', + $argument, + ['\Google\Cloud\Metastore\V1alpha\Backup', 'decode'], + $metadata, $options); + } + + /** + * Creates a new backup in a given project and location. + * @param \Google\Cloud\Metastore\V1alpha\CreateBackupRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function CreateBackup(\Google\Cloud\Metastore\V1alpha\CreateBackupRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.metastore.v1alpha.DataprocMetastore/CreateBackup', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Deletes a single backup. + * @param \Google\Cloud\Metastore\V1alpha\DeleteBackupRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function DeleteBackup(\Google\Cloud\Metastore\V1alpha\DeleteBackupRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.metastore.v1alpha.DataprocMetastore/DeleteBackup', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Removes the attached IAM policies for a resource + * @param \Google\Cloud\Metastore\V1alpha\RemoveIamPolicyRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function RemoveIamPolicy(\Google\Cloud\Metastore\V1alpha\RemoveIamPolicyRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.metastore.v1alpha.DataprocMetastore/RemoveIamPolicy', + $argument, + ['\Google\Cloud\Metastore\V1alpha\RemoveIamPolicyResponse', 'decode'], + $metadata, $options); + } + + /** + * Query DPMS metadata. + * @param \Google\Cloud\Metastore\V1alpha\QueryMetadataRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function QueryMetadata(\Google\Cloud\Metastore\V1alpha\QueryMetadataRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.metastore.v1alpha.DataprocMetastore/QueryMetadata', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Move a table to another database. + * @param \Google\Cloud\Metastore\V1alpha\MoveTableToDatabaseRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function MoveTableToDatabase(\Google\Cloud\Metastore\V1alpha\MoveTableToDatabaseRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.metastore.v1alpha.DataprocMetastore/MoveTableToDatabase', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Alter metadata resource location. The metadata resource can be a database, + * table, or partition. This functionality only updates the parent directory + * for the respective metadata resource and does not transfer any existing + * data to the new location. + * @param \Google\Cloud\Metastore\V1alpha\AlterMetadataResourceLocationRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function AlterMetadataResourceLocation(\Google\Cloud\Metastore\V1alpha\AlterMetadataResourceLocationRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.metastore.v1alpha.DataprocMetastore/AlterMetadataResourceLocation', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + +} diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/DeleteBackupRequest.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/DeleteBackupRequest.php new file mode 100644 index 000000000000..4b19c6dfbf22 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/DeleteBackupRequest.php @@ -0,0 +1,146 @@ +google.cloud.metastore.v1alpha.DeleteBackupRequest + */ +class DeleteBackupRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The relative resource name of the backup to delete, in the + * following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The relative resource name of the backup to delete, in the + * following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + * @type string $request_id + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Alpha\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Required. The relative resource name of the backup to delete, in the + * following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + * + * 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 relative resource name of the backup to delete, in the + * following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + * + * 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; + } + + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @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/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/DeleteFederationRequest.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/DeleteFederationRequest.php new file mode 100644 index 000000000000..8abf3ddbe788 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/DeleteFederationRequest.php @@ -0,0 +1,145 @@ +google.cloud.metastore.v1alpha.DeleteFederationRequest + */ +class DeleteFederationRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The relative resource name of the metastore federation to delete, + * in the following form: + * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The relative resource name of the metastore federation to delete, + * in the following form: + * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + * @type string $request_id + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Alpha\MetastoreFederation::initOnce(); + parent::__construct($data); + } + + /** + * Required. The relative resource name of the metastore federation to delete, + * in the following form: + * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + * + * 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 relative resource name of the metastore federation to delete, + * in the following form: + * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + * + * 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; + } + + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @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/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/DeleteServiceRequest.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/DeleteServiceRequest.php new file mode 100644 index 000000000000..f7d6a866613d --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/DeleteServiceRequest.php @@ -0,0 +1,146 @@ +google.cloud.metastore.v1alpha.DeleteServiceRequest + */ +class DeleteServiceRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The relative resource name of the metastore service to delete, in + * the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The relative resource name of the metastore service to delete, in + * the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * @type string $request_id + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Alpha\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Required. The relative resource name of the metastore service to delete, in + * the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * + * 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 relative resource name of the metastore service to delete, in + * the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * + * 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; + } + + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @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/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/EncryptionConfig.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/EncryptionConfig.php new file mode 100644 index 000000000000..1fc13fad7313 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/EncryptionConfig.php @@ -0,0 +1,75 @@ +google.cloud.metastore.v1alpha.EncryptionConfig + */ +class EncryptionConfig extends \Google\Protobuf\Internal\Message +{ + /** + * The fully qualified customer provided Cloud KMS key name to use for + * customer data encryption, in the following form: + * `projects/{project_number}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}`. + * + * Generated from protobuf field string kms_key = 1; + */ + protected $kms_key = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $kms_key + * The fully qualified customer provided Cloud KMS key name to use for + * customer data encryption, in the following form: + * `projects/{project_number}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Alpha\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * The fully qualified customer provided Cloud KMS key name to use for + * customer data encryption, in the following form: + * `projects/{project_number}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}`. + * + * Generated from protobuf field string kms_key = 1; + * @return string + */ + public function getKmsKey() + { + return $this->kms_key; + } + + /** + * The fully qualified customer provided Cloud KMS key name to use for + * customer data encryption, in the following form: + * `projects/{project_number}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}`. + * + * Generated from protobuf field string kms_key = 1; + * @param string $var + * @return $this + */ + public function setKmsKey($var) + { + GPBUtil::checkString($var, True); + $this->kms_key = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/ExportMetadataRequest.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/ExportMetadataRequest.php new file mode 100644 index 000000000000..2cb051a9cdac --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/ExportMetadataRequest.php @@ -0,0 +1,232 @@ +google.cloud.metastore.v1alpha.ExportMetadataRequest + */ +class ExportMetadataRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The relative resource name of the metastore service to run + * export, in the following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * + * Generated from protobuf field string service = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $service = ''; + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + /** + * Optional. The type of the database dump. If unspecified, defaults to + * `MYSQL`. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.DatabaseDumpSpec.Type database_dump_type = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $database_dump_type = 0; + protected $destination; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $destination_gcs_folder + * A Cloud Storage URI of a folder, in the format + * `gs:///`. A sub-folder + * `` containing exported files will be created below it. + * @type string $service + * Required. The relative resource name of the metastore service to run + * export, in the following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * @type string $request_id + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @type int $database_dump_type + * Optional. The type of the database dump. If unspecified, defaults to + * `MYSQL`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Alpha\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * A Cloud Storage URI of a folder, in the format + * `gs:///`. A sub-folder + * `` containing exported files will be created below it. + * + * Generated from protobuf field string destination_gcs_folder = 2; + * @return string + */ + public function getDestinationGcsFolder() + { + return $this->readOneof(2); + } + + public function hasDestinationGcsFolder() + { + return $this->hasOneof(2); + } + + /** + * A Cloud Storage URI of a folder, in the format + * `gs:///`. A sub-folder + * `` containing exported files will be created below it. + * + * Generated from protobuf field string destination_gcs_folder = 2; + * @param string $var + * @return $this + */ + public function setDestinationGcsFolder($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * Required. The relative resource name of the metastore service to run + * export, in the following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * + * Generated from protobuf field string service = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getService() + { + return $this->service; + } + + /** + * Required. The relative resource name of the metastore service to run + * export, in the following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * + * Generated from protobuf field string service = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setService($var) + { + GPBUtil::checkString($var, True); + $this->service = $var; + + return $this; + } + + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + + /** + * Optional. The type of the database dump. If unspecified, defaults to + * `MYSQL`. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.DatabaseDumpSpec.Type database_dump_type = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getDatabaseDumpType() + { + return $this->database_dump_type; + } + + /** + * Optional. The type of the database dump. If unspecified, defaults to + * `MYSQL`. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.DatabaseDumpSpec.Type database_dump_type = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setDatabaseDumpType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Metastore\V1alpha\DatabaseDumpSpec\Type::class); + $this->database_dump_type = $var; + + return $this; + } + + /** + * @return string + */ + public function getDestination() + { + return $this->whichOneof("destination"); + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/Federation.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/Federation.php new file mode 100644 index 000000000000..fd83282f0ddb --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/Federation.php @@ -0,0 +1,433 @@ +google.cloud.metastore.v1alpha.Federation + */ +class Federation extends \Google\Protobuf\Internal\Message +{ + /** + * Immutable. The relative resource name of the federation, of the + * form: + * projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + */ + protected $name = ''; + /** + * Output only. The time when the metastore federation was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. The time when the metastore federation was last updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * User-defined labels for the metastore federation. + * + * Generated from protobuf field map labels = 4; + */ + private $labels; + /** + * Immutable. The Apache Hive metastore version of the federation. All backend + * metastore versions must be compatible with the federation version. + * + * Generated from protobuf field string version = 5 [(.google.api.field_behavior) = IMMUTABLE]; + */ + protected $version = ''; + /** + * A map from `BackendMetastore` rank to `BackendMetastore`s from which the + * federation service serves metadata at query time. The map key represents + * the order in which `BackendMetastore`s should be evaluated to resolve + * database names at query time and should be greater than or equal to zero. A + * `BackendMetastore` with a lower number will be evaluated before a + * `BackendMetastore` with a higher number. + * + * Generated from protobuf field map backend_metastores = 6; + */ + private $backend_metastores; + /** + * Output only. The federation endpoint. + * + * Generated from protobuf field string endpoint_uri = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $endpoint_uri = ''; + /** + * Output only. The current state of the federation. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.Federation.State state = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Output only. Additional information about the current state of the + * metastore federation, if available. + * + * Generated from protobuf field string state_message = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state_message = ''; + /** + * Output only. The globally unique resource identifier of the metastore + * federation. + * + * Generated from protobuf field string uid = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $uid = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Immutable. The relative resource name of the federation, of the + * form: + * projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The time when the metastore federation was created. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. The time when the metastore federation was last updated. + * @type array|\Google\Protobuf\Internal\MapField $labels + * User-defined labels for the metastore federation. + * @type string $version + * Immutable. The Apache Hive metastore version of the federation. All backend + * metastore versions must be compatible with the federation version. + * @type array|\Google\Protobuf\Internal\MapField $backend_metastores + * A map from `BackendMetastore` rank to `BackendMetastore`s from which the + * federation service serves metadata at query time. The map key represents + * the order in which `BackendMetastore`s should be evaluated to resolve + * database names at query time and should be greater than or equal to zero. A + * `BackendMetastore` with a lower number will be evaluated before a + * `BackendMetastore` with a higher number. + * @type string $endpoint_uri + * Output only. The federation endpoint. + * @type int $state + * Output only. The current state of the federation. + * @type string $state_message + * Output only. Additional information about the current state of the + * metastore federation, if available. + * @type string $uid + * Output only. The globally unique resource identifier of the metastore + * federation. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Alpha\MetastoreFederation::initOnce(); + parent::__construct($data); + } + + /** + * Immutable. The relative resource name of the federation, of the + * form: + * projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Immutable. The relative resource name of the federation, of the + * form: + * projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. The time when the metastore federation was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.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 when the metastore federation was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.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 when the metastore federation was last updated. + * + * 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 when the metastore federation was last updated. + * + * 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; + } + + /** + * User-defined labels for the metastore federation. + * + * Generated from protobuf field map labels = 4; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * User-defined labels for the metastore federation. + * + * Generated from protobuf field map labels = 4; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + + /** + * Immutable. The Apache Hive metastore version of the federation. All backend + * metastore versions must be compatible with the federation version. + * + * Generated from protobuf field string version = 5 [(.google.api.field_behavior) = IMMUTABLE]; + * @return string + */ + public function getVersion() + { + return $this->version; + } + + /** + * Immutable. The Apache Hive metastore version of the federation. All backend + * metastore versions must be compatible with the federation version. + * + * Generated from protobuf field string version = 5 [(.google.api.field_behavior) = IMMUTABLE]; + * @param string $var + * @return $this + */ + public function setVersion($var) + { + GPBUtil::checkString($var, True); + $this->version = $var; + + return $this; + } + + /** + * A map from `BackendMetastore` rank to `BackendMetastore`s from which the + * federation service serves metadata at query time. The map key represents + * the order in which `BackendMetastore`s should be evaluated to resolve + * database names at query time and should be greater than or equal to zero. A + * `BackendMetastore` with a lower number will be evaluated before a + * `BackendMetastore` with a higher number. + * + * Generated from protobuf field map backend_metastores = 6; + * @return \Google\Protobuf\Internal\MapField + */ + public function getBackendMetastores() + { + return $this->backend_metastores; + } + + /** + * A map from `BackendMetastore` rank to `BackendMetastore`s from which the + * federation service serves metadata at query time. The map key represents + * the order in which `BackendMetastore`s should be evaluated to resolve + * database names at query time and should be greater than or equal to zero. A + * `BackendMetastore` with a lower number will be evaluated before a + * `BackendMetastore` with a higher number. + * + * Generated from protobuf field map backend_metastores = 6; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setBackendMetastores($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::INT32, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Metastore\V1alpha\BackendMetastore::class); + $this->backend_metastores = $arr; + + return $this; + } + + /** + * Output only. The federation endpoint. + * + * Generated from protobuf field string endpoint_uri = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getEndpointUri() + { + return $this->endpoint_uri; + } + + /** + * Output only. The federation endpoint. + * + * Generated from protobuf field string endpoint_uri = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setEndpointUri($var) + { + GPBUtil::checkString($var, True); + $this->endpoint_uri = $var; + + return $this; + } + + /** + * Output only. The current state of the federation. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.Federation.State state = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. The current state of the federation. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.Federation.State state = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Metastore\V1alpha\Federation\State::class); + $this->state = $var; + + return $this; + } + + /** + * Output only. Additional information about the current state of the + * metastore federation, if available. + * + * Generated from protobuf field string state_message = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getStateMessage() + { + return $this->state_message; + } + + /** + * Output only. Additional information about the current state of the + * metastore federation, if available. + * + * Generated from protobuf field string state_message = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setStateMessage($var) + { + GPBUtil::checkString($var, True); + $this->state_message = $var; + + return $this; + } + + /** + * Output only. The globally unique resource identifier of the metastore + * federation. + * + * Generated from protobuf field string uid = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getUid() + { + return $this->uid; + } + + /** + * Output only. The globally unique resource identifier of the metastore + * federation. + * + * Generated from protobuf field string uid = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setUid($var) + { + GPBUtil::checkString($var, True); + $this->uid = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/Federation/State.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/Federation/State.php new file mode 100644 index 000000000000..8282624f193d --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/Federation/State.php @@ -0,0 +1,87 @@ +google.cloud.metastore.v1alpha.Federation.State + */ +class State +{ + /** + * The state of the metastore federation is unknown. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The metastore federation is in the process of being created. + * + * Generated from protobuf enum CREATING = 1; + */ + const CREATING = 1; + /** + * The metastore federation is running and ready to serve queries. + * + * Generated from protobuf enum ACTIVE = 2; + */ + const ACTIVE = 2; + /** + * The metastore federation is being updated. It remains usable but cannot + * accept additional update requests or be deleted at this time. + * + * Generated from protobuf enum UPDATING = 3; + */ + const UPDATING = 3; + /** + * The metastore federation is undergoing deletion. It cannot be used. + * + * Generated from protobuf enum DELETING = 4; + */ + const DELETING = 4; + /** + * The metastore federation has encountered an error and cannot be used. The + * metastore federation should be deleted. + * + * Generated from protobuf enum ERROR = 5; + */ + const ERROR = 5; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::CREATING => 'CREATING', + self::ACTIVE => 'ACTIVE', + self::UPDATING => 'UPDATING', + self::DELETING => 'DELETING', + self::ERROR => 'ERROR', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\Metastore\V1alpha\Federation_State::class); + diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/Federation_State.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/Federation_State.php new file mode 100644 index 000000000000..7c5b0e6cb0be --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/Federation_State.php @@ -0,0 +1,16 @@ +google.cloud.metastore.v1alpha.GetBackupRequest + */ +class GetBackupRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The relative resource name of the backup to retrieve, in the + * following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The relative resource name of the backup to retrieve, in the + * following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Alpha\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Required. The relative resource name of the backup to retrieve, in the + * following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + * + * 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 relative resource name of the backup to retrieve, in the + * following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + * + * 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; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/GetFederationRequest.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/GetFederationRequest.php new file mode 100644 index 000000000000..e8956ae561cc --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/GetFederationRequest.php @@ -0,0 +1,75 @@ +google.cloud.metastore.v1alpha.GetFederationRequest + */ +class GetFederationRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The relative resource name of the metastore federation to + * retrieve, in the following form: + * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The relative resource name of the metastore federation to + * retrieve, in the following form: + * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Alpha\MetastoreFederation::initOnce(); + parent::__construct($data); + } + + /** + * Required. The relative resource name of the metastore federation to + * retrieve, in the following form: + * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + * + * 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 relative resource name of the metastore federation to + * retrieve, in the following form: + * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + * + * 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; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/GetMetadataImportRequest.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/GetMetadataImportRequest.php new file mode 100644 index 000000000000..e4c8b57eba8d --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/GetMetadataImportRequest.php @@ -0,0 +1,76 @@ +google.cloud.metastore.v1alpha.GetMetadataImportRequest + */ +class GetMetadataImportRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The relative resource name of the metadata import to retrieve, in + * the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{import_id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The relative resource name of the metadata import to retrieve, in + * the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{import_id}`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Alpha\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Required. The relative resource name of the metadata import to retrieve, in + * the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{import_id}`. + * + * 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 relative resource name of the metadata import to retrieve, in + * the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{import_id}`. + * + * 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; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/GetServiceRequest.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/GetServiceRequest.php new file mode 100644 index 000000000000..2cda29b7e3fe --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/GetServiceRequest.php @@ -0,0 +1,76 @@ +google.cloud.metastore.v1alpha.GetServiceRequest + */ +class GetServiceRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The relative resource name of the metastore service to retrieve, + * in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The relative resource name of the metastore service to retrieve, + * in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Alpha\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Required. The relative resource name of the metastore service to retrieve, + * in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * + * 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 relative resource name of the metastore service to retrieve, + * in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * + * 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; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/HiveMetastoreConfig.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/HiveMetastoreConfig.php new file mode 100644 index 000000000000..b272e64f4210 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/HiveMetastoreConfig.php @@ -0,0 +1,278 @@ +google.cloud.metastore.v1alpha.HiveMetastoreConfig + */ +class HiveMetastoreConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Immutable. The Hive metastore schema version. + * + * Generated from protobuf field string version = 1 [(.google.api.field_behavior) = IMMUTABLE]; + */ + protected $version = ''; + /** + * A mapping of Hive metastore configuration key-value pairs to apply to the + * Hive metastore (configured in `hive-site.xml`). The mappings + * override system defaults (some keys cannot be overridden). These + * overrides are also applied to auxiliary versions and can be further + * customized in the auxiliary version's `AuxiliaryVersionConfig`. + * + * Generated from protobuf field map config_overrides = 2; + */ + private $config_overrides; + /** + * Information used to configure the Hive metastore service as a service + * principal in a Kerberos realm. To disable Kerberos, use the `UpdateService` + * method and specify this field's path + * (`hive_metastore_config.kerberos_config`) in the request's `update_mask` + * while omitting this field from the request's `service`. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.KerberosConfig kerberos_config = 3; + */ + protected $kerberos_config = null; + /** + * The protocol to use for the metastore service endpoint. If unspecified, + * defaults to `THRIFT`. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.HiveMetastoreConfig.EndpointProtocol endpoint_protocol = 4; + */ + protected $endpoint_protocol = 0; + /** + * A mapping of Hive metastore version to the auxiliary version + * configuration. When specified, a secondary Hive metastore service is + * created along with the primary service. All auxiliary versions must be less + * than the service's primary version. The key is the auxiliary service name + * and it must match the regular expression [a-z]([-a-z0-9]*[a-z0-9])?. This + * means that the first character must be a lowercase letter, and all the + * following characters must be hyphens, lowercase letters, or digits, except + * the last character, which cannot be a hyphen. + * + * Generated from protobuf field map auxiliary_versions = 5; + */ + private $auxiliary_versions; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $version + * Immutable. The Hive metastore schema version. + * @type array|\Google\Protobuf\Internal\MapField $config_overrides + * A mapping of Hive metastore configuration key-value pairs to apply to the + * Hive metastore (configured in `hive-site.xml`). The mappings + * override system defaults (some keys cannot be overridden). These + * overrides are also applied to auxiliary versions and can be further + * customized in the auxiliary version's `AuxiliaryVersionConfig`. + * @type \Google\Cloud\Metastore\V1alpha\KerberosConfig $kerberos_config + * Information used to configure the Hive metastore service as a service + * principal in a Kerberos realm. To disable Kerberos, use the `UpdateService` + * method and specify this field's path + * (`hive_metastore_config.kerberos_config`) in the request's `update_mask` + * while omitting this field from the request's `service`. + * @type int $endpoint_protocol + * The protocol to use for the metastore service endpoint. If unspecified, + * defaults to `THRIFT`. + * @type array|\Google\Protobuf\Internal\MapField $auxiliary_versions + * A mapping of Hive metastore version to the auxiliary version + * configuration. When specified, a secondary Hive metastore service is + * created along with the primary service. All auxiliary versions must be less + * than the service's primary version. The key is the auxiliary service name + * and it must match the regular expression [a-z]([-a-z0-9]*[a-z0-9])?. This + * means that the first character must be a lowercase letter, and all the + * following characters must be hyphens, lowercase letters, or digits, except + * the last character, which cannot be a hyphen. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Alpha\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Immutable. The Hive metastore schema version. + * + * Generated from protobuf field string version = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * @return string + */ + public function getVersion() + { + return $this->version; + } + + /** + * Immutable. The Hive metastore schema version. + * + * Generated from protobuf field string version = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * @param string $var + * @return $this + */ + public function setVersion($var) + { + GPBUtil::checkString($var, True); + $this->version = $var; + + return $this; + } + + /** + * A mapping of Hive metastore configuration key-value pairs to apply to the + * Hive metastore (configured in `hive-site.xml`). The mappings + * override system defaults (some keys cannot be overridden). These + * overrides are also applied to auxiliary versions and can be further + * customized in the auxiliary version's `AuxiliaryVersionConfig`. + * + * Generated from protobuf field map config_overrides = 2; + * @return \Google\Protobuf\Internal\MapField + */ + public function getConfigOverrides() + { + return $this->config_overrides; + } + + /** + * A mapping of Hive metastore configuration key-value pairs to apply to the + * Hive metastore (configured in `hive-site.xml`). The mappings + * override system defaults (some keys cannot be overridden). These + * overrides are also applied to auxiliary versions and can be further + * customized in the auxiliary version's `AuxiliaryVersionConfig`. + * + * Generated from protobuf field map config_overrides = 2; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setConfigOverrides($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->config_overrides = $arr; + + return $this; + } + + /** + * Information used to configure the Hive metastore service as a service + * principal in a Kerberos realm. To disable Kerberos, use the `UpdateService` + * method and specify this field's path + * (`hive_metastore_config.kerberos_config`) in the request's `update_mask` + * while omitting this field from the request's `service`. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.KerberosConfig kerberos_config = 3; + * @return \Google\Cloud\Metastore\V1alpha\KerberosConfig|null + */ + public function getKerberosConfig() + { + return $this->kerberos_config; + } + + public function hasKerberosConfig() + { + return isset($this->kerberos_config); + } + + public function clearKerberosConfig() + { + unset($this->kerberos_config); + } + + /** + * Information used to configure the Hive metastore service as a service + * principal in a Kerberos realm. To disable Kerberos, use the `UpdateService` + * method and specify this field's path + * (`hive_metastore_config.kerberos_config`) in the request's `update_mask` + * while omitting this field from the request's `service`. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.KerberosConfig kerberos_config = 3; + * @param \Google\Cloud\Metastore\V1alpha\KerberosConfig $var + * @return $this + */ + public function setKerberosConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Metastore\V1alpha\KerberosConfig::class); + $this->kerberos_config = $var; + + return $this; + } + + /** + * The protocol to use for the metastore service endpoint. If unspecified, + * defaults to `THRIFT`. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.HiveMetastoreConfig.EndpointProtocol endpoint_protocol = 4; + * @return int + */ + public function getEndpointProtocol() + { + return $this->endpoint_protocol; + } + + /** + * The protocol to use for the metastore service endpoint. If unspecified, + * defaults to `THRIFT`. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.HiveMetastoreConfig.EndpointProtocol endpoint_protocol = 4; + * @param int $var + * @return $this + */ + public function setEndpointProtocol($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Metastore\V1alpha\HiveMetastoreConfig\EndpointProtocol::class); + $this->endpoint_protocol = $var; + + return $this; + } + + /** + * A mapping of Hive metastore version to the auxiliary version + * configuration. When specified, a secondary Hive metastore service is + * created along with the primary service. All auxiliary versions must be less + * than the service's primary version. The key is the auxiliary service name + * and it must match the regular expression [a-z]([-a-z0-9]*[a-z0-9])?. This + * means that the first character must be a lowercase letter, and all the + * following characters must be hyphens, lowercase letters, or digits, except + * the last character, which cannot be a hyphen. + * + * Generated from protobuf field map auxiliary_versions = 5; + * @return \Google\Protobuf\Internal\MapField + */ + public function getAuxiliaryVersions() + { + return $this->auxiliary_versions; + } + + /** + * A mapping of Hive metastore version to the auxiliary version + * configuration. When specified, a secondary Hive metastore service is + * created along with the primary service. All auxiliary versions must be less + * than the service's primary version. The key is the auxiliary service name + * and it must match the regular expression [a-z]([-a-z0-9]*[a-z0-9])?. This + * means that the first character must be a lowercase letter, and all the + * following characters must be hyphens, lowercase letters, or digits, except + * the last character, which cannot be a hyphen. + * + * Generated from protobuf field map auxiliary_versions = 5; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setAuxiliaryVersions($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Metastore\V1alpha\AuxiliaryVersionConfig::class); + $this->auxiliary_versions = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/HiveMetastoreConfig/EndpointProtocol.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/HiveMetastoreConfig/EndpointProtocol.php new file mode 100644 index 000000000000..4b93919c49c6 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/HiveMetastoreConfig/EndpointProtocol.php @@ -0,0 +1,64 @@ +google.cloud.metastore.v1alpha.HiveMetastoreConfig.EndpointProtocol + */ +class EndpointProtocol +{ + /** + * The protocol is not set. + * + * Generated from protobuf enum ENDPOINT_PROTOCOL_UNSPECIFIED = 0; + */ + const ENDPOINT_PROTOCOL_UNSPECIFIED = 0; + /** + * Use the legacy Apache Thrift protocol for the metastore service endpoint. + * + * Generated from protobuf enum THRIFT = 1; + */ + const THRIFT = 1; + /** + * Use the modernized gRPC protocol for the metastore service endpoint. + * + * Generated from protobuf enum GRPC = 2; + */ + const GRPC = 2; + + private static $valueToName = [ + self::ENDPOINT_PROTOCOL_UNSPECIFIED => 'ENDPOINT_PROTOCOL_UNSPECIFIED', + self::THRIFT => 'THRIFT', + self::GRPC => 'GRPC', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(EndpointProtocol::class, \Google\Cloud\Metastore\V1alpha\HiveMetastoreConfig_EndpointProtocol::class); + diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/HiveMetastoreConfig_EndpointProtocol.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/HiveMetastoreConfig_EndpointProtocol.php new file mode 100644 index 000000000000..7556da3487dd --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/HiveMetastoreConfig_EndpointProtocol.php @@ -0,0 +1,16 @@ +google.cloud.metastore.v1alpha.KerberosConfig + */ +class KerberosConfig extends \Google\Protobuf\Internal\Message +{ + /** + * A Kerberos keytab file that can be used to authenticate a service principal + * with a Kerberos Key Distribution Center (KDC). + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.Secret keytab = 1; + */ + protected $keytab = null; + /** + * A Kerberos principal that exists in the both the keytab the KDC + * to authenticate as. A typical principal is of the form + * `primary/instance@REALM`, but there is no exact format. + * + * Generated from protobuf field string principal = 2; + */ + protected $principal = ''; + /** + * A Cloud Storage URI that specifies the path to a + * krb5.conf file. It is of the form `gs://{bucket_name}/path/to/krb5.conf`, + * although the file does not need to be named krb5.conf explicitly. + * + * Generated from protobuf field string krb5_config_gcs_uri = 3; + */ + protected $krb5_config_gcs_uri = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Metastore\V1alpha\Secret $keytab + * A Kerberos keytab file that can be used to authenticate a service principal + * with a Kerberos Key Distribution Center (KDC). + * @type string $principal + * A Kerberos principal that exists in the both the keytab the KDC + * to authenticate as. A typical principal is of the form + * `primary/instance@REALM`, but there is no exact format. + * @type string $krb5_config_gcs_uri + * A Cloud Storage URI that specifies the path to a + * krb5.conf file. It is of the form `gs://{bucket_name}/path/to/krb5.conf`, + * although the file does not need to be named krb5.conf explicitly. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Alpha\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * A Kerberos keytab file that can be used to authenticate a service principal + * with a Kerberos Key Distribution Center (KDC). + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.Secret keytab = 1; + * @return \Google\Cloud\Metastore\V1alpha\Secret|null + */ + public function getKeytab() + { + return $this->keytab; + } + + public function hasKeytab() + { + return isset($this->keytab); + } + + public function clearKeytab() + { + unset($this->keytab); + } + + /** + * A Kerberos keytab file that can be used to authenticate a service principal + * with a Kerberos Key Distribution Center (KDC). + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.Secret keytab = 1; + * @param \Google\Cloud\Metastore\V1alpha\Secret $var + * @return $this + */ + public function setKeytab($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Metastore\V1alpha\Secret::class); + $this->keytab = $var; + + return $this; + } + + /** + * A Kerberos principal that exists in the both the keytab the KDC + * to authenticate as. A typical principal is of the form + * `primary/instance@REALM`, but there is no exact format. + * + * Generated from protobuf field string principal = 2; + * @return string + */ + public function getPrincipal() + { + return $this->principal; + } + + /** + * A Kerberos principal that exists in the both the keytab the KDC + * to authenticate as. A typical principal is of the form + * `primary/instance@REALM`, but there is no exact format. + * + * Generated from protobuf field string principal = 2; + * @param string $var + * @return $this + */ + public function setPrincipal($var) + { + GPBUtil::checkString($var, True); + $this->principal = $var; + + return $this; + } + + /** + * A Cloud Storage URI that specifies the path to a + * krb5.conf file. It is of the form `gs://{bucket_name}/path/to/krb5.conf`, + * although the file does not need to be named krb5.conf explicitly. + * + * Generated from protobuf field string krb5_config_gcs_uri = 3; + * @return string + */ + public function getKrb5ConfigGcsUri() + { + return $this->krb5_config_gcs_uri; + } + + /** + * A Cloud Storage URI that specifies the path to a + * krb5.conf file. It is of the form `gs://{bucket_name}/path/to/krb5.conf`, + * although the file does not need to be named krb5.conf explicitly. + * + * Generated from protobuf field string krb5_config_gcs_uri = 3; + * @param string $var + * @return $this + */ + public function setKrb5ConfigGcsUri($var) + { + GPBUtil::checkString($var, True); + $this->krb5_config_gcs_uri = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/Lake.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/Lake.php new file mode 100644 index 000000000000..520f9c41748d --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/Lake.php @@ -0,0 +1,75 @@ +google.cloud.metastore.v1alpha.Lake + */ +class Lake extends \Google\Protobuf\Internal\Message +{ + /** + * The Lake resource name. + * Example: + * `projects/{project_number}/locations/{location_id}/lakes/{lake_id}` + * + * Generated from protobuf field string name = 1 [(.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The Lake resource name. + * Example: + * `projects/{project_number}/locations/{location_id}/lakes/{lake_id}` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Alpha\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * The Lake resource name. + * Example: + * `projects/{project_number}/locations/{location_id}/lakes/{lake_id}` + * + * Generated from protobuf field string name = 1 [(.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The Lake resource name. + * Example: + * `projects/{project_number}/locations/{location_id}/lakes/{lake_id}` + * + * Generated from protobuf field string name = 1 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/ListBackupsRequest.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/ListBackupsRequest.php new file mode 100644 index 000000000000..db6747dc2550 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/ListBackupsRequest.php @@ -0,0 +1,252 @@ +google.cloud.metastore.v1alpha.ListBackupsRequest + */ +class ListBackupsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The relative resource name of the service whose backups to + * list, in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. The maximum number of backups to return. The response may contain + * less than the maximum number. If unspecified, no more than 500 backups are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Optional. A page token, received from a previous + * [DataprocMetastore.ListBackups][google.cloud.metastore.v1alpha.DataprocMetastore.ListBackups] + * call. Provide this token to retrieve the subsequent page. + * To retrieve the first page, supply an empty page token. + * When paginating, other parameters provided to + * [DataprocMetastore.ListBackups][google.cloud.metastore.v1alpha.DataprocMetastore.ListBackups] + * must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = ''; + /** + * Optional. The filter to apply to list results. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $filter = ''; + /** + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $order_by = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The relative resource name of the service whose backups to + * list, in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. + * @type int $page_size + * Optional. The maximum number of backups to return. The response may contain + * less than the maximum number. If unspecified, no more than 500 backups are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + * @type string $page_token + * Optional. A page token, received from a previous + * [DataprocMetastore.ListBackups][google.cloud.metastore.v1alpha.DataprocMetastore.ListBackups] + * call. Provide this token to retrieve the subsequent page. + * To retrieve the first page, supply an empty page token. + * When paginating, other parameters provided to + * [DataprocMetastore.ListBackups][google.cloud.metastore.v1alpha.DataprocMetastore.ListBackups] + * must match the call that provided the page token. + * @type string $filter + * Optional. The filter to apply to list results. + * @type string $order_by + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Alpha\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Required. The relative resource name of the service whose backups to + * list, in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. + * + * 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. The relative resource name of the service whose backups to + * list, in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. + * + * 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. The maximum number of backups to return. The response may contain + * less than the maximum number. If unspecified, no more than 500 backups are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. The maximum number of backups to return. The response may contain + * less than the maximum number. If unspecified, no more than 500 backups are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + * + * 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 page token, received from a previous + * [DataprocMetastore.ListBackups][google.cloud.metastore.v1alpha.DataprocMetastore.ListBackups] + * call. Provide this token to retrieve the subsequent page. + * To retrieve the first page, supply an empty page token. + * When paginating, other parameters provided to + * [DataprocMetastore.ListBackups][google.cloud.metastore.v1alpha.DataprocMetastore.ListBackups] + * must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. A page token, received from a previous + * [DataprocMetastore.ListBackups][google.cloud.metastore.v1alpha.DataprocMetastore.ListBackups] + * call. Provide this token to retrieve the subsequent page. + * To retrieve the first page, supply an empty page token. + * When paginating, other parameters provided to + * [DataprocMetastore.ListBackups][google.cloud.metastore.v1alpha.DataprocMetastore.ListBackups] + * must match the call that provided the page token. + * + * 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. The filter to apply to list results. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Optional. The filter to apply to list results. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/ListBackupsResponse.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/ListBackupsResponse.php new file mode 100644 index 000000000000..25db12b281f9 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/ListBackupsResponse.php @@ -0,0 +1,140 @@ +google.cloud.metastore.v1alpha.ListBackupsResponse + */ +class ListBackupsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The backups of the specified service. + * + * Generated from protobuf field repeated .google.cloud.metastore.v1alpha.Backup backups = 1; + */ + private $backups; + /** + * A token that can be sent as `page_token` to retrieve the next page. If this + * field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + */ + private $unreachable; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Metastore\V1alpha\Backup>|\Google\Protobuf\Internal\RepeatedField $backups + * The backups of the specified service. + * @type string $next_page_token + * A token that can be sent as `page_token` to retrieve the next page. If this + * field is omitted, there are no subsequent pages. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Locations that could not be reached. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Alpha\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * The backups of the specified service. + * + * Generated from protobuf field repeated .google.cloud.metastore.v1alpha.Backup backups = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getBackups() + { + return $this->backups; + } + + /** + * The backups of the specified service. + * + * Generated from protobuf field repeated .google.cloud.metastore.v1alpha.Backup backups = 1; + * @param array<\Google\Cloud\Metastore\V1alpha\Backup>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setBackups($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Metastore\V1alpha\Backup::class); + $this->backups = $arr; + + return $this; + } + + /** + * A token that can be sent as `page_token` to retrieve the next page. If this + * field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token that can be sent as `page_token` to retrieve the next page. If this + * field is omitted, there are no subsequent pages. + * + * 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; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUnreachable($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->unreachable = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/ListFederationsRequest.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/ListFederationsRequest.php new file mode 100644 index 000000000000..12a4abc079b4 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/ListFederationsRequest.php @@ -0,0 +1,251 @@ +google.cloud.metastore.v1alpha.ListFederationsRequest + */ +class ListFederationsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The relative resource name of the location of metastore + * federations to list, in the following form: + * `projects/{project_number}/locations/{location_id}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. The maximum number of federations to return. The response may + * contain less than the maximum number. If unspecified, no more than 500 + * services are returned. The maximum value is 1000; values above 1000 are + * changed to 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Optional. A page token, received from a previous ListFederationServices + * call. Provide this token to retrieve the subsequent page. + * To retrieve the first page, supply an empty page token. + * When paginating, other parameters provided to + * ListFederationServices must match the call that provided the + * page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = ''; + /** + * Optional. The filter to apply to list results. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $filter = ''; + /** + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $order_by = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The relative resource name of the location of metastore + * federations to list, in the following form: + * `projects/{project_number}/locations/{location_id}`. + * @type int $page_size + * Optional. The maximum number of federations to return. The response may + * contain less than the maximum number. If unspecified, no more than 500 + * services are returned. The maximum value is 1000; values above 1000 are + * changed to 1000. + * @type string $page_token + * Optional. A page token, received from a previous ListFederationServices + * call. Provide this token to retrieve the subsequent page. + * To retrieve the first page, supply an empty page token. + * When paginating, other parameters provided to + * ListFederationServices must match the call that provided the + * page token. + * @type string $filter + * Optional. The filter to apply to list results. + * @type string $order_by + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Alpha\MetastoreFederation::initOnce(); + parent::__construct($data); + } + + /** + * Required. The relative resource name of the location of metastore + * federations to list, in the following form: + * `projects/{project_number}/locations/{location_id}`. + * + * 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. The relative resource name of the location of metastore + * federations to list, in the following form: + * `projects/{project_number}/locations/{location_id}`. + * + * 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. The maximum number of federations to return. The response may + * contain less than the maximum number. If unspecified, no more than 500 + * services are returned. The maximum value is 1000; values above 1000 are + * changed to 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. The maximum number of federations to return. The response may + * contain less than the maximum number. If unspecified, no more than 500 + * services are returned. The maximum value is 1000; values above 1000 are + * changed to 1000. + * + * 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 page token, received from a previous ListFederationServices + * call. Provide this token to retrieve the subsequent page. + * To retrieve the first page, supply an empty page token. + * When paginating, other parameters provided to + * ListFederationServices must match the call that provided the + * page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. A page token, received from a previous ListFederationServices + * call. Provide this token to retrieve the subsequent page. + * To retrieve the first page, supply an empty page token. + * When paginating, other parameters provided to + * ListFederationServices must match the call that provided the + * page token. + * + * 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. The filter to apply to list results. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Optional. The filter to apply to list results. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/ListFederationsResponse.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/ListFederationsResponse.php new file mode 100644 index 000000000000..6fe15394a05e --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/ListFederationsResponse.php @@ -0,0 +1,139 @@ +google.cloud.metastore.v1alpha.ListFederationsResponse + */ +class ListFederationsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The services in the specified location. + * + * Generated from protobuf field repeated .google.cloud.metastore.v1alpha.Federation federations = 1; + */ + private $federations; + /** + * A token that can be sent as `page_token` to retrieve the next page. If this + * field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + */ + private $unreachable; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Metastore\V1alpha\Federation>|\Google\Protobuf\Internal\RepeatedField $federations + * The services in the specified location. + * @type string $next_page_token + * A token that can be sent as `page_token` to retrieve the next page. If this + * field is omitted, there are no subsequent pages. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Locations that could not be reached. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Alpha\MetastoreFederation::initOnce(); + parent::__construct($data); + } + + /** + * The services in the specified location. + * + * Generated from protobuf field repeated .google.cloud.metastore.v1alpha.Federation federations = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getFederations() + { + return $this->federations; + } + + /** + * The services in the specified location. + * + * Generated from protobuf field repeated .google.cloud.metastore.v1alpha.Federation federations = 1; + * @param array<\Google\Cloud\Metastore\V1alpha\Federation>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setFederations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Metastore\V1alpha\Federation::class); + $this->federations = $arr; + + return $this; + } + + /** + * A token that can be sent as `page_token` to retrieve the next page. If this + * field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token that can be sent as `page_token` to retrieve the next page. If this + * field is omitted, there are no subsequent pages. + * + * 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; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUnreachable($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->unreachable = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/ListMetadataImportsRequest.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/ListMetadataImportsRequest.php new file mode 100644 index 000000000000..7a022d5ed98d --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/ListMetadataImportsRequest.php @@ -0,0 +1,252 @@ +google.cloud.metastore.v1alpha.ListMetadataImportsRequest + */ +class ListMetadataImportsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The relative resource name of the service whose metadata imports + * to list, in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. The maximum number of imports to return. The response may contain + * less than the maximum number. If unspecified, no more than 500 imports are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Optional. A page token, received from a previous + * [DataprocMetastore.ListServices][google.cloud.metastore.v1alpha.DataprocMetastore.ListServices] + * call. Provide this token to retrieve the subsequent page. + * To retrieve the first page, supply an empty page token. + * When paginating, other parameters provided to + * [DataprocMetastore.ListServices][google.cloud.metastore.v1alpha.DataprocMetastore.ListServices] + * must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = ''; + /** + * Optional. The filter to apply to list results. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $filter = ''; + /** + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $order_by = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The relative resource name of the service whose metadata imports + * to list, in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. + * @type int $page_size + * Optional. The maximum number of imports to return. The response may contain + * less than the maximum number. If unspecified, no more than 500 imports are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + * @type string $page_token + * Optional. A page token, received from a previous + * [DataprocMetastore.ListServices][google.cloud.metastore.v1alpha.DataprocMetastore.ListServices] + * call. Provide this token to retrieve the subsequent page. + * To retrieve the first page, supply an empty page token. + * When paginating, other parameters provided to + * [DataprocMetastore.ListServices][google.cloud.metastore.v1alpha.DataprocMetastore.ListServices] + * must match the call that provided the page token. + * @type string $filter + * Optional. The filter to apply to list results. + * @type string $order_by + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Alpha\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Required. The relative resource name of the service whose metadata imports + * to list, in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. + * + * 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. The relative resource name of the service whose metadata imports + * to list, in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. + * + * 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. The maximum number of imports to return. The response may contain + * less than the maximum number. If unspecified, no more than 500 imports are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. The maximum number of imports to return. The response may contain + * less than the maximum number. If unspecified, no more than 500 imports are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + * + * 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 page token, received from a previous + * [DataprocMetastore.ListServices][google.cloud.metastore.v1alpha.DataprocMetastore.ListServices] + * call. Provide this token to retrieve the subsequent page. + * To retrieve the first page, supply an empty page token. + * When paginating, other parameters provided to + * [DataprocMetastore.ListServices][google.cloud.metastore.v1alpha.DataprocMetastore.ListServices] + * must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. A page token, received from a previous + * [DataprocMetastore.ListServices][google.cloud.metastore.v1alpha.DataprocMetastore.ListServices] + * call. Provide this token to retrieve the subsequent page. + * To retrieve the first page, supply an empty page token. + * When paginating, other parameters provided to + * [DataprocMetastore.ListServices][google.cloud.metastore.v1alpha.DataprocMetastore.ListServices] + * must match the call that provided the page token. + * + * 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. The filter to apply to list results. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Optional. The filter to apply to list results. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/ListMetadataImportsResponse.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/ListMetadataImportsResponse.php new file mode 100644 index 000000000000..72e5d8c510ef --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/ListMetadataImportsResponse.php @@ -0,0 +1,140 @@ +google.cloud.metastore.v1alpha.ListMetadataImportsResponse + */ +class ListMetadataImportsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The imports in the specified service. + * + * Generated from protobuf field repeated .google.cloud.metastore.v1alpha.MetadataImport metadata_imports = 1; + */ + private $metadata_imports; + /** + * A token that can be sent as `page_token` to retrieve the next page. If this + * field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + */ + private $unreachable; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Metastore\V1alpha\MetadataImport>|\Google\Protobuf\Internal\RepeatedField $metadata_imports + * The imports in the specified service. + * @type string $next_page_token + * A token that can be sent as `page_token` to retrieve the next page. If this + * field is omitted, there are no subsequent pages. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Locations that could not be reached. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Alpha\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * The imports in the specified service. + * + * Generated from protobuf field repeated .google.cloud.metastore.v1alpha.MetadataImport metadata_imports = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getMetadataImports() + { + return $this->metadata_imports; + } + + /** + * The imports in the specified service. + * + * Generated from protobuf field repeated .google.cloud.metastore.v1alpha.MetadataImport metadata_imports = 1; + * @param array<\Google\Cloud\Metastore\V1alpha\MetadataImport>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setMetadataImports($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Metastore\V1alpha\MetadataImport::class); + $this->metadata_imports = $arr; + + return $this; + } + + /** + * A token that can be sent as `page_token` to retrieve the next page. If this + * field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token that can be sent as `page_token` to retrieve the next page. If this + * field is omitted, there are no subsequent pages. + * + * 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; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUnreachable($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->unreachable = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/ListServicesRequest.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/ListServicesRequest.php new file mode 100644 index 000000000000..f5213e46f8e7 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/ListServicesRequest.php @@ -0,0 +1,256 @@ +google.cloud.metastore.v1alpha.ListServicesRequest + */ +class ListServicesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The relative resource name of the location of metastore services + * to list, in the following form: + * `projects/{project_number}/locations/{location_id}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. The maximum number of services to return. The response may + * contain less than the maximum number. If unspecified, no more than 500 + * services are returned. The maximum value is 1000; values above 1000 are + * changed to 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Optional. A page token, received from a previous + * [DataprocMetastore.ListServices][google.cloud.metastore.v1alpha.DataprocMetastore.ListServices] + * call. Provide this token to retrieve the subsequent page. + * To retrieve the first page, supply an empty page token. + * When paginating, other parameters provided to + * [DataprocMetastore.ListServices][google.cloud.metastore.v1alpha.DataprocMetastore.ListServices] + * must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = ''; + /** + * Optional. The filter to apply to list results. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $filter = ''; + /** + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $order_by = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The relative resource name of the location of metastore services + * to list, in the following form: + * `projects/{project_number}/locations/{location_id}`. + * @type int $page_size + * Optional. The maximum number of services to return. The response may + * contain less than the maximum number. If unspecified, no more than 500 + * services are returned. The maximum value is 1000; values above 1000 are + * changed to 1000. + * @type string $page_token + * Optional. A page token, received from a previous + * [DataprocMetastore.ListServices][google.cloud.metastore.v1alpha.DataprocMetastore.ListServices] + * call. Provide this token to retrieve the subsequent page. + * To retrieve the first page, supply an empty page token. + * When paginating, other parameters provided to + * [DataprocMetastore.ListServices][google.cloud.metastore.v1alpha.DataprocMetastore.ListServices] + * must match the call that provided the page token. + * @type string $filter + * Optional. The filter to apply to list results. + * @type string $order_by + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Alpha\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Required. The relative resource name of the location of metastore services + * to list, in the following form: + * `projects/{project_number}/locations/{location_id}`. + * + * 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. The relative resource name of the location of metastore services + * to list, in the following form: + * `projects/{project_number}/locations/{location_id}`. + * + * 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. The maximum number of services to return. The response may + * contain less than the maximum number. If unspecified, no more than 500 + * services are returned. The maximum value is 1000; values above 1000 are + * changed to 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. The maximum number of services to return. The response may + * contain less than the maximum number. If unspecified, no more than 500 + * services are returned. The maximum value is 1000; values above 1000 are + * changed to 1000. + * + * 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 page token, received from a previous + * [DataprocMetastore.ListServices][google.cloud.metastore.v1alpha.DataprocMetastore.ListServices] + * call. Provide this token to retrieve the subsequent page. + * To retrieve the first page, supply an empty page token. + * When paginating, other parameters provided to + * [DataprocMetastore.ListServices][google.cloud.metastore.v1alpha.DataprocMetastore.ListServices] + * must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. A page token, received from a previous + * [DataprocMetastore.ListServices][google.cloud.metastore.v1alpha.DataprocMetastore.ListServices] + * call. Provide this token to retrieve the subsequent page. + * To retrieve the first page, supply an empty page token. + * When paginating, other parameters provided to + * [DataprocMetastore.ListServices][google.cloud.metastore.v1alpha.DataprocMetastore.ListServices] + * must match the call that provided the page token. + * + * 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. The filter to apply to list results. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Optional. The filter to apply to list results. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/ListServicesResponse.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/ListServicesResponse.php new file mode 100644 index 000000000000..721b2f06c113 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/ListServicesResponse.php @@ -0,0 +1,140 @@ +google.cloud.metastore.v1alpha.ListServicesResponse + */ +class ListServicesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The services in the specified location. + * + * Generated from protobuf field repeated .google.cloud.metastore.v1alpha.Service services = 1; + */ + private $services; + /** + * A token that can be sent as `page_token` to retrieve the next page. If this + * field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + */ + private $unreachable; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Metastore\V1alpha\Service>|\Google\Protobuf\Internal\RepeatedField $services + * The services in the specified location. + * @type string $next_page_token + * A token that can be sent as `page_token` to retrieve the next page. If this + * field is omitted, there are no subsequent pages. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Locations that could not be reached. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Alpha\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * The services in the specified location. + * + * Generated from protobuf field repeated .google.cloud.metastore.v1alpha.Service services = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getServices() + { + return $this->services; + } + + /** + * The services in the specified location. + * + * Generated from protobuf field repeated .google.cloud.metastore.v1alpha.Service services = 1; + * @param array<\Google\Cloud\Metastore\V1alpha\Service>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setServices($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Metastore\V1alpha\Service::class); + $this->services = $arr; + + return $this; + } + + /** + * A token that can be sent as `page_token` to retrieve the next page. If this + * field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token that can be sent as `page_token` to retrieve the next page. If this + * field is omitted, there are no subsequent pages. + * + * 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; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUnreachable($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->unreachable = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/LocationMetadata.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/LocationMetadata.php new file mode 100644 index 000000000000..068677258a75 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/LocationMetadata.php @@ -0,0 +1,75 @@ +google.cloud.metastore.v1alpha.LocationMetadata + */ +class LocationMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * The versions of Hive Metastore that can be used when creating a new + * metastore service in this location. The server guarantees that exactly one + * `HiveMetastoreVersion` in the list will set `is_default`. + * + * Generated from protobuf field repeated .google.cloud.metastore.v1alpha.LocationMetadata.HiveMetastoreVersion supported_hive_metastore_versions = 1; + */ + private $supported_hive_metastore_versions; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Metastore\V1alpha\LocationMetadata\HiveMetastoreVersion>|\Google\Protobuf\Internal\RepeatedField $supported_hive_metastore_versions + * The versions of Hive Metastore that can be used when creating a new + * metastore service in this location. The server guarantees that exactly one + * `HiveMetastoreVersion` in the list will set `is_default`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Alpha\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * The versions of Hive Metastore that can be used when creating a new + * metastore service in this location. The server guarantees that exactly one + * `HiveMetastoreVersion` in the list will set `is_default`. + * + * Generated from protobuf field repeated .google.cloud.metastore.v1alpha.LocationMetadata.HiveMetastoreVersion supported_hive_metastore_versions = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSupportedHiveMetastoreVersions() + { + return $this->supported_hive_metastore_versions; + } + + /** + * The versions of Hive Metastore that can be used when creating a new + * metastore service in this location. The server guarantees that exactly one + * `HiveMetastoreVersion` in the list will set `is_default`. + * + * Generated from protobuf field repeated .google.cloud.metastore.v1alpha.LocationMetadata.HiveMetastoreVersion supported_hive_metastore_versions = 1; + * @param array<\Google\Cloud\Metastore\V1alpha\LocationMetadata\HiveMetastoreVersion>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSupportedHiveMetastoreVersions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Metastore\V1alpha\LocationMetadata\HiveMetastoreVersion::class); + $this->supported_hive_metastore_versions = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/LocationMetadata/HiveMetastoreVersion.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/LocationMetadata/HiveMetastoreVersion.php new file mode 100644 index 000000000000..9d303276b6b6 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/LocationMetadata/HiveMetastoreVersion.php @@ -0,0 +1,108 @@ +google.cloud.metastore.v1alpha.LocationMetadata.HiveMetastoreVersion + */ +class HiveMetastoreVersion extends \Google\Protobuf\Internal\Message +{ + /** + * The semantic version of the Hive Metastore software. + * + * Generated from protobuf field string version = 1; + */ + protected $version = ''; + /** + * Whether `version` will be chosen by the server if a metastore service is + * created with a `HiveMetastoreConfig` that omits the `version`. + * + * Generated from protobuf field bool is_default = 2; + */ + protected $is_default = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $version + * The semantic version of the Hive Metastore software. + * @type bool $is_default + * Whether `version` will be chosen by the server if a metastore service is + * created with a `HiveMetastoreConfig` that omits the `version`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Alpha\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * The semantic version of the Hive Metastore software. + * + * Generated from protobuf field string version = 1; + * @return string + */ + public function getVersion() + { + return $this->version; + } + + /** + * The semantic version of the Hive Metastore software. + * + * Generated from protobuf field string version = 1; + * @param string $var + * @return $this + */ + public function setVersion($var) + { + GPBUtil::checkString($var, True); + $this->version = $var; + + return $this; + } + + /** + * Whether `version` will be chosen by the server if a metastore service is + * created with a `HiveMetastoreConfig` that omits the `version`. + * + * Generated from protobuf field bool is_default = 2; + * @return bool + */ + public function getIsDefault() + { + return $this->is_default; + } + + /** + * Whether `version` will be chosen by the server if a metastore service is + * created with a `HiveMetastoreConfig` that omits the `version`. + * + * Generated from protobuf field bool is_default = 2; + * @param bool $var + * @return $this + */ + public function setIsDefault($var) + { + GPBUtil::checkBool($var); + $this->is_default = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(HiveMetastoreVersion::class, \Google\Cloud\Metastore\V1alpha\LocationMetadata_HiveMetastoreVersion::class); + diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/LocationMetadata_HiveMetastoreVersion.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/LocationMetadata_HiveMetastoreVersion.php new file mode 100644 index 000000000000..34ca2fe4ae0e --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/LocationMetadata_HiveMetastoreVersion.php @@ -0,0 +1,16 @@ +google.cloud.metastore.v1alpha.MaintenanceWindow + */ +class MaintenanceWindow extends \Google\Protobuf\Internal\Message +{ + /** + * The hour of day (0-23) when the window starts. + * + * Generated from protobuf field .google.protobuf.Int32Value hour_of_day = 1; + */ + protected $hour_of_day = null; + /** + * The day of week, when the window starts. + * + * Generated from protobuf field .google.type.DayOfWeek day_of_week = 2; + */ + protected $day_of_week = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Int32Value $hour_of_day + * The hour of day (0-23) when the window starts. + * @type int $day_of_week + * The day of week, when the window starts. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Alpha\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * The hour of day (0-23) when the window starts. + * + * Generated from protobuf field .google.protobuf.Int32Value hour_of_day = 1; + * @return \Google\Protobuf\Int32Value|null + */ + public function getHourOfDay() + { + return $this->hour_of_day; + } + + public function hasHourOfDay() + { + return isset($this->hour_of_day); + } + + public function clearHourOfDay() + { + unset($this->hour_of_day); + } + + /** + * Returns the unboxed value from getHourOfDay() + + * The hour of day (0-23) when the window starts. + * + * Generated from protobuf field .google.protobuf.Int32Value hour_of_day = 1; + * @return int|null + */ + public function getHourOfDayUnwrapped() + { + return $this->readWrapperValue("hour_of_day"); + } + + /** + * The hour of day (0-23) when the window starts. + * + * Generated from protobuf field .google.protobuf.Int32Value hour_of_day = 1; + * @param \Google\Protobuf\Int32Value $var + * @return $this + */ + public function setHourOfDay($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Int32Value::class); + $this->hour_of_day = $var; + + return $this; + } + + /** + * Sets the field by wrapping a primitive type in a Google\Protobuf\Int32Value object. + + * The hour of day (0-23) when the window starts. + * + * Generated from protobuf field .google.protobuf.Int32Value hour_of_day = 1; + * @param int|null $var + * @return $this + */ + public function setHourOfDayUnwrapped($var) + { + $this->writeWrapperValue("hour_of_day", $var); + return $this;} + + /** + * The day of week, when the window starts. + * + * Generated from protobuf field .google.type.DayOfWeek day_of_week = 2; + * @return int + */ + public function getDayOfWeek() + { + return $this->day_of_week; + } + + /** + * The day of week, when the window starts. + * + * Generated from protobuf field .google.type.DayOfWeek day_of_week = 2; + * @param int $var + * @return $this + */ + public function setDayOfWeek($var) + { + GPBUtil::checkEnum($var, \Google\Type\DayOfWeek::class); + $this->day_of_week = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/MetadataExport.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/MetadataExport.php new file mode 100644 index 000000000000..6bdce9abf250 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/MetadataExport.php @@ -0,0 +1,240 @@ +google.cloud.metastore.v1alpha.MetadataExport + */ +class MetadataExport extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The time when the export started. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $start_time = null; + /** + * Output only. The time when the export ended. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $end_time = null; + /** + * Output only. The current state of the export. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.MetadataExport.State state = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Output only. The type of the database dump. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.DatabaseDumpSpec.Type database_dump_type = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $database_dump_type = 0; + protected $destination; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $destination_gcs_uri + * Output only. A Cloud Storage URI of a folder that metadata are exported + * to, in the form of + * `gs:////`, where + * `` is automatically generated. + * @type \Google\Protobuf\Timestamp $start_time + * Output only. The time when the export started. + * @type \Google\Protobuf\Timestamp $end_time + * Output only. The time when the export ended. + * @type int $state + * Output only. The current state of the export. + * @type int $database_dump_type + * Output only. The type of the database dump. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Alpha\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Output only. A Cloud Storage URI of a folder that metadata are exported + * to, in the form of + * `gs:////`, where + * `` is automatically generated. + * + * Generated from protobuf field string destination_gcs_uri = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getDestinationGcsUri() + { + return $this->readOneof(4); + } + + public function hasDestinationGcsUri() + { + return $this->hasOneof(4); + } + + /** + * Output only. A Cloud Storage URI of a folder that metadata are exported + * to, in the form of + * `gs:////`, where + * `` is automatically generated. + * + * Generated from protobuf field string destination_gcs_uri = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setDestinationGcsUri($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * Output only. The time when the export started. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getStartTime() + { + return $this->start_time; + } + + public function hasStartTime() + { + return isset($this->start_time); + } + + public function clearStartTime() + { + unset($this->start_time); + } + + /** + * Output only. The time when the export started. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setStartTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->start_time = $var; + + return $this; + } + + /** + * Output only. The time when the export ended. + * + * 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 when the export ended. + * + * 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 current state of the export. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.MetadataExport.State state = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. The current state of the export. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.MetadataExport.State state = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Metastore\V1alpha\MetadataExport\State::class); + $this->state = $var; + + return $this; + } + + /** + * Output only. The type of the database dump. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.DatabaseDumpSpec.Type database_dump_type = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getDatabaseDumpType() + { + return $this->database_dump_type; + } + + /** + * Output only. The type of the database dump. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.DatabaseDumpSpec.Type database_dump_type = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setDatabaseDumpType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Metastore\V1alpha\DatabaseDumpSpec\Type::class); + $this->database_dump_type = $var; + + return $this; + } + + /** + * @return string + */ + public function getDestination() + { + return $this->whichOneof("destination"); + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/MetadataExport/State.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/MetadataExport/State.php new file mode 100644 index 000000000000..5c68430d9e47 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/MetadataExport/State.php @@ -0,0 +1,78 @@ +google.cloud.metastore.v1alpha.MetadataExport.State + */ +class State +{ + /** + * The state of the metadata export is unknown. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The metadata export is running. + * + * Generated from protobuf enum RUNNING = 1; + */ + const RUNNING = 1; + /** + * The metadata export completed successfully. + * + * Generated from protobuf enum SUCCEEDED = 2; + */ + const SUCCEEDED = 2; + /** + * The metadata export failed. + * + * Generated from protobuf enum FAILED = 3; + */ + const FAILED = 3; + /** + * The metadata export is cancelled. + * + * Generated from protobuf enum CANCELLED = 4; + */ + const CANCELLED = 4; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::RUNNING => 'RUNNING', + self::SUCCEEDED => 'SUCCEEDED', + self::FAILED => 'FAILED', + self::CANCELLED => 'CANCELLED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\Metastore\V1alpha\MetadataExport_State::class); + diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/MetadataExport_State.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/MetadataExport_State.php new file mode 100644 index 000000000000..2f63ec303b06 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/MetadataExport_State.php @@ -0,0 +1,16 @@ +google.cloud.metastore.v1alpha.MetadataImport + */ +class MetadataImport extends \Google\Protobuf\Internal\Message +{ + /** + * Immutable. The relative resource name of the metadata import, of the form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{metadata_import_id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + */ + protected $name = ''; + /** + * The description of the metadata import. + * + * Generated from protobuf field string description = 2; + */ + protected $description = ''; + /** + * Output only. The time when the metadata import was started. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. The time when the metadata import was last updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * Output only. The time when the metadata import finished. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $end_time = null; + /** + * Output only. The current state of the metadata import. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.MetadataImport.State state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + protected $metadata; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Metastore\V1alpha\MetadataImport\DatabaseDump $database_dump + * Immutable. A database dump from a pre-existing metastore's database. + * @type string $name + * Immutable. The relative resource name of the metadata import, of the form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{metadata_import_id}`. + * @type string $description + * The description of the metadata import. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The time when the metadata import was started. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. The time when the metadata import was last updated. + * @type \Google\Protobuf\Timestamp $end_time + * Output only. The time when the metadata import finished. + * @type int $state + * Output only. The current state of the metadata import. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Alpha\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Immutable. A database dump from a pre-existing metastore's database. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.MetadataImport.DatabaseDump database_dump = 6 [(.google.api.field_behavior) = IMMUTABLE]; + * @return \Google\Cloud\Metastore\V1alpha\MetadataImport\DatabaseDump|null + */ + public function getDatabaseDump() + { + return $this->readOneof(6); + } + + public function hasDatabaseDump() + { + return $this->hasOneof(6); + } + + /** + * Immutable. A database dump from a pre-existing metastore's database. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.MetadataImport.DatabaseDump database_dump = 6 [(.google.api.field_behavior) = IMMUTABLE]; + * @param \Google\Cloud\Metastore\V1alpha\MetadataImport\DatabaseDump $var + * @return $this + */ + public function setDatabaseDump($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Metastore\V1alpha\MetadataImport\DatabaseDump::class); + $this->writeOneof(6, $var); + + return $this; + } + + /** + * Immutable. The relative resource name of the metadata import, of the form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{metadata_import_id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Immutable. The relative resource name of the metadata import, of the form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{metadata_import_id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The description of the metadata import. + * + * Generated from protobuf field string description = 2; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * The description of the metadata import. + * + * Generated from protobuf field string description = 2; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * Output only. The time when the metadata import was started. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 3 [(.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 when the metadata import was started. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 3 [(.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 when the metadata import was last updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 4 [(.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 when the metadata import was last updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 4 [(.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 time when the metadata import finished. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 7 [(.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 when the metadata import finished. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 7 [(.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 current state of the metadata import. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.MetadataImport.State state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. The current state of the metadata import. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.MetadataImport.State state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Metastore\V1alpha\MetadataImport\State::class); + $this->state = $var; + + return $this; + } + + /** + * @return string + */ + public function getMetadata() + { + return $this->whichOneof("metadata"); + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/MetadataImport/DatabaseDump.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/MetadataImport/DatabaseDump.php new file mode 100644 index 000000000000..41bcf9e8ef0e --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/MetadataImport/DatabaseDump.php @@ -0,0 +1,191 @@ +google.cloud.metastore.v1alpha.MetadataImport.DatabaseDump + */ +class DatabaseDump extends \Google\Protobuf\Internal\Message +{ + /** + * The type of the database. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.MetadataImport.DatabaseDump.DatabaseType database_type = 1 [deprecated = true]; + * @deprecated + */ + protected $database_type = 0; + /** + * A Cloud Storage object or folder URI that specifies the source from which + * to import metadata. It must begin with `gs://`. + * + * Generated from protobuf field string gcs_uri = 2; + */ + protected $gcs_uri = ''; + /** + * The name of the source database. + * + * Generated from protobuf field string source_database = 3 [deprecated = true]; + * @deprecated + */ + protected $source_database = ''; + /** + * Optional. The type of the database dump. If unspecified, defaults to + * `MYSQL`. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.DatabaseDumpSpec.Type type = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $type = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $database_type + * The type of the database. + * @type string $gcs_uri + * A Cloud Storage object or folder URI that specifies the source from which + * to import metadata. It must begin with `gs://`. + * @type string $source_database + * The name of the source database. + * @type int $type + * Optional. The type of the database dump. If unspecified, defaults to + * `MYSQL`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Alpha\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * The type of the database. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.MetadataImport.DatabaseDump.DatabaseType database_type = 1 [deprecated = true]; + * @return int + * @deprecated + */ + public function getDatabaseType() + { + @trigger_error('database_type is deprecated.', E_USER_DEPRECATED); + return $this->database_type; + } + + /** + * The type of the database. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.MetadataImport.DatabaseDump.DatabaseType database_type = 1 [deprecated = true]; + * @param int $var + * @return $this + * @deprecated + */ + public function setDatabaseType($var) + { + @trigger_error('database_type is deprecated.', E_USER_DEPRECATED); + GPBUtil::checkEnum($var, \Google\Cloud\Metastore\V1alpha\MetadataImport\DatabaseDump\DatabaseType::class); + $this->database_type = $var; + + return $this; + } + + /** + * A Cloud Storage object or folder URI that specifies the source from which + * to import metadata. It must begin with `gs://`. + * + * Generated from protobuf field string gcs_uri = 2; + * @return string + */ + public function getGcsUri() + { + return $this->gcs_uri; + } + + /** + * A Cloud Storage object or folder URI that specifies the source from which + * to import metadata. It must begin with `gs://`. + * + * Generated from protobuf field string gcs_uri = 2; + * @param string $var + * @return $this + */ + public function setGcsUri($var) + { + GPBUtil::checkString($var, True); + $this->gcs_uri = $var; + + return $this; + } + + /** + * The name of the source database. + * + * Generated from protobuf field string source_database = 3 [deprecated = true]; + * @return string + * @deprecated + */ + public function getSourceDatabase() + { + @trigger_error('source_database is deprecated.', E_USER_DEPRECATED); + return $this->source_database; + } + + /** + * The name of the source database. + * + * Generated from protobuf field string source_database = 3 [deprecated = true]; + * @param string $var + * @return $this + * @deprecated + */ + public function setSourceDatabase($var) + { + @trigger_error('source_database is deprecated.', E_USER_DEPRECATED); + GPBUtil::checkString($var, True); + $this->source_database = $var; + + return $this; + } + + /** + * Optional. The type of the database dump. If unspecified, defaults to + * `MYSQL`. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.DatabaseDumpSpec.Type type = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * Optional. The type of the database dump. If unspecified, defaults to + * `MYSQL`. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.DatabaseDumpSpec.Type type = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Metastore\V1alpha\DatabaseDumpSpec\Type::class); + $this->type = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(DatabaseDump::class, \Google\Cloud\Metastore\V1alpha\MetadataImport_DatabaseDump::class); + diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/MetadataImport/DatabaseDump/DatabaseType.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/MetadataImport/DatabaseDump/DatabaseType.php new file mode 100644 index 000000000000..be296436de3e --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/MetadataImport/DatabaseDump/DatabaseType.php @@ -0,0 +1,57 @@ +google.cloud.metastore.v1alpha.MetadataImport.DatabaseDump.DatabaseType + */ +class DatabaseType +{ + /** + * The type of the source database is unknown. + * + * Generated from protobuf enum DATABASE_TYPE_UNSPECIFIED = 0; + */ + const DATABASE_TYPE_UNSPECIFIED = 0; + /** + * The type of the source database is MySQL. + * + * Generated from protobuf enum MYSQL = 1; + */ + const MYSQL = 1; + + private static $valueToName = [ + self::DATABASE_TYPE_UNSPECIFIED => 'DATABASE_TYPE_UNSPECIFIED', + self::MYSQL => 'MYSQL', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(DatabaseType::class, \Google\Cloud\Metastore\V1alpha\MetadataImport_DatabaseDump_DatabaseType::class); + diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/MetadataImport/State.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/MetadataImport/State.php new file mode 100644 index 000000000000..7064408075c1 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/MetadataImport/State.php @@ -0,0 +1,79 @@ +google.cloud.metastore.v1alpha.MetadataImport.State + */ +class State +{ + /** + * The state of the metadata import is unknown. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The metadata import is running. + * + * Generated from protobuf enum RUNNING = 1; + */ + const RUNNING = 1; + /** + * The metadata import completed successfully. + * + * Generated from protobuf enum SUCCEEDED = 2; + */ + const SUCCEEDED = 2; + /** + * The metadata import is being updated. + * + * Generated from protobuf enum UPDATING = 3; + */ + const UPDATING = 3; + /** + * The metadata import failed, and attempted metadata changes were rolled + * back. + * + * Generated from protobuf enum FAILED = 4; + */ + const FAILED = 4; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::RUNNING => 'RUNNING', + self::SUCCEEDED => 'SUCCEEDED', + self::UPDATING => 'UPDATING', + self::FAILED => 'FAILED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\Metastore\V1alpha\MetadataImport_State::class); + diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/MetadataImport_DatabaseDump.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/MetadataImport_DatabaseDump.php new file mode 100644 index 000000000000..7e600e3e4aef --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/MetadataImport_DatabaseDump.php @@ -0,0 +1,16 @@ +google.cloud.metastore.v1alpha.MetadataIntegration + */ +class MetadataIntegration extends \Google\Protobuf\Internal\Message +{ + /** + * The integration config for the Data Catalog service. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.DataCatalogConfig data_catalog_config = 1; + */ + protected $data_catalog_config = null; + /** + * The integration config for the Dataplex service. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.DataplexConfig dataplex_config = 2; + */ + protected $dataplex_config = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Metastore\V1alpha\DataCatalogConfig $data_catalog_config + * The integration config for the Data Catalog service. + * @type \Google\Cloud\Metastore\V1alpha\DataplexConfig $dataplex_config + * The integration config for the Dataplex service. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Alpha\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * The integration config for the Data Catalog service. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.DataCatalogConfig data_catalog_config = 1; + * @return \Google\Cloud\Metastore\V1alpha\DataCatalogConfig|null + */ + public function getDataCatalogConfig() + { + return $this->data_catalog_config; + } + + public function hasDataCatalogConfig() + { + return isset($this->data_catalog_config); + } + + public function clearDataCatalogConfig() + { + unset($this->data_catalog_config); + } + + /** + * The integration config for the Data Catalog service. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.DataCatalogConfig data_catalog_config = 1; + * @param \Google\Cloud\Metastore\V1alpha\DataCatalogConfig $var + * @return $this + */ + public function setDataCatalogConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Metastore\V1alpha\DataCatalogConfig::class); + $this->data_catalog_config = $var; + + return $this; + } + + /** + * The integration config for the Dataplex service. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.DataplexConfig dataplex_config = 2; + * @return \Google\Cloud\Metastore\V1alpha\DataplexConfig|null + */ + public function getDataplexConfig() + { + return $this->dataplex_config; + } + + public function hasDataplexConfig() + { + return isset($this->dataplex_config); + } + + public function clearDataplexConfig() + { + unset($this->dataplex_config); + } + + /** + * The integration config for the Dataplex service. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.DataplexConfig dataplex_config = 2; + * @param \Google\Cloud\Metastore\V1alpha\DataplexConfig $var + * @return $this + */ + public function setDataplexConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Metastore\V1alpha\DataplexConfig::class); + $this->dataplex_config = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/MetadataManagementActivity.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/MetadataManagementActivity.php new file mode 100644 index 000000000000..3af658f899ef --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/MetadataManagementActivity.php @@ -0,0 +1,101 @@ +google.cloud.metastore.v1alpha.MetadataManagementActivity + */ +class MetadataManagementActivity extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The latest metadata exports of the metastore service. + * + * Generated from protobuf field repeated .google.cloud.metastore.v1alpha.MetadataExport metadata_exports = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $metadata_exports; + /** + * Output only. The latest restores of the metastore service. + * + * Generated from protobuf field repeated .google.cloud.metastore.v1alpha.Restore restores = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $restores; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Metastore\V1alpha\MetadataExport>|\Google\Protobuf\Internal\RepeatedField $metadata_exports + * Output only. The latest metadata exports of the metastore service. + * @type array<\Google\Cloud\Metastore\V1alpha\Restore>|\Google\Protobuf\Internal\RepeatedField $restores + * Output only. The latest restores of the metastore service. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Alpha\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The latest metadata exports of the metastore service. + * + * Generated from protobuf field repeated .google.cloud.metastore.v1alpha.MetadataExport metadata_exports = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getMetadataExports() + { + return $this->metadata_exports; + } + + /** + * Output only. The latest metadata exports of the metastore service. + * + * Generated from protobuf field repeated .google.cloud.metastore.v1alpha.MetadataExport metadata_exports = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array<\Google\Cloud\Metastore\V1alpha\MetadataExport>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setMetadataExports($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Metastore\V1alpha\MetadataExport::class); + $this->metadata_exports = $arr; + + return $this; + } + + /** + * Output only. The latest restores of the metastore service. + * + * Generated from protobuf field repeated .google.cloud.metastore.v1alpha.Restore restores = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRestores() + { + return $this->restores; + } + + /** + * Output only. The latest restores of the metastore service. + * + * Generated from protobuf field repeated .google.cloud.metastore.v1alpha.Restore restores = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array<\Google\Cloud\Metastore\V1alpha\Restore>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRestores($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Metastore\V1alpha\Restore::class); + $this->restores = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/MoveTableToDatabaseRequest.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/MoveTableToDatabaseRequest.php new file mode 100644 index 000000000000..144a2f02226b --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/MoveTableToDatabaseRequest.php @@ -0,0 +1,178 @@ +google.cloud.metastore.v1alpha.MoveTableToDatabaseRequest + */ +class MoveTableToDatabaseRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The relative resource name of the metastore service to mutate + * metadata, in the following format: + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * + * Generated from protobuf field string service = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $service = ''; + /** + * Required. The name of the table to be moved. + * + * Generated from protobuf field string table_name = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $table_name = ''; + /** + * Required. The name of the database where the table resides. + * + * Generated from protobuf field string db_name = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $db_name = ''; + /** + * Required. The name of the database where the table should be moved. + * + * Generated from protobuf field string destination_db_name = 4 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $destination_db_name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $service + * Required. The relative resource name of the metastore service to mutate + * metadata, in the following format: + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * @type string $table_name + * Required. The name of the table to be moved. + * @type string $db_name + * Required. The name of the database where the table resides. + * @type string $destination_db_name + * Required. The name of the database where the table should be moved. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Alpha\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Required. The relative resource name of the metastore service to mutate + * metadata, in the following format: + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * + * Generated from protobuf field string service = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getService() + { + return $this->service; + } + + /** + * Required. The relative resource name of the metastore service to mutate + * metadata, in the following format: + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * + * Generated from protobuf field string service = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setService($var) + { + GPBUtil::checkString($var, True); + $this->service = $var; + + return $this; + } + + /** + * Required. The name of the table to be moved. + * + * Generated from protobuf field string table_name = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getTableName() + { + return $this->table_name; + } + + /** + * Required. The name of the table to be moved. + * + * Generated from protobuf field string table_name = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setTableName($var) + { + GPBUtil::checkString($var, True); + $this->table_name = $var; + + return $this; + } + + /** + * Required. The name of the database where the table resides. + * + * Generated from protobuf field string db_name = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getDbName() + { + return $this->db_name; + } + + /** + * Required. The name of the database where the table resides. + * + * Generated from protobuf field string db_name = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setDbName($var) + { + GPBUtil::checkString($var, True); + $this->db_name = $var; + + return $this; + } + + /** + * Required. The name of the database where the table should be moved. + * + * Generated from protobuf field string destination_db_name = 4 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getDestinationDbName() + { + return $this->destination_db_name; + } + + /** + * Required. The name of the database where the table should be moved. + * + * Generated from protobuf field string destination_db_name = 4 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setDestinationDbName($var) + { + GPBUtil::checkString($var, True); + $this->destination_db_name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/MoveTableToDatabaseResponse.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/MoveTableToDatabaseResponse.php new file mode 100644 index 000000000000..de287eda072c --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/MoveTableToDatabaseResponse.php @@ -0,0 +1,34 @@ +google.cloud.metastore.v1alpha.MoveTableToDatabaseResponse + */ +class MoveTableToDatabaseResponse extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Alpha\Metastore::initOnce(); + parent::__construct($data); + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/NetworkConfig.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/NetworkConfig.php new file mode 100644 index 000000000000..c6ea2d9d4e20 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/NetworkConfig.php @@ -0,0 +1,109 @@ +google.cloud.metastore.v1alpha.NetworkConfig + */ +class NetworkConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Immutable. The consumer-side network configuration for the Dataproc + * Metastore instance. + * + * Generated from protobuf field repeated .google.cloud.metastore.v1alpha.NetworkConfig.Consumer consumers = 1 [(.google.api.field_behavior) = IMMUTABLE]; + */ + private $consumers; + /** + * Enables custom routes to be imported and exported for the Dataproc + * Metastore service's peered VPC network. + * + * Generated from protobuf field bool custom_routes_enabled = 2; + */ + protected $custom_routes_enabled = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Metastore\V1alpha\NetworkConfig\Consumer>|\Google\Protobuf\Internal\RepeatedField $consumers + * Immutable. The consumer-side network configuration for the Dataproc + * Metastore instance. + * @type bool $custom_routes_enabled + * Enables custom routes to be imported and exported for the Dataproc + * Metastore service's peered VPC network. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Alpha\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Immutable. The consumer-side network configuration for the Dataproc + * Metastore instance. + * + * Generated from protobuf field repeated .google.cloud.metastore.v1alpha.NetworkConfig.Consumer consumers = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getConsumers() + { + return $this->consumers; + } + + /** + * Immutable. The consumer-side network configuration for the Dataproc + * Metastore instance. + * + * Generated from protobuf field repeated .google.cloud.metastore.v1alpha.NetworkConfig.Consumer consumers = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * @param array<\Google\Cloud\Metastore\V1alpha\NetworkConfig\Consumer>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setConsumers($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Metastore\V1alpha\NetworkConfig\Consumer::class); + $this->consumers = $arr; + + return $this; + } + + /** + * Enables custom routes to be imported and exported for the Dataproc + * Metastore service's peered VPC network. + * + * Generated from protobuf field bool custom_routes_enabled = 2; + * @return bool + */ + public function getCustomRoutesEnabled() + { + return $this->custom_routes_enabled; + } + + /** + * Enables custom routes to be imported and exported for the Dataproc + * Metastore service's peered VPC network. + * + * Generated from protobuf field bool custom_routes_enabled = 2; + * @param bool $var + * @return $this + */ + public function setCustomRoutesEnabled($var) + { + GPBUtil::checkBool($var); + $this->custom_routes_enabled = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/NetworkConfig/Consumer.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/NetworkConfig/Consumer.php new file mode 100644 index 000000000000..cd2d150b1ef1 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/NetworkConfig/Consumer.php @@ -0,0 +1,134 @@ +google.cloud.metastore.v1alpha.NetworkConfig.Consumer + */ +class Consumer extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The URI of the endpoint used to access the metastore + * service. + * + * Generated from protobuf field string endpoint_uri = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $endpoint_uri = ''; + protected $vpc_resource; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $subnetwork + * Immutable. The subnetwork of the customer project from which an IP + * address is reserved and used as the Dataproc Metastore service's + * endpoint. It is accessible to hosts in the subnet and to all + * hosts in a subnet in the same region and same network. There must + * be at least one IP address available in the subnet's primary range. The + * subnet is specified in the following form: + * `projects/{project_number}/regions/{region_id}/subnetworks/{subnetwork_id}` + * @type string $endpoint_uri + * Output only. The URI of the endpoint used to access the metastore + * service. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Alpha\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Immutable. The subnetwork of the customer project from which an IP + * address is reserved and used as the Dataproc Metastore service's + * endpoint. It is accessible to hosts in the subnet and to all + * hosts in a subnet in the same region and same network. There must + * be at least one IP address available in the subnet's primary range. The + * subnet is specified in the following form: + * `projects/{project_number}/regions/{region_id}/subnetworks/{subnetwork_id}` + * + * Generated from protobuf field string subnetwork = 1 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.resource_reference) = { + * @return string + */ + public function getSubnetwork() + { + return $this->readOneof(1); + } + + public function hasSubnetwork() + { + return $this->hasOneof(1); + } + + /** + * Immutable. The subnetwork of the customer project from which an IP + * address is reserved and used as the Dataproc Metastore service's + * endpoint. It is accessible to hosts in the subnet and to all + * hosts in a subnet in the same region and same network. There must + * be at least one IP address available in the subnet's primary range. The + * subnet is specified in the following form: + * `projects/{project_number}/regions/{region_id}/subnetworks/{subnetwork_id}` + * + * Generated from protobuf field string subnetwork = 1 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setSubnetwork($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * Output only. The URI of the endpoint used to access the metastore + * service. + * + * Generated from protobuf field string endpoint_uri = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getEndpointUri() + { + return $this->endpoint_uri; + } + + /** + * Output only. The URI of the endpoint used to access the metastore + * service. + * + * Generated from protobuf field string endpoint_uri = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setEndpointUri($var) + { + GPBUtil::checkString($var, True); + $this->endpoint_uri = $var; + + return $this; + } + + /** + * @return string + */ + public function getVpcResource() + { + return $this->whichOneof("vpc_resource"); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Consumer::class, \Google\Cloud\Metastore\V1alpha\NetworkConfig_Consumer::class); + diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/NetworkConfig_Consumer.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/NetworkConfig_Consumer.php new file mode 100644 index 000000000000..eff303639cc3 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/NetworkConfig_Consumer.php @@ -0,0 +1,16 @@ +google.cloud.metastore.v1alpha.OperationMetadata + */ +class OperationMetadata 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. Server-defined resource path for the target of the operation. + * + * Generated from protobuf field string target = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $target = ''; + /** + * Output only. Name of the verb executed by the operation. + * + * Generated from protobuf field string verb = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $verb = ''; + /** + * Output only. Human-readable status of the operation, if any. + * + * Generated from protobuf field string status_message = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $status_message = ''; + /** + * Output only. Identifies whether the caller has requested cancellation + * of the operation. Operations that have successfully been cancelled + * have [Operation.error][] value with a + * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + * `Code.CANCELLED`. + * + * Generated from protobuf field bool requested_cancellation = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $requested_cancellation = false; + /** + * Output only. API version used to start the operation. + * + * Generated from protobuf field string api_version = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $api_version = ''; + + /** + * 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 string $target + * Output only. Server-defined resource path for the target of the operation. + * @type string $verb + * Output only. Name of the verb executed by the operation. + * @type string $status_message + * Output only. Human-readable status of the operation, if any. + * @type bool $requested_cancellation + * Output only. Identifies whether the caller has requested cancellation + * of the operation. Operations that have successfully been cancelled + * have [Operation.error][] value with a + * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + * `Code.CANCELLED`. + * @type string $api_version + * Output only. API version used to start the operation. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Alpha\Metastore::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. Server-defined resource path for the target of the operation. + * + * Generated from protobuf field string target = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getTarget() + { + return $this->target; + } + + /** + * Output only. Server-defined resource path for the target of the operation. + * + * Generated from protobuf field string target = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setTarget($var) + { + GPBUtil::checkString($var, True); + $this->target = $var; + + return $this; + } + + /** + * Output only. Name of the verb executed by the operation. + * + * Generated from protobuf field string verb = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getVerb() + { + return $this->verb; + } + + /** + * Output only. Name of the verb executed by the operation. + * + * Generated from protobuf field string verb = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setVerb($var) + { + GPBUtil::checkString($var, True); + $this->verb = $var; + + return $this; + } + + /** + * Output only. Human-readable status of the operation, if any. + * + * Generated from protobuf field string status_message = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getStatusMessage() + { + return $this->status_message; + } + + /** + * Output only. Human-readable status of the operation, if any. + * + * Generated from protobuf field string status_message = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setStatusMessage($var) + { + GPBUtil::checkString($var, True); + $this->status_message = $var; + + return $this; + } + + /** + * Output only. Identifies whether the caller has requested cancellation + * of the operation. Operations that have successfully been cancelled + * have [Operation.error][] value with a + * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + * `Code.CANCELLED`. + * + * Generated from protobuf field bool requested_cancellation = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return bool + */ + public function getRequestedCancellation() + { + return $this->requested_cancellation; + } + + /** + * Output only. Identifies whether the caller has requested cancellation + * of the operation. Operations that have successfully been cancelled + * have [Operation.error][] value with a + * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + * `Code.CANCELLED`. + * + * Generated from protobuf field bool requested_cancellation = 6 [(.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. API version used to start the operation. + * + * Generated from protobuf field string api_version = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getApiVersion() + { + return $this->api_version; + } + + /** + * Output only. API version used to start the operation. + * + * Generated from protobuf field string api_version = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setApiVersion($var) + { + GPBUtil::checkString($var, True); + $this->api_version = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/QueryMetadataRequest.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/QueryMetadataRequest.php new file mode 100644 index 000000000000..7311145db977 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/QueryMetadataRequest.php @@ -0,0 +1,114 @@ +google.cloud.metastore.v1alpha.QueryMetadataRequest + */ +class QueryMetadataRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The relative resource name of the metastore service to query + * metadata, in the following format: + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * + * Generated from protobuf field string service = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $service = ''; + /** + * Required. A read-only SQL query to execute against the metadata database. + * The query cannot change or mutate the data. + * + * Generated from protobuf field string query = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $query = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $service + * Required. The relative resource name of the metastore service to query + * metadata, in the following format: + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * @type string $query + * Required. A read-only SQL query to execute against the metadata database. + * The query cannot change or mutate the data. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Alpha\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Required. The relative resource name of the metastore service to query + * metadata, in the following format: + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * + * Generated from protobuf field string service = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getService() + { + return $this->service; + } + + /** + * Required. The relative resource name of the metastore service to query + * metadata, in the following format: + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * + * Generated from protobuf field string service = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setService($var) + { + GPBUtil::checkString($var, True); + $this->service = $var; + + return $this; + } + + /** + * Required. A read-only SQL query to execute against the metadata database. + * The query cannot change or mutate the data. + * + * Generated from protobuf field string query = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getQuery() + { + return $this->query; + } + + /** + * Required. A read-only SQL query to execute against the metadata database. + * The query cannot change or mutate the data. + * + * Generated from protobuf field string query = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setQuery($var) + { + GPBUtil::checkString($var, True); + $this->query = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/QueryMetadataResponse.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/QueryMetadataResponse.php new file mode 100644 index 000000000000..f281f4e03016 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/QueryMetadataResponse.php @@ -0,0 +1,80 @@ +google.cloud.metastore.v1alpha.QueryMetadataResponse + */ +class QueryMetadataResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The manifest URI is link to a JSON instance in Cloud Storage. + * This instance manifests immediately along with QueryMetadataResponse. The + * content of the URI is not retriable until the long-running operation query + * against the metadata finishes. + * + * Generated from protobuf field string result_manifest_uri = 1; + */ + protected $result_manifest_uri = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $result_manifest_uri + * The manifest URI is link to a JSON instance in Cloud Storage. + * This instance manifests immediately along with QueryMetadataResponse. The + * content of the URI is not retriable until the long-running operation query + * against the metadata finishes. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Alpha\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * The manifest URI is link to a JSON instance in Cloud Storage. + * This instance manifests immediately along with QueryMetadataResponse. The + * content of the URI is not retriable until the long-running operation query + * against the metadata finishes. + * + * Generated from protobuf field string result_manifest_uri = 1; + * @return string + */ + public function getResultManifestUri() + { + return $this->result_manifest_uri; + } + + /** + * The manifest URI is link to a JSON instance in Cloud Storage. + * This instance manifests immediately along with QueryMetadataResponse. The + * content of the URI is not retriable until the long-running operation query + * against the metadata finishes. + * + * Generated from protobuf field string result_manifest_uri = 1; + * @param string $var + * @return $this + */ + public function setResultManifestUri($var) + { + GPBUtil::checkString($var, True); + $this->result_manifest_uri = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/RemoveIamPolicyRequest.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/RemoveIamPolicyRequest.php new file mode 100644 index 000000000000..bb2ac3296f27 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/RemoveIamPolicyRequest.php @@ -0,0 +1,122 @@ +google.cloud.metastore.v1alpha.RemoveIamPolicyRequest + */ +class RemoveIamPolicyRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The relative resource name of the dataplane resource to remove + * IAM policy, in the following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}/databases/{database_id}` + * or + * `projects/{project_id}/locations/{location_id}/services/{service_id}/databases/{database_id}/tables/{table_id}`. + * + * Generated from protobuf field string resource = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $resource = ''; + /** + * Optional. Removes IAM policy attached to database or table asynchronously + * when it is set. The default is false. + * + * Generated from protobuf field bool asynchronous = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $asynchronous = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $resource + * Required. The relative resource name of the dataplane resource to remove + * IAM policy, in the following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}/databases/{database_id}` + * or + * `projects/{project_id}/locations/{location_id}/services/{service_id}/databases/{database_id}/tables/{table_id}`. + * @type bool $asynchronous + * Optional. Removes IAM policy attached to database or table asynchronously + * when it is set. The default is false. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Alpha\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Required. The relative resource name of the dataplane resource to remove + * IAM policy, in the following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}/databases/{database_id}` + * or + * `projects/{project_id}/locations/{location_id}/services/{service_id}/databases/{database_id}/tables/{table_id}`. + * + * Generated from protobuf field string resource = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getResource() + { + return $this->resource; + } + + /** + * Required. The relative resource name of the dataplane resource to remove + * IAM policy, in the following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}/databases/{database_id}` + * or + * `projects/{project_id}/locations/{location_id}/services/{service_id}/databases/{database_id}/tables/{table_id}`. + * + * Generated from protobuf field string resource = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setResource($var) + { + GPBUtil::checkString($var, True); + $this->resource = $var; + + return $this; + } + + /** + * Optional. Removes IAM policy attached to database or table asynchronously + * when it is set. The default is false. + * + * Generated from protobuf field bool asynchronous = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getAsynchronous() + { + return $this->asynchronous; + } + + /** + * Optional. Removes IAM policy attached to database or table asynchronously + * when it is set. The default is false. + * + * Generated from protobuf field bool asynchronous = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setAsynchronous($var) + { + GPBUtil::checkBool($var); + $this->asynchronous = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/RemoveIamPolicyResponse.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/RemoveIamPolicyResponse.php new file mode 100644 index 000000000000..d67408b39be9 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/RemoveIamPolicyResponse.php @@ -0,0 +1,68 @@ +google.cloud.metastore.v1alpha.RemoveIamPolicyResponse + */ +class RemoveIamPolicyResponse extends \Google\Protobuf\Internal\Message +{ + /** + * True if the policy is successfully removed. + * + * Generated from protobuf field bool success = 1; + */ + protected $success = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $success + * True if the policy is successfully removed. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Alpha\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * True if the policy is successfully removed. + * + * Generated from protobuf field bool success = 1; + * @return bool + */ + public function getSuccess() + { + return $this->success; + } + + /** + * True if the policy is successfully removed. + * + * Generated from protobuf field bool success = 1; + * @param bool $var + * @return $this + */ + public function setSuccess($var) + { + GPBUtil::checkBool($var); + $this->success = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/Restore.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/Restore.php new file mode 100644 index 000000000000..808a5b15a5b4 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/Restore.php @@ -0,0 +1,269 @@ +google.cloud.metastore.v1alpha.Restore + */ +class Restore extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The time when the restore started. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $start_time = null; + /** + * Output only. The time when the restore ended. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $end_time = null; + /** + * Output only. The current state of the restore. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.Restore.State state = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Output only. The relative resource name of the metastore service backup to + * restore from, in the following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + * + * Generated from protobuf field string backup = 4 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + */ + protected $backup = ''; + /** + * Output only. The type of restore. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.Restore.RestoreType type = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $type = 0; + /** + * Output only. The restore details containing the revision of the service to + * be restored to, in format of JSON. + * + * Generated from protobuf field string details = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $details = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Timestamp $start_time + * Output only. The time when the restore started. + * @type \Google\Protobuf\Timestamp $end_time + * Output only. The time when the restore ended. + * @type int $state + * Output only. The current state of the restore. + * @type string $backup + * Output only. The relative resource name of the metastore service backup to + * restore from, in the following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + * @type int $type + * Output only. The type of restore. + * @type string $details + * Output only. The restore details containing the revision of the service to + * be restored to, in format of JSON. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Alpha\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The time when the restore started. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getStartTime() + { + return $this->start_time; + } + + public function hasStartTime() + { + return isset($this->start_time); + } + + public function clearStartTime() + { + unset($this->start_time); + } + + /** + * Output only. The time when the restore started. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setStartTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->start_time = $var; + + return $this; + } + + /** + * Output only. The time when the restore ended. + * + * 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 when the restore ended. + * + * 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 current state of the restore. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.Restore.State state = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. The current state of the restore. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.Restore.State state = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Metastore\V1alpha\Restore\State::class); + $this->state = $var; + + return $this; + } + + /** + * Output only. The relative resource name of the metastore service backup to + * restore from, in the following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + * + * Generated from protobuf field string backup = 4 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + * @return string + */ + public function getBackup() + { + return $this->backup; + } + + /** + * Output only. The relative resource name of the metastore service backup to + * restore from, in the following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + * + * Generated from protobuf field string backup = 4 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setBackup($var) + { + GPBUtil::checkString($var, True); + $this->backup = $var; + + return $this; + } + + /** + * Output only. The type of restore. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.Restore.RestoreType type = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * Output only. The type of restore. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.Restore.RestoreType type = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Metastore\V1alpha\Restore\RestoreType::class); + $this->type = $var; + + return $this; + } + + /** + * Output only. The restore details containing the revision of the service to + * be restored to, in format of JSON. + * + * Generated from protobuf field string details = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getDetails() + { + return $this->details; + } + + /** + * Output only. The restore details containing the revision of the service to + * be restored to, in format of JSON. + * + * Generated from protobuf field string details = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setDetails($var) + { + GPBUtil::checkString($var, True); + $this->details = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/Restore/RestoreType.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/Restore/RestoreType.php new file mode 100644 index 000000000000..ac00e6c12f01 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/Restore/RestoreType.php @@ -0,0 +1,64 @@ +google.cloud.metastore.v1alpha.Restore.RestoreType + */ +class RestoreType +{ + /** + * The restore type is unknown. + * + * Generated from protobuf enum RESTORE_TYPE_UNSPECIFIED = 0; + */ + const RESTORE_TYPE_UNSPECIFIED = 0; + /** + * The service's metadata and configuration are restored. + * + * Generated from protobuf enum FULL = 1; + */ + const FULL = 1; + /** + * Only the service's metadata is restored. + * + * Generated from protobuf enum METADATA_ONLY = 2; + */ + const METADATA_ONLY = 2; + + private static $valueToName = [ + self::RESTORE_TYPE_UNSPECIFIED => 'RESTORE_TYPE_UNSPECIFIED', + self::FULL => 'FULL', + self::METADATA_ONLY => 'METADATA_ONLY', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(RestoreType::class, \Google\Cloud\Metastore\V1alpha\Restore_RestoreType::class); + diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/Restore/State.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/Restore/State.php new file mode 100644 index 000000000000..f5225dc2cc66 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/Restore/State.php @@ -0,0 +1,78 @@ +google.cloud.metastore.v1alpha.Restore.State + */ +class State +{ + /** + * The state of the metadata restore is unknown. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The metadata restore is running. + * + * Generated from protobuf enum RUNNING = 1; + */ + const RUNNING = 1; + /** + * The metadata restore completed successfully. + * + * Generated from protobuf enum SUCCEEDED = 2; + */ + const SUCCEEDED = 2; + /** + * The metadata restore failed. + * + * Generated from protobuf enum FAILED = 3; + */ + const FAILED = 3; + /** + * The metadata restore is cancelled. + * + * Generated from protobuf enum CANCELLED = 4; + */ + const CANCELLED = 4; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::RUNNING => 'RUNNING', + self::SUCCEEDED => 'SUCCEEDED', + self::FAILED => 'FAILED', + self::CANCELLED => 'CANCELLED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\Metastore\V1alpha\Restore_State::class); + diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/RestoreServiceRequest.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/RestoreServiceRequest.php new file mode 100644 index 000000000000..173c80bdc5ff --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/RestoreServiceRequest.php @@ -0,0 +1,221 @@ +google.cloud.metastore.v1alpha.RestoreServiceRequest + */ +class RestoreServiceRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The relative resource name of the metastore service to run + * restore, in the following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * + * Generated from protobuf field string service = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $service = ''; + /** + * Required. The relative resource name of the metastore service backup to + * restore from, in the following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + * + * Generated from protobuf field string backup = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $backup = ''; + /** + * Optional. The type of restore. If unspecified, defaults to `METADATA_ONLY`. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.Restore.RestoreType restore_type = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $restore_type = 0; + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $service + * Required. The relative resource name of the metastore service to run + * restore, in the following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * @type string $backup + * Required. The relative resource name of the metastore service backup to + * restore from, in the following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + * @type int $restore_type + * Optional. The type of restore. If unspecified, defaults to `METADATA_ONLY`. + * @type string $request_id + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Alpha\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Required. The relative resource name of the metastore service to run + * restore, in the following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * + * Generated from protobuf field string service = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getService() + { + return $this->service; + } + + /** + * Required. The relative resource name of the metastore service to run + * restore, in the following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * + * Generated from protobuf field string service = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setService($var) + { + GPBUtil::checkString($var, True); + $this->service = $var; + + return $this; + } + + /** + * Required. The relative resource name of the metastore service backup to + * restore from, in the following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + * + * Generated from protobuf field string backup = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getBackup() + { + return $this->backup; + } + + /** + * Required. The relative resource name of the metastore service backup to + * restore from, in the following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + * + * Generated from protobuf field string backup = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setBackup($var) + { + GPBUtil::checkString($var, True); + $this->backup = $var; + + return $this; + } + + /** + * Optional. The type of restore. If unspecified, defaults to `METADATA_ONLY`. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.Restore.RestoreType restore_type = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getRestoreType() + { + return $this->restore_type; + } + + /** + * Optional. The type of restore. If unspecified, defaults to `METADATA_ONLY`. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.Restore.RestoreType restore_type = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setRestoreType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Metastore\V1alpha\Restore\RestoreType::class); + $this->restore_type = $var; + + return $this; + } + + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @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/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/Restore_RestoreType.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/Restore_RestoreType.php new file mode 100644 index 000000000000..250369a14e17 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/Restore_RestoreType.php @@ -0,0 +1,16 @@ +google.cloud.metastore.v1alpha.ScalingConfig + */ +class ScalingConfig extends \Google\Protobuf\Internal\Message +{ + protected $scaling_model; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $instance_size + * An enum of readable instance sizes, with each instance size mapping to a + * float value (e.g. InstanceSize.EXTRA_SMALL = scaling_factor(0.1)) + * @type float $scaling_factor + * Scaling factor, increments of 0.1 for values less than 1.0, and + * increments of 1.0 for values greater than 1.0. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Alpha\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * An enum of readable instance sizes, with each instance size mapping to a + * float value (e.g. InstanceSize.EXTRA_SMALL = scaling_factor(0.1)) + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.ScalingConfig.InstanceSize instance_size = 1; + * @return int + */ + public function getInstanceSize() + { + return $this->readOneof(1); + } + + public function hasInstanceSize() + { + return $this->hasOneof(1); + } + + /** + * An enum of readable instance sizes, with each instance size mapping to a + * float value (e.g. InstanceSize.EXTRA_SMALL = scaling_factor(0.1)) + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.ScalingConfig.InstanceSize instance_size = 1; + * @param int $var + * @return $this + */ + public function setInstanceSize($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Metastore\V1alpha\ScalingConfig\InstanceSize::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * Scaling factor, increments of 0.1 for values less than 1.0, and + * increments of 1.0 for values greater than 1.0. + * + * Generated from protobuf field float scaling_factor = 2; + * @return float + */ + public function getScalingFactor() + { + return $this->readOneof(2); + } + + public function hasScalingFactor() + { + return $this->hasOneof(2); + } + + /** + * Scaling factor, increments of 0.1 for values less than 1.0, and + * increments of 1.0 for values greater than 1.0. + * + * Generated from protobuf field float scaling_factor = 2; + * @param float $var + * @return $this + */ + public function setScalingFactor($var) + { + GPBUtil::checkFloat($var); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * @return string + */ + public function getScalingModel() + { + return $this->whichOneof("scaling_model"); + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/ScalingConfig/InstanceSize.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/ScalingConfig/InstanceSize.php new file mode 100644 index 000000000000..1b7ccfc5dfe0 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/ScalingConfig/InstanceSize.php @@ -0,0 +1,85 @@ +google.cloud.metastore.v1alpha.ScalingConfig.InstanceSize + */ +class InstanceSize +{ + /** + * Unspecified instance size + * + * Generated from protobuf enum INSTANCE_SIZE_UNSPECIFIED = 0; + */ + const INSTANCE_SIZE_UNSPECIFIED = 0; + /** + * Extra small instance size, maps to a scaling factor of 0.1. + * + * Generated from protobuf enum EXTRA_SMALL = 1; + */ + const EXTRA_SMALL = 1; + /** + * Small instance size, maps to a scaling factor of 0.5. + * + * Generated from protobuf enum SMALL = 2; + */ + const SMALL = 2; + /** + * Medium instance size, maps to a scaling factor of 1.0. + * + * Generated from protobuf enum MEDIUM = 3; + */ + const MEDIUM = 3; + /** + * Large instance size, maps to a scaling factor of 3.0. + * + * Generated from protobuf enum LARGE = 4; + */ + const LARGE = 4; + /** + * Extra large instance size, maps to a scaling factor of 6.0. + * + * Generated from protobuf enum EXTRA_LARGE = 5; + */ + const EXTRA_LARGE = 5; + + private static $valueToName = [ + self::INSTANCE_SIZE_UNSPECIFIED => 'INSTANCE_SIZE_UNSPECIFIED', + self::EXTRA_SMALL => 'EXTRA_SMALL', + self::SMALL => 'SMALL', + self::MEDIUM => 'MEDIUM', + self::LARGE => 'LARGE', + self::EXTRA_LARGE => 'EXTRA_LARGE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(InstanceSize::class, \Google\Cloud\Metastore\V1alpha\ScalingConfig_InstanceSize::class); + diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/ScalingConfig_InstanceSize.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/ScalingConfig_InstanceSize.php new file mode 100644 index 000000000000..3307317e6840 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/ScalingConfig_InstanceSize.php @@ -0,0 +1,16 @@ +google.cloud.metastore.v1alpha.Secret + */ +class Secret extends \Google\Protobuf\Internal\Message +{ + protected $value; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $cloud_secret + * The relative resource name of a Secret Manager secret version, in the + * following form: + * `projects/{project_number}/secrets/{secret_id}/versions/{version_id}`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Alpha\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * The relative resource name of a Secret Manager secret version, in the + * following form: + * `projects/{project_number}/secrets/{secret_id}/versions/{version_id}`. + * + * Generated from protobuf field string cloud_secret = 2; + * @return string + */ + public function getCloudSecret() + { + return $this->readOneof(2); + } + + public function hasCloudSecret() + { + return $this->hasOneof(2); + } + + /** + * The relative resource name of a Secret Manager secret version, in the + * following form: + * `projects/{project_number}/secrets/{secret_id}/versions/{version_id}`. + * + * Generated from protobuf field string cloud_secret = 2; + * @param string $var + * @return $this + */ + public function setCloudSecret($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * @return string + */ + public function getValue() + { + return $this->whichOneof("value"); + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/Service.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/Service.php new file mode 100644 index 000000000000..7efbade698c0 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/Service.php @@ -0,0 +1,942 @@ +google.cloud.metastore.v1alpha.Service + */ +class Service extends \Google\Protobuf\Internal\Message +{ + /** + * Immutable. The relative resource name of the metastore service, in the + * following format: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + */ + protected $name = ''; + /** + * Output only. The time when the metastore service was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. The time when the metastore service was last updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * User-defined labels for the metastore service. + * + * Generated from protobuf field map labels = 4; + */ + private $labels; + /** + * Immutable. The relative resource name of the VPC network on which the + * instance can be accessed. It is specified in the following form: + * `projects/{project_number}/global/networks/{network_id}`. + * + * Generated from protobuf field string network = 7 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.resource_reference) = { + */ + protected $network = ''; + /** + * Output only. The URI of the endpoint used to access the metastore service. + * + * Generated from protobuf field string endpoint_uri = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $endpoint_uri = ''; + /** + * The TCP port at which the metastore service is reached. Default: 9083. + * + * Generated from protobuf field int32 port = 9; + */ + protected $port = 0; + /** + * Output only. The current state of the metastore service. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.Service.State state = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Output only. Additional information about the current state of the + * metastore service, if available. + * + * Generated from protobuf field string state_message = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state_message = ''; + /** + * Output only. A Cloud Storage URI (starting with `gs://`) that specifies + * where artifacts related to the metastore service are stored. + * + * Generated from protobuf field string artifact_gcs_uri = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $artifact_gcs_uri = ''; + /** + * The tier of the service. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.Service.Tier tier = 13; + */ + protected $tier = 0; + /** + * The setting that defines how metastore metadata should be integrated with + * external services and systems. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.MetadataIntegration metadata_integration = 14; + */ + protected $metadata_integration = null; + /** + * The one hour maintenance window of the metastore service. This specifies + * when the service can be restarted for maintenance purposes in UTC time. + * Maintenance window is not needed for services with the SPANNER + * database type. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.MaintenanceWindow maintenance_window = 15; + */ + protected $maintenance_window = null; + /** + * Output only. The globally unique resource identifier of the metastore + * service. + * + * Generated from protobuf field string uid = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $uid = ''; + /** + * Output only. The metadata management activities of the metastore service. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.MetadataManagementActivity metadata_management_activity = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $metadata_management_activity = null; + /** + * Immutable. The release channel of the service. + * If unspecified, defaults to `STABLE`. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.Service.ReleaseChannel release_channel = 19 [(.google.api.field_behavior) = IMMUTABLE]; + */ + protected $release_channel = 0; + /** + * Immutable. Information used to configure the Dataproc Metastore service to + * encrypt customer data at rest. Cannot be updated. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.EncryptionConfig encryption_config = 20 [(.google.api.field_behavior) = IMMUTABLE]; + */ + protected $encryption_config = null; + /** + * The configuration specifying the network settings for the + * Dataproc Metastore service. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.NetworkConfig network_config = 21; + */ + protected $network_config = null; + /** + * Immutable. The database type that the Metastore service stores its data. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.Service.DatabaseType database_type = 22 [(.google.api.field_behavior) = IMMUTABLE]; + */ + protected $database_type = 0; + /** + * The configuration specifying telemetry settings for the Dataproc Metastore + * service. If unspecified defaults to `JSON`. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.TelemetryConfig telemetry_config = 23; + */ + protected $telemetry_config = null; + /** + * Scaling configuration of the metastore service. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.ScalingConfig scaling_config = 24; + */ + protected $scaling_config = null; + protected $metastore_config; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Metastore\V1alpha\HiveMetastoreConfig $hive_metastore_config + * Configuration information specific to running Hive metastore + * software as the metastore service. + * @type string $name + * Immutable. The relative resource name of the metastore service, in the + * following format: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The time when the metastore service was created. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. The time when the metastore service was last updated. + * @type array|\Google\Protobuf\Internal\MapField $labels + * User-defined labels for the metastore service. + * @type string $network + * Immutable. The relative resource name of the VPC network on which the + * instance can be accessed. It is specified in the following form: + * `projects/{project_number}/global/networks/{network_id}`. + * @type string $endpoint_uri + * Output only. The URI of the endpoint used to access the metastore service. + * @type int $port + * The TCP port at which the metastore service is reached. Default: 9083. + * @type int $state + * Output only. The current state of the metastore service. + * @type string $state_message + * Output only. Additional information about the current state of the + * metastore service, if available. + * @type string $artifact_gcs_uri + * Output only. A Cloud Storage URI (starting with `gs://`) that specifies + * where artifacts related to the metastore service are stored. + * @type int $tier + * The tier of the service. + * @type \Google\Cloud\Metastore\V1alpha\MetadataIntegration $metadata_integration + * The setting that defines how metastore metadata should be integrated with + * external services and systems. + * @type \Google\Cloud\Metastore\V1alpha\MaintenanceWindow $maintenance_window + * The one hour maintenance window of the metastore service. This specifies + * when the service can be restarted for maintenance purposes in UTC time. + * Maintenance window is not needed for services with the SPANNER + * database type. + * @type string $uid + * Output only. The globally unique resource identifier of the metastore + * service. + * @type \Google\Cloud\Metastore\V1alpha\MetadataManagementActivity $metadata_management_activity + * Output only. The metadata management activities of the metastore service. + * @type int $release_channel + * Immutable. The release channel of the service. + * If unspecified, defaults to `STABLE`. + * @type \Google\Cloud\Metastore\V1alpha\EncryptionConfig $encryption_config + * Immutable. Information used to configure the Dataproc Metastore service to + * encrypt customer data at rest. Cannot be updated. + * @type \Google\Cloud\Metastore\V1alpha\NetworkConfig $network_config + * The configuration specifying the network settings for the + * Dataproc Metastore service. + * @type int $database_type + * Immutable. The database type that the Metastore service stores its data. + * @type \Google\Cloud\Metastore\V1alpha\TelemetryConfig $telemetry_config + * The configuration specifying telemetry settings for the Dataproc Metastore + * service. If unspecified defaults to `JSON`. + * @type \Google\Cloud\Metastore\V1alpha\ScalingConfig $scaling_config + * Scaling configuration of the metastore service. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Alpha\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Configuration information specific to running Hive metastore + * software as the metastore service. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.HiveMetastoreConfig hive_metastore_config = 5; + * @return \Google\Cloud\Metastore\V1alpha\HiveMetastoreConfig|null + */ + public function getHiveMetastoreConfig() + { + return $this->readOneof(5); + } + + public function hasHiveMetastoreConfig() + { + return $this->hasOneof(5); + } + + /** + * Configuration information specific to running Hive metastore + * software as the metastore service. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.HiveMetastoreConfig hive_metastore_config = 5; + * @param \Google\Cloud\Metastore\V1alpha\HiveMetastoreConfig $var + * @return $this + */ + public function setHiveMetastoreConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Metastore\V1alpha\HiveMetastoreConfig::class); + $this->writeOneof(5, $var); + + return $this; + } + + /** + * Immutable. The relative resource name of the metastore service, in the + * following format: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Immutable. The relative resource name of the metastore service, in the + * following format: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. The time when the metastore service was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.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 when the metastore service was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.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 when the metastore service was last updated. + * + * 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 when the metastore service was last updated. + * + * 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; + } + + /** + * User-defined labels for the metastore service. + * + * Generated from protobuf field map labels = 4; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * User-defined labels for the metastore service. + * + * Generated from protobuf field map labels = 4; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + + /** + * Immutable. The relative resource name of the VPC network on which the + * instance can be accessed. It is specified in the following form: + * `projects/{project_number}/global/networks/{network_id}`. + * + * Generated from protobuf field string network = 7 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.resource_reference) = { + * @return string + */ + public function getNetwork() + { + return $this->network; + } + + /** + * Immutable. The relative resource name of the VPC network on which the + * instance can be accessed. It is specified in the following form: + * `projects/{project_number}/global/networks/{network_id}`. + * + * Generated from protobuf field string network = 7 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setNetwork($var) + { + GPBUtil::checkString($var, True); + $this->network = $var; + + return $this; + } + + /** + * Output only. The URI of the endpoint used to access the metastore service. + * + * Generated from protobuf field string endpoint_uri = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getEndpointUri() + { + return $this->endpoint_uri; + } + + /** + * Output only. The URI of the endpoint used to access the metastore service. + * + * Generated from protobuf field string endpoint_uri = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setEndpointUri($var) + { + GPBUtil::checkString($var, True); + $this->endpoint_uri = $var; + + return $this; + } + + /** + * The TCP port at which the metastore service is reached. Default: 9083. + * + * Generated from protobuf field int32 port = 9; + * @return int + */ + public function getPort() + { + return $this->port; + } + + /** + * The TCP port at which the metastore service is reached. Default: 9083. + * + * Generated from protobuf field int32 port = 9; + * @param int $var + * @return $this + */ + public function setPort($var) + { + GPBUtil::checkInt32($var); + $this->port = $var; + + return $this; + } + + /** + * Output only. The current state of the metastore service. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.Service.State state = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. The current state of the metastore service. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.Service.State state = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Metastore\V1alpha\Service\State::class); + $this->state = $var; + + return $this; + } + + /** + * Output only. Additional information about the current state of the + * metastore service, if available. + * + * Generated from protobuf field string state_message = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getStateMessage() + { + return $this->state_message; + } + + /** + * Output only. Additional information about the current state of the + * metastore service, if available. + * + * Generated from protobuf field string state_message = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setStateMessage($var) + { + GPBUtil::checkString($var, True); + $this->state_message = $var; + + return $this; + } + + /** + * Output only. A Cloud Storage URI (starting with `gs://`) that specifies + * where artifacts related to the metastore service are stored. + * + * Generated from protobuf field string artifact_gcs_uri = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getArtifactGcsUri() + { + return $this->artifact_gcs_uri; + } + + /** + * Output only. A Cloud Storage URI (starting with `gs://`) that specifies + * where artifacts related to the metastore service are stored. + * + * Generated from protobuf field string artifact_gcs_uri = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setArtifactGcsUri($var) + { + GPBUtil::checkString($var, True); + $this->artifact_gcs_uri = $var; + + return $this; + } + + /** + * The tier of the service. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.Service.Tier tier = 13; + * @return int + */ + public function getTier() + { + return $this->tier; + } + + /** + * The tier of the service. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.Service.Tier tier = 13; + * @param int $var + * @return $this + */ + public function setTier($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Metastore\V1alpha\Service\Tier::class); + $this->tier = $var; + + return $this; + } + + /** + * The setting that defines how metastore metadata should be integrated with + * external services and systems. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.MetadataIntegration metadata_integration = 14; + * @return \Google\Cloud\Metastore\V1alpha\MetadataIntegration|null + */ + public function getMetadataIntegration() + { + return $this->metadata_integration; + } + + public function hasMetadataIntegration() + { + return isset($this->metadata_integration); + } + + public function clearMetadataIntegration() + { + unset($this->metadata_integration); + } + + /** + * The setting that defines how metastore metadata should be integrated with + * external services and systems. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.MetadataIntegration metadata_integration = 14; + * @param \Google\Cloud\Metastore\V1alpha\MetadataIntegration $var + * @return $this + */ + public function setMetadataIntegration($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Metastore\V1alpha\MetadataIntegration::class); + $this->metadata_integration = $var; + + return $this; + } + + /** + * The one hour maintenance window of the metastore service. This specifies + * when the service can be restarted for maintenance purposes in UTC time. + * Maintenance window is not needed for services with the SPANNER + * database type. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.MaintenanceWindow maintenance_window = 15; + * @return \Google\Cloud\Metastore\V1alpha\MaintenanceWindow|null + */ + public function getMaintenanceWindow() + { + return $this->maintenance_window; + } + + public function hasMaintenanceWindow() + { + return isset($this->maintenance_window); + } + + public function clearMaintenanceWindow() + { + unset($this->maintenance_window); + } + + /** + * The one hour maintenance window of the metastore service. This specifies + * when the service can be restarted for maintenance purposes in UTC time. + * Maintenance window is not needed for services with the SPANNER + * database type. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.MaintenanceWindow maintenance_window = 15; + * @param \Google\Cloud\Metastore\V1alpha\MaintenanceWindow $var + * @return $this + */ + public function setMaintenanceWindow($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Metastore\V1alpha\MaintenanceWindow::class); + $this->maintenance_window = $var; + + return $this; + } + + /** + * Output only. The globally unique resource identifier of the metastore + * service. + * + * Generated from protobuf field string uid = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getUid() + { + return $this->uid; + } + + /** + * Output only. The globally unique resource identifier of the metastore + * service. + * + * Generated from protobuf field string uid = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setUid($var) + { + GPBUtil::checkString($var, True); + $this->uid = $var; + + return $this; + } + + /** + * Output only. The metadata management activities of the metastore service. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.MetadataManagementActivity metadata_management_activity = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\Metastore\V1alpha\MetadataManagementActivity|null + */ + public function getMetadataManagementActivity() + { + return $this->metadata_management_activity; + } + + public function hasMetadataManagementActivity() + { + return isset($this->metadata_management_activity); + } + + public function clearMetadataManagementActivity() + { + unset($this->metadata_management_activity); + } + + /** + * Output only. The metadata management activities of the metastore service. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.MetadataManagementActivity metadata_management_activity = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\Metastore\V1alpha\MetadataManagementActivity $var + * @return $this + */ + public function setMetadataManagementActivity($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Metastore\V1alpha\MetadataManagementActivity::class); + $this->metadata_management_activity = $var; + + return $this; + } + + /** + * Immutable. The release channel of the service. + * If unspecified, defaults to `STABLE`. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.Service.ReleaseChannel release_channel = 19 [(.google.api.field_behavior) = IMMUTABLE]; + * @return int + */ + public function getReleaseChannel() + { + return $this->release_channel; + } + + /** + * Immutable. The release channel of the service. + * If unspecified, defaults to `STABLE`. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.Service.ReleaseChannel release_channel = 19 [(.google.api.field_behavior) = IMMUTABLE]; + * @param int $var + * @return $this + */ + public function setReleaseChannel($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Metastore\V1alpha\Service\ReleaseChannel::class); + $this->release_channel = $var; + + return $this; + } + + /** + * Immutable. Information used to configure the Dataproc Metastore service to + * encrypt customer data at rest. Cannot be updated. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.EncryptionConfig encryption_config = 20 [(.google.api.field_behavior) = IMMUTABLE]; + * @return \Google\Cloud\Metastore\V1alpha\EncryptionConfig|null + */ + public function getEncryptionConfig() + { + return $this->encryption_config; + } + + public function hasEncryptionConfig() + { + return isset($this->encryption_config); + } + + public function clearEncryptionConfig() + { + unset($this->encryption_config); + } + + /** + * Immutable. Information used to configure the Dataproc Metastore service to + * encrypt customer data at rest. Cannot be updated. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.EncryptionConfig encryption_config = 20 [(.google.api.field_behavior) = IMMUTABLE]; + * @param \Google\Cloud\Metastore\V1alpha\EncryptionConfig $var + * @return $this + */ + public function setEncryptionConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Metastore\V1alpha\EncryptionConfig::class); + $this->encryption_config = $var; + + return $this; + } + + /** + * The configuration specifying the network settings for the + * Dataproc Metastore service. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.NetworkConfig network_config = 21; + * @return \Google\Cloud\Metastore\V1alpha\NetworkConfig|null + */ + public function getNetworkConfig() + { + return $this->network_config; + } + + public function hasNetworkConfig() + { + return isset($this->network_config); + } + + public function clearNetworkConfig() + { + unset($this->network_config); + } + + /** + * The configuration specifying the network settings for the + * Dataproc Metastore service. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.NetworkConfig network_config = 21; + * @param \Google\Cloud\Metastore\V1alpha\NetworkConfig $var + * @return $this + */ + public function setNetworkConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Metastore\V1alpha\NetworkConfig::class); + $this->network_config = $var; + + return $this; + } + + /** + * Immutable. The database type that the Metastore service stores its data. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.Service.DatabaseType database_type = 22 [(.google.api.field_behavior) = IMMUTABLE]; + * @return int + */ + public function getDatabaseType() + { + return $this->database_type; + } + + /** + * Immutable. The database type that the Metastore service stores its data. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.Service.DatabaseType database_type = 22 [(.google.api.field_behavior) = IMMUTABLE]; + * @param int $var + * @return $this + */ + public function setDatabaseType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Metastore\V1alpha\Service\DatabaseType::class); + $this->database_type = $var; + + return $this; + } + + /** + * The configuration specifying telemetry settings for the Dataproc Metastore + * service. If unspecified defaults to `JSON`. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.TelemetryConfig telemetry_config = 23; + * @return \Google\Cloud\Metastore\V1alpha\TelemetryConfig|null + */ + public function getTelemetryConfig() + { + return $this->telemetry_config; + } + + public function hasTelemetryConfig() + { + return isset($this->telemetry_config); + } + + public function clearTelemetryConfig() + { + unset($this->telemetry_config); + } + + /** + * The configuration specifying telemetry settings for the Dataproc Metastore + * service. If unspecified defaults to `JSON`. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.TelemetryConfig telemetry_config = 23; + * @param \Google\Cloud\Metastore\V1alpha\TelemetryConfig $var + * @return $this + */ + public function setTelemetryConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Metastore\V1alpha\TelemetryConfig::class); + $this->telemetry_config = $var; + + return $this; + } + + /** + * Scaling configuration of the metastore service. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.ScalingConfig scaling_config = 24; + * @return \Google\Cloud\Metastore\V1alpha\ScalingConfig|null + */ + public function getScalingConfig() + { + return $this->scaling_config; + } + + public function hasScalingConfig() + { + return isset($this->scaling_config); + } + + public function clearScalingConfig() + { + unset($this->scaling_config); + } + + /** + * Scaling configuration of the metastore service. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.ScalingConfig scaling_config = 24; + * @param \Google\Cloud\Metastore\V1alpha\ScalingConfig $var + * @return $this + */ + public function setScalingConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Metastore\V1alpha\ScalingConfig::class); + $this->scaling_config = $var; + + return $this; + } + + /** + * @return string + */ + public function getMetastoreConfig() + { + return $this->whichOneof("metastore_config"); + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/Service/DatabaseType.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/Service/DatabaseType.php new file mode 100644 index 000000000000..af3d2b8bc594 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/Service/DatabaseType.php @@ -0,0 +1,64 @@ +google.cloud.metastore.v1alpha.Service.DatabaseType + */ +class DatabaseType +{ + /** + * The DATABASE_TYPE is not set. + * + * Generated from protobuf enum DATABASE_TYPE_UNSPECIFIED = 0; + */ + const DATABASE_TYPE_UNSPECIFIED = 0; + /** + * MySQL is used to persist the metastore data. + * + * Generated from protobuf enum MYSQL = 1; + */ + const MYSQL = 1; + /** + * Spanner is used to persist the metastore data. + * + * Generated from protobuf enum SPANNER = 2; + */ + const SPANNER = 2; + + private static $valueToName = [ + self::DATABASE_TYPE_UNSPECIFIED => 'DATABASE_TYPE_UNSPECIFIED', + self::MYSQL => 'MYSQL', + self::SPANNER => 'SPANNER', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(DatabaseType::class, \Google\Cloud\Metastore\V1alpha\Service_DatabaseType::class); + diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/Service/ReleaseChannel.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/Service/ReleaseChannel.php new file mode 100644 index 000000000000..5bc9f8664adb --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/Service/ReleaseChannel.php @@ -0,0 +1,69 @@ +google.cloud.metastore.v1alpha.Service.ReleaseChannel + */ +class ReleaseChannel +{ + /** + * Release channel is not specified. + * + * Generated from protobuf enum RELEASE_CHANNEL_UNSPECIFIED = 0; + */ + const RELEASE_CHANNEL_UNSPECIFIED = 0; + /** + * The `CANARY` release channel contains the newest features, which may be + * unstable and subject to unresolved issues with no known workarounds. + * Services using the `CANARY` release channel are not subject to any SLAs. + * + * Generated from protobuf enum CANARY = 1; + */ + const CANARY = 1; + /** + * The `STABLE` release channel contains features that are considered stable + * and have been validated for production use. + * + * Generated from protobuf enum STABLE = 2; + */ + const STABLE = 2; + + private static $valueToName = [ + self::RELEASE_CHANNEL_UNSPECIFIED => 'RELEASE_CHANNEL_UNSPECIFIED', + self::CANARY => 'CANARY', + self::STABLE => 'STABLE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ReleaseChannel::class, \Google\Cloud\Metastore\V1alpha\Service_ReleaseChannel::class); + diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/Service/State.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/Service/State.php new file mode 100644 index 000000000000..ccf6ccae3a0e --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/Service/State.php @@ -0,0 +1,102 @@ +google.cloud.metastore.v1alpha.Service.State + */ +class State +{ + /** + * The state of the metastore service is unknown. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The metastore service is in the process of being created. + * + * Generated from protobuf enum CREATING = 1; + */ + const CREATING = 1; + /** + * The metastore service is running and ready to serve queries. + * + * Generated from protobuf enum ACTIVE = 2; + */ + const ACTIVE = 2; + /** + * The metastore service is entering suspension. Its query-serving + * availability may cease unexpectedly. + * + * Generated from protobuf enum SUSPENDING = 3; + */ + const SUSPENDING = 3; + /** + * The metastore service is suspended and unable to serve queries. + * + * Generated from protobuf enum SUSPENDED = 4; + */ + const SUSPENDED = 4; + /** + * The metastore service is being updated. It remains usable but cannot + * accept additional update requests or be deleted at this time. + * + * Generated from protobuf enum UPDATING = 5; + */ + const UPDATING = 5; + /** + * The metastore service is undergoing deletion. It cannot be used. + * + * Generated from protobuf enum DELETING = 6; + */ + const DELETING = 6; + /** + * The metastore service has encountered an error and cannot be used. The + * metastore service should be deleted. + * + * Generated from protobuf enum ERROR = 7; + */ + const ERROR = 7; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::CREATING => 'CREATING', + self::ACTIVE => 'ACTIVE', + self::SUSPENDING => 'SUSPENDING', + self::SUSPENDED => 'SUSPENDED', + self::UPDATING => 'UPDATING', + self::DELETING => 'DELETING', + self::ERROR => 'ERROR', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\Metastore\V1alpha\Service_State::class); + diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/Service/Tier.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/Service/Tier.php new file mode 100644 index 000000000000..83e8f852b49e --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/Service/Tier.php @@ -0,0 +1,66 @@ +google.cloud.metastore.v1alpha.Service.Tier + */ +class Tier +{ + /** + * The tier is not set. + * + * Generated from protobuf enum TIER_UNSPECIFIED = 0; + */ + const TIER_UNSPECIFIED = 0; + /** + * The developer tier provides limited scalability and no fault tolerance. + * Good for low-cost proof-of-concept. + * + * Generated from protobuf enum DEVELOPER = 1; + */ + const DEVELOPER = 1; + /** + * The enterprise tier provides multi-zone high availability, and sufficient + * scalability for enterprise-level Dataproc Metastore workloads. + * + * Generated from protobuf enum ENTERPRISE = 3; + */ + const ENTERPRISE = 3; + + private static $valueToName = [ + self::TIER_UNSPECIFIED => 'TIER_UNSPECIFIED', + self::DEVELOPER => 'DEVELOPER', + self::ENTERPRISE => 'ENTERPRISE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Tier::class, \Google\Cloud\Metastore\V1alpha\Service_Tier::class); + diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/Service_DatabaseType.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/Service_DatabaseType.php new file mode 100644 index 000000000000..1bfb965957d9 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/Service_DatabaseType.php @@ -0,0 +1,16 @@ +google.cloud.metastore.v1alpha.TelemetryConfig + */ +class TelemetryConfig extends \Google\Protobuf\Internal\Message +{ + /** + * The output format of the Dataproc Metastore service's logs. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.TelemetryConfig.LogFormat log_format = 1; + */ + protected $log_format = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $log_format + * The output format of the Dataproc Metastore service's logs. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Alpha\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * The output format of the Dataproc Metastore service's logs. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.TelemetryConfig.LogFormat log_format = 1; + * @return int + */ + public function getLogFormat() + { + return $this->log_format; + } + + /** + * The output format of the Dataproc Metastore service's logs. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.TelemetryConfig.LogFormat log_format = 1; + * @param int $var + * @return $this + */ + public function setLogFormat($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Metastore\V1alpha\TelemetryConfig\LogFormat::class); + $this->log_format = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/TelemetryConfig/LogFormat.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/TelemetryConfig/LogFormat.php new file mode 100644 index 000000000000..e1ea20ce4cc9 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/TelemetryConfig/LogFormat.php @@ -0,0 +1,62 @@ +google.cloud.metastore.v1alpha.TelemetryConfig.LogFormat + */ +class LogFormat +{ + /** + * The LOG_FORMAT is not set. + * + * Generated from protobuf enum LOG_FORMAT_UNSPECIFIED = 0; + */ + const LOG_FORMAT_UNSPECIFIED = 0; + /** + * Logging output uses the legacy `textPayload` format. + * + * Generated from protobuf enum LEGACY = 1; + */ + const LEGACY = 1; + /** + * Logging output uses the `jsonPayload` format. + * + * Generated from protobuf enum JSON = 2; + */ + const JSON = 2; + + private static $valueToName = [ + self::LOG_FORMAT_UNSPECIFIED => 'LOG_FORMAT_UNSPECIFIED', + self::LEGACY => 'LEGACY', + self::JSON => 'JSON', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(LogFormat::class, \Google\Cloud\Metastore\V1alpha\TelemetryConfig_LogFormat::class); + diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/TelemetryConfig_LogFormat.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/TelemetryConfig_LogFormat.php new file mode 100644 index 000000000000..374e3961c1ea --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/TelemetryConfig_LogFormat.php @@ -0,0 +1,16 @@ +google.cloud.metastore.v1alpha.UpdateFederationRequest + */ +class UpdateFederationRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. A field mask used to specify the fields to be overwritten in the + * metastore federation resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $update_mask = null; + /** + * Required. The metastore federation to update. The server only merges fields + * in the service if they are specified in `update_mask`. + * The metastore federation's `name` field is used to identify the + * metastore service to be updated. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.Federation federation = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $federation = null; + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\FieldMask $update_mask + * Required. A field mask used to specify the fields to be overwritten in the + * metastore federation resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + * @type \Google\Cloud\Metastore\V1alpha\Federation $federation + * Required. The metastore federation to update. The server only merges fields + * in the service if they are specified in `update_mask`. + * The metastore federation's `name` field is used to identify the + * metastore service to be updated. + * @type string $request_id + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Alpha\MetastoreFederation::initOnce(); + parent::__construct($data); + } + + /** + * Required. A field mask used to specify the fields to be overwritten in the + * metastore federation resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Required. A field mask used to specify the fields to be overwritten in the + * metastore federation resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + + /** + * Required. The metastore federation to update. The server only merges fields + * in the service if they are specified in `update_mask`. + * The metastore federation's `name` field is used to identify the + * metastore service to be updated. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.Federation federation = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Metastore\V1alpha\Federation|null + */ + public function getFederation() + { + return $this->federation; + } + + public function hasFederation() + { + return isset($this->federation); + } + + public function clearFederation() + { + unset($this->federation); + } + + /** + * Required. The metastore federation to update. The server only merges fields + * in the service if they are specified in `update_mask`. + * The metastore federation's `name` field is used to identify the + * metastore service to be updated. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.Federation federation = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Metastore\V1alpha\Federation $var + * @return $this + */ + public function setFederation($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Metastore\V1alpha\Federation::class); + $this->federation = $var; + + return $this; + } + + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @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/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/UpdateMetadataImportRequest.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/UpdateMetadataImportRequest.php new file mode 100644 index 000000000000..a61c5e3fb348 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/UpdateMetadataImportRequest.php @@ -0,0 +1,216 @@ +google.cloud.metastore.v1alpha.UpdateMetadataImportRequest + */ +class UpdateMetadataImportRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. A field mask used to specify the fields to be overwritten in the + * metadata import resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $update_mask = null; + /** + * Required. The metadata import to update. The server only merges fields + * in the import if they are specified in `update_mask`. + * The metadata import's `name` field is used to identify the metastore + * import to be updated. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.MetadataImport metadata_import = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $metadata_import = null; + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\FieldMask $update_mask + * Required. A field mask used to specify the fields to be overwritten in the + * metadata import resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + * @type \Google\Cloud\Metastore\V1alpha\MetadataImport $metadata_import + * Required. The metadata import to update. The server only merges fields + * in the import if they are specified in `update_mask`. + * The metadata import's `name` field is used to identify the metastore + * import to be updated. + * @type string $request_id + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Alpha\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Required. A field mask used to specify the fields to be overwritten in the + * metadata import resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Required. A field mask used to specify the fields to be overwritten in the + * metadata import resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + + /** + * Required. The metadata import to update. The server only merges fields + * in the import if they are specified in `update_mask`. + * The metadata import's `name` field is used to identify the metastore + * import to be updated. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.MetadataImport metadata_import = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Metastore\V1alpha\MetadataImport|null + */ + public function getMetadataImport() + { + return $this->metadata_import; + } + + public function hasMetadataImport() + { + return isset($this->metadata_import); + } + + public function clearMetadataImport() + { + unset($this->metadata_import); + } + + /** + * Required. The metadata import to update. The server only merges fields + * in the import if they are specified in `update_mask`. + * The metadata import's `name` field is used to identify the metastore + * import to be updated. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.MetadataImport metadata_import = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Metastore\V1alpha\MetadataImport $var + * @return $this + */ + public function setMetadataImport($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Metastore\V1alpha\MetadataImport::class); + $this->metadata_import = $var; + + return $this; + } + + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @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/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/UpdateServiceRequest.php b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/UpdateServiceRequest.php new file mode 100644 index 000000000000..28939877147e --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/proto/src/Google/Cloud/Metastore/V1alpha/UpdateServiceRequest.php @@ -0,0 +1,216 @@ +google.cloud.metastore.v1alpha.UpdateServiceRequest + */ +class UpdateServiceRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. A field mask used to specify the fields to be overwritten in the + * metastore service resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $update_mask = null; + /** + * Required. The metastore service to update. The server only merges fields + * in the service if they are specified in `update_mask`. + * The metastore service's `name` field is used to identify the metastore + * service to be updated. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.Service service = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $service = null; + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\FieldMask $update_mask + * Required. A field mask used to specify the fields to be overwritten in the + * metastore service resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + * @type \Google\Cloud\Metastore\V1alpha\Service $service + * Required. The metastore service to update. The server only merges fields + * in the service if they are specified in `update_mask`. + * The metastore service's `name` field is used to identify the metastore + * service to be updated. + * @type string $request_id + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Alpha\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Required. A field mask used to specify the fields to be overwritten in the + * metastore service resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Required. A field mask used to specify the fields to be overwritten in the + * metastore service resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + + /** + * Required. The metastore service to update. The server only merges fields + * in the service if they are specified in `update_mask`. + * The metastore service's `name` field is used to identify the metastore + * service to be updated. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.Service service = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Metastore\V1alpha\Service|null + */ + public function getService() + { + return $this->service; + } + + public function hasService() + { + return isset($this->service); + } + + public function clearService() + { + unset($this->service); + } + + /** + * Required. The metastore service to update. The server only merges fields + * in the service if they are specified in `update_mask`. + * The metastore service's `name` field is used to identify the metastore + * service to be updated. + * + * Generated from protobuf field .google.cloud.metastore.v1alpha.Service service = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Metastore\V1alpha\Service $var + * @return $this + */ + public function setService($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Metastore\V1alpha\Service::class); + $this->service = $var; + + return $this; + } + + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @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/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreClient/alter_metadata_resource_location.php b/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreClient/alter_metadata_resource_location.php new file mode 100644 index 000000000000..6482f4c513e8 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreClient/alter_metadata_resource_location.php @@ -0,0 +1,101 @@ +alterMetadataResourceLocation( + $formattedService, + $resourceName, + $locationUri + ); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var AlterMetadataResourceLocationResponse $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 +{ + $formattedService = DataprocMetastoreClient::serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $resourceName = '[RESOURCE_NAME]'; + $locationUri = '[LOCATION_URI]'; + + alter_metadata_resource_location_sample($formattedService, $resourceName, $locationUri); +} +// [END metastore_v1alpha_generated_DataprocMetastore_AlterMetadataResourceLocation_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreClient/create_backup.php b/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreClient/create_backup.php new file mode 100644 index 000000000000..ff3dfcf7af1c --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreClient/create_backup.php @@ -0,0 +1,91 @@ +createBackup($formattedParent, $backupId, $backup); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Backup $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 +{ + $formattedParent = DataprocMetastoreClient::serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $backupId = '[BACKUP_ID]'; + + create_backup_sample($formattedParent, $backupId); +} +// [END metastore_v1alpha_generated_DataprocMetastore_CreateBackup_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreClient/create_metadata_import.php b/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreClient/create_metadata_import.php new file mode 100644 index 000000000000..f0bea08b4c22 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreClient/create_metadata_import.php @@ -0,0 +1,95 @@ +createMetadataImport( + $formattedParent, + $metadataImportId, + $metadataImport + ); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var MetadataImport $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 +{ + $formattedParent = DataprocMetastoreClient::serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $metadataImportId = '[METADATA_IMPORT_ID]'; + + create_metadata_import_sample($formattedParent, $metadataImportId); +} +// [END metastore_v1alpha_generated_DataprocMetastore_CreateMetadataImport_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreClient/create_service.php b/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreClient/create_service.php new file mode 100644 index 000000000000..4d71d85dd4b9 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreClient/create_service.php @@ -0,0 +1,91 @@ +createService($formattedParent, $serviceId, $service); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Service $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 +{ + $formattedParent = DataprocMetastoreClient::locationName('[PROJECT]', '[LOCATION]'); + $serviceId = '[SERVICE_ID]'; + + create_service_sample($formattedParent, $serviceId); +} +// [END metastore_v1alpha_generated_DataprocMetastore_CreateService_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreClient/delete_backup.php b/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreClient/delete_backup.php new file mode 100644 index 000000000000..75a46a3f89c6 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreClient/delete_backup.php @@ -0,0 +1,83 @@ +deleteBackup($formattedName); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + printf('Operation completed successfully.' . PHP_EOL); + } 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 = DataprocMetastoreClient::backupName( + '[PROJECT]', + '[LOCATION]', + '[SERVICE]', + '[BACKUP]' + ); + + delete_backup_sample($formattedName); +} +// [END metastore_v1alpha_generated_DataprocMetastore_DeleteBackup_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreClient/delete_service.php b/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreClient/delete_service.php new file mode 100644 index 000000000000..b012821c0046 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreClient/delete_service.php @@ -0,0 +1,78 @@ +deleteService($formattedName); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + printf('Operation completed successfully.' . PHP_EOL); + } 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 = DataprocMetastoreClient::serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + + delete_service_sample($formattedName); +} +// [END metastore_v1alpha_generated_DataprocMetastore_DeleteService_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreClient/export_metadata.php b/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreClient/export_metadata.php new file mode 100644 index 000000000000..757b1d9cbe04 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreClient/export_metadata.php @@ -0,0 +1,81 @@ +exportMetadata($formattedService); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var MetadataExport $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 +{ + $formattedService = DataprocMetastoreClient::serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + + export_metadata_sample($formattedService); +} +// [END metastore_v1alpha_generated_DataprocMetastore_ExportMetadata_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreClient/get_backup.php b/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreClient/get_backup.php new file mode 100644 index 000000000000..f8d684d63425 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreClient/get_backup.php @@ -0,0 +1,74 @@ +getBackup($formattedName); + 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 = DataprocMetastoreClient::backupName( + '[PROJECT]', + '[LOCATION]', + '[SERVICE]', + '[BACKUP]' + ); + + get_backup_sample($formattedName); +} +// [END metastore_v1alpha_generated_DataprocMetastore_GetBackup_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreClient/get_iam_policy.php b/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreClient/get_iam_policy.php new file mode 100644 index 000000000000..2c15b687582f --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreClient/get_iam_policy.php @@ -0,0 +1,67 @@ +getIamPolicy($resource); + 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 +{ + $resource = '[RESOURCE]'; + + get_iam_policy_sample($resource); +} +// [END metastore_v1alpha_generated_DataprocMetastore_GetIamPolicy_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreClient/get_location.php b/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreClient/get_location.php new file mode 100644 index 000000000000..128815a834e6 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreClient/get_location.php @@ -0,0 +1,53 @@ +getLocation(); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END metastore_v1alpha_generated_DataprocMetastore_GetLocation_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreClient/get_metadata_import.php b/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreClient/get_metadata_import.php new file mode 100644 index 000000000000..f489bb0cf022 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreClient/get_metadata_import.php @@ -0,0 +1,74 @@ +getMetadataImport($formattedName); + 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 = DataprocMetastoreClient::metadataImportName( + '[PROJECT]', + '[LOCATION]', + '[SERVICE]', + '[METADATA_IMPORT]' + ); + + get_metadata_import_sample($formattedName); +} +// [END metastore_v1alpha_generated_DataprocMetastore_GetMetadataImport_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreClient/get_service.php b/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreClient/get_service.php new file mode 100644 index 000000000000..16c8885857dd --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreClient/get_service.php @@ -0,0 +1,69 @@ +getService($formattedName); + 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 = DataprocMetastoreClient::serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + + get_service_sample($formattedName); +} +// [END metastore_v1alpha_generated_DataprocMetastore_GetService_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreClient/list_backups.php b/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreClient/list_backups.php new file mode 100644 index 000000000000..44ab79b85591 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreClient/list_backups.php @@ -0,0 +1,74 @@ +listBackups($formattedParent); + + /** @var Backup $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 = DataprocMetastoreClient::serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + + list_backups_sample($formattedParent); +} +// [END metastore_v1alpha_generated_DataprocMetastore_ListBackups_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreClient/list_locations.php b/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreClient/list_locations.php new file mode 100644 index 000000000000..b3bb4abb59d0 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreClient/list_locations.php @@ -0,0 +1,58 @@ +listLocations(); + + /** @var Location $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()); + } +} +// [END metastore_v1alpha_generated_DataprocMetastore_ListLocations_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreClient/list_metadata_imports.php b/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreClient/list_metadata_imports.php new file mode 100644 index 000000000000..ac01e4cd0964 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreClient/list_metadata_imports.php @@ -0,0 +1,74 @@ +listMetadataImports($formattedParent); + + /** @var MetadataImport $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 = DataprocMetastoreClient::serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + + list_metadata_imports_sample($formattedParent); +} +// [END metastore_v1alpha_generated_DataprocMetastore_ListMetadataImports_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreClient/list_services.php b/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreClient/list_services.php new file mode 100644 index 000000000000..014470d7a8fa --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreClient/list_services.php @@ -0,0 +1,74 @@ +listServices($formattedParent); + + /** @var Service $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 = DataprocMetastoreClient::locationName('[PROJECT]', '[LOCATION]'); + + list_services_sample($formattedParent); +} +// [END metastore_v1alpha_generated_DataprocMetastore_ListServices_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreClient/move_table_to_database.php b/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreClient/move_table_to_database.php new file mode 100644 index 000000000000..6c2d78ff5a59 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreClient/move_table_to_database.php @@ -0,0 +1,96 @@ +moveTableToDatabase( + $formattedService, + $tableName, + $dbName, + $destinationDbName + ); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var MoveTableToDatabaseResponse $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 +{ + $formattedService = DataprocMetastoreClient::serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $tableName = '[TABLE_NAME]'; + $dbName = '[DB_NAME]'; + $destinationDbName = '[DESTINATION_DB_NAME]'; + + move_table_to_database_sample($formattedService, $tableName, $dbName, $destinationDbName); +} +// [END metastore_v1alpha_generated_DataprocMetastore_MoveTableToDatabase_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreClient/query_metadata.php b/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreClient/query_metadata.php new file mode 100644 index 000000000000..f55f466aad75 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreClient/query_metadata.php @@ -0,0 +1,84 @@ +queryMetadata($formattedService, $query); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var QueryMetadataResponse $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 +{ + $formattedService = DataprocMetastoreClient::serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $query = '[QUERY]'; + + query_metadata_sample($formattedService, $query); +} +// [END metastore_v1alpha_generated_DataprocMetastore_QueryMetadata_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreClient/remove_iam_policy.php b/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreClient/remove_iam_policy.php new file mode 100644 index 000000000000..329fc9524059 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreClient/remove_iam_policy.php @@ -0,0 +1,70 @@ +removeIamPolicy($resource); + 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 +{ + $resource = '[RESOURCE]'; + + remove_iam_policy_sample($resource); +} +// [END metastore_v1alpha_generated_DataprocMetastore_RemoveIamPolicy_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreClient/restore_service.php b/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreClient/restore_service.php new file mode 100644 index 000000000000..54c95a2295b8 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreClient/restore_service.php @@ -0,0 +1,92 @@ +restoreService($formattedService, $formattedBackup); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Restore $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 +{ + $formattedService = DataprocMetastoreClient::serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $formattedBackup = DataprocMetastoreClient::backupName( + '[PROJECT]', + '[LOCATION]', + '[SERVICE]', + '[BACKUP]' + ); + + restore_service_sample($formattedService, $formattedBackup); +} +// [END metastore_v1alpha_generated_DataprocMetastore_RestoreService_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreClient/set_iam_policy.php b/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreClient/set_iam_policy.php new file mode 100644 index 000000000000..cde1c74042ee --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreClient/set_iam_policy.php @@ -0,0 +1,73 @@ +setIamPolicy($resource, $policy); + 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 +{ + $resource = '[RESOURCE]'; + + set_iam_policy_sample($resource); +} +// [END metastore_v1alpha_generated_DataprocMetastore_SetIamPolicy_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreClient/test_iam_permissions.php b/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreClient/test_iam_permissions.php new file mode 100644 index 000000000000..678f26c8efd2 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreClient/test_iam_permissions.php @@ -0,0 +1,80 @@ +testIamPermissions($resource, $permissions); + 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 +{ + $resource = '[RESOURCE]'; + $permissionsElement = '[PERMISSIONS]'; + + test_iam_permissions_sample($resource, $permissionsElement); +} +// [END metastore_v1alpha_generated_DataprocMetastore_TestIamPermissions_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreClient/update_metadata_import.php b/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreClient/update_metadata_import.php new file mode 100644 index 000000000000..e22a09546077 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreClient/update_metadata_import.php @@ -0,0 +1,71 @@ +updateMetadataImport($updateMask, $metadataImport); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var MetadataImport $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()); + } +} +// [END metastore_v1alpha_generated_DataprocMetastore_UpdateMetadataImport_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreClient/update_service.php b/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreClient/update_service.php new file mode 100644 index 000000000000..6ce02a71b7c9 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreClient/update_service.php @@ -0,0 +1,70 @@ +updateService($updateMask, $service); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Service $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()); + } +} +// [END metastore_v1alpha_generated_DataprocMetastore_UpdateService_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreFederationClient/create_federation.php b/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreFederationClient/create_federation.php new file mode 100644 index 000000000000..20bbcf00ef96 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreFederationClient/create_federation.php @@ -0,0 +1,95 @@ +createFederation( + $formattedParent, + $federationId, + $federation + ); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Federation $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 +{ + $formattedParent = DataprocMetastoreFederationClient::locationName('[PROJECT]', '[LOCATION]'); + $federationId = '[FEDERATION_ID]'; + + create_federation_sample($formattedParent, $federationId); +} +// [END metastore_v1alpha_generated_DataprocMetastoreFederation_CreateFederation_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreFederationClient/delete_federation.php b/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreFederationClient/delete_federation.php new file mode 100644 index 000000000000..94b03316cead --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreFederationClient/delete_federation.php @@ -0,0 +1,82 @@ +deleteFederation($formattedName); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + printf('Operation completed successfully.' . PHP_EOL); + } 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 = DataprocMetastoreFederationClient::federationName( + '[PROJECT]', + '[LOCATION]', + '[FEDERATION]' + ); + + delete_federation_sample($formattedName); +} +// [END metastore_v1alpha_generated_DataprocMetastoreFederation_DeleteFederation_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreFederationClient/get_federation.php b/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreFederationClient/get_federation.php new file mode 100644 index 000000000000..7cc504a9134f --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreFederationClient/get_federation.php @@ -0,0 +1,73 @@ +getFederation($formattedName); + 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 = DataprocMetastoreFederationClient::federationName( + '[PROJECT]', + '[LOCATION]', + '[FEDERATION]' + ); + + get_federation_sample($formattedName); +} +// [END metastore_v1alpha_generated_DataprocMetastoreFederation_GetFederation_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreFederationClient/get_iam_policy.php b/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreFederationClient/get_iam_policy.php new file mode 100644 index 000000000000..59ab8b2073e2 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreFederationClient/get_iam_policy.php @@ -0,0 +1,67 @@ +getIamPolicy($resource); + 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 +{ + $resource = '[RESOURCE]'; + + get_iam_policy_sample($resource); +} +// [END metastore_v1alpha_generated_DataprocMetastoreFederation_GetIamPolicy_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreFederationClient/get_location.php b/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreFederationClient/get_location.php new file mode 100644 index 000000000000..c7d5c2f16f17 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreFederationClient/get_location.php @@ -0,0 +1,53 @@ +getLocation(); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END metastore_v1alpha_generated_DataprocMetastoreFederation_GetLocation_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreFederationClient/list_federations.php b/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreFederationClient/list_federations.php new file mode 100644 index 000000000000..446e925c33e5 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreFederationClient/list_federations.php @@ -0,0 +1,73 @@ +listFederations($formattedParent); + + /** @var Federation $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 = DataprocMetastoreFederationClient::locationName('[PROJECT]', '[LOCATION]'); + + list_federations_sample($formattedParent); +} +// [END metastore_v1alpha_generated_DataprocMetastoreFederation_ListFederations_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreFederationClient/list_locations.php b/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreFederationClient/list_locations.php new file mode 100644 index 000000000000..0186c9067e10 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreFederationClient/list_locations.php @@ -0,0 +1,58 @@ +listLocations(); + + /** @var Location $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()); + } +} +// [END metastore_v1alpha_generated_DataprocMetastoreFederation_ListLocations_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreFederationClient/set_iam_policy.php b/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreFederationClient/set_iam_policy.php new file mode 100644 index 000000000000..72821d97ce3d --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreFederationClient/set_iam_policy.php @@ -0,0 +1,73 @@ +setIamPolicy($resource, $policy); + 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 +{ + $resource = '[RESOURCE]'; + + set_iam_policy_sample($resource); +} +// [END metastore_v1alpha_generated_DataprocMetastoreFederation_SetIamPolicy_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreFederationClient/test_iam_permissions.php b/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreFederationClient/test_iam_permissions.php new file mode 100644 index 000000000000..a2bcc0e03d4a --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreFederationClient/test_iam_permissions.php @@ -0,0 +1,80 @@ +testIamPermissions($resource, $permissions); + 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 +{ + $resource = '[RESOURCE]'; + $permissionsElement = '[PERMISSIONS]'; + + test_iam_permissions_sample($resource, $permissionsElement); +} +// [END metastore_v1alpha_generated_DataprocMetastoreFederation_TestIamPermissions_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreFederationClient/update_federation.php b/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreFederationClient/update_federation.php new file mode 100644 index 000000000000..96726a7e7ba9 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/samples/V1alpha/DataprocMetastoreFederationClient/update_federation.php @@ -0,0 +1,70 @@ +updateFederation($updateMask, $federation); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Federation $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()); + } +} +// [END metastore_v1alpha_generated_DataprocMetastoreFederation_UpdateFederation_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/src/V1alpha/DataprocMetastoreClient.php b/owl-bot-staging/DataprocMetastore/v1alpha/src/V1alpha/DataprocMetastoreClient.php new file mode 100644 index 000000000000..e668f4ecf4e4 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/src/V1alpha/DataprocMetastoreClient.php @@ -0,0 +1,36 @@ +locationName('[PROJECT]', '[LOCATION]'); + * $federationId = 'federation_id'; + * $federation = new Federation(); + * $operationResponse = $dataprocMetastoreFederationClient->createFederation($formattedParent, $federationId, $federation); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $dataprocMetastoreFederationClient->createFederation($formattedParent, $federationId, $federation); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $dataprocMetastoreFederationClient->resumeOperation($operationName, 'createFederation'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $dataprocMetastoreFederationClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + * + * @experimental + */ +class DataprocMetastoreFederationGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.metastore.v1alpha.DataprocMetastoreFederation'; + + /** The default address of the service. */ + const SERVICE_ADDRESS = 'metastore.googleapis.com'; + + /** The default port of the service. */ + const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + ]; + + private static $federationNameTemplate; + + private static $locationNameTemplate; + + private static $pathTemplateMap; + + private $operationsClient; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/dataproc_metastore_federation_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/dataproc_metastore_federation_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/dataproc_metastore_federation_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/dataproc_metastore_federation_rest_client_config.php', + ], + ], + ]; + } + + private static function getFederationNameTemplate() + { + if (self::$federationNameTemplate == null) { + self::$federationNameTemplate = new PathTemplate('projects/{project}/locations/{location}/federations/{federation}'); + } + + return self::$federationNameTemplate; + } + + private static function getLocationNameTemplate() + { + if (self::$locationNameTemplate == null) { + self::$locationNameTemplate = new PathTemplate('projects/{project}/locations/{location}'); + } + + return self::$locationNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'federation' => self::getFederationNameTemplate(), + 'location' => self::getLocationNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a federation + * resource. + * + * @param string $project + * @param string $location + * @param string $federation + * + * @return string The formatted federation resource. + * + * @experimental + */ + public static function federationName($project, $location, $federation) + { + return self::getFederationNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'federation' => $federation, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a location + * resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted location resource. + * + * @experimental + */ + public static function locationName($project, $location) + { + return self::getLocationNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - federation: projects/{project}/locations/{location}/federations/{federation} + * - location: projects/{project}/locations/{location} + * + * 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. + * + * @experimental + */ + public static function parseName($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * Return an OperationsClient object with the same endpoint as $this. + * + * @return OperationsClient + * + * @experimental + */ + 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 + * + * @experimental + */ + 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; + } + + /** + * 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 'metastore.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. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *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' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods 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 + * + * @experimental + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + $this->operationsClient = $this->createOperationsClient($clientOptions); + } + + /** + * Creates a metastore federation in a project and location. + * + * Sample code: + * ``` + * $dataprocMetastoreFederationClient = new DataprocMetastoreFederationClient(); + * try { + * $formattedParent = $dataprocMetastoreFederationClient->locationName('[PROJECT]', '[LOCATION]'); + * $federationId = 'federation_id'; + * $federation = new Federation(); + * $operationResponse = $dataprocMetastoreFederationClient->createFederation($formattedParent, $federationId, $federation); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $dataprocMetastoreFederationClient->createFederation($formattedParent, $federationId, $federation); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $dataprocMetastoreFederationClient->resumeOperation($operationName, 'createFederation'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $dataprocMetastoreFederationClient->close(); + * } + * ``` + * + * @param string $parent Required. The relative resource name of the location in which to create a + * federation service, in the following form: + * + * `projects/{project_number}/locations/{location_id}`. + * @param string $federationId Required. The ID of the metastore federation, which is used as the final + * component of the metastore federation's name. + * + * This value must be between 2 and 63 characters long inclusive, begin with a + * letter, end with a letter or number, and consist of alpha-numeric + * ASCII characters or hyphens. + * @param Federation $federation Required. The Metastore Federation to create. The `name` field is + * ignored. The ID of the created metastore federation must be + * provided in the request's `federation_id` field. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function createFederation($parent, $federationId, $federation, array $optionalArgs = []) + { + $request = new CreateFederationRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setFederationId($federationId); + $request->setFederation($federation); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateFederation', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Deletes a single federation. + * + * Sample code: + * ``` + * $dataprocMetastoreFederationClient = new DataprocMetastoreFederationClient(); + * try { + * $formattedName = $dataprocMetastoreFederationClient->federationName('[PROJECT]', '[LOCATION]', '[FEDERATION]'); + * $operationResponse = $dataprocMetastoreFederationClient->deleteFederation($formattedName); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $dataprocMetastoreFederationClient->deleteFederation($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $dataprocMetastoreFederationClient->resumeOperation($operationName, 'deleteFederation'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $dataprocMetastoreFederationClient->close(); + * } + * ``` + * + * @param string $name Required. The relative resource name of the metastore federation to delete, + * in the following form: + * + * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function deleteFederation($name, array $optionalArgs = []) + { + $request = new DeleteFederationRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('DeleteFederation', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Gets the details of a single federation. + * + * Sample code: + * ``` + * $dataprocMetastoreFederationClient = new DataprocMetastoreFederationClient(); + * try { + * $formattedName = $dataprocMetastoreFederationClient->federationName('[PROJECT]', '[LOCATION]', '[FEDERATION]'); + * $response = $dataprocMetastoreFederationClient->getFederation($formattedName); + * } finally { + * $dataprocMetastoreFederationClient->close(); + * } + * ``` + * + * @param string $name Required. The relative resource name of the metastore federation to + * retrieve, in the following form: + * + * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + * @param array $optionalArgs { + * 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 \Google\Cloud\Metastore\V1alpha\Federation + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function getFederation($name, array $optionalArgs = []) + { + $request = new GetFederationRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetFederation', Federation::class, $optionalArgs, $request)->wait(); + } + + /** + * Lists federations in a project and location. + * + * Sample code: + * ``` + * $dataprocMetastoreFederationClient = new DataprocMetastoreFederationClient(); + * try { + * $formattedParent = $dataprocMetastoreFederationClient->locationName('[PROJECT]', '[LOCATION]'); + * // Iterate over pages of elements + * $pagedResponse = $dataprocMetastoreFederationClient->listFederations($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $dataprocMetastoreFederationClient->listFederations($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $dataprocMetastoreFederationClient->close(); + * } + * ``` + * + * @param string $parent Required. The relative resource name of the location of metastore + * federations to list, in the following form: + * `projects/{project_number}/locations/{location_id}`. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type string $filter + * Optional. The filter to apply to list results. + * @type string $orderBy + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @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 \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function listFederations($parent, array $optionalArgs = []) + { + $request = new ListFederationsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListFederations', $optionalArgs, ListFederationsResponse::class, $request); + } + + /** + * Updates the fields of a federation. + * + * Sample code: + * ``` + * $dataprocMetastoreFederationClient = new DataprocMetastoreFederationClient(); + * try { + * $updateMask = new FieldMask(); + * $federation = new Federation(); + * $operationResponse = $dataprocMetastoreFederationClient->updateFederation($updateMask, $federation); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $dataprocMetastoreFederationClient->updateFederation($updateMask, $federation); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $dataprocMetastoreFederationClient->resumeOperation($operationName, 'updateFederation'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $dataprocMetastoreFederationClient->close(); + * } + * ``` + * + * @param FieldMask $updateMask Required. A field mask used to specify the fields to be overwritten in the + * metastore federation resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + * @param Federation $federation Required. The metastore federation to update. The server only merges fields + * in the service if they are specified in `update_mask`. + * + * The metastore federation's `name` field is used to identify the + * metastore service to be updated. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function updateFederation($updateMask, $federation, array $optionalArgs = []) + { + $request = new UpdateFederationRequest(); + $requestParamHeaders = []; + $request->setUpdateMask($updateMask); + $request->setFederation($federation); + $requestParamHeaders['federation.name'] = $federation->getName(); + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('UpdateFederation', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Gets information about a location. + * + * Sample code: + * ``` + * $dataprocMetastoreFederationClient = new DataprocMetastoreFederationClient(); + * try { + * $response = $dataprocMetastoreFederationClient->getLocation(); + * } finally { + * $dataprocMetastoreFederationClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * Resource name for the location. + * @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 \Google\Cloud\Location\Location + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function getLocation(array $optionalArgs = []) + { + $request = new GetLocationRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetLocation', Location::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.cloud.location.Locations')->wait(); + } + + /** + * Lists information about the supported locations for this service. + * + * Sample code: + * ``` + * $dataprocMetastoreFederationClient = new DataprocMetastoreFederationClient(); + * try { + * // Iterate over pages of elements + * $pagedResponse = $dataprocMetastoreFederationClient->listLocations(); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $dataprocMetastoreFederationClient->listLocations(); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $dataprocMetastoreFederationClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * The resource that owns the locations collection, if applicable. + * @type string $filter + * The standard list filter. + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @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 \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function listLocations(array $optionalArgs = []) + { + $request = new ListLocationsRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListLocations', $optionalArgs, ListLocationsResponse::class, $request, 'google.cloud.location.Locations'); + } + + /** + * Gets the access control policy for a resource. Returns an empty policy + if the resource exists and does not have a policy set. + * + * Sample code: + * ``` + * $dataprocMetastoreFederationClient = new DataprocMetastoreFederationClient(); + * try { + * $resource = 'resource'; + * $response = $dataprocMetastoreFederationClient->getIamPolicy($resource); + * } finally { + * $dataprocMetastoreFederationClient->close(); + * } + * ``` + * + * @param string $resource REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param array $optionalArgs { + * Optional. + * + * @type GetPolicyOptions $options + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. + * @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 \Google\Cloud\Iam\V1\Policy + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function getIamPolicy($resource, array $optionalArgs = []) + { + $request = new GetIamPolicyRequest(); + $requestParamHeaders = []; + $request->setResource($resource); + $requestParamHeaders['resource'] = $resource; + if (isset($optionalArgs['options'])) { + $request->setOptions($optionalArgs['options']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetIamPolicy', Policy::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.iam.v1.IAMPolicy')->wait(); + } + + /** + * Sets the access control policy on the specified resource. Replaces + any existing policy. + + Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` + errors. + * + * Sample code: + * ``` + * $dataprocMetastoreFederationClient = new DataprocMetastoreFederationClient(); + * try { + * $resource = 'resource'; + * $policy = new Policy(); + * $response = $dataprocMetastoreFederationClient->setIamPolicy($resource, $policy); + * } finally { + * $dataprocMetastoreFederationClient->close(); + * } + * ``` + * + * @param string $resource REQUIRED: The resource for which the policy is being specified. + * See the operation documentation for the appropriate value for this field. + * @param Policy $policy REQUIRED: The complete policy to be applied to the `resource`. The size of + * the policy is limited to a few 10s of KB. An empty policy is a + * valid policy but certain Cloud Platform services (such as Projects) + * might reject them. + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only + * the fields in the mask will be modified. If no mask is provided, the + * following default mask is used: + * + * `paths: "bindings, etag"` + * @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 \Google\Cloud\Iam\V1\Policy + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function setIamPolicy($resource, $policy, array $optionalArgs = []) + { + $request = new SetIamPolicyRequest(); + $requestParamHeaders = []; + $request->setResource($resource); + $request->setPolicy($policy); + $requestParamHeaders['resource'] = $resource; + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('SetIamPolicy', Policy::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.iam.v1.IAMPolicy')->wait(); + } + + /** + * Returns permissions that a caller has on the specified resource. If the + resource does not exist, this will return an empty set of + permissions, not a `NOT_FOUND` error. + + Note: This operation is designed to be used for building + permission-aware UIs and command-line tools, not for authorization + checking. This operation may "fail open" without warning. + * + * Sample code: + * ``` + * $dataprocMetastoreFederationClient = new DataprocMetastoreFederationClient(); + * try { + * $resource = 'resource'; + * $permissions = []; + * $response = $dataprocMetastoreFederationClient->testIamPermissions($resource, $permissions); + * } finally { + * $dataprocMetastoreFederationClient->close(); + * } + * ``` + * + * @param string $resource REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param string[] $permissions The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @param array $optionalArgs { + * 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 \Google\Cloud\Iam\V1\TestIamPermissionsResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function testIamPermissions($resource, $permissions, array $optionalArgs = []) + { + $request = new TestIamPermissionsRequest(); + $requestParamHeaders = []; + $request->setResource($resource); + $request->setPermissions($permissions); + $requestParamHeaders['resource'] = $resource; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('TestIamPermissions', TestIamPermissionsResponse::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.iam.v1.IAMPolicy')->wait(); + } +} diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/src/V1alpha/Gapic/DataprocMetastoreGapicClient.php b/owl-bot-staging/DataprocMetastore/v1alpha/src/V1alpha/Gapic/DataprocMetastoreGapicClient.php new file mode 100644 index 000000000000..fcf73fb8357a --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/src/V1alpha/Gapic/DataprocMetastoreGapicClient.php @@ -0,0 +1,2399 @@ +serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + * $resourceName = 'resource_name'; + * $locationUri = 'location_uri'; + * $operationResponse = $dataprocMetastoreClient->alterMetadataResourceLocation($formattedService, $resourceName, $locationUri); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $dataprocMetastoreClient->alterMetadataResourceLocation($formattedService, $resourceName, $locationUri); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $dataprocMetastoreClient->resumeOperation($operationName, 'alterMetadataResourceLocation'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $dataprocMetastoreClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + * + * @experimental + */ +class DataprocMetastoreGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.metastore.v1alpha.DataprocMetastore'; + + /** The default address of the service. */ + const SERVICE_ADDRESS = 'metastore.googleapis.com'; + + /** The default port of the service. */ + const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + ]; + + private static $backupNameTemplate; + + private static $lakeNameTemplate; + + private static $locationNameTemplate; + + private static $metadataImportNameTemplate; + + private static $networkNameTemplate; + + private static $serviceNameTemplate; + + private static $subnetworkNameTemplate; + + private static $pathTemplateMap; + + private $operationsClient; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/dataproc_metastore_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/dataproc_metastore_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/dataproc_metastore_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/dataproc_metastore_rest_client_config.php', + ], + ], + ]; + } + + private static function getBackupNameTemplate() + { + if (self::$backupNameTemplate == null) { + self::$backupNameTemplate = new PathTemplate('projects/{project}/locations/{location}/services/{service}/backups/{backup}'); + } + + return self::$backupNameTemplate; + } + + private static function getLakeNameTemplate() + { + if (self::$lakeNameTemplate == null) { + self::$lakeNameTemplate = new PathTemplate('projects/{project}/locations/{location}/lakes/{lake}'); + } + + return self::$lakeNameTemplate; + } + + private static function getLocationNameTemplate() + { + if (self::$locationNameTemplate == null) { + self::$locationNameTemplate = new PathTemplate('projects/{project}/locations/{location}'); + } + + return self::$locationNameTemplate; + } + + private static function getMetadataImportNameTemplate() + { + if (self::$metadataImportNameTemplate == null) { + self::$metadataImportNameTemplate = new PathTemplate('projects/{project}/locations/{location}/services/{service}/metadataImports/{metadata_import}'); + } + + return self::$metadataImportNameTemplate; + } + + private static function getNetworkNameTemplate() + { + if (self::$networkNameTemplate == null) { + self::$networkNameTemplate = new PathTemplate('projects/{project}/global/networks/{network}'); + } + + return self::$networkNameTemplate; + } + + private static function getServiceNameTemplate() + { + if (self::$serviceNameTemplate == null) { + self::$serviceNameTemplate = new PathTemplate('projects/{project}/locations/{location}/services/{service}'); + } + + return self::$serviceNameTemplate; + } + + private static function getSubnetworkNameTemplate() + { + if (self::$subnetworkNameTemplate == null) { + self::$subnetworkNameTemplate = new PathTemplate('projects/{project}/regions/{region}/subnetworks/{subnetwork}'); + } + + return self::$subnetworkNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'backup' => self::getBackupNameTemplate(), + 'lake' => self::getLakeNameTemplate(), + 'location' => self::getLocationNameTemplate(), + 'metadataImport' => self::getMetadataImportNameTemplate(), + 'network' => self::getNetworkNameTemplate(), + 'service' => self::getServiceNameTemplate(), + 'subnetwork' => self::getSubnetworkNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a backup + * resource. + * + * @param string $project + * @param string $location + * @param string $service + * @param string $backup + * + * @return string The formatted backup resource. + * + * @experimental + */ + public static function backupName($project, $location, $service, $backup) + { + return self::getBackupNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'service' => $service, + 'backup' => $backup, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a lake + * resource. + * + * @param string $project + * @param string $location + * @param string $lake + * + * @return string The formatted lake resource. + * + * @experimental + */ + public static function lakeName($project, $location, $lake) + { + return self::getLakeNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'lake' => $lake, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a location + * resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted location resource. + * + * @experimental + */ + public static function locationName($project, $location) + { + return self::getLocationNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * metadata_import resource. + * + * @param string $project + * @param string $location + * @param string $service + * @param string $metadataImport + * + * @return string The formatted metadata_import resource. + * + * @experimental + */ + public static function metadataImportName($project, $location, $service, $metadataImport) + { + return self::getMetadataImportNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'service' => $service, + 'metadata_import' => $metadataImport, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a network + * resource. + * + * @param string $project + * @param string $network + * + * @return string The formatted network resource. + * + * @experimental + */ + public static function networkName($project, $network) + { + return self::getNetworkNameTemplate()->render([ + 'project' => $project, + 'network' => $network, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a service + * resource. + * + * @param string $project + * @param string $location + * @param string $service + * + * @return string The formatted service resource. + * + * @experimental + */ + public static function serviceName($project, $location, $service) + { + return self::getServiceNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'service' => $service, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a subnetwork + * resource. + * + * @param string $project + * @param string $region + * @param string $subnetwork + * + * @return string The formatted subnetwork resource. + * + * @experimental + */ + public static function subnetworkName($project, $region, $subnetwork) + { + return self::getSubnetworkNameTemplate()->render([ + 'project' => $project, + 'region' => $region, + 'subnetwork' => $subnetwork, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - backup: projects/{project}/locations/{location}/services/{service}/backups/{backup} + * - lake: projects/{project}/locations/{location}/lakes/{lake} + * - location: projects/{project}/locations/{location} + * - metadataImport: projects/{project}/locations/{location}/services/{service}/metadataImports/{metadata_import} + * - network: projects/{project}/global/networks/{network} + * - service: projects/{project}/locations/{location}/services/{service} + * - subnetwork: projects/{project}/regions/{region}/subnetworks/{subnetwork} + * + * 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. + * + * @experimental + */ + public static function parseName($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * Return an OperationsClient object with the same endpoint as $this. + * + * @return OperationsClient + * + * @experimental + */ + 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 + * + * @experimental + */ + 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; + } + + /** + * 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 'metastore.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. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *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' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods 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 + * + * @experimental + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + $this->operationsClient = $this->createOperationsClient($clientOptions); + } + + /** + * Alter metadata resource location. The metadata resource can be a database, + * table, or partition. This functionality only updates the parent directory + * for the respective metadata resource and does not transfer any existing + * data to the new location. + * + * Sample code: + * ``` + * $dataprocMetastoreClient = new DataprocMetastoreClient(); + * try { + * $formattedService = $dataprocMetastoreClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + * $resourceName = 'resource_name'; + * $locationUri = 'location_uri'; + * $operationResponse = $dataprocMetastoreClient->alterMetadataResourceLocation($formattedService, $resourceName, $locationUri); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $dataprocMetastoreClient->alterMetadataResourceLocation($formattedService, $resourceName, $locationUri); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $dataprocMetastoreClient->resumeOperation($operationName, 'alterMetadataResourceLocation'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $dataprocMetastoreClient->close(); + * } + * ``` + * + * @param string $service Required. The relative resource name of the metastore service to mutate + * metadata, in the following format: + * + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * @param string $resourceName Required. The relative metadata resource name in the following format. + * + * `databases/{database_id}` + * or + * `databases/{database_id}/tables/{table_id}` + * or + * `databases/{database_id}/tables/{table_id}/partitions/{partition_id}` + * @param string $locationUri Required. The new location URI for the metadata resource. + * @param array $optionalArgs { + * 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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function alterMetadataResourceLocation($service, $resourceName, $locationUri, array $optionalArgs = []) + { + $request = new AlterMetadataResourceLocationRequest(); + $requestParamHeaders = []; + $request->setService($service); + $request->setResourceName($resourceName); + $request->setLocationUri($locationUri); + $requestParamHeaders['service'] = $service; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('AlterMetadataResourceLocation', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Creates a new backup in a given project and location. + * + * Sample code: + * ``` + * $dataprocMetastoreClient = new DataprocMetastoreClient(); + * try { + * $formattedParent = $dataprocMetastoreClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + * $backupId = 'backup_id'; + * $backup = new Backup(); + * $operationResponse = $dataprocMetastoreClient->createBackup($formattedParent, $backupId, $backup); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $dataprocMetastoreClient->createBackup($formattedParent, $backupId, $backup); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $dataprocMetastoreClient->resumeOperation($operationName, 'createBackup'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $dataprocMetastoreClient->close(); + * } + * ``` + * + * @param string $parent Required. The relative resource name of the service in which to create a + * backup of the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * @param string $backupId Required. The ID of the backup, which is used as the final component of the + * backup's name. + * + * This value must be between 1 and 64 characters long, begin with a letter, + * end with a letter or number, and consist of alpha-numeric ASCII characters + * or hyphens. + * @param Backup $backup Required. The backup to create. The `name` field is ignored. The ID of the + * created backup must be provided in the request's `backup_id` field. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function createBackup($parent, $backupId, $backup, array $optionalArgs = []) + { + $request = new CreateBackupRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setBackupId($backupId); + $request->setBackup($backup); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateBackup', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Creates a new MetadataImport in a given project and location. + * + * Sample code: + * ``` + * $dataprocMetastoreClient = new DataprocMetastoreClient(); + * try { + * $formattedParent = $dataprocMetastoreClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + * $metadataImportId = 'metadata_import_id'; + * $metadataImport = new MetadataImport(); + * $operationResponse = $dataprocMetastoreClient->createMetadataImport($formattedParent, $metadataImportId, $metadataImport); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $dataprocMetastoreClient->createMetadataImport($formattedParent, $metadataImportId, $metadataImport); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $dataprocMetastoreClient->resumeOperation($operationName, 'createMetadataImport'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $dataprocMetastoreClient->close(); + * } + * ``` + * + * @param string $parent Required. The relative resource name of the service in which to create a + * metastore import, in the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * @param string $metadataImportId Required. The ID of the metadata import, which is used as the final + * component of the metadata import's name. + * + * This value must be between 1 and 64 characters long, begin with a letter, + * end with a letter or number, and consist of alpha-numeric ASCII characters + * or hyphens. + * @param MetadataImport $metadataImport Required. The metadata import to create. The `name` field is ignored. The + * ID of the created metadata import must be provided in the request's + * `metadata_import_id` field. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function createMetadataImport($parent, $metadataImportId, $metadataImport, array $optionalArgs = []) + { + $request = new CreateMetadataImportRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setMetadataImportId($metadataImportId); + $request->setMetadataImport($metadataImport); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateMetadataImport', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Creates a metastore service in a project and location. + * + * Sample code: + * ``` + * $dataprocMetastoreClient = new DataprocMetastoreClient(); + * try { + * $formattedParent = $dataprocMetastoreClient->locationName('[PROJECT]', '[LOCATION]'); + * $serviceId = 'service_id'; + * $service = new Service(); + * $operationResponse = $dataprocMetastoreClient->createService($formattedParent, $serviceId, $service); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $dataprocMetastoreClient->createService($formattedParent, $serviceId, $service); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $dataprocMetastoreClient->resumeOperation($operationName, 'createService'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $dataprocMetastoreClient->close(); + * } + * ``` + * + * @param string $parent Required. The relative resource name of the location in which to create a + * metastore service, in the following form: + * + * `projects/{project_number}/locations/{location_id}`. + * @param string $serviceId Required. The ID of the metastore service, which is used as the final + * component of the metastore service's name. + * + * This value must be between 2 and 63 characters long inclusive, begin with a + * letter, end with a letter or number, and consist of alpha-numeric + * ASCII characters or hyphens. + * @param Service $service Required. The Metastore service to create. The `name` field is + * ignored. The ID of the created metastore service must be provided in + * the request's `service_id` field. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function createService($parent, $serviceId, $service, array $optionalArgs = []) + { + $request = new CreateServiceRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setServiceId($serviceId); + $request->setService($service); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateService', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Deletes a single backup. + * + * Sample code: + * ``` + * $dataprocMetastoreClient = new DataprocMetastoreClient(); + * try { + * $formattedName = $dataprocMetastoreClient->backupName('[PROJECT]', '[LOCATION]', '[SERVICE]', '[BACKUP]'); + * $operationResponse = $dataprocMetastoreClient->deleteBackup($formattedName); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $dataprocMetastoreClient->deleteBackup($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $dataprocMetastoreClient->resumeOperation($operationName, 'deleteBackup'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $dataprocMetastoreClient->close(); + * } + * ``` + * + * @param string $name Required. The relative resource name of the backup to delete, in the + * following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function deleteBackup($name, array $optionalArgs = []) + { + $request = new DeleteBackupRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('DeleteBackup', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Deletes a single service. + * + * Sample code: + * ``` + * $dataprocMetastoreClient = new DataprocMetastoreClient(); + * try { + * $formattedName = $dataprocMetastoreClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + * $operationResponse = $dataprocMetastoreClient->deleteService($formattedName); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $dataprocMetastoreClient->deleteService($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $dataprocMetastoreClient->resumeOperation($operationName, 'deleteService'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $dataprocMetastoreClient->close(); + * } + * ``` + * + * @param string $name Required. The relative resource name of the metastore service to delete, in + * the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function deleteService($name, array $optionalArgs = []) + { + $request = new DeleteServiceRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('DeleteService', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Exports metadata from a service. + * + * Sample code: + * ``` + * $dataprocMetastoreClient = new DataprocMetastoreClient(); + * try { + * $formattedService = $dataprocMetastoreClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + * $operationResponse = $dataprocMetastoreClient->exportMetadata($formattedService); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $dataprocMetastoreClient->exportMetadata($formattedService); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $dataprocMetastoreClient->resumeOperation($operationName, 'exportMetadata'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $dataprocMetastoreClient->close(); + * } + * ``` + * + * @param string $service Required. The relative resource name of the metastore service to run + * export, in the following form: + * + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * @param array $optionalArgs { + * Optional. + * + * @type string $destinationGcsFolder + * A Cloud Storage URI of a folder, in the format + * `gs:///`. A sub-folder + * `` containing exported files will be created below it. + * @type string $requestId + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @type int $databaseDumpType + * Optional. The type of the database dump. If unspecified, defaults to + * `MYSQL`. + * For allowed values, use constants defined on {@see \Google\Cloud\Metastore\V1alpha\DatabaseDumpSpec\Type} + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function exportMetadata($service, array $optionalArgs = []) + { + $request = new ExportMetadataRequest(); + $requestParamHeaders = []; + $request->setService($service); + $requestParamHeaders['service'] = $service; + if (isset($optionalArgs['destinationGcsFolder'])) { + $request->setDestinationGcsFolder($optionalArgs['destinationGcsFolder']); + } + + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + if (isset($optionalArgs['databaseDumpType'])) { + $request->setDatabaseDumpType($optionalArgs['databaseDumpType']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('ExportMetadata', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Gets details of a single backup. + * + * Sample code: + * ``` + * $dataprocMetastoreClient = new DataprocMetastoreClient(); + * try { + * $formattedName = $dataprocMetastoreClient->backupName('[PROJECT]', '[LOCATION]', '[SERVICE]', '[BACKUP]'); + * $response = $dataprocMetastoreClient->getBackup($formattedName); + * } finally { + * $dataprocMetastoreClient->close(); + * } + * ``` + * + * @param string $name Required. The relative resource name of the backup to retrieve, in the + * following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + * @param array $optionalArgs { + * 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 \Google\Cloud\Metastore\V1alpha\Backup + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function getBackup($name, array $optionalArgs = []) + { + $request = new GetBackupRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetBackup', Backup::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets details of a single import. + * + * Sample code: + * ``` + * $dataprocMetastoreClient = new DataprocMetastoreClient(); + * try { + * $formattedName = $dataprocMetastoreClient->metadataImportName('[PROJECT]', '[LOCATION]', '[SERVICE]', '[METADATA_IMPORT]'); + * $response = $dataprocMetastoreClient->getMetadataImport($formattedName); + * } finally { + * $dataprocMetastoreClient->close(); + * } + * ``` + * + * @param string $name Required. The relative resource name of the metadata import to retrieve, in + * the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{import_id}`. + * @param array $optionalArgs { + * 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 \Google\Cloud\Metastore\V1alpha\MetadataImport + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function getMetadataImport($name, array $optionalArgs = []) + { + $request = new GetMetadataImportRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetMetadataImport', MetadataImport::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets the details of a single service. + * + * Sample code: + * ``` + * $dataprocMetastoreClient = new DataprocMetastoreClient(); + * try { + * $formattedName = $dataprocMetastoreClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + * $response = $dataprocMetastoreClient->getService($formattedName); + * } finally { + * $dataprocMetastoreClient->close(); + * } + * ``` + * + * @param string $name Required. The relative resource name of the metastore service to retrieve, + * in the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * @param array $optionalArgs { + * 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 \Google\Cloud\Metastore\V1alpha\Service + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function getService($name, array $optionalArgs = []) + { + $request = new GetServiceRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetService', Service::class, $optionalArgs, $request)->wait(); + } + + /** + * Lists backups in a service. + * + * Sample code: + * ``` + * $dataprocMetastoreClient = new DataprocMetastoreClient(); + * try { + * $formattedParent = $dataprocMetastoreClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + * // Iterate over pages of elements + * $pagedResponse = $dataprocMetastoreClient->listBackups($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $dataprocMetastoreClient->listBackups($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $dataprocMetastoreClient->close(); + * } + * ``` + * + * @param string $parent Required. The relative resource name of the service whose backups to + * list, in the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type string $filter + * Optional. The filter to apply to list results. + * @type string $orderBy + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @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 \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function listBackups($parent, array $optionalArgs = []) + { + $request = new ListBackupsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListBackups', $optionalArgs, ListBackupsResponse::class, $request); + } + + /** + * Lists imports in a service. + * + * Sample code: + * ``` + * $dataprocMetastoreClient = new DataprocMetastoreClient(); + * try { + * $formattedParent = $dataprocMetastoreClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + * // Iterate over pages of elements + * $pagedResponse = $dataprocMetastoreClient->listMetadataImports($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $dataprocMetastoreClient->listMetadataImports($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $dataprocMetastoreClient->close(); + * } + * ``` + * + * @param string $parent Required. The relative resource name of the service whose metadata imports + * to list, in the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type string $filter + * Optional. The filter to apply to list results. + * @type string $orderBy + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @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 \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function listMetadataImports($parent, array $optionalArgs = []) + { + $request = new ListMetadataImportsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListMetadataImports', $optionalArgs, ListMetadataImportsResponse::class, $request); + } + + /** + * Lists services in a project and location. + * + * Sample code: + * ``` + * $dataprocMetastoreClient = new DataprocMetastoreClient(); + * try { + * $formattedParent = $dataprocMetastoreClient->locationName('[PROJECT]', '[LOCATION]'); + * // Iterate over pages of elements + * $pagedResponse = $dataprocMetastoreClient->listServices($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $dataprocMetastoreClient->listServices($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $dataprocMetastoreClient->close(); + * } + * ``` + * + * @param string $parent Required. The relative resource name of the location of metastore services + * to list, in the following form: + * + * `projects/{project_number}/locations/{location_id}`. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type string $filter + * Optional. The filter to apply to list results. + * @type string $orderBy + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @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 \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function listServices($parent, array $optionalArgs = []) + { + $request = new ListServicesRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListServices', $optionalArgs, ListServicesResponse::class, $request); + } + + /** + * Move a table to another database. + * + * Sample code: + * ``` + * $dataprocMetastoreClient = new DataprocMetastoreClient(); + * try { + * $formattedService = $dataprocMetastoreClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + * $tableName = 'table_name'; + * $dbName = 'db_name'; + * $destinationDbName = 'destination_db_name'; + * $operationResponse = $dataprocMetastoreClient->moveTableToDatabase($formattedService, $tableName, $dbName, $destinationDbName); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $dataprocMetastoreClient->moveTableToDatabase($formattedService, $tableName, $dbName, $destinationDbName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $dataprocMetastoreClient->resumeOperation($operationName, 'moveTableToDatabase'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $dataprocMetastoreClient->close(); + * } + * ``` + * + * @param string $service Required. The relative resource name of the metastore service to mutate + * metadata, in the following format: + * + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * @param string $tableName Required. The name of the table to be moved. + * @param string $dbName Required. The name of the database where the table resides. + * @param string $destinationDbName Required. The name of the database where the table should be moved. + * @param array $optionalArgs { + * 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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function moveTableToDatabase($service, $tableName, $dbName, $destinationDbName, array $optionalArgs = []) + { + $request = new MoveTableToDatabaseRequest(); + $requestParamHeaders = []; + $request->setService($service); + $request->setTableName($tableName); + $request->setDbName($dbName); + $request->setDestinationDbName($destinationDbName); + $requestParamHeaders['service'] = $service; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('MoveTableToDatabase', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Query DPMS metadata. + * + * Sample code: + * ``` + * $dataprocMetastoreClient = new DataprocMetastoreClient(); + * try { + * $formattedService = $dataprocMetastoreClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + * $query = 'query'; + * $operationResponse = $dataprocMetastoreClient->queryMetadata($formattedService, $query); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $dataprocMetastoreClient->queryMetadata($formattedService, $query); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $dataprocMetastoreClient->resumeOperation($operationName, 'queryMetadata'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $dataprocMetastoreClient->close(); + * } + * ``` + * + * @param string $service Required. The relative resource name of the metastore service to query + * metadata, in the following format: + * + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * @param string $query Required. A read-only SQL query to execute against the metadata database. + * The query cannot change or mutate the data. + * @param array $optionalArgs { + * 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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function queryMetadata($service, $query, array $optionalArgs = []) + { + $request = new QueryMetadataRequest(); + $requestParamHeaders = []; + $request->setService($service); + $request->setQuery($query); + $requestParamHeaders['service'] = $service; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('QueryMetadata', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Removes the attached IAM policies for a resource + * + * Sample code: + * ``` + * $dataprocMetastoreClient = new DataprocMetastoreClient(); + * try { + * $resource = 'resource'; + * $response = $dataprocMetastoreClient->removeIamPolicy($resource); + * } finally { + * $dataprocMetastoreClient->close(); + * } + * ``` + * + * @param string $resource Required. The relative resource name of the dataplane resource to remove + * IAM policy, in the following form: + * + * `projects/{project_id}/locations/{location_id}/services/{service_id}/databases/{database_id}` + * or + * `projects/{project_id}/locations/{location_id}/services/{service_id}/databases/{database_id}/tables/{table_id}`. + * @param array $optionalArgs { + * Optional. + * + * @type bool $asynchronous + * Optional. Removes IAM policy attached to database or table asynchronously + * when it is set. The default is false. + * @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 \Google\Cloud\Metastore\V1alpha\RemoveIamPolicyResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function removeIamPolicy($resource, array $optionalArgs = []) + { + $request = new RemoveIamPolicyRequest(); + $requestParamHeaders = []; + $request->setResource($resource); + $requestParamHeaders['resource'] = $resource; + if (isset($optionalArgs['asynchronous'])) { + $request->setAsynchronous($optionalArgs['asynchronous']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('RemoveIamPolicy', RemoveIamPolicyResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Restores a service from a backup. + * + * Sample code: + * ``` + * $dataprocMetastoreClient = new DataprocMetastoreClient(); + * try { + * $formattedService = $dataprocMetastoreClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + * $formattedBackup = $dataprocMetastoreClient->backupName('[PROJECT]', '[LOCATION]', '[SERVICE]', '[BACKUP]'); + * $operationResponse = $dataprocMetastoreClient->restoreService($formattedService, $formattedBackup); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $dataprocMetastoreClient->restoreService($formattedService, $formattedBackup); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $dataprocMetastoreClient->resumeOperation($operationName, 'restoreService'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $dataprocMetastoreClient->close(); + * } + * ``` + * + * @param string $service Required. The relative resource name of the metastore service to run + * restore, in the following form: + * + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * @param string $backup Required. The relative resource name of the metastore service backup to + * restore from, in the following form: + * + * `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + * @param array $optionalArgs { + * Optional. + * + * @type int $restoreType + * Optional. The type of restore. If unspecified, defaults to `METADATA_ONLY`. + * For allowed values, use constants defined on {@see \Google\Cloud\Metastore\V1alpha\Restore\RestoreType} + * @type string $requestId + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function restoreService($service, $backup, array $optionalArgs = []) + { + $request = new RestoreServiceRequest(); + $requestParamHeaders = []; + $request->setService($service); + $request->setBackup($backup); + $requestParamHeaders['service'] = $service; + if (isset($optionalArgs['restoreType'])) { + $request->setRestoreType($optionalArgs['restoreType']); + } + + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('RestoreService', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Updates a single import. + * Only the description field of MetadataImport is supported to be updated. + * + * Sample code: + * ``` + * $dataprocMetastoreClient = new DataprocMetastoreClient(); + * try { + * $updateMask = new FieldMask(); + * $metadataImport = new MetadataImport(); + * $operationResponse = $dataprocMetastoreClient->updateMetadataImport($updateMask, $metadataImport); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $dataprocMetastoreClient->updateMetadataImport($updateMask, $metadataImport); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $dataprocMetastoreClient->resumeOperation($operationName, 'updateMetadataImport'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $dataprocMetastoreClient->close(); + * } + * ``` + * + * @param FieldMask $updateMask Required. A field mask used to specify the fields to be overwritten in the + * metadata import resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + * @param MetadataImport $metadataImport Required. The metadata import to update. The server only merges fields + * in the import if they are specified in `update_mask`. + * + * The metadata import's `name` field is used to identify the metastore + * import to be updated. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function updateMetadataImport($updateMask, $metadataImport, array $optionalArgs = []) + { + $request = new UpdateMetadataImportRequest(); + $requestParamHeaders = []; + $request->setUpdateMask($updateMask); + $request->setMetadataImport($metadataImport); + $requestParamHeaders['metadata_import.name'] = $metadataImport->getName(); + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('UpdateMetadataImport', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Updates the parameters of a single service. + * + * Sample code: + * ``` + * $dataprocMetastoreClient = new DataprocMetastoreClient(); + * try { + * $updateMask = new FieldMask(); + * $service = new Service(); + * $operationResponse = $dataprocMetastoreClient->updateService($updateMask, $service); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $dataprocMetastoreClient->updateService($updateMask, $service); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $dataprocMetastoreClient->resumeOperation($operationName, 'updateService'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $dataprocMetastoreClient->close(); + * } + * ``` + * + * @param FieldMask $updateMask Required. A field mask used to specify the fields to be overwritten in the + * metastore service resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + * @param Service $service Required. The metastore service to update. The server only merges fields + * in the service if they are specified in `update_mask`. + * + * The metastore service's `name` field is used to identify the metastore + * service to be updated. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function updateService($updateMask, $service, array $optionalArgs = []) + { + $request = new UpdateServiceRequest(); + $requestParamHeaders = []; + $request->setUpdateMask($updateMask); + $request->setService($service); + $requestParamHeaders['service.name'] = $service->getName(); + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('UpdateService', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Gets information about a location. + * + * Sample code: + * ``` + * $dataprocMetastoreClient = new DataprocMetastoreClient(); + * try { + * $response = $dataprocMetastoreClient->getLocation(); + * } finally { + * $dataprocMetastoreClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * Resource name for the location. + * @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 \Google\Cloud\Location\Location + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function getLocation(array $optionalArgs = []) + { + $request = new GetLocationRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetLocation', Location::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.cloud.location.Locations')->wait(); + } + + /** + * Lists information about the supported locations for this service. + * + * Sample code: + * ``` + * $dataprocMetastoreClient = new DataprocMetastoreClient(); + * try { + * // Iterate over pages of elements + * $pagedResponse = $dataprocMetastoreClient->listLocations(); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $dataprocMetastoreClient->listLocations(); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $dataprocMetastoreClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * The resource that owns the locations collection, if applicable. + * @type string $filter + * The standard list filter. + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @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 \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function listLocations(array $optionalArgs = []) + { + $request = new ListLocationsRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListLocations', $optionalArgs, ListLocationsResponse::class, $request, 'google.cloud.location.Locations'); + } + + /** + * Gets the access control policy for a resource. Returns an empty policy + if the resource exists and does not have a policy set. + * + * Sample code: + * ``` + * $dataprocMetastoreClient = new DataprocMetastoreClient(); + * try { + * $resource = 'resource'; + * $response = $dataprocMetastoreClient->getIamPolicy($resource); + * } finally { + * $dataprocMetastoreClient->close(); + * } + * ``` + * + * @param string $resource REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param array $optionalArgs { + * Optional. + * + * @type GetPolicyOptions $options + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. + * @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 \Google\Cloud\Iam\V1\Policy + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function getIamPolicy($resource, array $optionalArgs = []) + { + $request = new GetIamPolicyRequest(); + $requestParamHeaders = []; + $request->setResource($resource); + $requestParamHeaders['resource'] = $resource; + if (isset($optionalArgs['options'])) { + $request->setOptions($optionalArgs['options']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetIamPolicy', Policy::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.iam.v1.IAMPolicy')->wait(); + } + + /** + * Sets the access control policy on the specified resource. Replaces + any existing policy. + + Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` + errors. + * + * Sample code: + * ``` + * $dataprocMetastoreClient = new DataprocMetastoreClient(); + * try { + * $resource = 'resource'; + * $policy = new Policy(); + * $response = $dataprocMetastoreClient->setIamPolicy($resource, $policy); + * } finally { + * $dataprocMetastoreClient->close(); + * } + * ``` + * + * @param string $resource REQUIRED: The resource for which the policy is being specified. + * See the operation documentation for the appropriate value for this field. + * @param Policy $policy REQUIRED: The complete policy to be applied to the `resource`. The size of + * the policy is limited to a few 10s of KB. An empty policy is a + * valid policy but certain Cloud Platform services (such as Projects) + * might reject them. + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only + * the fields in the mask will be modified. If no mask is provided, the + * following default mask is used: + * + * `paths: "bindings, etag"` + * @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 \Google\Cloud\Iam\V1\Policy + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function setIamPolicy($resource, $policy, array $optionalArgs = []) + { + $request = new SetIamPolicyRequest(); + $requestParamHeaders = []; + $request->setResource($resource); + $request->setPolicy($policy); + $requestParamHeaders['resource'] = $resource; + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('SetIamPolicy', Policy::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.iam.v1.IAMPolicy')->wait(); + } + + /** + * Returns permissions that a caller has on the specified resource. If the + resource does not exist, this will return an empty set of + permissions, not a `NOT_FOUND` error. + + Note: This operation is designed to be used for building + permission-aware UIs and command-line tools, not for authorization + checking. This operation may "fail open" without warning. + * + * Sample code: + * ``` + * $dataprocMetastoreClient = new DataprocMetastoreClient(); + * try { + * $resource = 'resource'; + * $permissions = []; + * $response = $dataprocMetastoreClient->testIamPermissions($resource, $permissions); + * } finally { + * $dataprocMetastoreClient->close(); + * } + * ``` + * + * @param string $resource REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param string[] $permissions The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @param array $optionalArgs { + * 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 \Google\Cloud\Iam\V1\TestIamPermissionsResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function testIamPermissions($resource, $permissions, array $optionalArgs = []) + { + $request = new TestIamPermissionsRequest(); + $requestParamHeaders = []; + $request->setResource($resource); + $request->setPermissions($permissions); + $requestParamHeaders['resource'] = $resource; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('TestIamPermissions', TestIamPermissionsResponse::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.iam.v1.IAMPolicy')->wait(); + } +} diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/src/V1alpha/gapic_metadata.json b/owl-bot-staging/DataprocMetastore/v1alpha/src/V1alpha/gapic_metadata.json new file mode 100644 index 000000000000..1276f9994a16 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/src/V1alpha/gapic_metadata.json @@ -0,0 +1,197 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services\/RPCs to the corresponding library clients\/methods", + "language": "php", + "protoPackage": "google.cloud.metastore.v1alpha", + "libraryPackage": "Google\\Cloud\\Metastore\\V1alpha", + "services": { + "DataprocMetastore": { + "clients": { + "grpc": { + "libraryClient": "DataprocMetastoreGapicClient", + "rpcs": { + "AlterMetadataResourceLocation": { + "methods": [ + "alterMetadataResourceLocation" + ] + }, + "CreateBackup": { + "methods": [ + "createBackup" + ] + }, + "CreateMetadataImport": { + "methods": [ + "createMetadataImport" + ] + }, + "CreateService": { + "methods": [ + "createService" + ] + }, + "DeleteBackup": { + "methods": [ + "deleteBackup" + ] + }, + "DeleteService": { + "methods": [ + "deleteService" + ] + }, + "ExportMetadata": { + "methods": [ + "exportMetadata" + ] + }, + "GetBackup": { + "methods": [ + "getBackup" + ] + }, + "GetMetadataImport": { + "methods": [ + "getMetadataImport" + ] + }, + "GetService": { + "methods": [ + "getService" + ] + }, + "ListBackups": { + "methods": [ + "listBackups" + ] + }, + "ListMetadataImports": { + "methods": [ + "listMetadataImports" + ] + }, + "ListServices": { + "methods": [ + "listServices" + ] + }, + "MoveTableToDatabase": { + "methods": [ + "moveTableToDatabase" + ] + }, + "QueryMetadata": { + "methods": [ + "queryMetadata" + ] + }, + "RemoveIamPolicy": { + "methods": [ + "removeIamPolicy" + ] + }, + "RestoreService": { + "methods": [ + "restoreService" + ] + }, + "UpdateMetadataImport": { + "methods": [ + "updateMetadataImport" + ] + }, + "UpdateService": { + "methods": [ + "updateService" + ] + }, + "GetLocation": { + "methods": [ + "getLocation" + ] + }, + "ListLocations": { + "methods": [ + "listLocations" + ] + }, + "GetIamPolicy": { + "methods": [ + "getIamPolicy" + ] + }, + "SetIamPolicy": { + "methods": [ + "setIamPolicy" + ] + }, + "TestIamPermissions": { + "methods": [ + "testIamPermissions" + ] + } + } + } + } + }, + "DataprocMetastoreFederation": { + "clients": { + "grpc": { + "libraryClient": "DataprocMetastoreFederationGapicClient", + "rpcs": { + "CreateFederation": { + "methods": [ + "createFederation" + ] + }, + "DeleteFederation": { + "methods": [ + "deleteFederation" + ] + }, + "GetFederation": { + "methods": [ + "getFederation" + ] + }, + "ListFederations": { + "methods": [ + "listFederations" + ] + }, + "UpdateFederation": { + "methods": [ + "updateFederation" + ] + }, + "GetLocation": { + "methods": [ + "getLocation" + ] + }, + "ListLocations": { + "methods": [ + "listLocations" + ] + }, + "GetIamPolicy": { + "methods": [ + "getIamPolicy" + ] + }, + "SetIamPolicy": { + "methods": [ + "setIamPolicy" + ] + }, + "TestIamPermissions": { + "methods": [ + "testIamPermissions" + ] + } + } + } + } + } + } +} \ No newline at end of file diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/src/V1alpha/resources/dataproc_metastore_client_config.json b/owl-bot-staging/DataprocMetastore/v1alpha/src/V1alpha/resources/dataproc_metastore_client_config.json new file mode 100644 index 000000000000..2355e4bd3525 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/src/V1alpha/resources/dataproc_metastore_client_config.json @@ -0,0 +1,164 @@ +{ + "interfaces": { + "google.cloud.metastore.v1alpha.DataprocMetastore": { + "retry_codes": { + "no_retry_codes": [], + "retry_policy_1_codes": [ + "UNAVAILABLE" + ], + "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": 1.3, + "max_retry_delay_millis": 10000, + "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": { + "AlterMetadataResourceLocation": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "CreateBackup": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "CreateMetadataImport": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "CreateService": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "DeleteBackup": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "DeleteService": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "ExportMetadata": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "GetBackup": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetMetadataImport": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetService": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListBackups": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListMetadataImports": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListServices": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "MoveTableToDatabase": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "QueryMetadata": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "RemoveIamPolicy": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "RestoreService": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "UpdateMetadataImport": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "UpdateService": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "GetLocation": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListLocations": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetIamPolicy": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "SetIamPolicy": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "TestIamPermissions": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + } + } + } + } +} diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/src/V1alpha/resources/dataproc_metastore_descriptor_config.php b/owl-bot-staging/DataprocMetastore/v1alpha/src/V1alpha/resources/dataproc_metastore_descriptor_config.php new file mode 100644 index 000000000000..94d5d9d3a88f --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/src/V1alpha/resources/dataproc_metastore_descriptor_config.php @@ -0,0 +1,181 @@ + [ + 'google.cloud.metastore.v1alpha.DataprocMetastore' => [ + 'AlterMetadataResourceLocation' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Metastore\V1alpha\AlterMetadataResourceLocationResponse', + 'metadataReturnType' => '\Google\Cloud\Metastore\V1alpha\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'CreateBackup' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Metastore\V1alpha\Backup', + 'metadataReturnType' => '\Google\Cloud\Metastore\V1alpha\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'CreateMetadataImport' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Metastore\V1alpha\MetadataImport', + 'metadataReturnType' => '\Google\Cloud\Metastore\V1alpha\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'CreateService' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Metastore\V1alpha\Service', + 'metadataReturnType' => '\Google\Cloud\Metastore\V1alpha\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'DeleteBackup' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\Metastore\V1alpha\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'DeleteService' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\Metastore\V1alpha\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'ExportMetadata' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Metastore\V1alpha\MetadataExport', + 'metadataReturnType' => '\Google\Cloud\Metastore\V1alpha\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'MoveTableToDatabase' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Metastore\V1alpha\MoveTableToDatabaseResponse', + 'metadataReturnType' => '\Google\Cloud\Metastore\V1alpha\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'QueryMetadata' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Metastore\V1alpha\QueryMetadataResponse', + 'metadataReturnType' => '\Google\Cloud\Metastore\V1alpha\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'RestoreService' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Metastore\V1alpha\Restore', + 'metadataReturnType' => '\Google\Cloud\Metastore\V1alpha\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'UpdateMetadataImport' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Metastore\V1alpha\MetadataImport', + 'metadataReturnType' => '\Google\Cloud\Metastore\V1alpha\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'UpdateService' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Metastore\V1alpha\Service', + 'metadataReturnType' => '\Google\Cloud\Metastore\V1alpha\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'ListBackups' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getBackups', + ], + ], + 'ListMetadataImports' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getMetadataImports', + ], + ], + 'ListServices' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getServices', + ], + ], + 'GetLocation' => [ + 'interfaceOverride' => 'google.cloud.location.Locations', + ], + 'ListLocations' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getLocations', + ], + 'interfaceOverride' => 'google.cloud.location.Locations', + ], + 'GetIamPolicy' => [ + 'interfaceOverride' => 'google.iam.v1.IAMPolicy', + ], + 'SetIamPolicy' => [ + 'interfaceOverride' => 'google.iam.v1.IAMPolicy', + ], + 'TestIamPermissions' => [ + 'interfaceOverride' => 'google.iam.v1.IAMPolicy', + ], + ], + ], +]; diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/src/V1alpha/resources/dataproc_metastore_federation_client_config.json b/owl-bot-staging/DataprocMetastore/v1alpha/src/V1alpha/resources/dataproc_metastore_federation_client_config.json new file mode 100644 index 000000000000..360aa62b94ff --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/src/V1alpha/resources/dataproc_metastore_federation_client_config.json @@ -0,0 +1,72 @@ +{ + "interfaces": { + "google.cloud.metastore.v1alpha.DataprocMetastoreFederation": { + "retry_codes": { + "no_retry_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 + } + }, + "methods": { + "CreateFederation": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "DeleteFederation": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "GetFederation": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "ListFederations": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "UpdateFederation": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "GetLocation": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "ListLocations": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "GetIamPolicy": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "SetIamPolicy": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "TestIamPermissions": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + } + } + } + } +} diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/src/V1alpha/resources/dataproc_metastore_federation_descriptor_config.php b/owl-bot-staging/DataprocMetastore/v1alpha/src/V1alpha/resources/dataproc_metastore_federation_descriptor_config.php new file mode 100644 index 000000000000..0fb6ca9677cb --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/src/V1alpha/resources/dataproc_metastore_federation_descriptor_config.php @@ -0,0 +1,71 @@ + [ + 'google.cloud.metastore.v1alpha.DataprocMetastoreFederation' => [ + 'CreateFederation' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Metastore\V1alpha\Federation', + 'metadataReturnType' => '\Google\Cloud\Metastore\V1alpha\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'DeleteFederation' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\Metastore\V1alpha\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'UpdateFederation' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Metastore\V1alpha\Federation', + 'metadataReturnType' => '\Google\Cloud\Metastore\V1alpha\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'ListFederations' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getFederations', + ], + ], + 'GetLocation' => [ + 'interfaceOverride' => 'google.cloud.location.Locations', + ], + 'ListLocations' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getLocations', + ], + 'interfaceOverride' => 'google.cloud.location.Locations', + ], + 'GetIamPolicy' => [ + 'interfaceOverride' => 'google.iam.v1.IAMPolicy', + ], + 'SetIamPolicy' => [ + 'interfaceOverride' => 'google.iam.v1.IAMPolicy', + ], + 'TestIamPermissions' => [ + 'interfaceOverride' => 'google.iam.v1.IAMPolicy', + ], + ], + ], +]; diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/src/V1alpha/resources/dataproc_metastore_federation_rest_client_config.php b/owl-bot-staging/DataprocMetastore/v1alpha/src/V1alpha/resources/dataproc_metastore_federation_rest_client_config.php new file mode 100644 index 000000000000..aad54be89376 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/src/V1alpha/resources/dataproc_metastore_federation_rest_client_config.php @@ -0,0 +1,243 @@ + [ + 'google.cloud.location.Locations' => [ + 'GetLocation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1alpha/{name=projects/*/locations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListLocations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1alpha/{name=projects/*}/locations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + 'google.cloud.metastore.v1alpha.DataprocMetastoreFederation' => [ + 'CreateFederation' => [ + 'method' => 'post', + 'uriTemplate' => '/v1alpha/{parent=projects/*/locations/*}/federations', + 'body' => 'federation', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'federation_id', + ], + ], + 'DeleteFederation' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1alpha/{name=projects/*/locations/*/federations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetFederation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1alpha/{name=projects/*/locations/*/federations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListFederations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1alpha/{parent=projects/*/locations/*}/federations', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'UpdateFederation' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1alpha/{federation.name=projects/*/locations/*/federations/*}', + 'body' => 'federation', + 'placeholders' => [ + 'federation.name' => [ + 'getters' => [ + 'getFederation', + 'getName', + ], + ], + ], + 'queryParams' => [ + 'update_mask', + ], + ], + ], + 'google.iam.v1.IAMPolicy' => [ + 'GetIamPolicy' => [ + 'method' => 'get', + 'uriTemplate' => '/v1alpha/{resource=projects/*/locations/*/services/*}:getIamPolicy', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v1alpha/{resource=projects/*/locations/*/services/*/backups/*}:getIamPolicy', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1alpha/{resource=projects/*/locations/*/services/*/databases/*}:getIamPolicy', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1alpha/{resource=projects/*/locations/*/services/*/databases/*/tables/*}:getIamPolicy', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1alpha/{resource=projects/*/locations/*/federations/*}:getIamPolicy', + ], + ], + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + 'SetIamPolicy' => [ + 'method' => 'post', + 'uriTemplate' => '/v1alpha/{resource=projects/*/locations/*/services/*}:setIamPolicy', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1alpha/{resource=projects/*/locations/*/services/*/backups/*}:setIamPolicy', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1alpha/{resource=projects/*/locations/*/services/*/databases/*}:setIamPolicy', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1alpha/{resource=projects/*/locations/*/services/*/databases/*/tables/*}:setIamPolicy', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1alpha/{resource=projects/*/locations/*/federations/*}:setIamPolicy', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + 'TestIamPermissions' => [ + 'method' => 'post', + 'uriTemplate' => '/v1alpha/{resource=projects/*/locations/*/services/*}:testIamPermissions', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1alpha/{resource=projects/*/locations/*/services/*/backups/*}:testIamPermissions', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1alpha/{resource=projects/*/locations/*/services/*/databases/*}:testIamPermissions', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1alpha/{resource=projects/*/locations/*/services/*/databases/*/tables/*}:testIamPermissions', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1alpha/{resource=projects/*/locations/*/federations/*}:testIamPermissions', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + ], + 'google.longrunning.Operations' => [ + 'CancelOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v1alpha/{name=projects/*/locations/*/operations/*}:cancel', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteOperation' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1alpha/{name=projects/*/locations/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetOperation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1alpha/{name=projects/*/locations/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListOperations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1alpha/{name=projects/*/locations/*}/operations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/src/V1alpha/resources/dataproc_metastore_rest_client_config.php b/owl-bot-staging/DataprocMetastore/v1alpha/src/V1alpha/resources/dataproc_metastore_rest_client_config.php new file mode 100644 index 000000000000..5da0a2b6574d --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/src/V1alpha/resources/dataproc_metastore_rest_client_config.php @@ -0,0 +1,416 @@ + [ + 'google.cloud.location.Locations' => [ + 'GetLocation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1alpha/{name=projects/*/locations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListLocations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1alpha/{name=projects/*}/locations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + 'google.cloud.metastore.v1alpha.DataprocMetastore' => [ + 'AlterMetadataResourceLocation' => [ + 'method' => 'post', + 'uriTemplate' => '/v1alpha/{service=projects/*/locations/*/services/*}:alterLocation', + 'body' => '*', + 'placeholders' => [ + 'service' => [ + 'getters' => [ + 'getService', + ], + ], + ], + ], + 'CreateBackup' => [ + 'method' => 'post', + 'uriTemplate' => '/v1alpha/{parent=projects/*/locations/*/services/*}/backups', + 'body' => 'backup', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'backup_id', + ], + ], + 'CreateMetadataImport' => [ + 'method' => 'post', + 'uriTemplate' => '/v1alpha/{parent=projects/*/locations/*/services/*}/metadataImports', + 'body' => 'metadata_import', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'metadata_import_id', + ], + ], + 'CreateService' => [ + 'method' => 'post', + 'uriTemplate' => '/v1alpha/{parent=projects/*/locations/*}/services', + 'body' => 'service', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'service_id', + ], + ], + 'DeleteBackup' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1alpha/{name=projects/*/locations/*/services/*/backups/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteService' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1alpha/{name=projects/*/locations/*/services/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ExportMetadata' => [ + 'method' => 'post', + 'uriTemplate' => '/v1alpha/{service=projects/*/locations/*/services/*}:exportMetadata', + 'body' => '*', + 'placeholders' => [ + 'service' => [ + 'getters' => [ + 'getService', + ], + ], + ], + ], + 'GetBackup' => [ + 'method' => 'get', + 'uriTemplate' => '/v1alpha/{name=projects/*/locations/*/services/*/backups/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetMetadataImport' => [ + 'method' => 'get', + 'uriTemplate' => '/v1alpha/{name=projects/*/locations/*/services/*/metadataImports/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetService' => [ + 'method' => 'get', + 'uriTemplate' => '/v1alpha/{name=projects/*/locations/*/services/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListBackups' => [ + 'method' => 'get', + 'uriTemplate' => '/v1alpha/{parent=projects/*/locations/*/services/*}/backups', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListMetadataImports' => [ + 'method' => 'get', + 'uriTemplate' => '/v1alpha/{parent=projects/*/locations/*/services/*}/metadataImports', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListServices' => [ + 'method' => 'get', + 'uriTemplate' => '/v1alpha/{parent=projects/*/locations/*}/services', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'MoveTableToDatabase' => [ + 'method' => 'post', + 'uriTemplate' => '/v1alpha/{service=projects/*/locations/*/services/*}:moveTableToDatabase', + 'body' => '*', + 'placeholders' => [ + 'service' => [ + 'getters' => [ + 'getService', + ], + ], + ], + ], + 'QueryMetadata' => [ + 'method' => 'post', + 'uriTemplate' => '/v1alpha/{service=projects/*/locations/*/services/*}:queryMetadata', + 'body' => '*', + 'placeholders' => [ + 'service' => [ + 'getters' => [ + 'getService', + ], + ], + ], + ], + 'RemoveIamPolicy' => [ + 'method' => 'post', + 'uriTemplate' => '/v1alpha/{resource=projects/*/locations/*/services/*/**}:removeIamPolicy', + 'body' => '*', + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + 'RestoreService' => [ + 'method' => 'post', + 'uriTemplate' => '/v1alpha/{service=projects/*/locations/*/services/*}:restore', + 'body' => '*', + 'placeholders' => [ + 'service' => [ + 'getters' => [ + 'getService', + ], + ], + ], + ], + 'UpdateMetadataImport' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1alpha/{metadata_import.name=projects/*/locations/*/services/*/metadataImports/*}', + 'body' => 'metadata_import', + 'placeholders' => [ + 'metadata_import.name' => [ + 'getters' => [ + 'getMetadataImport', + 'getName', + ], + ], + ], + 'queryParams' => [ + 'update_mask', + ], + ], + 'UpdateService' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1alpha/{service.name=projects/*/locations/*/services/*}', + 'body' => 'service', + 'placeholders' => [ + 'service.name' => [ + 'getters' => [ + 'getService', + 'getName', + ], + ], + ], + 'queryParams' => [ + 'update_mask', + ], + ], + ], + 'google.iam.v1.IAMPolicy' => [ + 'GetIamPolicy' => [ + 'method' => 'get', + 'uriTemplate' => '/v1alpha/{resource=projects/*/locations/*/services/*}:getIamPolicy', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v1alpha/{resource=projects/*/locations/*/services/*/backups/*}:getIamPolicy', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1alpha/{resource=projects/*/locations/*/services/*/databases/*}:getIamPolicy', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1alpha/{resource=projects/*/locations/*/services/*/databases/*/tables/*}:getIamPolicy', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1alpha/{resource=projects/*/locations/*/federations/*}:getIamPolicy', + ], + ], + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + 'SetIamPolicy' => [ + 'method' => 'post', + 'uriTemplate' => '/v1alpha/{resource=projects/*/locations/*/services/*}:setIamPolicy', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1alpha/{resource=projects/*/locations/*/services/*/backups/*}:setIamPolicy', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1alpha/{resource=projects/*/locations/*/services/*/databases/*}:setIamPolicy', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1alpha/{resource=projects/*/locations/*/services/*/databases/*/tables/*}:setIamPolicy', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1alpha/{resource=projects/*/locations/*/federations/*}:setIamPolicy', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + 'TestIamPermissions' => [ + 'method' => 'post', + 'uriTemplate' => '/v1alpha/{resource=projects/*/locations/*/services/*}:testIamPermissions', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1alpha/{resource=projects/*/locations/*/services/*/backups/*}:testIamPermissions', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1alpha/{resource=projects/*/locations/*/services/*/databases/*}:testIamPermissions', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1alpha/{resource=projects/*/locations/*/services/*/databases/*/tables/*}:testIamPermissions', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1alpha/{resource=projects/*/locations/*/federations/*}:testIamPermissions', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + ], + 'google.longrunning.Operations' => [ + 'CancelOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v1alpha/{name=projects/*/locations/*/operations/*}:cancel', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteOperation' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1alpha/{name=projects/*/locations/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetOperation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1alpha/{name=projects/*/locations/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListOperations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1alpha/{name=projects/*/locations/*}/operations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/tests/Unit/V1alpha/DataprocMetastoreClientTest.php b/owl-bot-staging/DataprocMetastore/v1alpha/tests/Unit/V1alpha/DataprocMetastoreClientTest.php new file mode 100644 index 000000000000..836ed8d475c5 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/tests/Unit/V1alpha/DataprocMetastoreClientTest.php @@ -0,0 +1,2364 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return DataprocMetastoreClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new DataprocMetastoreClient($options); + } + + /** @test */ + public function alterMetadataResourceLocationTest() + { + $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/alterMetadataResourceLocationTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new AlterMetadataResourceLocationResponse(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/alterMetadataResourceLocationTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedService = $gapicClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $resourceName = 'resourceName979421212'; + $locationUri = 'locationUri-57953822'; + $response = $gapicClient->alterMetadataResourceLocation($formattedService, $resourceName, $locationUri); + $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.cloud.metastore.v1alpha.DataprocMetastore/AlterMetadataResourceLocation', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getService(); + $this->assertProtobufEquals($formattedService, $actualValue); + $actualValue = $actualApiRequestObject->getResourceName(); + $this->assertProtobufEquals($resourceName, $actualValue); + $actualValue = $actualApiRequestObject->getLocationUri(); + $this->assertProtobufEquals($locationUri, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/alterMetadataResourceLocationTest'); + $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 alterMetadataResourceLocationExceptionTest() + { + $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/alterMetadataResourceLocationTest'); + $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 + $formattedService = $gapicClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $resourceName = 'resourceName979421212'; + $locationUri = 'locationUri-57953822'; + $response = $gapicClient->alterMetadataResourceLocation($formattedService, $resourceName, $locationUri); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/alterMetadataResourceLocationTest'); + 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 createBackupTest() + { + $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/createBackupTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $expectedResponse = new Backup(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createBackupTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $backupId = 'backupId1355353272'; + $backup = new Backup(); + $response = $gapicClient->createBackup($formattedParent, $backupId, $backup); + $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.cloud.metastore.v1alpha.DataprocMetastore/CreateBackup', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getBackupId(); + $this->assertProtobufEquals($backupId, $actualValue); + $actualValue = $actualApiRequestObject->getBackup(); + $this->assertProtobufEquals($backup, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createBackupTest'); + $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 createBackupExceptionTest() + { + $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/createBackupTest'); + $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 + $formattedParent = $gapicClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $backupId = 'backupId1355353272'; + $backup = new Backup(); + $response = $gapicClient->createBackup($formattedParent, $backupId, $backup); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createBackupTest'); + 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 createMetadataImportTest() + { + $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/createMetadataImportTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $expectedResponse = new MetadataImport(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createMetadataImportTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $metadataImportId = 'metadataImportId-476076315'; + $metadataImport = new MetadataImport(); + $response = $gapicClient->createMetadataImport($formattedParent, $metadataImportId, $metadataImport); + $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.cloud.metastore.v1alpha.DataprocMetastore/CreateMetadataImport', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getMetadataImportId(); + $this->assertProtobufEquals($metadataImportId, $actualValue); + $actualValue = $actualApiRequestObject->getMetadataImport(); + $this->assertProtobufEquals($metadataImport, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createMetadataImportTest'); + $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 createMetadataImportExceptionTest() + { + $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/createMetadataImportTest'); + $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 + $formattedParent = $gapicClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $metadataImportId = 'metadataImportId-476076315'; + $metadataImport = new MetadataImport(); + $response = $gapicClient->createMetadataImport($formattedParent, $metadataImportId, $metadataImport); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createMetadataImportTest'); + 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 createServiceTest() + { + $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/createServiceTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $network = 'network1843485230'; + $endpointUri = 'endpointUri-850313278'; + $port = 3446913; + $stateMessage = 'stateMessage29641305'; + $artifactGcsUri = 'artifactGcsUri1337121495'; + $uid = 'uid115792'; + $expectedResponse = new Service(); + $expectedResponse->setName($name); + $expectedResponse->setNetwork($network); + $expectedResponse->setEndpointUri($endpointUri); + $expectedResponse->setPort($port); + $expectedResponse->setStateMessage($stateMessage); + $expectedResponse->setArtifactGcsUri($artifactGcsUri); + $expectedResponse->setUid($uid); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createServiceTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $serviceId = 'serviceId-1724763419'; + $service = new Service(); + $response = $gapicClient->createService($formattedParent, $serviceId, $service); + $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.cloud.metastore.v1alpha.DataprocMetastore/CreateService', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getServiceId(); + $this->assertProtobufEquals($serviceId, $actualValue); + $actualValue = $actualApiRequestObject->getService(); + $this->assertProtobufEquals($service, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createServiceTest'); + $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 createServiceExceptionTest() + { + $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/createServiceTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $serviceId = 'serviceId-1724763419'; + $service = new Service(); + $response = $gapicClient->createService($formattedParent, $serviceId, $service); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createServiceTest'); + 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 deleteBackupTest() + { + $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/deleteBackupTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteBackupTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->backupName('[PROJECT]', '[LOCATION]', '[SERVICE]', '[BACKUP]'); + $response = $gapicClient->deleteBackup($formattedName); + $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.cloud.metastore.v1alpha.DataprocMetastore/DeleteBackup', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteBackupTest'); + $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 deleteBackupExceptionTest() + { + $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/deleteBackupTest'); + $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->backupName('[PROJECT]', '[LOCATION]', '[SERVICE]', '[BACKUP]'); + $response = $gapicClient->deleteBackup($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteBackupTest'); + 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 deleteServiceTest() + { + $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/deleteServiceTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteServiceTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $response = $gapicClient->deleteService($formattedName); + $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.cloud.metastore.v1alpha.DataprocMetastore/DeleteService', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteServiceTest'); + $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 deleteServiceExceptionTest() + { + $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/deleteServiceTest'); + $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->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $response = $gapicClient->deleteService($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteServiceTest'); + 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 exportMetadataTest() + { + $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/exportMetadataTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $destinationGcsUri = 'destinationGcsUri1386421523'; + $expectedResponse = new MetadataExport(); + $expectedResponse->setDestinationGcsUri($destinationGcsUri); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/exportMetadataTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedService = $gapicClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $response = $gapicClient->exportMetadata($formattedService); + $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.cloud.metastore.v1alpha.DataprocMetastore/ExportMetadata', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getService(); + $this->assertProtobufEquals($formattedService, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/exportMetadataTest'); + $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 exportMetadataExceptionTest() + { + $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/exportMetadataTest'); + $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 + $formattedService = $gapicClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $response = $gapicClient->exportMetadata($formattedService); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/exportMetadataTest'); + 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 getBackupTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $description = 'description-1724546052'; + $expectedResponse = new Backup(); + $expectedResponse->setName($name2); + $expectedResponse->setDescription($description); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->backupName('[PROJECT]', '[LOCATION]', '[SERVICE]', '[BACKUP]'); + $response = $gapicClient->getBackup($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.metastore.v1alpha.DataprocMetastore/GetBackup', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getBackupExceptionTest() + { + $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->backupName('[PROJECT]', '[LOCATION]', '[SERVICE]', '[BACKUP]'); + try { + $gapicClient->getBackup($formattedName); + // 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 getMetadataImportTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $description = 'description-1724546052'; + $expectedResponse = new MetadataImport(); + $expectedResponse->setName($name2); + $expectedResponse->setDescription($description); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->metadataImportName('[PROJECT]', '[LOCATION]', '[SERVICE]', '[METADATA_IMPORT]'); + $response = $gapicClient->getMetadataImport($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.metastore.v1alpha.DataprocMetastore/GetMetadataImport', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getMetadataImportExceptionTest() + { + $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->metadataImportName('[PROJECT]', '[LOCATION]', '[SERVICE]', '[METADATA_IMPORT]'); + try { + $gapicClient->getMetadataImport($formattedName); + // 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 getServiceTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $network = 'network1843485230'; + $endpointUri = 'endpointUri-850313278'; + $port = 3446913; + $stateMessage = 'stateMessage29641305'; + $artifactGcsUri = 'artifactGcsUri1337121495'; + $uid = 'uid115792'; + $expectedResponse = new Service(); + $expectedResponse->setName($name2); + $expectedResponse->setNetwork($network); + $expectedResponse->setEndpointUri($endpointUri); + $expectedResponse->setPort($port); + $expectedResponse->setStateMessage($stateMessage); + $expectedResponse->setArtifactGcsUri($artifactGcsUri); + $expectedResponse->setUid($uid); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $response = $gapicClient->getService($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.metastore.v1alpha.DataprocMetastore/GetService', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getServiceExceptionTest() + { + $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->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + try { + $gapicClient->getService($formattedName); + // 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 listBackupsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $backupsElement = new Backup(); + $backups = [ + $backupsElement, + ]; + $expectedResponse = new ListBackupsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setBackups($backups); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $response = $gapicClient->listBackups($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getBackups()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.metastore.v1alpha.DataprocMetastore/ListBackups', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listBackupsExceptionTest() + { + $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->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + try { + $gapicClient->listBackups($formattedParent); + // 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 listMetadataImportsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $metadataImportsElement = new MetadataImport(); + $metadataImports = [ + $metadataImportsElement, + ]; + $expectedResponse = new ListMetadataImportsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setMetadataImports($metadataImports); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $response = $gapicClient->listMetadataImports($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getMetadataImports()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.metastore.v1alpha.DataprocMetastore/ListMetadataImports', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listMetadataImportsExceptionTest() + { + $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->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + try { + $gapicClient->listMetadataImports($formattedParent); + // 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 listServicesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $servicesElement = new Service(); + $services = [ + $servicesElement, + ]; + $expectedResponse = new ListServicesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setServices($services); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->listServices($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getServices()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.metastore.v1alpha.DataprocMetastore/ListServices', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listServicesExceptionTest() + { + $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->locationName('[PROJECT]', '[LOCATION]'); + try { + $gapicClient->listServices($formattedParent); + // 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 moveTableToDatabaseTest() + { + $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/moveTableToDatabaseTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new MoveTableToDatabaseResponse(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/moveTableToDatabaseTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedService = $gapicClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $tableName = 'tableName-1504630692'; + $dbName = 'dbName1452819884'; + $destinationDbName = 'destinationDbName-1322761605'; + $response = $gapicClient->moveTableToDatabase($formattedService, $tableName, $dbName, $destinationDbName); + $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.cloud.metastore.v1alpha.DataprocMetastore/MoveTableToDatabase', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getService(); + $this->assertProtobufEquals($formattedService, $actualValue); + $actualValue = $actualApiRequestObject->getTableName(); + $this->assertProtobufEquals($tableName, $actualValue); + $actualValue = $actualApiRequestObject->getDbName(); + $this->assertProtobufEquals($dbName, $actualValue); + $actualValue = $actualApiRequestObject->getDestinationDbName(); + $this->assertProtobufEquals($destinationDbName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/moveTableToDatabaseTest'); + $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 moveTableToDatabaseExceptionTest() + { + $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/moveTableToDatabaseTest'); + $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 + $formattedService = $gapicClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $tableName = 'tableName-1504630692'; + $dbName = 'dbName1452819884'; + $destinationDbName = 'destinationDbName-1322761605'; + $response = $gapicClient->moveTableToDatabase($formattedService, $tableName, $dbName, $destinationDbName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/moveTableToDatabaseTest'); + 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 queryMetadataTest() + { + $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/queryMetadataTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $resultManifestUri = 'resultManifestUri-1050940354'; + $expectedResponse = new QueryMetadataResponse(); + $expectedResponse->setResultManifestUri($resultManifestUri); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/queryMetadataTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedService = $gapicClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $query = 'query107944136'; + $response = $gapicClient->queryMetadata($formattedService, $query); + $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.cloud.metastore.v1alpha.DataprocMetastore/QueryMetadata', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getService(); + $this->assertProtobufEquals($formattedService, $actualValue); + $actualValue = $actualApiRequestObject->getQuery(); + $this->assertProtobufEquals($query, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/queryMetadataTest'); + $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 queryMetadataExceptionTest() + { + $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/queryMetadataTest'); + $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 + $formattedService = $gapicClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $query = 'query107944136'; + $response = $gapicClient->queryMetadata($formattedService, $query); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/queryMetadataTest'); + 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 removeIamPolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $success = false; + $expectedResponse = new RemoveIamPolicyResponse(); + $expectedResponse->setSuccess($success); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $response = $gapicClient->removeIamPolicy($resource); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.metastore.v1alpha.DataprocMetastore/RemoveIamPolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function removeIamPolicyExceptionTest() + { + $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 + $resource = 'resource-341064690'; + try { + $gapicClient->removeIamPolicy($resource); + // 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 restoreServiceTest() + { + $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/restoreServiceTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $backup2 = 'backup22121930997'; + $details = 'details1557721666'; + $expectedResponse = new Restore(); + $expectedResponse->setBackup($backup2); + $expectedResponse->setDetails($details); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/restoreServiceTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedService = $gapicClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $formattedBackup = $gapicClient->backupName('[PROJECT]', '[LOCATION]', '[SERVICE]', '[BACKUP]'); + $response = $gapicClient->restoreService($formattedService, $formattedBackup); + $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.cloud.metastore.v1alpha.DataprocMetastore/RestoreService', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getService(); + $this->assertProtobufEquals($formattedService, $actualValue); + $actualValue = $actualApiRequestObject->getBackup(); + $this->assertProtobufEquals($formattedBackup, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/restoreServiceTest'); + $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 restoreServiceExceptionTest() + { + $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/restoreServiceTest'); + $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 + $formattedService = $gapicClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $formattedBackup = $gapicClient->backupName('[PROJECT]', '[LOCATION]', '[SERVICE]', '[BACKUP]'); + $response = $gapicClient->restoreService($formattedService, $formattedBackup); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/restoreServiceTest'); + 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 updateMetadataImportTest() + { + $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/updateMetadataImportTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $expectedResponse = new MetadataImport(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateMetadataImportTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $updateMask = new FieldMask(); + $metadataImport = new MetadataImport(); + $response = $gapicClient->updateMetadataImport($updateMask, $metadataImport); + $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.cloud.metastore.v1alpha.DataprocMetastore/UpdateMetadataImport', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $actualValue = $actualApiRequestObject->getMetadataImport(); + $this->assertProtobufEquals($metadataImport, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateMetadataImportTest'); + $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 updateMetadataImportExceptionTest() + { + $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/updateMetadataImportTest'); + $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 + $updateMask = new FieldMask(); + $metadataImport = new MetadataImport(); + $response = $gapicClient->updateMetadataImport($updateMask, $metadataImport); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateMetadataImportTest'); + 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 updateServiceTest() + { + $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/updateServiceTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $network = 'network1843485230'; + $endpointUri = 'endpointUri-850313278'; + $port = 3446913; + $stateMessage = 'stateMessage29641305'; + $artifactGcsUri = 'artifactGcsUri1337121495'; + $uid = 'uid115792'; + $expectedResponse = new Service(); + $expectedResponse->setName($name); + $expectedResponse->setNetwork($network); + $expectedResponse->setEndpointUri($endpointUri); + $expectedResponse->setPort($port); + $expectedResponse->setStateMessage($stateMessage); + $expectedResponse->setArtifactGcsUri($artifactGcsUri); + $expectedResponse->setUid($uid); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateServiceTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $updateMask = new FieldMask(); + $service = new Service(); + $response = $gapicClient->updateService($updateMask, $service); + $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.cloud.metastore.v1alpha.DataprocMetastore/UpdateService', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $actualValue = $actualApiRequestObject->getService(); + $this->assertProtobufEquals($service, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateServiceTest'); + $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 updateServiceExceptionTest() + { + $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/updateServiceTest'); + $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 + $updateMask = new FieldMask(); + $service = new Service(); + $response = $gapicClient->updateService($updateMask, $service); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateServiceTest'); + 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 getLocationTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $locationId = 'locationId552319461'; + $displayName = 'displayName1615086568'; + $expectedResponse = new Location(); + $expectedResponse->setName($name2); + $expectedResponse->setLocationId($locationId); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + $response = $gapicClient->getLocation(); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/GetLocation', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getLocationExceptionTest() + { + $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); + try { + $gapicClient->getLocation(); + // 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 listLocationsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $locationsElement = new Location(); + $locations = [ + $locationsElement, + ]; + $expectedResponse = new ListLocationsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setLocations($locations); + $transport->addResponse($expectedResponse); + $response = $gapicClient->listLocations(); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getLocations()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/ListLocations', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listLocationsExceptionTest() + { + $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); + try { + $gapicClient->listLocations(); + // 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 getIamPolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $version = 351608024; + $etag = '21'; + $expectedResponse = new Policy(); + $expectedResponse->setVersion($version); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $response = $gapicClient->getIamPolicy($resource); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.iam.v1.IAMPolicy/GetIamPolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getIamPolicyExceptionTest() + { + $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 + $resource = 'resource-341064690'; + try { + $gapicClient->getIamPolicy($resource); + // 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 setIamPolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $version = 351608024; + $etag = '21'; + $expectedResponse = new Policy(); + $expectedResponse->setVersion($version); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $policy = new Policy(); + $response = $gapicClient->setIamPolicy($resource, $policy); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.iam.v1.IAMPolicy/SetIamPolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $actualValue = $actualRequestObject->getPolicy(); + $this->assertProtobufEquals($policy, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function setIamPolicyExceptionTest() + { + $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 + $resource = 'resource-341064690'; + $policy = new Policy(); + try { + $gapicClient->setIamPolicy($resource, $policy); + // 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 testIamPermissionsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new TestIamPermissionsResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $permissions = []; + $response = $gapicClient->testIamPermissions($resource, $permissions); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.iam.v1.IAMPolicy/TestIamPermissions', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $actualValue = $actualRequestObject->getPermissions(); + $this->assertProtobufEquals($permissions, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function testIamPermissionsExceptionTest() + { + $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 + $resource = 'resource-341064690'; + $permissions = []; + try { + $gapicClient->testIamPermissions($resource, $permissions); + // 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()); + } +} diff --git a/owl-bot-staging/DataprocMetastore/v1alpha/tests/Unit/V1alpha/DataprocMetastoreFederationClientTest.php b/owl-bot-staging/DataprocMetastore/v1alpha/tests/Unit/V1alpha/DataprocMetastoreFederationClientTest.php new file mode 100644 index 000000000000..88348d6e8e58 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1alpha/tests/Unit/V1alpha/DataprocMetastoreFederationClientTest.php @@ -0,0 +1,901 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return DataprocMetastoreFederationClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new DataprocMetastoreFederationClient($options); + } + + /** @test */ + public function createFederationTest() + { + $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/createFederationTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $version = 'version351608024'; + $endpointUri = 'endpointUri-850313278'; + $stateMessage = 'stateMessage29641305'; + $uid = 'uid115792'; + $expectedResponse = new Federation(); + $expectedResponse->setName($name); + $expectedResponse->setVersion($version); + $expectedResponse->setEndpointUri($endpointUri); + $expectedResponse->setStateMessage($stateMessage); + $expectedResponse->setUid($uid); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createFederationTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $federationId = 'federationId-1338699881'; + $federation = new Federation(); + $response = $gapicClient->createFederation($formattedParent, $federationId, $federation); + $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.cloud.metastore.v1alpha.DataprocMetastoreFederation/CreateFederation', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getFederationId(); + $this->assertProtobufEquals($federationId, $actualValue); + $actualValue = $actualApiRequestObject->getFederation(); + $this->assertProtobufEquals($federation, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createFederationTest'); + $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 createFederationExceptionTest() + { + $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/createFederationTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $federationId = 'federationId-1338699881'; + $federation = new Federation(); + $response = $gapicClient->createFederation($formattedParent, $federationId, $federation); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createFederationTest'); + 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 deleteFederationTest() + { + $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/deleteFederationTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteFederationTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->federationName('[PROJECT]', '[LOCATION]', '[FEDERATION]'); + $response = $gapicClient->deleteFederation($formattedName); + $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.cloud.metastore.v1alpha.DataprocMetastoreFederation/DeleteFederation', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteFederationTest'); + $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 deleteFederationExceptionTest() + { + $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/deleteFederationTest'); + $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->federationName('[PROJECT]', '[LOCATION]', '[FEDERATION]'); + $response = $gapicClient->deleteFederation($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteFederationTest'); + 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 getFederationTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $version = 'version351608024'; + $endpointUri = 'endpointUri-850313278'; + $stateMessage = 'stateMessage29641305'; + $uid = 'uid115792'; + $expectedResponse = new Federation(); + $expectedResponse->setName($name2); + $expectedResponse->setVersion($version); + $expectedResponse->setEndpointUri($endpointUri); + $expectedResponse->setStateMessage($stateMessage); + $expectedResponse->setUid($uid); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->federationName('[PROJECT]', '[LOCATION]', '[FEDERATION]'); + $response = $gapicClient->getFederation($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.metastore.v1alpha.DataprocMetastoreFederation/GetFederation', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getFederationExceptionTest() + { + $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->federationName('[PROJECT]', '[LOCATION]', '[FEDERATION]'); + try { + $gapicClient->getFederation($formattedName); + // 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 listFederationsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $federationsElement = new Federation(); + $federations = [ + $federationsElement, + ]; + $expectedResponse = new ListFederationsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setFederations($federations); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->listFederations($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getFederations()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.metastore.v1alpha.DataprocMetastoreFederation/ListFederations', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listFederationsExceptionTest() + { + $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->locationName('[PROJECT]', '[LOCATION]'); + try { + $gapicClient->listFederations($formattedParent); + // 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 updateFederationTest() + { + $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/updateFederationTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $version = 'version351608024'; + $endpointUri = 'endpointUri-850313278'; + $stateMessage = 'stateMessage29641305'; + $uid = 'uid115792'; + $expectedResponse = new Federation(); + $expectedResponse->setName($name); + $expectedResponse->setVersion($version); + $expectedResponse->setEndpointUri($endpointUri); + $expectedResponse->setStateMessage($stateMessage); + $expectedResponse->setUid($uid); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateFederationTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $updateMask = new FieldMask(); + $federation = new Federation(); + $response = $gapicClient->updateFederation($updateMask, $federation); + $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.cloud.metastore.v1alpha.DataprocMetastoreFederation/UpdateFederation', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $actualValue = $actualApiRequestObject->getFederation(); + $this->assertProtobufEquals($federation, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateFederationTest'); + $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 updateFederationExceptionTest() + { + $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/updateFederationTest'); + $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 + $updateMask = new FieldMask(); + $federation = new Federation(); + $response = $gapicClient->updateFederation($updateMask, $federation); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateFederationTest'); + 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 getLocationTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $locationId = 'locationId552319461'; + $displayName = 'displayName1615086568'; + $expectedResponse = new Location(); + $expectedResponse->setName($name2); + $expectedResponse->setLocationId($locationId); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + $response = $gapicClient->getLocation(); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/GetLocation', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getLocationExceptionTest() + { + $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); + try { + $gapicClient->getLocation(); + // 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 listLocationsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $locationsElement = new Location(); + $locations = [ + $locationsElement, + ]; + $expectedResponse = new ListLocationsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setLocations($locations); + $transport->addResponse($expectedResponse); + $response = $gapicClient->listLocations(); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getLocations()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/ListLocations', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listLocationsExceptionTest() + { + $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); + try { + $gapicClient->listLocations(); + // 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 getIamPolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $version = 351608024; + $etag = '21'; + $expectedResponse = new Policy(); + $expectedResponse->setVersion($version); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $response = $gapicClient->getIamPolicy($resource); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.iam.v1.IAMPolicy/GetIamPolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getIamPolicyExceptionTest() + { + $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 + $resource = 'resource-341064690'; + try { + $gapicClient->getIamPolicy($resource); + // 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 setIamPolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $version = 351608024; + $etag = '21'; + $expectedResponse = new Policy(); + $expectedResponse->setVersion($version); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $policy = new Policy(); + $response = $gapicClient->setIamPolicy($resource, $policy); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.iam.v1.IAMPolicy/SetIamPolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $actualValue = $actualRequestObject->getPolicy(); + $this->assertProtobufEquals($policy, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function setIamPolicyExceptionTest() + { + $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 + $resource = 'resource-341064690'; + $policy = new Policy(); + try { + $gapicClient->setIamPolicy($resource, $policy); + // 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 testIamPermissionsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new TestIamPermissionsResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $permissions = []; + $response = $gapicClient->testIamPermissions($resource, $permissions); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.iam.v1.IAMPolicy/TestIamPermissions', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $actualValue = $actualRequestObject->getPermissions(); + $this->assertProtobufEquals($permissions, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function testIamPermissionsExceptionTest() + { + $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 + $resource = 'resource-341064690'; + $permissions = []; + try { + $gapicClient->testIamPermissions($resource, $permissions); + // 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()); + } +} diff --git a/owl-bot-staging/DataprocMetastore/v1beta/proto/src/GPBMetadata/Google/Cloud/Metastore/V1Beta/Metastore.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/GPBMetadata/Google/Cloud/Metastore/V1Beta/Metastore.php new file mode 100644 index 000000000000..6d7f8a0d6dad Binary files /dev/null and b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/GPBMetadata/Google/Cloud/Metastore/V1Beta/Metastore.php differ diff --git a/owl-bot-staging/DataprocMetastore/v1beta/proto/src/GPBMetadata/Google/Cloud/Metastore/V1Beta/MetastoreFederation.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/GPBMetadata/Google/Cloud/Metastore/V1Beta/MetastoreFederation.php new file mode 100644 index 000000000000..87fc10e1c67a Binary files /dev/null and b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/GPBMetadata/Google/Cloud/Metastore/V1Beta/MetastoreFederation.php differ diff --git a/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/AlterMetadataResourceLocationRequest.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/AlterMetadataResourceLocationRequest.php new file mode 100644 index 000000000000..fc849cb388b1 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/AlterMetadataResourceLocationRequest.php @@ -0,0 +1,164 @@ +google.cloud.metastore.v1beta.AlterMetadataResourceLocationRequest + */ +class AlterMetadataResourceLocationRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The relative resource name of the metastore service to mutate + * metadata, in the following format: + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * + * Generated from protobuf field string service = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $service = ''; + /** + * Required. The relative metadata resource name in the following format. + * `databases/{database_id}` + * or + * `databases/{database_id}/tables/{table_id}` + * or + * `databases/{database_id}/tables/{table_id}/partitions/{partition_id}` + * + * Generated from protobuf field string resource_name = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $resource_name = ''; + /** + * Required. The new location URI for the metadata resource. + * + * Generated from protobuf field string location_uri = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $location_uri = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $service + * Required. The relative resource name of the metastore service to mutate + * metadata, in the following format: + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * @type string $resource_name + * Required. The relative metadata resource name in the following format. + * `databases/{database_id}` + * or + * `databases/{database_id}/tables/{table_id}` + * or + * `databases/{database_id}/tables/{table_id}/partitions/{partition_id}` + * @type string $location_uri + * Required. The new location URI for the metadata resource. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Beta\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Required. The relative resource name of the metastore service to mutate + * metadata, in the following format: + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * + * Generated from protobuf field string service = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getService() + { + return $this->service; + } + + /** + * Required. The relative resource name of the metastore service to mutate + * metadata, in the following format: + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * + * Generated from protobuf field string service = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setService($var) + { + GPBUtil::checkString($var, True); + $this->service = $var; + + return $this; + } + + /** + * Required. The relative metadata resource name in the following format. + * `databases/{database_id}` + * or + * `databases/{database_id}/tables/{table_id}` + * or + * `databases/{database_id}/tables/{table_id}/partitions/{partition_id}` + * + * Generated from protobuf field string resource_name = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getResourceName() + { + return $this->resource_name; + } + + /** + * Required. The relative metadata resource name in the following format. + * `databases/{database_id}` + * or + * `databases/{database_id}/tables/{table_id}` + * or + * `databases/{database_id}/tables/{table_id}/partitions/{partition_id}` + * + * Generated from protobuf field string resource_name = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setResourceName($var) + { + GPBUtil::checkString($var, True); + $this->resource_name = $var; + + return $this; + } + + /** + * Required. The new location URI for the metadata resource. + * + * Generated from protobuf field string location_uri = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getLocationUri() + { + return $this->location_uri; + } + + /** + * Required. The new location URI for the metadata resource. + * + * Generated from protobuf field string location_uri = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setLocationUri($var) + { + GPBUtil::checkString($var, True); + $this->location_uri = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/AlterMetadataResourceLocationResponse.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/AlterMetadataResourceLocationResponse.php new file mode 100644 index 000000000000..03eec5061def --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/AlterMetadataResourceLocationResponse.php @@ -0,0 +1,34 @@ +google.cloud.metastore.v1beta.AlterMetadataResourceLocationResponse + */ +class AlterMetadataResourceLocationResponse extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Beta\Metastore::initOnce(); + parent::__construct($data); + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/AuxiliaryVersionConfig.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/AuxiliaryVersionConfig.php new file mode 100644 index 000000000000..968460eae50e --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/AuxiliaryVersionConfig.php @@ -0,0 +1,169 @@ +google.cloud.metastore.v1beta.AuxiliaryVersionConfig + */ +class AuxiliaryVersionConfig extends \Google\Protobuf\Internal\Message +{ + /** + * The Hive metastore version of the auxiliary service. It must be less + * than the primary Hive metastore service's version. + * + * Generated from protobuf field string version = 1; + */ + protected $version = ''; + /** + * A mapping of Hive metastore configuration key-value pairs to apply to the + * auxiliary Hive metastore (configured in `hive-site.xml`) in addition to + * the primary version's overrides. If keys are present in both the auxiliary + * version's overrides and the primary version's overrides, the value from + * the auxiliary version's overrides takes precedence. + * + * Generated from protobuf field map config_overrides = 2; + */ + private $config_overrides; + /** + * Output only. The network configuration contains the endpoint URI(s) of the + * auxiliary Hive metastore service. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.NetworkConfig network_config = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $network_config = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $version + * The Hive metastore version of the auxiliary service. It must be less + * than the primary Hive metastore service's version. + * @type array|\Google\Protobuf\Internal\MapField $config_overrides + * A mapping of Hive metastore configuration key-value pairs to apply to the + * auxiliary Hive metastore (configured in `hive-site.xml`) in addition to + * the primary version's overrides. If keys are present in both the auxiliary + * version's overrides and the primary version's overrides, the value from + * the auxiliary version's overrides takes precedence. + * @type \Google\Cloud\Metastore\V1beta\NetworkConfig $network_config + * Output only. The network configuration contains the endpoint URI(s) of the + * auxiliary Hive metastore service. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Beta\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * The Hive metastore version of the auxiliary service. It must be less + * than the primary Hive metastore service's version. + * + * Generated from protobuf field string version = 1; + * @return string + */ + public function getVersion() + { + return $this->version; + } + + /** + * The Hive metastore version of the auxiliary service. It must be less + * than the primary Hive metastore service's version. + * + * Generated from protobuf field string version = 1; + * @param string $var + * @return $this + */ + public function setVersion($var) + { + GPBUtil::checkString($var, True); + $this->version = $var; + + return $this; + } + + /** + * A mapping of Hive metastore configuration key-value pairs to apply to the + * auxiliary Hive metastore (configured in `hive-site.xml`) in addition to + * the primary version's overrides. If keys are present in both the auxiliary + * version's overrides and the primary version's overrides, the value from + * the auxiliary version's overrides takes precedence. + * + * Generated from protobuf field map config_overrides = 2; + * @return \Google\Protobuf\Internal\MapField + */ + public function getConfigOverrides() + { + return $this->config_overrides; + } + + /** + * A mapping of Hive metastore configuration key-value pairs to apply to the + * auxiliary Hive metastore (configured in `hive-site.xml`) in addition to + * the primary version's overrides. If keys are present in both the auxiliary + * version's overrides and the primary version's overrides, the value from + * the auxiliary version's overrides takes precedence. + * + * Generated from protobuf field map config_overrides = 2; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setConfigOverrides($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->config_overrides = $arr; + + return $this; + } + + /** + * Output only. The network configuration contains the endpoint URI(s) of the + * auxiliary Hive metastore service. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.NetworkConfig network_config = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\Metastore\V1beta\NetworkConfig|null + */ + public function getNetworkConfig() + { + return $this->network_config; + } + + public function hasNetworkConfig() + { + return isset($this->network_config); + } + + public function clearNetworkConfig() + { + unset($this->network_config); + } + + /** + * Output only. The network configuration contains the endpoint URI(s) of the + * auxiliary Hive metastore service. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.NetworkConfig network_config = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\Metastore\V1beta\NetworkConfig $var + * @return $this + */ + public function setNetworkConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Metastore\V1beta\NetworkConfig::class); + $this->network_config = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/BackendMetastore.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/BackendMetastore.php new file mode 100644 index 000000000000..6b4bff0e5194 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/BackendMetastore.php @@ -0,0 +1,125 @@ +google.cloud.metastore.v1beta.BackendMetastore + */ +class BackendMetastore extends \Google\Protobuf\Internal\Message +{ + /** + * The relative resource name of the metastore that is being federated. + * The formats of the relative resource names for the currently supported + * metastores are listed below: + * * BigQuery + * * `projects/{project_id}` + * * Dataproc Metastore + * * `projects/{project_id}/locations/{location}/services/{service_id}` + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * The type of the backend metastore. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.BackendMetastore.MetastoreType metastore_type = 2; + */ + protected $metastore_type = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The relative resource name of the metastore that is being federated. + * The formats of the relative resource names for the currently supported + * metastores are listed below: + * * BigQuery + * * `projects/{project_id}` + * * Dataproc Metastore + * * `projects/{project_id}/locations/{location}/services/{service_id}` + * @type int $metastore_type + * The type of the backend metastore. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Beta\MetastoreFederation::initOnce(); + parent::__construct($data); + } + + /** + * The relative resource name of the metastore that is being federated. + * The formats of the relative resource names for the currently supported + * metastores are listed below: + * * BigQuery + * * `projects/{project_id}` + * * Dataproc Metastore + * * `projects/{project_id}/locations/{location}/services/{service_id}` + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The relative resource name of the metastore that is being federated. + * The formats of the relative resource names for the currently supported + * metastores are listed below: + * * BigQuery + * * `projects/{project_id}` + * * Dataproc Metastore + * * `projects/{project_id}/locations/{location}/services/{service_id}` + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The type of the backend metastore. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.BackendMetastore.MetastoreType metastore_type = 2; + * @return int + */ + public function getMetastoreType() + { + return $this->metastore_type; + } + + /** + * The type of the backend metastore. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.BackendMetastore.MetastoreType metastore_type = 2; + * @param int $var + * @return $this + */ + public function setMetastoreType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Metastore\V1beta\BackendMetastore\MetastoreType::class); + $this->metastore_type = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/BackendMetastore/MetastoreType.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/BackendMetastore/MetastoreType.php new file mode 100644 index 000000000000..4f52e47ec7df --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/BackendMetastore/MetastoreType.php @@ -0,0 +1,71 @@ +google.cloud.metastore.v1beta.BackendMetastore.MetastoreType + */ +class MetastoreType +{ + /** + * The metastore type is not set. + * + * Generated from protobuf enum METASTORE_TYPE_UNSPECIFIED = 0; + */ + const METASTORE_TYPE_UNSPECIFIED = 0; + /** + * The backend metastore is Dataplex. + * + * Generated from protobuf enum DATAPLEX = 1; + */ + const DATAPLEX = 1; + /** + * The backend metastore is BigQuery. + * + * Generated from protobuf enum BIGQUERY = 2; + */ + const BIGQUERY = 2; + /** + * The backend metastore is Dataproc Metastore. + * + * Generated from protobuf enum DATAPROC_METASTORE = 3; + */ + const DATAPROC_METASTORE = 3; + + private static $valueToName = [ + self::METASTORE_TYPE_UNSPECIFIED => 'METASTORE_TYPE_UNSPECIFIED', + self::DATAPLEX => 'DATAPLEX', + self::BIGQUERY => 'BIGQUERY', + self::DATAPROC_METASTORE => 'DATAPROC_METASTORE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(MetastoreType::class, \Google\Cloud\Metastore\V1beta\BackendMetastore_MetastoreType::class); + diff --git a/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/BackendMetastore_MetastoreType.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/BackendMetastore_MetastoreType.php new file mode 100644 index 000000000000..2bfb08dc8b6b --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/BackendMetastore_MetastoreType.php @@ -0,0 +1,16 @@ +google.cloud.metastore.v1beta.Backup + */ +class Backup extends \Google\Protobuf\Internal\Message +{ + /** + * Immutable. The relative resource name of the backup, in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + */ + protected $name = ''; + /** + * Output only. The time when the backup was started. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. The time when the backup finished creating. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $end_time = null; + /** + * Output only. The current state of the backup. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.Backup.State state = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Output only. The revision of the service at the time of backup. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.Service service_revision = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $service_revision = null; + /** + * The description of the backup. + * + * Generated from protobuf field string description = 6; + */ + protected $description = ''; + /** + * Output only. Services that are restoring from the backup. + * + * Generated from protobuf field repeated string restoring_services = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $restoring_services; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Immutable. The relative resource name of the backup, in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}` + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The time when the backup was started. + * @type \Google\Protobuf\Timestamp $end_time + * Output only. The time when the backup finished creating. + * @type int $state + * Output only. The current state of the backup. + * @type \Google\Cloud\Metastore\V1beta\Service $service_revision + * Output only. The revision of the service at the time of backup. + * @type string $description + * The description of the backup. + * @type array|\Google\Protobuf\Internal\RepeatedField $restoring_services + * Output only. Services that are restoring from the backup. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Beta\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Immutable. The relative resource name of the backup, in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Immutable. The relative resource name of the backup, in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. The time when the backup was started. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.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 when the backup was started. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.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 when the backup finished creating. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 3 [(.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 when the backup finished creating. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 3 [(.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 current state of the backup. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.Backup.State state = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. The current state of the backup. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.Backup.State state = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Metastore\V1beta\Backup\State::class); + $this->state = $var; + + return $this; + } + + /** + * Output only. The revision of the service at the time of backup. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.Service service_revision = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\Metastore\V1beta\Service|null + */ + public function getServiceRevision() + { + return $this->service_revision; + } + + public function hasServiceRevision() + { + return isset($this->service_revision); + } + + public function clearServiceRevision() + { + unset($this->service_revision); + } + + /** + * Output only. The revision of the service at the time of backup. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.Service service_revision = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\Metastore\V1beta\Service $var + * @return $this + */ + public function setServiceRevision($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Metastore\V1beta\Service::class); + $this->service_revision = $var; + + return $this; + } + + /** + * The description of the backup. + * + * Generated from protobuf field string description = 6; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * The description of the backup. + * + * Generated from protobuf field string description = 6; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * Output only. Services that are restoring from the backup. + * + * Generated from protobuf field repeated string restoring_services = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRestoringServices() + { + return $this->restoring_services; + } + + /** + * Output only. Services that are restoring from the backup. + * + * Generated from protobuf field repeated string restoring_services = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRestoringServices($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->restoring_services = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/Backup/State.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/Backup/State.php new file mode 100644 index 000000000000..b66b7d93284c --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/Backup/State.php @@ -0,0 +1,85 @@ +google.cloud.metastore.v1beta.Backup.State + */ +class State +{ + /** + * The state of the backup is unknown. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The backup is being created. + * + * Generated from protobuf enum CREATING = 1; + */ + const CREATING = 1; + /** + * The backup is being deleted. + * + * Generated from protobuf enum DELETING = 2; + */ + const DELETING = 2; + /** + * The backup is active and ready to use. + * + * Generated from protobuf enum ACTIVE = 3; + */ + const ACTIVE = 3; + /** + * The backup failed. + * + * Generated from protobuf enum FAILED = 4; + */ + const FAILED = 4; + /** + * The backup is being restored. + * + * Generated from protobuf enum RESTORING = 5; + */ + const RESTORING = 5; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::CREATING => 'CREATING', + self::DELETING => 'DELETING', + self::ACTIVE => 'ACTIVE', + self::FAILED => 'FAILED', + self::RESTORING => 'RESTORING', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\Metastore\V1beta\Backup_State::class); + diff --git a/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/Backup_State.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/Backup_State.php new file mode 100644 index 000000000000..1c1b9cc5c689 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/Backup_State.php @@ -0,0 +1,16 @@ +google.cloud.metastore.v1beta.CreateBackupRequest + */ +class CreateBackupRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The relative resource name of the service in which to create a + * backup of the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The ID of the backup, which is used as the final component of the + * backup's name. + * This value must be between 1 and 64 characters long, begin with a letter, + * end with a letter or number, and consist of alpha-numeric ASCII characters + * or hyphens. + * + * Generated from protobuf field string backup_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $backup_id = ''; + /** + * Required. The backup to create. The `name` field is ignored. The ID of the + * created backup must be provided in the request's `backup_id` field. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.Backup backup = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $backup = null; + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The relative resource name of the service in which to create a + * backup of the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * @type string $backup_id + * Required. The ID of the backup, which is used as the final component of the + * backup's name. + * This value must be between 1 and 64 characters long, begin with a letter, + * end with a letter or number, and consist of alpha-numeric ASCII characters + * or hyphens. + * @type \Google\Cloud\Metastore\V1beta\Backup $backup + * Required. The backup to create. The `name` field is ignored. The ID of the + * created backup must be provided in the request's `backup_id` field. + * @type string $request_id + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Beta\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Required. The relative resource name of the service in which to create a + * backup of the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * + * 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. The relative resource name of the service in which to create a + * backup of the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * + * 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. The ID of the backup, which is used as the final component of the + * backup's name. + * This value must be between 1 and 64 characters long, begin with a letter, + * end with a letter or number, and consist of alpha-numeric ASCII characters + * or hyphens. + * + * Generated from protobuf field string backup_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getBackupId() + { + return $this->backup_id; + } + + /** + * Required. The ID of the backup, which is used as the final component of the + * backup's name. + * This value must be between 1 and 64 characters long, begin with a letter, + * end with a letter or number, and consist of alpha-numeric ASCII characters + * or hyphens. + * + * Generated from protobuf field string backup_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setBackupId($var) + { + GPBUtil::checkString($var, True); + $this->backup_id = $var; + + return $this; + } + + /** + * Required. The backup to create. The `name` field is ignored. The ID of the + * created backup must be provided in the request's `backup_id` field. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.Backup backup = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Metastore\V1beta\Backup|null + */ + public function getBackup() + { + return $this->backup; + } + + public function hasBackup() + { + return isset($this->backup); + } + + public function clearBackup() + { + unset($this->backup); + } + + /** + * Required. The backup to create. The `name` field is ignored. The ID of the + * created backup must be provided in the request's `backup_id` field. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.Backup backup = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Metastore\V1beta\Backup $var + * @return $this + */ + public function setBackup($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Metastore\V1beta\Backup::class); + $this->backup = $var; + + return $this; + } + + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @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/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/CreateFederationRequest.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/CreateFederationRequest.php new file mode 100644 index 000000000000..bbc27b9a9cb9 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/CreateFederationRequest.php @@ -0,0 +1,247 @@ +google.cloud.metastore.v1beta.CreateFederationRequest + */ +class CreateFederationRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The relative resource name of the location in which to create a + * federation service, in the following form: + * `projects/{project_number}/locations/{location_id}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The ID of the metastore federation, which is used as the final + * component of the metastore federation's name. + * This value must be between 2 and 63 characters long inclusive, begin with a + * letter, end with a letter or number, and consist of alpha-numeric + * ASCII characters or hyphens. + * + * Generated from protobuf field string federation_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $federation_id = ''; + /** + * Required. The Metastore Federation to create. The `name` field is + * ignored. The ID of the created metastore federation must be + * provided in the request's `federation_id` field. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.Federation federation = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $federation = null; + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The relative resource name of the location in which to create a + * federation service, in the following form: + * `projects/{project_number}/locations/{location_id}`. + * @type string $federation_id + * Required. The ID of the metastore federation, which is used as the final + * component of the metastore federation's name. + * This value must be between 2 and 63 characters long inclusive, begin with a + * letter, end with a letter or number, and consist of alpha-numeric + * ASCII characters or hyphens. + * @type \Google\Cloud\Metastore\V1beta\Federation $federation + * Required. The Metastore Federation to create. The `name` field is + * ignored. The ID of the created metastore federation must be + * provided in the request's `federation_id` field. + * @type string $request_id + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Beta\MetastoreFederation::initOnce(); + parent::__construct($data); + } + + /** + * Required. The relative resource name of the location in which to create a + * federation service, in the following form: + * `projects/{project_number}/locations/{location_id}`. + * + * 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. The relative resource name of the location in which to create a + * federation service, in the following form: + * `projects/{project_number}/locations/{location_id}`. + * + * 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. The ID of the metastore federation, which is used as the final + * component of the metastore federation's name. + * This value must be between 2 and 63 characters long inclusive, begin with a + * letter, end with a letter or number, and consist of alpha-numeric + * ASCII characters or hyphens. + * + * Generated from protobuf field string federation_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getFederationId() + { + return $this->federation_id; + } + + /** + * Required. The ID of the metastore federation, which is used as the final + * component of the metastore federation's name. + * This value must be between 2 and 63 characters long inclusive, begin with a + * letter, end with a letter or number, and consist of alpha-numeric + * ASCII characters or hyphens. + * + * Generated from protobuf field string federation_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setFederationId($var) + { + GPBUtil::checkString($var, True); + $this->federation_id = $var; + + return $this; + } + + /** + * Required. The Metastore Federation to create. The `name` field is + * ignored. The ID of the created metastore federation must be + * provided in the request's `federation_id` field. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.Federation federation = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Metastore\V1beta\Federation|null + */ + public function getFederation() + { + return $this->federation; + } + + public function hasFederation() + { + return isset($this->federation); + } + + public function clearFederation() + { + unset($this->federation); + } + + /** + * Required. The Metastore Federation to create. The `name` field is + * ignored. The ID of the created metastore federation must be + * provided in the request's `federation_id` field. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.Federation federation = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Metastore\V1beta\Federation $var + * @return $this + */ + public function setFederation($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Metastore\V1beta\Federation::class); + $this->federation = $var; + + return $this; + } + + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @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/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/CreateMetadataImportRequest.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/CreateMetadataImportRequest.php new file mode 100644 index 000000000000..0b854d8101a3 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/CreateMetadataImportRequest.php @@ -0,0 +1,248 @@ +google.cloud.metastore.v1beta.CreateMetadataImportRequest + */ +class CreateMetadataImportRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The relative resource name of the service in which to create a + * metastore import, in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The ID of the metadata import, which is used as the final + * component of the metadata import's name. + * This value must be between 1 and 64 characters long, begin with a letter, + * end with a letter or number, and consist of alpha-numeric ASCII characters + * or hyphens. + * + * Generated from protobuf field string metadata_import_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $metadata_import_id = ''; + /** + * Required. The metadata import to create. The `name` field is ignored. The + * ID of the created metadata import must be provided in the request's + * `metadata_import_id` field. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.MetadataImport metadata_import = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $metadata_import = null; + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The relative resource name of the service in which to create a + * metastore import, in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * @type string $metadata_import_id + * Required. The ID of the metadata import, which is used as the final + * component of the metadata import's name. + * This value must be between 1 and 64 characters long, begin with a letter, + * end with a letter or number, and consist of alpha-numeric ASCII characters + * or hyphens. + * @type \Google\Cloud\Metastore\V1beta\MetadataImport $metadata_import + * Required. The metadata import to create. The `name` field is ignored. The + * ID of the created metadata import must be provided in the request's + * `metadata_import_id` field. + * @type string $request_id + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Beta\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Required. The relative resource name of the service in which to create a + * metastore import, in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * + * 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. The relative resource name of the service in which to create a + * metastore import, in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * + * 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. The ID of the metadata import, which is used as the final + * component of the metadata import's name. + * This value must be between 1 and 64 characters long, begin with a letter, + * end with a letter or number, and consist of alpha-numeric ASCII characters + * or hyphens. + * + * Generated from protobuf field string metadata_import_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getMetadataImportId() + { + return $this->metadata_import_id; + } + + /** + * Required. The ID of the metadata import, which is used as the final + * component of the metadata import's name. + * This value must be between 1 and 64 characters long, begin with a letter, + * end with a letter or number, and consist of alpha-numeric ASCII characters + * or hyphens. + * + * Generated from protobuf field string metadata_import_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setMetadataImportId($var) + { + GPBUtil::checkString($var, True); + $this->metadata_import_id = $var; + + return $this; + } + + /** + * Required. The metadata import to create. The `name` field is ignored. The + * ID of the created metadata import must be provided in the request's + * `metadata_import_id` field. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.MetadataImport metadata_import = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Metastore\V1beta\MetadataImport|null + */ + public function getMetadataImport() + { + return $this->metadata_import; + } + + public function hasMetadataImport() + { + return isset($this->metadata_import); + } + + public function clearMetadataImport() + { + unset($this->metadata_import); + } + + /** + * Required. The metadata import to create. The `name` field is ignored. The + * ID of the created metadata import must be provided in the request's + * `metadata_import_id` field. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.MetadataImport metadata_import = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Metastore\V1beta\MetadataImport $var + * @return $this + */ + public function setMetadataImport($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Metastore\V1beta\MetadataImport::class); + $this->metadata_import = $var; + + return $this; + } + + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @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/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/CreateServiceRequest.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/CreateServiceRequest.php new file mode 100644 index 000000000000..b4c1d5f098ec --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/CreateServiceRequest.php @@ -0,0 +1,248 @@ +google.cloud.metastore.v1beta.CreateServiceRequest + */ +class CreateServiceRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The relative resource name of the location in which to create a + * metastore service, in the following form: + * `projects/{project_number}/locations/{location_id}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The ID of the metastore service, which is used as the final + * component of the metastore service's name. + * This value must be between 2 and 63 characters long inclusive, begin with a + * letter, end with a letter or number, and consist of alpha-numeric + * ASCII characters or hyphens. + * + * Generated from protobuf field string service_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $service_id = ''; + /** + * Required. The Metastore service to create. The `name` field is + * ignored. The ID of the created metastore service must be provided in + * the request's `service_id` field. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.Service service = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $service = null; + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The relative resource name of the location in which to create a + * metastore service, in the following form: + * `projects/{project_number}/locations/{location_id}`. + * @type string $service_id + * Required. The ID of the metastore service, which is used as the final + * component of the metastore service's name. + * This value must be between 2 and 63 characters long inclusive, begin with a + * letter, end with a letter or number, and consist of alpha-numeric + * ASCII characters or hyphens. + * @type \Google\Cloud\Metastore\V1beta\Service $service + * Required. The Metastore service to create. The `name` field is + * ignored. The ID of the created metastore service must be provided in + * the request's `service_id` field. + * @type string $request_id + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Beta\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Required. The relative resource name of the location in which to create a + * metastore service, in the following form: + * `projects/{project_number}/locations/{location_id}`. + * + * 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. The relative resource name of the location in which to create a + * metastore service, in the following form: + * `projects/{project_number}/locations/{location_id}`. + * + * 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. The ID of the metastore service, which is used as the final + * component of the metastore service's name. + * This value must be between 2 and 63 characters long inclusive, begin with a + * letter, end with a letter or number, and consist of alpha-numeric + * ASCII characters or hyphens. + * + * Generated from protobuf field string service_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getServiceId() + { + return $this->service_id; + } + + /** + * Required. The ID of the metastore service, which is used as the final + * component of the metastore service's name. + * This value must be between 2 and 63 characters long inclusive, begin with a + * letter, end with a letter or number, and consist of alpha-numeric + * ASCII characters or hyphens. + * + * Generated from protobuf field string service_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setServiceId($var) + { + GPBUtil::checkString($var, True); + $this->service_id = $var; + + return $this; + } + + /** + * Required. The Metastore service to create. The `name` field is + * ignored. The ID of the created metastore service must be provided in + * the request's `service_id` field. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.Service service = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Metastore\V1beta\Service|null + */ + public function getService() + { + return $this->service; + } + + public function hasService() + { + return isset($this->service); + } + + public function clearService() + { + unset($this->service); + } + + /** + * Required. The Metastore service to create. The `name` field is + * ignored. The ID of the created metastore service must be provided in + * the request's `service_id` field. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.Service service = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Metastore\V1beta\Service $var + * @return $this + */ + public function setService($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Metastore\V1beta\Service::class); + $this->service = $var; + + return $this; + } + + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @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/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/DataCatalogConfig.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/DataCatalogConfig.php new file mode 100644 index 000000000000..d445745eba1e --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/DataCatalogConfig.php @@ -0,0 +1,72 @@ +google.cloud.metastore.v1beta.DataCatalogConfig + */ +class DataCatalogConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Defines whether the metastore metadata should be synced to Data Catalog. + * The default value is to disable syncing metastore metadata to Data Catalog. + * + * Generated from protobuf field bool enabled = 2; + */ + protected $enabled = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $enabled + * Defines whether the metastore metadata should be synced to Data Catalog. + * The default value is to disable syncing metastore metadata to Data Catalog. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Beta\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Defines whether the metastore metadata should be synced to Data Catalog. + * The default value is to disable syncing metastore metadata to Data Catalog. + * + * Generated from protobuf field bool enabled = 2; + * @return bool + */ + public function getEnabled() + { + return $this->enabled; + } + + /** + * Defines whether the metastore metadata should be synced to Data Catalog. + * The default value is to disable syncing metastore metadata to Data Catalog. + * + * Generated from protobuf field bool enabled = 2; + * @param bool $var + * @return $this + */ + public function setEnabled($var) + { + GPBUtil::checkBool($var); + $this->enabled = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/DatabaseDumpSpec.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/DatabaseDumpSpec.php new file mode 100644 index 000000000000..3f8713173032 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/DatabaseDumpSpec.php @@ -0,0 +1,33 @@ +google.cloud.metastore.v1beta.DatabaseDumpSpec + */ +class DatabaseDumpSpec extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Beta\Metastore::initOnce(); + parent::__construct($data); + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/DatabaseDumpSpec/Type.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/DatabaseDumpSpec/Type.php new file mode 100644 index 000000000000..47888ab7a90a --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/DatabaseDumpSpec/Type.php @@ -0,0 +1,64 @@ +google.cloud.metastore.v1beta.DatabaseDumpSpec.Type + */ +class Type +{ + /** + * The type of the database dump is unknown. + * + * Generated from protobuf enum TYPE_UNSPECIFIED = 0; + */ + const TYPE_UNSPECIFIED = 0; + /** + * Database dump is a MySQL dump file. + * + * Generated from protobuf enum MYSQL = 1; + */ + const MYSQL = 1; + /** + * Database dump contains Avro files. + * + * Generated from protobuf enum AVRO = 2; + */ + const AVRO = 2; + + private static $valueToName = [ + self::TYPE_UNSPECIFIED => 'TYPE_UNSPECIFIED', + self::MYSQL => 'MYSQL', + self::AVRO => 'AVRO', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Type::class, \Google\Cloud\Metastore\V1beta\DatabaseDumpSpec_Type::class); + diff --git a/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/DatabaseDumpSpec_Type.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/DatabaseDumpSpec_Type.php new file mode 100644 index 000000000000..ec69ee336af3 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/DatabaseDumpSpec_Type.php @@ -0,0 +1,16 @@ +google.cloud.metastore.v1beta.DataplexConfig + */ +class DataplexConfig extends \Google\Protobuf\Internal\Message +{ + /** + * A reference to the Lake resources that this metastore service is attached + * to. The key is the lake resource name. Example: + * `projects/{project_number}/locations/{location_id}/lakes/{lake_id}`. + * + * Generated from protobuf field map lake_resources = 1; + */ + private $lake_resources; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\MapField $lake_resources + * A reference to the Lake resources that this metastore service is attached + * to. The key is the lake resource name. Example: + * `projects/{project_number}/locations/{location_id}/lakes/{lake_id}`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Beta\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * A reference to the Lake resources that this metastore service is attached + * to. The key is the lake resource name. Example: + * `projects/{project_number}/locations/{location_id}/lakes/{lake_id}`. + * + * Generated from protobuf field map lake_resources = 1; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLakeResources() + { + return $this->lake_resources; + } + + /** + * A reference to the Lake resources that this metastore service is attached + * to. The key is the lake resource name. Example: + * `projects/{project_number}/locations/{location_id}/lakes/{lake_id}`. + * + * Generated from protobuf field map lake_resources = 1; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLakeResources($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Metastore\V1beta\Lake::class); + $this->lake_resources = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/DataprocMetastoreFederationGrpcClient.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/DataprocMetastoreFederationGrpcClient.php new file mode 100644 index 000000000000..ffbd2074ba13 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/DataprocMetastoreFederationGrpcClient.php @@ -0,0 +1,122 @@ +_simpleRequest('/google.cloud.metastore.v1beta.DataprocMetastoreFederation/ListFederations', + $argument, + ['\Google\Cloud\Metastore\V1beta\ListFederationsResponse', 'decode'], + $metadata, $options); + } + + /** + * Gets the details of a single federation. + * @param \Google\Cloud\Metastore\V1beta\GetFederationRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function GetFederation(\Google\Cloud\Metastore\V1beta\GetFederationRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.metastore.v1beta.DataprocMetastoreFederation/GetFederation', + $argument, + ['\Google\Cloud\Metastore\V1beta\Federation', 'decode'], + $metadata, $options); + } + + /** + * Creates a metastore federation in a project and location. + * @param \Google\Cloud\Metastore\V1beta\CreateFederationRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function CreateFederation(\Google\Cloud\Metastore\V1beta\CreateFederationRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.metastore.v1beta.DataprocMetastoreFederation/CreateFederation', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Updates the fields of a federation. + * @param \Google\Cloud\Metastore\V1beta\UpdateFederationRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function UpdateFederation(\Google\Cloud\Metastore\V1beta\UpdateFederationRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.metastore.v1beta.DataprocMetastoreFederation/UpdateFederation', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Deletes a single federation. + * @param \Google\Cloud\Metastore\V1beta\DeleteFederationRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function DeleteFederation(\Google\Cloud\Metastore\V1beta\DeleteFederationRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.metastore.v1beta.DataprocMetastoreFederation/DeleteFederation', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + +} diff --git a/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/DataprocMetastoreGrpcClient.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/DataprocMetastoreGrpcClient.php new file mode 100644 index 000000000000..b1e3da0defa3 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/DataprocMetastoreGrpcClient.php @@ -0,0 +1,340 @@ +_simpleRequest('/google.cloud.metastore.v1beta.DataprocMetastore/ListServices', + $argument, + ['\Google\Cloud\Metastore\V1beta\ListServicesResponse', 'decode'], + $metadata, $options); + } + + /** + * Gets the details of a single service. + * @param \Google\Cloud\Metastore\V1beta\GetServiceRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function GetService(\Google\Cloud\Metastore\V1beta\GetServiceRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.metastore.v1beta.DataprocMetastore/GetService', + $argument, + ['\Google\Cloud\Metastore\V1beta\Service', 'decode'], + $metadata, $options); + } + + /** + * Creates a metastore service in a project and location. + * @param \Google\Cloud\Metastore\V1beta\CreateServiceRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function CreateService(\Google\Cloud\Metastore\V1beta\CreateServiceRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.metastore.v1beta.DataprocMetastore/CreateService', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Updates the parameters of a single service. + * @param \Google\Cloud\Metastore\V1beta\UpdateServiceRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function UpdateService(\Google\Cloud\Metastore\V1beta\UpdateServiceRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.metastore.v1beta.DataprocMetastore/UpdateService', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Deletes a single service. + * @param \Google\Cloud\Metastore\V1beta\DeleteServiceRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function DeleteService(\Google\Cloud\Metastore\V1beta\DeleteServiceRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.metastore.v1beta.DataprocMetastore/DeleteService', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Lists imports in a service. + * @param \Google\Cloud\Metastore\V1beta\ListMetadataImportsRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function ListMetadataImports(\Google\Cloud\Metastore\V1beta\ListMetadataImportsRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.metastore.v1beta.DataprocMetastore/ListMetadataImports', + $argument, + ['\Google\Cloud\Metastore\V1beta\ListMetadataImportsResponse', 'decode'], + $metadata, $options); + } + + /** + * Gets details of a single import. + * @param \Google\Cloud\Metastore\V1beta\GetMetadataImportRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function GetMetadataImport(\Google\Cloud\Metastore\V1beta\GetMetadataImportRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.metastore.v1beta.DataprocMetastore/GetMetadataImport', + $argument, + ['\Google\Cloud\Metastore\V1beta\MetadataImport', 'decode'], + $metadata, $options); + } + + /** + * Creates a new MetadataImport in a given project and location. + * @param \Google\Cloud\Metastore\V1beta\CreateMetadataImportRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function CreateMetadataImport(\Google\Cloud\Metastore\V1beta\CreateMetadataImportRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.metastore.v1beta.DataprocMetastore/CreateMetadataImport', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Updates a single import. + * Only the description field of MetadataImport is supported to be updated. + * @param \Google\Cloud\Metastore\V1beta\UpdateMetadataImportRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function UpdateMetadataImport(\Google\Cloud\Metastore\V1beta\UpdateMetadataImportRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.metastore.v1beta.DataprocMetastore/UpdateMetadataImport', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Exports metadata from a service. + * @param \Google\Cloud\Metastore\V1beta\ExportMetadataRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function ExportMetadata(\Google\Cloud\Metastore\V1beta\ExportMetadataRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.metastore.v1beta.DataprocMetastore/ExportMetadata', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Restores a service from a backup. + * @param \Google\Cloud\Metastore\V1beta\RestoreServiceRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function RestoreService(\Google\Cloud\Metastore\V1beta\RestoreServiceRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.metastore.v1beta.DataprocMetastore/RestoreService', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Lists backups in a service. + * @param \Google\Cloud\Metastore\V1beta\ListBackupsRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function ListBackups(\Google\Cloud\Metastore\V1beta\ListBackupsRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.metastore.v1beta.DataprocMetastore/ListBackups', + $argument, + ['\Google\Cloud\Metastore\V1beta\ListBackupsResponse', 'decode'], + $metadata, $options); + } + + /** + * Gets details of a single backup. + * @param \Google\Cloud\Metastore\V1beta\GetBackupRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function GetBackup(\Google\Cloud\Metastore\V1beta\GetBackupRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.metastore.v1beta.DataprocMetastore/GetBackup', + $argument, + ['\Google\Cloud\Metastore\V1beta\Backup', 'decode'], + $metadata, $options); + } + + /** + * Creates a new backup in a given project and location. + * @param \Google\Cloud\Metastore\V1beta\CreateBackupRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function CreateBackup(\Google\Cloud\Metastore\V1beta\CreateBackupRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.metastore.v1beta.DataprocMetastore/CreateBackup', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Deletes a single backup. + * @param \Google\Cloud\Metastore\V1beta\DeleteBackupRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function DeleteBackup(\Google\Cloud\Metastore\V1beta\DeleteBackupRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.metastore.v1beta.DataprocMetastore/DeleteBackup', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Removes the attached IAM policies for a resource + * @param \Google\Cloud\Metastore\V1beta\RemoveIamPolicyRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function RemoveIamPolicy(\Google\Cloud\Metastore\V1beta\RemoveIamPolicyRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.metastore.v1beta.DataprocMetastore/RemoveIamPolicy', + $argument, + ['\Google\Cloud\Metastore\V1beta\RemoveIamPolicyResponse', 'decode'], + $metadata, $options); + } + + /** + * Query DPMS metadata. + * @param \Google\Cloud\Metastore\V1beta\QueryMetadataRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function QueryMetadata(\Google\Cloud\Metastore\V1beta\QueryMetadataRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.metastore.v1beta.DataprocMetastore/QueryMetadata', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Move a table to another database. + * @param \Google\Cloud\Metastore\V1beta\MoveTableToDatabaseRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function MoveTableToDatabase(\Google\Cloud\Metastore\V1beta\MoveTableToDatabaseRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.metastore.v1beta.DataprocMetastore/MoveTableToDatabase', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Alter metadata resource location. The metadata resource can be a database, + * table, or partition. This functionality only updates the parent directory + * for the respective metadata resource and does not transfer any existing + * data to the new location. + * @param \Google\Cloud\Metastore\V1beta\AlterMetadataResourceLocationRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function AlterMetadataResourceLocation(\Google\Cloud\Metastore\V1beta\AlterMetadataResourceLocationRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.metastore.v1beta.DataprocMetastore/AlterMetadataResourceLocation', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + +} diff --git a/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/DeleteBackupRequest.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/DeleteBackupRequest.php new file mode 100644 index 000000000000..502139968259 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/DeleteBackupRequest.php @@ -0,0 +1,146 @@ +google.cloud.metastore.v1beta.DeleteBackupRequest + */ +class DeleteBackupRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The relative resource name of the backup to delete, in the + * following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The relative resource name of the backup to delete, in the + * following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + * @type string $request_id + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Beta\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Required. The relative resource name of the backup to delete, in the + * following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + * + * 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 relative resource name of the backup to delete, in the + * following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + * + * 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; + } + + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @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/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/DeleteFederationRequest.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/DeleteFederationRequest.php new file mode 100644 index 000000000000..37ea8f14cf98 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/DeleteFederationRequest.php @@ -0,0 +1,145 @@ +google.cloud.metastore.v1beta.DeleteFederationRequest + */ +class DeleteFederationRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The relative resource name of the metastore federation to delete, + * in the following form: + * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The relative resource name of the metastore federation to delete, + * in the following form: + * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + * @type string $request_id + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Beta\MetastoreFederation::initOnce(); + parent::__construct($data); + } + + /** + * Required. The relative resource name of the metastore federation to delete, + * in the following form: + * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + * + * 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 relative resource name of the metastore federation to delete, + * in the following form: + * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + * + * 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; + } + + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @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/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/DeleteServiceRequest.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/DeleteServiceRequest.php new file mode 100644 index 000000000000..98a261602e43 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/DeleteServiceRequest.php @@ -0,0 +1,146 @@ +google.cloud.metastore.v1beta.DeleteServiceRequest + */ +class DeleteServiceRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The relative resource name of the metastore service to delete, in + * the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The relative resource name of the metastore service to delete, in + * the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * @type string $request_id + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Beta\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Required. The relative resource name of the metastore service to delete, in + * the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * + * 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 relative resource name of the metastore service to delete, in + * the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * + * 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; + } + + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @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/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/EncryptionConfig.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/EncryptionConfig.php new file mode 100644 index 000000000000..0c580153147d --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/EncryptionConfig.php @@ -0,0 +1,75 @@ +google.cloud.metastore.v1beta.EncryptionConfig + */ +class EncryptionConfig extends \Google\Protobuf\Internal\Message +{ + /** + * The fully qualified customer provided Cloud KMS key name to use for + * customer data encryption, in the following form: + * `projects/{project_number}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}`. + * + * Generated from protobuf field string kms_key = 1; + */ + protected $kms_key = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $kms_key + * The fully qualified customer provided Cloud KMS key name to use for + * customer data encryption, in the following form: + * `projects/{project_number}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Beta\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * The fully qualified customer provided Cloud KMS key name to use for + * customer data encryption, in the following form: + * `projects/{project_number}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}`. + * + * Generated from protobuf field string kms_key = 1; + * @return string + */ + public function getKmsKey() + { + return $this->kms_key; + } + + /** + * The fully qualified customer provided Cloud KMS key name to use for + * customer data encryption, in the following form: + * `projects/{project_number}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}`. + * + * Generated from protobuf field string kms_key = 1; + * @param string $var + * @return $this + */ + public function setKmsKey($var) + { + GPBUtil::checkString($var, True); + $this->kms_key = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/ExportMetadataRequest.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/ExportMetadataRequest.php new file mode 100644 index 000000000000..562eeb937f38 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/ExportMetadataRequest.php @@ -0,0 +1,232 @@ +google.cloud.metastore.v1beta.ExportMetadataRequest + */ +class ExportMetadataRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The relative resource name of the metastore service to run + * export, in the following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * + * Generated from protobuf field string service = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $service = ''; + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + /** + * Optional. The type of the database dump. If unspecified, defaults to + * `MYSQL`. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.DatabaseDumpSpec.Type database_dump_type = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $database_dump_type = 0; + protected $destination; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $destination_gcs_folder + * A Cloud Storage URI of a folder, in the format + * `gs:///`. A sub-folder + * `` containing exported files will be created below it. + * @type string $service + * Required. The relative resource name of the metastore service to run + * export, in the following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * @type string $request_id + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @type int $database_dump_type + * Optional. The type of the database dump. If unspecified, defaults to + * `MYSQL`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Beta\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * A Cloud Storage URI of a folder, in the format + * `gs:///`. A sub-folder + * `` containing exported files will be created below it. + * + * Generated from protobuf field string destination_gcs_folder = 2; + * @return string + */ + public function getDestinationGcsFolder() + { + return $this->readOneof(2); + } + + public function hasDestinationGcsFolder() + { + return $this->hasOneof(2); + } + + /** + * A Cloud Storage URI of a folder, in the format + * `gs:///`. A sub-folder + * `` containing exported files will be created below it. + * + * Generated from protobuf field string destination_gcs_folder = 2; + * @param string $var + * @return $this + */ + public function setDestinationGcsFolder($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * Required. The relative resource name of the metastore service to run + * export, in the following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * + * Generated from protobuf field string service = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getService() + { + return $this->service; + } + + /** + * Required. The relative resource name of the metastore service to run + * export, in the following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * + * Generated from protobuf field string service = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setService($var) + { + GPBUtil::checkString($var, True); + $this->service = $var; + + return $this; + } + + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + + /** + * Optional. The type of the database dump. If unspecified, defaults to + * `MYSQL`. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.DatabaseDumpSpec.Type database_dump_type = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getDatabaseDumpType() + { + return $this->database_dump_type; + } + + /** + * Optional. The type of the database dump. If unspecified, defaults to + * `MYSQL`. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.DatabaseDumpSpec.Type database_dump_type = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setDatabaseDumpType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Metastore\V1beta\DatabaseDumpSpec\Type::class); + $this->database_dump_type = $var; + + return $this; + } + + /** + * @return string + */ + public function getDestination() + { + return $this->whichOneof("destination"); + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/Federation.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/Federation.php new file mode 100644 index 000000000000..7751b7c96516 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/Federation.php @@ -0,0 +1,433 @@ +google.cloud.metastore.v1beta.Federation + */ +class Federation extends \Google\Protobuf\Internal\Message +{ + /** + * Immutable. The relative resource name of the federation, of the + * form: + * projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + */ + protected $name = ''; + /** + * Output only. The time when the metastore federation was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. The time when the metastore federation was last updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * User-defined labels for the metastore federation. + * + * Generated from protobuf field map labels = 4; + */ + private $labels; + /** + * Immutable. The Apache Hive metastore version of the federation. All backend + * metastore versions must be compatible with the federation version. + * + * Generated from protobuf field string version = 5 [(.google.api.field_behavior) = IMMUTABLE]; + */ + protected $version = ''; + /** + * A map from `BackendMetastore` rank to `BackendMetastore`s from which the + * federation service serves metadata at query time. The map key represents + * the order in which `BackendMetastore`s should be evaluated to resolve + * database names at query time and should be greater than or equal to zero. A + * `BackendMetastore` with a lower number will be evaluated before a + * `BackendMetastore` with a higher number. + * + * Generated from protobuf field map backend_metastores = 6; + */ + private $backend_metastores; + /** + * Output only. The federation endpoint. + * + * Generated from protobuf field string endpoint_uri = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $endpoint_uri = ''; + /** + * Output only. The current state of the federation. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.Federation.State state = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Output only. Additional information about the current state of the + * metastore federation, if available. + * + * Generated from protobuf field string state_message = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state_message = ''; + /** + * Output only. The globally unique resource identifier of the metastore + * federation. + * + * Generated from protobuf field string uid = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $uid = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Immutable. The relative resource name of the federation, of the + * form: + * projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The time when the metastore federation was created. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. The time when the metastore federation was last updated. + * @type array|\Google\Protobuf\Internal\MapField $labels + * User-defined labels for the metastore federation. + * @type string $version + * Immutable. The Apache Hive metastore version of the federation. All backend + * metastore versions must be compatible with the federation version. + * @type array|\Google\Protobuf\Internal\MapField $backend_metastores + * A map from `BackendMetastore` rank to `BackendMetastore`s from which the + * federation service serves metadata at query time. The map key represents + * the order in which `BackendMetastore`s should be evaluated to resolve + * database names at query time and should be greater than or equal to zero. A + * `BackendMetastore` with a lower number will be evaluated before a + * `BackendMetastore` with a higher number. + * @type string $endpoint_uri + * Output only. The federation endpoint. + * @type int $state + * Output only. The current state of the federation. + * @type string $state_message + * Output only. Additional information about the current state of the + * metastore federation, if available. + * @type string $uid + * Output only. The globally unique resource identifier of the metastore + * federation. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Beta\MetastoreFederation::initOnce(); + parent::__construct($data); + } + + /** + * Immutable. The relative resource name of the federation, of the + * form: + * projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Immutable. The relative resource name of the federation, of the + * form: + * projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. The time when the metastore federation was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.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 when the metastore federation was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.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 when the metastore federation was last updated. + * + * 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 when the metastore federation was last updated. + * + * 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; + } + + /** + * User-defined labels for the metastore federation. + * + * Generated from protobuf field map labels = 4; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * User-defined labels for the metastore federation. + * + * Generated from protobuf field map labels = 4; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + + /** + * Immutable. The Apache Hive metastore version of the federation. All backend + * metastore versions must be compatible with the federation version. + * + * Generated from protobuf field string version = 5 [(.google.api.field_behavior) = IMMUTABLE]; + * @return string + */ + public function getVersion() + { + return $this->version; + } + + /** + * Immutable. The Apache Hive metastore version of the federation. All backend + * metastore versions must be compatible with the federation version. + * + * Generated from protobuf field string version = 5 [(.google.api.field_behavior) = IMMUTABLE]; + * @param string $var + * @return $this + */ + public function setVersion($var) + { + GPBUtil::checkString($var, True); + $this->version = $var; + + return $this; + } + + /** + * A map from `BackendMetastore` rank to `BackendMetastore`s from which the + * federation service serves metadata at query time. The map key represents + * the order in which `BackendMetastore`s should be evaluated to resolve + * database names at query time and should be greater than or equal to zero. A + * `BackendMetastore` with a lower number will be evaluated before a + * `BackendMetastore` with a higher number. + * + * Generated from protobuf field map backend_metastores = 6; + * @return \Google\Protobuf\Internal\MapField + */ + public function getBackendMetastores() + { + return $this->backend_metastores; + } + + /** + * A map from `BackendMetastore` rank to `BackendMetastore`s from which the + * federation service serves metadata at query time. The map key represents + * the order in which `BackendMetastore`s should be evaluated to resolve + * database names at query time and should be greater than or equal to zero. A + * `BackendMetastore` with a lower number will be evaluated before a + * `BackendMetastore` with a higher number. + * + * Generated from protobuf field map backend_metastores = 6; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setBackendMetastores($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::INT32, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Metastore\V1beta\BackendMetastore::class); + $this->backend_metastores = $arr; + + return $this; + } + + /** + * Output only. The federation endpoint. + * + * Generated from protobuf field string endpoint_uri = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getEndpointUri() + { + return $this->endpoint_uri; + } + + /** + * Output only. The federation endpoint. + * + * Generated from protobuf field string endpoint_uri = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setEndpointUri($var) + { + GPBUtil::checkString($var, True); + $this->endpoint_uri = $var; + + return $this; + } + + /** + * Output only. The current state of the federation. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.Federation.State state = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. The current state of the federation. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.Federation.State state = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Metastore\V1beta\Federation\State::class); + $this->state = $var; + + return $this; + } + + /** + * Output only. Additional information about the current state of the + * metastore federation, if available. + * + * Generated from protobuf field string state_message = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getStateMessage() + { + return $this->state_message; + } + + /** + * Output only. Additional information about the current state of the + * metastore federation, if available. + * + * Generated from protobuf field string state_message = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setStateMessage($var) + { + GPBUtil::checkString($var, True); + $this->state_message = $var; + + return $this; + } + + /** + * Output only. The globally unique resource identifier of the metastore + * federation. + * + * Generated from protobuf field string uid = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getUid() + { + return $this->uid; + } + + /** + * Output only. The globally unique resource identifier of the metastore + * federation. + * + * Generated from protobuf field string uid = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setUid($var) + { + GPBUtil::checkString($var, True); + $this->uid = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/Federation/State.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/Federation/State.php new file mode 100644 index 000000000000..ece483cad3f2 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/Federation/State.php @@ -0,0 +1,87 @@ +google.cloud.metastore.v1beta.Federation.State + */ +class State +{ + /** + * The state of the metastore federation is unknown. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The metastore federation is in the process of being created. + * + * Generated from protobuf enum CREATING = 1; + */ + const CREATING = 1; + /** + * The metastore federation is running and ready to serve queries. + * + * Generated from protobuf enum ACTIVE = 2; + */ + const ACTIVE = 2; + /** + * The metastore federation is being updated. It remains usable but cannot + * accept additional update requests or be deleted at this time. + * + * Generated from protobuf enum UPDATING = 3; + */ + const UPDATING = 3; + /** + * The metastore federation is undergoing deletion. It cannot be used. + * + * Generated from protobuf enum DELETING = 4; + */ + const DELETING = 4; + /** + * The metastore federation has encountered an error and cannot be used. The + * metastore federation should be deleted. + * + * Generated from protobuf enum ERROR = 5; + */ + const ERROR = 5; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::CREATING => 'CREATING', + self::ACTIVE => 'ACTIVE', + self::UPDATING => 'UPDATING', + self::DELETING => 'DELETING', + self::ERROR => 'ERROR', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\Metastore\V1beta\Federation_State::class); + diff --git a/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/Federation_State.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/Federation_State.php new file mode 100644 index 000000000000..ff631592fafd --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/Federation_State.php @@ -0,0 +1,16 @@ +google.cloud.metastore.v1beta.GetBackupRequest + */ +class GetBackupRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The relative resource name of the backup to retrieve, in the + * following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The relative resource name of the backup to retrieve, in the + * following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Beta\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Required. The relative resource name of the backup to retrieve, in the + * following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + * + * 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 relative resource name of the backup to retrieve, in the + * following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + * + * 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; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/GetFederationRequest.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/GetFederationRequest.php new file mode 100644 index 000000000000..d37137df1cc1 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/GetFederationRequest.php @@ -0,0 +1,75 @@ +google.cloud.metastore.v1beta.GetFederationRequest + */ +class GetFederationRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The relative resource name of the metastore federation to + * retrieve, in the following form: + * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The relative resource name of the metastore federation to + * retrieve, in the following form: + * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Beta\MetastoreFederation::initOnce(); + parent::__construct($data); + } + + /** + * Required. The relative resource name of the metastore federation to + * retrieve, in the following form: + * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + * + * 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 relative resource name of the metastore federation to + * retrieve, in the following form: + * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + * + * 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; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/GetMetadataImportRequest.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/GetMetadataImportRequest.php new file mode 100644 index 000000000000..f68832aaeee1 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/GetMetadataImportRequest.php @@ -0,0 +1,76 @@ +google.cloud.metastore.v1beta.GetMetadataImportRequest + */ +class GetMetadataImportRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The relative resource name of the metadata import to retrieve, in + * the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{import_id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The relative resource name of the metadata import to retrieve, in + * the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{import_id}`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Beta\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Required. The relative resource name of the metadata import to retrieve, in + * the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{import_id}`. + * + * 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 relative resource name of the metadata import to retrieve, in + * the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{import_id}`. + * + * 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; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/GetServiceRequest.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/GetServiceRequest.php new file mode 100644 index 000000000000..3b061125d7b9 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/GetServiceRequest.php @@ -0,0 +1,76 @@ +google.cloud.metastore.v1beta.GetServiceRequest + */ +class GetServiceRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The relative resource name of the metastore service to retrieve, + * in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The relative resource name of the metastore service to retrieve, + * in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Beta\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Required. The relative resource name of the metastore service to retrieve, + * in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * + * 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 relative resource name of the metastore service to retrieve, + * in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * + * 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; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/HiveMetastoreConfig.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/HiveMetastoreConfig.php new file mode 100644 index 000000000000..b04e639ad22d --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/HiveMetastoreConfig.php @@ -0,0 +1,278 @@ +google.cloud.metastore.v1beta.HiveMetastoreConfig + */ +class HiveMetastoreConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Immutable. The Hive metastore schema version. + * + * Generated from protobuf field string version = 1 [(.google.api.field_behavior) = IMMUTABLE]; + */ + protected $version = ''; + /** + * A mapping of Hive metastore configuration key-value pairs to apply to the + * Hive metastore (configured in `hive-site.xml`). The mappings + * override system defaults (some keys cannot be overridden). These + * overrides are also applied to auxiliary versions and can be further + * customized in the auxiliary version's `AuxiliaryVersionConfig`. + * + * Generated from protobuf field map config_overrides = 2; + */ + private $config_overrides; + /** + * Information used to configure the Hive metastore service as a service + * principal in a Kerberos realm. To disable Kerberos, use the `UpdateService` + * method and specify this field's path + * (`hive_metastore_config.kerberos_config`) in the request's `update_mask` + * while omitting this field from the request's `service`. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.KerberosConfig kerberos_config = 3; + */ + protected $kerberos_config = null; + /** + * The protocol to use for the metastore service endpoint. If unspecified, + * defaults to `THRIFT`. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.HiveMetastoreConfig.EndpointProtocol endpoint_protocol = 4; + */ + protected $endpoint_protocol = 0; + /** + * A mapping of Hive metastore version to the auxiliary version + * configuration. When specified, a secondary Hive metastore service is + * created along with the primary service. All auxiliary versions must be less + * than the service's primary version. The key is the auxiliary service name + * and it must match the regular expression [a-z]([-a-z0-9]*[a-z0-9])?. This + * means that the first character must be a lowercase letter, and all the + * following characters must be hyphens, lowercase letters, or digits, except + * the last character, which cannot be a hyphen. + * + * Generated from protobuf field map auxiliary_versions = 5; + */ + private $auxiliary_versions; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $version + * Immutable. The Hive metastore schema version. + * @type array|\Google\Protobuf\Internal\MapField $config_overrides + * A mapping of Hive metastore configuration key-value pairs to apply to the + * Hive metastore (configured in `hive-site.xml`). The mappings + * override system defaults (some keys cannot be overridden). These + * overrides are also applied to auxiliary versions and can be further + * customized in the auxiliary version's `AuxiliaryVersionConfig`. + * @type \Google\Cloud\Metastore\V1beta\KerberosConfig $kerberos_config + * Information used to configure the Hive metastore service as a service + * principal in a Kerberos realm. To disable Kerberos, use the `UpdateService` + * method and specify this field's path + * (`hive_metastore_config.kerberos_config`) in the request's `update_mask` + * while omitting this field from the request's `service`. + * @type int $endpoint_protocol + * The protocol to use for the metastore service endpoint. If unspecified, + * defaults to `THRIFT`. + * @type array|\Google\Protobuf\Internal\MapField $auxiliary_versions + * A mapping of Hive metastore version to the auxiliary version + * configuration. When specified, a secondary Hive metastore service is + * created along with the primary service. All auxiliary versions must be less + * than the service's primary version. The key is the auxiliary service name + * and it must match the regular expression [a-z]([-a-z0-9]*[a-z0-9])?. This + * means that the first character must be a lowercase letter, and all the + * following characters must be hyphens, lowercase letters, or digits, except + * the last character, which cannot be a hyphen. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Beta\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Immutable. The Hive metastore schema version. + * + * Generated from protobuf field string version = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * @return string + */ + public function getVersion() + { + return $this->version; + } + + /** + * Immutable. The Hive metastore schema version. + * + * Generated from protobuf field string version = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * @param string $var + * @return $this + */ + public function setVersion($var) + { + GPBUtil::checkString($var, True); + $this->version = $var; + + return $this; + } + + /** + * A mapping of Hive metastore configuration key-value pairs to apply to the + * Hive metastore (configured in `hive-site.xml`). The mappings + * override system defaults (some keys cannot be overridden). These + * overrides are also applied to auxiliary versions and can be further + * customized in the auxiliary version's `AuxiliaryVersionConfig`. + * + * Generated from protobuf field map config_overrides = 2; + * @return \Google\Protobuf\Internal\MapField + */ + public function getConfigOverrides() + { + return $this->config_overrides; + } + + /** + * A mapping of Hive metastore configuration key-value pairs to apply to the + * Hive metastore (configured in `hive-site.xml`). The mappings + * override system defaults (some keys cannot be overridden). These + * overrides are also applied to auxiliary versions and can be further + * customized in the auxiliary version's `AuxiliaryVersionConfig`. + * + * Generated from protobuf field map config_overrides = 2; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setConfigOverrides($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->config_overrides = $arr; + + return $this; + } + + /** + * Information used to configure the Hive metastore service as a service + * principal in a Kerberos realm. To disable Kerberos, use the `UpdateService` + * method and specify this field's path + * (`hive_metastore_config.kerberos_config`) in the request's `update_mask` + * while omitting this field from the request's `service`. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.KerberosConfig kerberos_config = 3; + * @return \Google\Cloud\Metastore\V1beta\KerberosConfig|null + */ + public function getKerberosConfig() + { + return $this->kerberos_config; + } + + public function hasKerberosConfig() + { + return isset($this->kerberos_config); + } + + public function clearKerberosConfig() + { + unset($this->kerberos_config); + } + + /** + * Information used to configure the Hive metastore service as a service + * principal in a Kerberos realm. To disable Kerberos, use the `UpdateService` + * method and specify this field's path + * (`hive_metastore_config.kerberos_config`) in the request's `update_mask` + * while omitting this field from the request's `service`. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.KerberosConfig kerberos_config = 3; + * @param \Google\Cloud\Metastore\V1beta\KerberosConfig $var + * @return $this + */ + public function setKerberosConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Metastore\V1beta\KerberosConfig::class); + $this->kerberos_config = $var; + + return $this; + } + + /** + * The protocol to use for the metastore service endpoint. If unspecified, + * defaults to `THRIFT`. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.HiveMetastoreConfig.EndpointProtocol endpoint_protocol = 4; + * @return int + */ + public function getEndpointProtocol() + { + return $this->endpoint_protocol; + } + + /** + * The protocol to use for the metastore service endpoint. If unspecified, + * defaults to `THRIFT`. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.HiveMetastoreConfig.EndpointProtocol endpoint_protocol = 4; + * @param int $var + * @return $this + */ + public function setEndpointProtocol($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Metastore\V1beta\HiveMetastoreConfig\EndpointProtocol::class); + $this->endpoint_protocol = $var; + + return $this; + } + + /** + * A mapping of Hive metastore version to the auxiliary version + * configuration. When specified, a secondary Hive metastore service is + * created along with the primary service. All auxiliary versions must be less + * than the service's primary version. The key is the auxiliary service name + * and it must match the regular expression [a-z]([-a-z0-9]*[a-z0-9])?. This + * means that the first character must be a lowercase letter, and all the + * following characters must be hyphens, lowercase letters, or digits, except + * the last character, which cannot be a hyphen. + * + * Generated from protobuf field map auxiliary_versions = 5; + * @return \Google\Protobuf\Internal\MapField + */ + public function getAuxiliaryVersions() + { + return $this->auxiliary_versions; + } + + /** + * A mapping of Hive metastore version to the auxiliary version + * configuration. When specified, a secondary Hive metastore service is + * created along with the primary service. All auxiliary versions must be less + * than the service's primary version. The key is the auxiliary service name + * and it must match the regular expression [a-z]([-a-z0-9]*[a-z0-9])?. This + * means that the first character must be a lowercase letter, and all the + * following characters must be hyphens, lowercase letters, or digits, except + * the last character, which cannot be a hyphen. + * + * Generated from protobuf field map auxiliary_versions = 5; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setAuxiliaryVersions($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Metastore\V1beta\AuxiliaryVersionConfig::class); + $this->auxiliary_versions = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/HiveMetastoreConfig/EndpointProtocol.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/HiveMetastoreConfig/EndpointProtocol.php new file mode 100644 index 000000000000..2098fa3fe11e --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/HiveMetastoreConfig/EndpointProtocol.php @@ -0,0 +1,64 @@ +google.cloud.metastore.v1beta.HiveMetastoreConfig.EndpointProtocol + */ +class EndpointProtocol +{ + /** + * The protocol is not set. + * + * Generated from protobuf enum ENDPOINT_PROTOCOL_UNSPECIFIED = 0; + */ + const ENDPOINT_PROTOCOL_UNSPECIFIED = 0; + /** + * Use the legacy Apache Thrift protocol for the metastore service endpoint. + * + * Generated from protobuf enum THRIFT = 1; + */ + const THRIFT = 1; + /** + * Use the modernized gRPC protocol for the metastore service endpoint. + * + * Generated from protobuf enum GRPC = 2; + */ + const GRPC = 2; + + private static $valueToName = [ + self::ENDPOINT_PROTOCOL_UNSPECIFIED => 'ENDPOINT_PROTOCOL_UNSPECIFIED', + self::THRIFT => 'THRIFT', + self::GRPC => 'GRPC', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(EndpointProtocol::class, \Google\Cloud\Metastore\V1beta\HiveMetastoreConfig_EndpointProtocol::class); + diff --git a/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/HiveMetastoreConfig_EndpointProtocol.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/HiveMetastoreConfig_EndpointProtocol.php new file mode 100644 index 000000000000..3b63e5e9cd8a --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/HiveMetastoreConfig_EndpointProtocol.php @@ -0,0 +1,16 @@ +google.cloud.metastore.v1beta.KerberosConfig + */ +class KerberosConfig extends \Google\Protobuf\Internal\Message +{ + /** + * A Kerberos keytab file that can be used to authenticate a service principal + * with a Kerberos Key Distribution Center (KDC). + * + * Generated from protobuf field .google.cloud.metastore.v1beta.Secret keytab = 1; + */ + protected $keytab = null; + /** + * A Kerberos principal that exists in the both the keytab the KDC + * to authenticate as. A typical principal is of the form + * `primary/instance@REALM`, but there is no exact format. + * + * Generated from protobuf field string principal = 2; + */ + protected $principal = ''; + /** + * A Cloud Storage URI that specifies the path to a + * krb5.conf file. It is of the form `gs://{bucket_name}/path/to/krb5.conf`, + * although the file does not need to be named krb5.conf explicitly. + * + * Generated from protobuf field string krb5_config_gcs_uri = 3; + */ + protected $krb5_config_gcs_uri = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Metastore\V1beta\Secret $keytab + * A Kerberos keytab file that can be used to authenticate a service principal + * with a Kerberos Key Distribution Center (KDC). + * @type string $principal + * A Kerberos principal that exists in the both the keytab the KDC + * to authenticate as. A typical principal is of the form + * `primary/instance@REALM`, but there is no exact format. + * @type string $krb5_config_gcs_uri + * A Cloud Storage URI that specifies the path to a + * krb5.conf file. It is of the form `gs://{bucket_name}/path/to/krb5.conf`, + * although the file does not need to be named krb5.conf explicitly. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Beta\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * A Kerberos keytab file that can be used to authenticate a service principal + * with a Kerberos Key Distribution Center (KDC). + * + * Generated from protobuf field .google.cloud.metastore.v1beta.Secret keytab = 1; + * @return \Google\Cloud\Metastore\V1beta\Secret|null + */ + public function getKeytab() + { + return $this->keytab; + } + + public function hasKeytab() + { + return isset($this->keytab); + } + + public function clearKeytab() + { + unset($this->keytab); + } + + /** + * A Kerberos keytab file that can be used to authenticate a service principal + * with a Kerberos Key Distribution Center (KDC). + * + * Generated from protobuf field .google.cloud.metastore.v1beta.Secret keytab = 1; + * @param \Google\Cloud\Metastore\V1beta\Secret $var + * @return $this + */ + public function setKeytab($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Metastore\V1beta\Secret::class); + $this->keytab = $var; + + return $this; + } + + /** + * A Kerberos principal that exists in the both the keytab the KDC + * to authenticate as. A typical principal is of the form + * `primary/instance@REALM`, but there is no exact format. + * + * Generated from protobuf field string principal = 2; + * @return string + */ + public function getPrincipal() + { + return $this->principal; + } + + /** + * A Kerberos principal that exists in the both the keytab the KDC + * to authenticate as. A typical principal is of the form + * `primary/instance@REALM`, but there is no exact format. + * + * Generated from protobuf field string principal = 2; + * @param string $var + * @return $this + */ + public function setPrincipal($var) + { + GPBUtil::checkString($var, True); + $this->principal = $var; + + return $this; + } + + /** + * A Cloud Storage URI that specifies the path to a + * krb5.conf file. It is of the form `gs://{bucket_name}/path/to/krb5.conf`, + * although the file does not need to be named krb5.conf explicitly. + * + * Generated from protobuf field string krb5_config_gcs_uri = 3; + * @return string + */ + public function getKrb5ConfigGcsUri() + { + return $this->krb5_config_gcs_uri; + } + + /** + * A Cloud Storage URI that specifies the path to a + * krb5.conf file. It is of the form `gs://{bucket_name}/path/to/krb5.conf`, + * although the file does not need to be named krb5.conf explicitly. + * + * Generated from protobuf field string krb5_config_gcs_uri = 3; + * @param string $var + * @return $this + */ + public function setKrb5ConfigGcsUri($var) + { + GPBUtil::checkString($var, True); + $this->krb5_config_gcs_uri = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/Lake.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/Lake.php new file mode 100644 index 000000000000..62cb12726e69 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/Lake.php @@ -0,0 +1,75 @@ +google.cloud.metastore.v1beta.Lake + */ +class Lake extends \Google\Protobuf\Internal\Message +{ + /** + * The Lake resource name. + * Example: + * `projects/{project_number}/locations/{location_id}/lakes/{lake_id}` + * + * Generated from protobuf field string name = 1 [(.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The Lake resource name. + * Example: + * `projects/{project_number}/locations/{location_id}/lakes/{lake_id}` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Beta\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * The Lake resource name. + * Example: + * `projects/{project_number}/locations/{location_id}/lakes/{lake_id}` + * + * Generated from protobuf field string name = 1 [(.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The Lake resource name. + * Example: + * `projects/{project_number}/locations/{location_id}/lakes/{lake_id}` + * + * Generated from protobuf field string name = 1 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/ListBackupsRequest.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/ListBackupsRequest.php new file mode 100644 index 000000000000..36886d02c938 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/ListBackupsRequest.php @@ -0,0 +1,252 @@ +google.cloud.metastore.v1beta.ListBackupsRequest + */ +class ListBackupsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The relative resource name of the service whose backups to + * list, in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. The maximum number of backups to return. The response may contain + * less than the maximum number. If unspecified, no more than 500 backups are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Optional. A page token, received from a previous + * [DataprocMetastore.ListBackups][google.cloud.metastore.v1beta.DataprocMetastore.ListBackups] + * call. Provide this token to retrieve the subsequent page. + * To retrieve the first page, supply an empty page token. + * When paginating, other parameters provided to + * [DataprocMetastore.ListBackups][google.cloud.metastore.v1beta.DataprocMetastore.ListBackups] + * must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = ''; + /** + * Optional. The filter to apply to list results. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $filter = ''; + /** + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $order_by = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The relative resource name of the service whose backups to + * list, in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. + * @type int $page_size + * Optional. The maximum number of backups to return. The response may contain + * less than the maximum number. If unspecified, no more than 500 backups are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + * @type string $page_token + * Optional. A page token, received from a previous + * [DataprocMetastore.ListBackups][google.cloud.metastore.v1beta.DataprocMetastore.ListBackups] + * call. Provide this token to retrieve the subsequent page. + * To retrieve the first page, supply an empty page token. + * When paginating, other parameters provided to + * [DataprocMetastore.ListBackups][google.cloud.metastore.v1beta.DataprocMetastore.ListBackups] + * must match the call that provided the page token. + * @type string $filter + * Optional. The filter to apply to list results. + * @type string $order_by + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Beta\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Required. The relative resource name of the service whose backups to + * list, in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. + * + * 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. The relative resource name of the service whose backups to + * list, in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. + * + * 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. The maximum number of backups to return. The response may contain + * less than the maximum number. If unspecified, no more than 500 backups are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. The maximum number of backups to return. The response may contain + * less than the maximum number. If unspecified, no more than 500 backups are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + * + * 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 page token, received from a previous + * [DataprocMetastore.ListBackups][google.cloud.metastore.v1beta.DataprocMetastore.ListBackups] + * call. Provide this token to retrieve the subsequent page. + * To retrieve the first page, supply an empty page token. + * When paginating, other parameters provided to + * [DataprocMetastore.ListBackups][google.cloud.metastore.v1beta.DataprocMetastore.ListBackups] + * must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. A page token, received from a previous + * [DataprocMetastore.ListBackups][google.cloud.metastore.v1beta.DataprocMetastore.ListBackups] + * call. Provide this token to retrieve the subsequent page. + * To retrieve the first page, supply an empty page token. + * When paginating, other parameters provided to + * [DataprocMetastore.ListBackups][google.cloud.metastore.v1beta.DataprocMetastore.ListBackups] + * must match the call that provided the page token. + * + * 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. The filter to apply to list results. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Optional. The filter to apply to list results. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/ListBackupsResponse.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/ListBackupsResponse.php new file mode 100644 index 000000000000..a28503a594af --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/ListBackupsResponse.php @@ -0,0 +1,140 @@ +google.cloud.metastore.v1beta.ListBackupsResponse + */ +class ListBackupsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The backups of the specified service. + * + * Generated from protobuf field repeated .google.cloud.metastore.v1beta.Backup backups = 1; + */ + private $backups; + /** + * A token that can be sent as `page_token` to retrieve the next page. If this + * field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + */ + private $unreachable; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Metastore\V1beta\Backup>|\Google\Protobuf\Internal\RepeatedField $backups + * The backups of the specified service. + * @type string $next_page_token + * A token that can be sent as `page_token` to retrieve the next page. If this + * field is omitted, there are no subsequent pages. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Locations that could not be reached. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Beta\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * The backups of the specified service. + * + * Generated from protobuf field repeated .google.cloud.metastore.v1beta.Backup backups = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getBackups() + { + return $this->backups; + } + + /** + * The backups of the specified service. + * + * Generated from protobuf field repeated .google.cloud.metastore.v1beta.Backup backups = 1; + * @param array<\Google\Cloud\Metastore\V1beta\Backup>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setBackups($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Metastore\V1beta\Backup::class); + $this->backups = $arr; + + return $this; + } + + /** + * A token that can be sent as `page_token` to retrieve the next page. If this + * field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token that can be sent as `page_token` to retrieve the next page. If this + * field is omitted, there are no subsequent pages. + * + * 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; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUnreachable($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->unreachable = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/ListFederationsRequest.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/ListFederationsRequest.php new file mode 100644 index 000000000000..cd49d1a0f5c2 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/ListFederationsRequest.php @@ -0,0 +1,251 @@ +google.cloud.metastore.v1beta.ListFederationsRequest + */ +class ListFederationsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The relative resource name of the location of metastore + * federations to list, in the following form: + * `projects/{project_number}/locations/{location_id}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. The maximum number of federations to return. The response may + * contain less than the maximum number. If unspecified, no more than 500 + * services are returned. The maximum value is 1000; values above 1000 are + * changed to 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Optional. A page token, received from a previous ListFederationServices + * call. Provide this token to retrieve the subsequent page. + * To retrieve the first page, supply an empty page token. + * When paginating, other parameters provided to + * ListFederationServices must match the call that provided the + * page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = ''; + /** + * Optional. The filter to apply to list results. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $filter = ''; + /** + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $order_by = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The relative resource name of the location of metastore + * federations to list, in the following form: + * `projects/{project_number}/locations/{location_id}`. + * @type int $page_size + * Optional. The maximum number of federations to return. The response may + * contain less than the maximum number. If unspecified, no more than 500 + * services are returned. The maximum value is 1000; values above 1000 are + * changed to 1000. + * @type string $page_token + * Optional. A page token, received from a previous ListFederationServices + * call. Provide this token to retrieve the subsequent page. + * To retrieve the first page, supply an empty page token. + * When paginating, other parameters provided to + * ListFederationServices must match the call that provided the + * page token. + * @type string $filter + * Optional. The filter to apply to list results. + * @type string $order_by + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Beta\MetastoreFederation::initOnce(); + parent::__construct($data); + } + + /** + * Required. The relative resource name of the location of metastore + * federations to list, in the following form: + * `projects/{project_number}/locations/{location_id}`. + * + * 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. The relative resource name of the location of metastore + * federations to list, in the following form: + * `projects/{project_number}/locations/{location_id}`. + * + * 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. The maximum number of federations to return. The response may + * contain less than the maximum number. If unspecified, no more than 500 + * services are returned. The maximum value is 1000; values above 1000 are + * changed to 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. The maximum number of federations to return. The response may + * contain less than the maximum number. If unspecified, no more than 500 + * services are returned. The maximum value is 1000; values above 1000 are + * changed to 1000. + * + * 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 page token, received from a previous ListFederationServices + * call. Provide this token to retrieve the subsequent page. + * To retrieve the first page, supply an empty page token. + * When paginating, other parameters provided to + * ListFederationServices must match the call that provided the + * page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. A page token, received from a previous ListFederationServices + * call. Provide this token to retrieve the subsequent page. + * To retrieve the first page, supply an empty page token. + * When paginating, other parameters provided to + * ListFederationServices must match the call that provided the + * page token. + * + * 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. The filter to apply to list results. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Optional. The filter to apply to list results. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/ListFederationsResponse.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/ListFederationsResponse.php new file mode 100644 index 000000000000..c3e522aedae4 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/ListFederationsResponse.php @@ -0,0 +1,139 @@ +google.cloud.metastore.v1beta.ListFederationsResponse + */ +class ListFederationsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The services in the specified location. + * + * Generated from protobuf field repeated .google.cloud.metastore.v1beta.Federation federations = 1; + */ + private $federations; + /** + * A token that can be sent as `page_token` to retrieve the next page. If this + * field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + */ + private $unreachable; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Metastore\V1beta\Federation>|\Google\Protobuf\Internal\RepeatedField $federations + * The services in the specified location. + * @type string $next_page_token + * A token that can be sent as `page_token` to retrieve the next page. If this + * field is omitted, there are no subsequent pages. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Locations that could not be reached. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Beta\MetastoreFederation::initOnce(); + parent::__construct($data); + } + + /** + * The services in the specified location. + * + * Generated from protobuf field repeated .google.cloud.metastore.v1beta.Federation federations = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getFederations() + { + return $this->federations; + } + + /** + * The services in the specified location. + * + * Generated from protobuf field repeated .google.cloud.metastore.v1beta.Federation federations = 1; + * @param array<\Google\Cloud\Metastore\V1beta\Federation>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setFederations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Metastore\V1beta\Federation::class); + $this->federations = $arr; + + return $this; + } + + /** + * A token that can be sent as `page_token` to retrieve the next page. If this + * field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token that can be sent as `page_token` to retrieve the next page. If this + * field is omitted, there are no subsequent pages. + * + * 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; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUnreachable($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->unreachable = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/ListMetadataImportsRequest.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/ListMetadataImportsRequest.php new file mode 100644 index 000000000000..63bb5ae4dbc7 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/ListMetadataImportsRequest.php @@ -0,0 +1,252 @@ +google.cloud.metastore.v1beta.ListMetadataImportsRequest + */ +class ListMetadataImportsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The relative resource name of the service whose metadata imports + * to list, in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. The maximum number of imports to return. The response may contain + * less than the maximum number. If unspecified, no more than 500 imports are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Optional. A page token, received from a previous + * [DataprocMetastore.ListServices][google.cloud.metastore.v1beta.DataprocMetastore.ListServices] + * call. Provide this token to retrieve the subsequent page. + * To retrieve the first page, supply an empty page token. + * When paginating, other parameters provided to + * [DataprocMetastore.ListServices][google.cloud.metastore.v1beta.DataprocMetastore.ListServices] + * must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = ''; + /** + * Optional. The filter to apply to list results. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $filter = ''; + /** + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $order_by = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The relative resource name of the service whose metadata imports + * to list, in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. + * @type int $page_size + * Optional. The maximum number of imports to return. The response may contain + * less than the maximum number. If unspecified, no more than 500 imports are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + * @type string $page_token + * Optional. A page token, received from a previous + * [DataprocMetastore.ListServices][google.cloud.metastore.v1beta.DataprocMetastore.ListServices] + * call. Provide this token to retrieve the subsequent page. + * To retrieve the first page, supply an empty page token. + * When paginating, other parameters provided to + * [DataprocMetastore.ListServices][google.cloud.metastore.v1beta.DataprocMetastore.ListServices] + * must match the call that provided the page token. + * @type string $filter + * Optional. The filter to apply to list results. + * @type string $order_by + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Beta\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Required. The relative resource name of the service whose metadata imports + * to list, in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. + * + * 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. The relative resource name of the service whose metadata imports + * to list, in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. + * + * 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. The maximum number of imports to return. The response may contain + * less than the maximum number. If unspecified, no more than 500 imports are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. The maximum number of imports to return. The response may contain + * less than the maximum number. If unspecified, no more than 500 imports are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + * + * 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 page token, received from a previous + * [DataprocMetastore.ListServices][google.cloud.metastore.v1beta.DataprocMetastore.ListServices] + * call. Provide this token to retrieve the subsequent page. + * To retrieve the first page, supply an empty page token. + * When paginating, other parameters provided to + * [DataprocMetastore.ListServices][google.cloud.metastore.v1beta.DataprocMetastore.ListServices] + * must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. A page token, received from a previous + * [DataprocMetastore.ListServices][google.cloud.metastore.v1beta.DataprocMetastore.ListServices] + * call. Provide this token to retrieve the subsequent page. + * To retrieve the first page, supply an empty page token. + * When paginating, other parameters provided to + * [DataprocMetastore.ListServices][google.cloud.metastore.v1beta.DataprocMetastore.ListServices] + * must match the call that provided the page token. + * + * 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. The filter to apply to list results. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Optional. The filter to apply to list results. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/ListMetadataImportsResponse.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/ListMetadataImportsResponse.php new file mode 100644 index 000000000000..3185137d31b9 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/ListMetadataImportsResponse.php @@ -0,0 +1,140 @@ +google.cloud.metastore.v1beta.ListMetadataImportsResponse + */ +class ListMetadataImportsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The imports in the specified service. + * + * Generated from protobuf field repeated .google.cloud.metastore.v1beta.MetadataImport metadata_imports = 1; + */ + private $metadata_imports; + /** + * A token that can be sent as `page_token` to retrieve the next page. If this + * field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + */ + private $unreachable; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Metastore\V1beta\MetadataImport>|\Google\Protobuf\Internal\RepeatedField $metadata_imports + * The imports in the specified service. + * @type string $next_page_token + * A token that can be sent as `page_token` to retrieve the next page. If this + * field is omitted, there are no subsequent pages. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Locations that could not be reached. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Beta\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * The imports in the specified service. + * + * Generated from protobuf field repeated .google.cloud.metastore.v1beta.MetadataImport metadata_imports = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getMetadataImports() + { + return $this->metadata_imports; + } + + /** + * The imports in the specified service. + * + * Generated from protobuf field repeated .google.cloud.metastore.v1beta.MetadataImport metadata_imports = 1; + * @param array<\Google\Cloud\Metastore\V1beta\MetadataImport>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setMetadataImports($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Metastore\V1beta\MetadataImport::class); + $this->metadata_imports = $arr; + + return $this; + } + + /** + * A token that can be sent as `page_token` to retrieve the next page. If this + * field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token that can be sent as `page_token` to retrieve the next page. If this + * field is omitted, there are no subsequent pages. + * + * 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; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUnreachable($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->unreachable = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/ListServicesRequest.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/ListServicesRequest.php new file mode 100644 index 000000000000..3ad5134d65c1 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/ListServicesRequest.php @@ -0,0 +1,256 @@ +google.cloud.metastore.v1beta.ListServicesRequest + */ +class ListServicesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The relative resource name of the location of metastore services + * to list, in the following form: + * `projects/{project_number}/locations/{location_id}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. The maximum number of services to return. The response may + * contain less than the maximum number. If unspecified, no more than 500 + * services are returned. The maximum value is 1000; values above 1000 are + * changed to 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Optional. A page token, received from a previous + * [DataprocMetastore.ListServices][google.cloud.metastore.v1beta.DataprocMetastore.ListServices] + * call. Provide this token to retrieve the subsequent page. + * To retrieve the first page, supply an empty page token. + * When paginating, other parameters provided to + * [DataprocMetastore.ListServices][google.cloud.metastore.v1beta.DataprocMetastore.ListServices] + * must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = ''; + /** + * Optional. The filter to apply to list results. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $filter = ''; + /** + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $order_by = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The relative resource name of the location of metastore services + * to list, in the following form: + * `projects/{project_number}/locations/{location_id}`. + * @type int $page_size + * Optional. The maximum number of services to return. The response may + * contain less than the maximum number. If unspecified, no more than 500 + * services are returned. The maximum value is 1000; values above 1000 are + * changed to 1000. + * @type string $page_token + * Optional. A page token, received from a previous + * [DataprocMetastore.ListServices][google.cloud.metastore.v1beta.DataprocMetastore.ListServices] + * call. Provide this token to retrieve the subsequent page. + * To retrieve the first page, supply an empty page token. + * When paginating, other parameters provided to + * [DataprocMetastore.ListServices][google.cloud.metastore.v1beta.DataprocMetastore.ListServices] + * must match the call that provided the page token. + * @type string $filter + * Optional. The filter to apply to list results. + * @type string $order_by + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Beta\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Required. The relative resource name of the location of metastore services + * to list, in the following form: + * `projects/{project_number}/locations/{location_id}`. + * + * 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. The relative resource name of the location of metastore services + * to list, in the following form: + * `projects/{project_number}/locations/{location_id}`. + * + * 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. The maximum number of services to return. The response may + * contain less than the maximum number. If unspecified, no more than 500 + * services are returned. The maximum value is 1000; values above 1000 are + * changed to 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. The maximum number of services to return. The response may + * contain less than the maximum number. If unspecified, no more than 500 + * services are returned. The maximum value is 1000; values above 1000 are + * changed to 1000. + * + * 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 page token, received from a previous + * [DataprocMetastore.ListServices][google.cloud.metastore.v1beta.DataprocMetastore.ListServices] + * call. Provide this token to retrieve the subsequent page. + * To retrieve the first page, supply an empty page token. + * When paginating, other parameters provided to + * [DataprocMetastore.ListServices][google.cloud.metastore.v1beta.DataprocMetastore.ListServices] + * must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. A page token, received from a previous + * [DataprocMetastore.ListServices][google.cloud.metastore.v1beta.DataprocMetastore.ListServices] + * call. Provide this token to retrieve the subsequent page. + * To retrieve the first page, supply an empty page token. + * When paginating, other parameters provided to + * [DataprocMetastore.ListServices][google.cloud.metastore.v1beta.DataprocMetastore.ListServices] + * must match the call that provided the page token. + * + * 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. The filter to apply to list results. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Optional. The filter to apply to list results. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/ListServicesResponse.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/ListServicesResponse.php new file mode 100644 index 000000000000..b37cb04836b5 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/ListServicesResponse.php @@ -0,0 +1,140 @@ +google.cloud.metastore.v1beta.ListServicesResponse + */ +class ListServicesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The services in the specified location. + * + * Generated from protobuf field repeated .google.cloud.metastore.v1beta.Service services = 1; + */ + private $services; + /** + * A token that can be sent as `page_token` to retrieve the next page. If this + * field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + */ + private $unreachable; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Metastore\V1beta\Service>|\Google\Protobuf\Internal\RepeatedField $services + * The services in the specified location. + * @type string $next_page_token + * A token that can be sent as `page_token` to retrieve the next page. If this + * field is omitted, there are no subsequent pages. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Locations that could not be reached. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Beta\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * The services in the specified location. + * + * Generated from protobuf field repeated .google.cloud.metastore.v1beta.Service services = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getServices() + { + return $this->services; + } + + /** + * The services in the specified location. + * + * Generated from protobuf field repeated .google.cloud.metastore.v1beta.Service services = 1; + * @param array<\Google\Cloud\Metastore\V1beta\Service>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setServices($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Metastore\V1beta\Service::class); + $this->services = $arr; + + return $this; + } + + /** + * A token that can be sent as `page_token` to retrieve the next page. If this + * field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token that can be sent as `page_token` to retrieve the next page. If this + * field is omitted, there are no subsequent pages. + * + * 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; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUnreachable($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->unreachable = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/LocationMetadata.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/LocationMetadata.php new file mode 100644 index 000000000000..2399c3c3e4ec --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/LocationMetadata.php @@ -0,0 +1,75 @@ +google.cloud.metastore.v1beta.LocationMetadata + */ +class LocationMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * The versions of Hive Metastore that can be used when creating a new + * metastore service in this location. The server guarantees that exactly one + * `HiveMetastoreVersion` in the list will set `is_default`. + * + * Generated from protobuf field repeated .google.cloud.metastore.v1beta.LocationMetadata.HiveMetastoreVersion supported_hive_metastore_versions = 1; + */ + private $supported_hive_metastore_versions; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Metastore\V1beta\LocationMetadata\HiveMetastoreVersion>|\Google\Protobuf\Internal\RepeatedField $supported_hive_metastore_versions + * The versions of Hive Metastore that can be used when creating a new + * metastore service in this location. The server guarantees that exactly one + * `HiveMetastoreVersion` in the list will set `is_default`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Beta\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * The versions of Hive Metastore that can be used when creating a new + * metastore service in this location. The server guarantees that exactly one + * `HiveMetastoreVersion` in the list will set `is_default`. + * + * Generated from protobuf field repeated .google.cloud.metastore.v1beta.LocationMetadata.HiveMetastoreVersion supported_hive_metastore_versions = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSupportedHiveMetastoreVersions() + { + return $this->supported_hive_metastore_versions; + } + + /** + * The versions of Hive Metastore that can be used when creating a new + * metastore service in this location. The server guarantees that exactly one + * `HiveMetastoreVersion` in the list will set `is_default`. + * + * Generated from protobuf field repeated .google.cloud.metastore.v1beta.LocationMetadata.HiveMetastoreVersion supported_hive_metastore_versions = 1; + * @param array<\Google\Cloud\Metastore\V1beta\LocationMetadata\HiveMetastoreVersion>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSupportedHiveMetastoreVersions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Metastore\V1beta\LocationMetadata\HiveMetastoreVersion::class); + $this->supported_hive_metastore_versions = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/LocationMetadata/HiveMetastoreVersion.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/LocationMetadata/HiveMetastoreVersion.php new file mode 100644 index 000000000000..6e8fc8b023e8 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/LocationMetadata/HiveMetastoreVersion.php @@ -0,0 +1,108 @@ +google.cloud.metastore.v1beta.LocationMetadata.HiveMetastoreVersion + */ +class HiveMetastoreVersion extends \Google\Protobuf\Internal\Message +{ + /** + * The semantic version of the Hive Metastore software. + * + * Generated from protobuf field string version = 1; + */ + protected $version = ''; + /** + * Whether `version` will be chosen by the server if a metastore service is + * created with a `HiveMetastoreConfig` that omits the `version`. + * + * Generated from protobuf field bool is_default = 2; + */ + protected $is_default = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $version + * The semantic version of the Hive Metastore software. + * @type bool $is_default + * Whether `version` will be chosen by the server if a metastore service is + * created with a `HiveMetastoreConfig` that omits the `version`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Beta\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * The semantic version of the Hive Metastore software. + * + * Generated from protobuf field string version = 1; + * @return string + */ + public function getVersion() + { + return $this->version; + } + + /** + * The semantic version of the Hive Metastore software. + * + * Generated from protobuf field string version = 1; + * @param string $var + * @return $this + */ + public function setVersion($var) + { + GPBUtil::checkString($var, True); + $this->version = $var; + + return $this; + } + + /** + * Whether `version` will be chosen by the server if a metastore service is + * created with a `HiveMetastoreConfig` that omits the `version`. + * + * Generated from protobuf field bool is_default = 2; + * @return bool + */ + public function getIsDefault() + { + return $this->is_default; + } + + /** + * Whether `version` will be chosen by the server if a metastore service is + * created with a `HiveMetastoreConfig` that omits the `version`. + * + * Generated from protobuf field bool is_default = 2; + * @param bool $var + * @return $this + */ + public function setIsDefault($var) + { + GPBUtil::checkBool($var); + $this->is_default = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(HiveMetastoreVersion::class, \Google\Cloud\Metastore\V1beta\LocationMetadata_HiveMetastoreVersion::class); + diff --git a/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/LocationMetadata_HiveMetastoreVersion.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/LocationMetadata_HiveMetastoreVersion.php new file mode 100644 index 000000000000..3110a7f795b0 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/LocationMetadata_HiveMetastoreVersion.php @@ -0,0 +1,16 @@ +google.cloud.metastore.v1beta.MaintenanceWindow + */ +class MaintenanceWindow extends \Google\Protobuf\Internal\Message +{ + /** + * The hour of day (0-23) when the window starts. + * + * Generated from protobuf field .google.protobuf.Int32Value hour_of_day = 1; + */ + protected $hour_of_day = null; + /** + * The day of week, when the window starts. + * + * Generated from protobuf field .google.type.DayOfWeek day_of_week = 2; + */ + protected $day_of_week = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Int32Value $hour_of_day + * The hour of day (0-23) when the window starts. + * @type int $day_of_week + * The day of week, when the window starts. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Beta\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * The hour of day (0-23) when the window starts. + * + * Generated from protobuf field .google.protobuf.Int32Value hour_of_day = 1; + * @return \Google\Protobuf\Int32Value|null + */ + public function getHourOfDay() + { + return $this->hour_of_day; + } + + public function hasHourOfDay() + { + return isset($this->hour_of_day); + } + + public function clearHourOfDay() + { + unset($this->hour_of_day); + } + + /** + * Returns the unboxed value from getHourOfDay() + + * The hour of day (0-23) when the window starts. + * + * Generated from protobuf field .google.protobuf.Int32Value hour_of_day = 1; + * @return int|null + */ + public function getHourOfDayUnwrapped() + { + return $this->readWrapperValue("hour_of_day"); + } + + /** + * The hour of day (0-23) when the window starts. + * + * Generated from protobuf field .google.protobuf.Int32Value hour_of_day = 1; + * @param \Google\Protobuf\Int32Value $var + * @return $this + */ + public function setHourOfDay($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Int32Value::class); + $this->hour_of_day = $var; + + return $this; + } + + /** + * Sets the field by wrapping a primitive type in a Google\Protobuf\Int32Value object. + + * The hour of day (0-23) when the window starts. + * + * Generated from protobuf field .google.protobuf.Int32Value hour_of_day = 1; + * @param int|null $var + * @return $this + */ + public function setHourOfDayUnwrapped($var) + { + $this->writeWrapperValue("hour_of_day", $var); + return $this;} + + /** + * The day of week, when the window starts. + * + * Generated from protobuf field .google.type.DayOfWeek day_of_week = 2; + * @return int + */ + public function getDayOfWeek() + { + return $this->day_of_week; + } + + /** + * The day of week, when the window starts. + * + * Generated from protobuf field .google.type.DayOfWeek day_of_week = 2; + * @param int $var + * @return $this + */ + public function setDayOfWeek($var) + { + GPBUtil::checkEnum($var, \Google\Type\DayOfWeek::class); + $this->day_of_week = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/MetadataExport.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/MetadataExport.php new file mode 100644 index 000000000000..08d2d19f3979 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/MetadataExport.php @@ -0,0 +1,240 @@ +google.cloud.metastore.v1beta.MetadataExport + */ +class MetadataExport extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The time when the export started. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $start_time = null; + /** + * Output only. The time when the export ended. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $end_time = null; + /** + * Output only. The current state of the export. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.MetadataExport.State state = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Output only. The type of the database dump. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.DatabaseDumpSpec.Type database_dump_type = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $database_dump_type = 0; + protected $destination; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $destination_gcs_uri + * Output only. A Cloud Storage URI of a folder that metadata are exported + * to, in the form of + * `gs:////`, where + * `` is automatically generated. + * @type \Google\Protobuf\Timestamp $start_time + * Output only. The time when the export started. + * @type \Google\Protobuf\Timestamp $end_time + * Output only. The time when the export ended. + * @type int $state + * Output only. The current state of the export. + * @type int $database_dump_type + * Output only. The type of the database dump. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Beta\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Output only. A Cloud Storage URI of a folder that metadata are exported + * to, in the form of + * `gs:////`, where + * `` is automatically generated. + * + * Generated from protobuf field string destination_gcs_uri = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getDestinationGcsUri() + { + return $this->readOneof(4); + } + + public function hasDestinationGcsUri() + { + return $this->hasOneof(4); + } + + /** + * Output only. A Cloud Storage URI of a folder that metadata are exported + * to, in the form of + * `gs:////`, where + * `` is automatically generated. + * + * Generated from protobuf field string destination_gcs_uri = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setDestinationGcsUri($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * Output only. The time when the export started. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getStartTime() + { + return $this->start_time; + } + + public function hasStartTime() + { + return isset($this->start_time); + } + + public function clearStartTime() + { + unset($this->start_time); + } + + /** + * Output only. The time when the export started. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setStartTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->start_time = $var; + + return $this; + } + + /** + * Output only. The time when the export ended. + * + * 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 when the export ended. + * + * 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 current state of the export. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.MetadataExport.State state = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. The current state of the export. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.MetadataExport.State state = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Metastore\V1beta\MetadataExport\State::class); + $this->state = $var; + + return $this; + } + + /** + * Output only. The type of the database dump. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.DatabaseDumpSpec.Type database_dump_type = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getDatabaseDumpType() + { + return $this->database_dump_type; + } + + /** + * Output only. The type of the database dump. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.DatabaseDumpSpec.Type database_dump_type = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setDatabaseDumpType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Metastore\V1beta\DatabaseDumpSpec\Type::class); + $this->database_dump_type = $var; + + return $this; + } + + /** + * @return string + */ + public function getDestination() + { + return $this->whichOneof("destination"); + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/MetadataExport/State.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/MetadataExport/State.php new file mode 100644 index 000000000000..92bac47ffdc6 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/MetadataExport/State.php @@ -0,0 +1,78 @@ +google.cloud.metastore.v1beta.MetadataExport.State + */ +class State +{ + /** + * The state of the metadata export is unknown. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The metadata export is running. + * + * Generated from protobuf enum RUNNING = 1; + */ + const RUNNING = 1; + /** + * The metadata export completed successfully. + * + * Generated from protobuf enum SUCCEEDED = 2; + */ + const SUCCEEDED = 2; + /** + * The metadata export failed. + * + * Generated from protobuf enum FAILED = 3; + */ + const FAILED = 3; + /** + * The metadata export is cancelled. + * + * Generated from protobuf enum CANCELLED = 4; + */ + const CANCELLED = 4; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::RUNNING => 'RUNNING', + self::SUCCEEDED => 'SUCCEEDED', + self::FAILED => 'FAILED', + self::CANCELLED => 'CANCELLED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\Metastore\V1beta\MetadataExport_State::class); + diff --git a/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/MetadataExport_State.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/MetadataExport_State.php new file mode 100644 index 000000000000..fc0ed65eab07 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/MetadataExport_State.php @@ -0,0 +1,16 @@ +google.cloud.metastore.v1beta.MetadataImport + */ +class MetadataImport extends \Google\Protobuf\Internal\Message +{ + /** + * Immutable. The relative resource name of the metadata import, of the form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{metadata_import_id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + */ + protected $name = ''; + /** + * The description of the metadata import. + * + * Generated from protobuf field string description = 2; + */ + protected $description = ''; + /** + * Output only. The time when the metadata import was started. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. The time when the metadata import was last updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * Output only. The time when the metadata import finished. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $end_time = null; + /** + * Output only. The current state of the metadata import. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.MetadataImport.State state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + protected $metadata; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Metastore\V1beta\MetadataImport\DatabaseDump $database_dump + * Immutable. A database dump from a pre-existing metastore's database. + * @type string $name + * Immutable. The relative resource name of the metadata import, of the form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{metadata_import_id}`. + * @type string $description + * The description of the metadata import. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The time when the metadata import was started. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. The time when the metadata import was last updated. + * @type \Google\Protobuf\Timestamp $end_time + * Output only. The time when the metadata import finished. + * @type int $state + * Output only. The current state of the metadata import. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Beta\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Immutable. A database dump from a pre-existing metastore's database. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.MetadataImport.DatabaseDump database_dump = 6 [(.google.api.field_behavior) = IMMUTABLE]; + * @return \Google\Cloud\Metastore\V1beta\MetadataImport\DatabaseDump|null + */ + public function getDatabaseDump() + { + return $this->readOneof(6); + } + + public function hasDatabaseDump() + { + return $this->hasOneof(6); + } + + /** + * Immutable. A database dump from a pre-existing metastore's database. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.MetadataImport.DatabaseDump database_dump = 6 [(.google.api.field_behavior) = IMMUTABLE]; + * @param \Google\Cloud\Metastore\V1beta\MetadataImport\DatabaseDump $var + * @return $this + */ + public function setDatabaseDump($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Metastore\V1beta\MetadataImport\DatabaseDump::class); + $this->writeOneof(6, $var); + + return $this; + } + + /** + * Immutable. The relative resource name of the metadata import, of the form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{metadata_import_id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Immutable. The relative resource name of the metadata import, of the form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{metadata_import_id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The description of the metadata import. + * + * Generated from protobuf field string description = 2; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * The description of the metadata import. + * + * Generated from protobuf field string description = 2; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * Output only. The time when the metadata import was started. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 3 [(.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 when the metadata import was started. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 3 [(.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 when the metadata import was last updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 4 [(.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 when the metadata import was last updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 4 [(.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 time when the metadata import finished. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 7 [(.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 when the metadata import finished. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 7 [(.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 current state of the metadata import. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.MetadataImport.State state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. The current state of the metadata import. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.MetadataImport.State state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Metastore\V1beta\MetadataImport\State::class); + $this->state = $var; + + return $this; + } + + /** + * @return string + */ + public function getMetadata() + { + return $this->whichOneof("metadata"); + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/MetadataImport/DatabaseDump.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/MetadataImport/DatabaseDump.php new file mode 100644 index 000000000000..b70a092e0864 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/MetadataImport/DatabaseDump.php @@ -0,0 +1,191 @@ +google.cloud.metastore.v1beta.MetadataImport.DatabaseDump + */ +class DatabaseDump extends \Google\Protobuf\Internal\Message +{ + /** + * The type of the database. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.MetadataImport.DatabaseDump.DatabaseType database_type = 1 [deprecated = true]; + * @deprecated + */ + protected $database_type = 0; + /** + * A Cloud Storage object or folder URI that specifies the source from which + * to import metadata. It must begin with `gs://`. + * + * Generated from protobuf field string gcs_uri = 2; + */ + protected $gcs_uri = ''; + /** + * The name of the source database. + * + * Generated from protobuf field string source_database = 3 [deprecated = true]; + * @deprecated + */ + protected $source_database = ''; + /** + * Optional. The type of the database dump. If unspecified, defaults to + * `MYSQL`. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.DatabaseDumpSpec.Type type = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $type = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $database_type + * The type of the database. + * @type string $gcs_uri + * A Cloud Storage object or folder URI that specifies the source from which + * to import metadata. It must begin with `gs://`. + * @type string $source_database + * The name of the source database. + * @type int $type + * Optional. The type of the database dump. If unspecified, defaults to + * `MYSQL`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Beta\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * The type of the database. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.MetadataImport.DatabaseDump.DatabaseType database_type = 1 [deprecated = true]; + * @return int + * @deprecated + */ + public function getDatabaseType() + { + @trigger_error('database_type is deprecated.', E_USER_DEPRECATED); + return $this->database_type; + } + + /** + * The type of the database. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.MetadataImport.DatabaseDump.DatabaseType database_type = 1 [deprecated = true]; + * @param int $var + * @return $this + * @deprecated + */ + public function setDatabaseType($var) + { + @trigger_error('database_type is deprecated.', E_USER_DEPRECATED); + GPBUtil::checkEnum($var, \Google\Cloud\Metastore\V1beta\MetadataImport\DatabaseDump\DatabaseType::class); + $this->database_type = $var; + + return $this; + } + + /** + * A Cloud Storage object or folder URI that specifies the source from which + * to import metadata. It must begin with `gs://`. + * + * Generated from protobuf field string gcs_uri = 2; + * @return string + */ + public function getGcsUri() + { + return $this->gcs_uri; + } + + /** + * A Cloud Storage object or folder URI that specifies the source from which + * to import metadata. It must begin with `gs://`. + * + * Generated from protobuf field string gcs_uri = 2; + * @param string $var + * @return $this + */ + public function setGcsUri($var) + { + GPBUtil::checkString($var, True); + $this->gcs_uri = $var; + + return $this; + } + + /** + * The name of the source database. + * + * Generated from protobuf field string source_database = 3 [deprecated = true]; + * @return string + * @deprecated + */ + public function getSourceDatabase() + { + @trigger_error('source_database is deprecated.', E_USER_DEPRECATED); + return $this->source_database; + } + + /** + * The name of the source database. + * + * Generated from protobuf field string source_database = 3 [deprecated = true]; + * @param string $var + * @return $this + * @deprecated + */ + public function setSourceDatabase($var) + { + @trigger_error('source_database is deprecated.', E_USER_DEPRECATED); + GPBUtil::checkString($var, True); + $this->source_database = $var; + + return $this; + } + + /** + * Optional. The type of the database dump. If unspecified, defaults to + * `MYSQL`. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.DatabaseDumpSpec.Type type = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * Optional. The type of the database dump. If unspecified, defaults to + * `MYSQL`. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.DatabaseDumpSpec.Type type = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Metastore\V1beta\DatabaseDumpSpec\Type::class); + $this->type = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(DatabaseDump::class, \Google\Cloud\Metastore\V1beta\MetadataImport_DatabaseDump::class); + diff --git a/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/MetadataImport/DatabaseDump/DatabaseType.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/MetadataImport/DatabaseDump/DatabaseType.php new file mode 100644 index 000000000000..d217a3fd64c5 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/MetadataImport/DatabaseDump/DatabaseType.php @@ -0,0 +1,57 @@ +google.cloud.metastore.v1beta.MetadataImport.DatabaseDump.DatabaseType + */ +class DatabaseType +{ + /** + * The type of the source database is unknown. + * + * Generated from protobuf enum DATABASE_TYPE_UNSPECIFIED = 0; + */ + const DATABASE_TYPE_UNSPECIFIED = 0; + /** + * The type of the source database is MySQL. + * + * Generated from protobuf enum MYSQL = 1; + */ + const MYSQL = 1; + + private static $valueToName = [ + self::DATABASE_TYPE_UNSPECIFIED => 'DATABASE_TYPE_UNSPECIFIED', + self::MYSQL => 'MYSQL', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(DatabaseType::class, \Google\Cloud\Metastore\V1beta\MetadataImport_DatabaseDump_DatabaseType::class); + diff --git a/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/MetadataImport/State.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/MetadataImport/State.php new file mode 100644 index 000000000000..317ecb495509 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/MetadataImport/State.php @@ -0,0 +1,79 @@ +google.cloud.metastore.v1beta.MetadataImport.State + */ +class State +{ + /** + * The state of the metadata import is unknown. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The metadata import is running. + * + * Generated from protobuf enum RUNNING = 1; + */ + const RUNNING = 1; + /** + * The metadata import completed successfully. + * + * Generated from protobuf enum SUCCEEDED = 2; + */ + const SUCCEEDED = 2; + /** + * The metadata import is being updated. + * + * Generated from protobuf enum UPDATING = 3; + */ + const UPDATING = 3; + /** + * The metadata import failed, and attempted metadata changes were rolled + * back. + * + * Generated from protobuf enum FAILED = 4; + */ + const FAILED = 4; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::RUNNING => 'RUNNING', + self::SUCCEEDED => 'SUCCEEDED', + self::UPDATING => 'UPDATING', + self::FAILED => 'FAILED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\Metastore\V1beta\MetadataImport_State::class); + diff --git a/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/MetadataImport_DatabaseDump.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/MetadataImport_DatabaseDump.php new file mode 100644 index 000000000000..cd1701ef0757 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/MetadataImport_DatabaseDump.php @@ -0,0 +1,16 @@ +google.cloud.metastore.v1beta.MetadataIntegration + */ +class MetadataIntegration extends \Google\Protobuf\Internal\Message +{ + /** + * The integration config for the Data Catalog service. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.DataCatalogConfig data_catalog_config = 1; + */ + protected $data_catalog_config = null; + /** + * The integration config for the Dataplex service. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.DataplexConfig dataplex_config = 2; + */ + protected $dataplex_config = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Metastore\V1beta\DataCatalogConfig $data_catalog_config + * The integration config for the Data Catalog service. + * @type \Google\Cloud\Metastore\V1beta\DataplexConfig $dataplex_config + * The integration config for the Dataplex service. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Beta\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * The integration config for the Data Catalog service. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.DataCatalogConfig data_catalog_config = 1; + * @return \Google\Cloud\Metastore\V1beta\DataCatalogConfig|null + */ + public function getDataCatalogConfig() + { + return $this->data_catalog_config; + } + + public function hasDataCatalogConfig() + { + return isset($this->data_catalog_config); + } + + public function clearDataCatalogConfig() + { + unset($this->data_catalog_config); + } + + /** + * The integration config for the Data Catalog service. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.DataCatalogConfig data_catalog_config = 1; + * @param \Google\Cloud\Metastore\V1beta\DataCatalogConfig $var + * @return $this + */ + public function setDataCatalogConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Metastore\V1beta\DataCatalogConfig::class); + $this->data_catalog_config = $var; + + return $this; + } + + /** + * The integration config for the Dataplex service. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.DataplexConfig dataplex_config = 2; + * @return \Google\Cloud\Metastore\V1beta\DataplexConfig|null + */ + public function getDataplexConfig() + { + return $this->dataplex_config; + } + + public function hasDataplexConfig() + { + return isset($this->dataplex_config); + } + + public function clearDataplexConfig() + { + unset($this->dataplex_config); + } + + /** + * The integration config for the Dataplex service. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.DataplexConfig dataplex_config = 2; + * @param \Google\Cloud\Metastore\V1beta\DataplexConfig $var + * @return $this + */ + public function setDataplexConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Metastore\V1beta\DataplexConfig::class); + $this->dataplex_config = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/MetadataManagementActivity.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/MetadataManagementActivity.php new file mode 100644 index 000000000000..379ac929fda8 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/MetadataManagementActivity.php @@ -0,0 +1,101 @@ +google.cloud.metastore.v1beta.MetadataManagementActivity + */ +class MetadataManagementActivity extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The latest metadata exports of the metastore service. + * + * Generated from protobuf field repeated .google.cloud.metastore.v1beta.MetadataExport metadata_exports = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $metadata_exports; + /** + * Output only. The latest restores of the metastore service. + * + * Generated from protobuf field repeated .google.cloud.metastore.v1beta.Restore restores = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $restores; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Metastore\V1beta\MetadataExport>|\Google\Protobuf\Internal\RepeatedField $metadata_exports + * Output only. The latest metadata exports of the metastore service. + * @type array<\Google\Cloud\Metastore\V1beta\Restore>|\Google\Protobuf\Internal\RepeatedField $restores + * Output only. The latest restores of the metastore service. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Beta\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The latest metadata exports of the metastore service. + * + * Generated from protobuf field repeated .google.cloud.metastore.v1beta.MetadataExport metadata_exports = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getMetadataExports() + { + return $this->metadata_exports; + } + + /** + * Output only. The latest metadata exports of the metastore service. + * + * Generated from protobuf field repeated .google.cloud.metastore.v1beta.MetadataExport metadata_exports = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array<\Google\Cloud\Metastore\V1beta\MetadataExport>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setMetadataExports($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Metastore\V1beta\MetadataExport::class); + $this->metadata_exports = $arr; + + return $this; + } + + /** + * Output only. The latest restores of the metastore service. + * + * Generated from protobuf field repeated .google.cloud.metastore.v1beta.Restore restores = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRestores() + { + return $this->restores; + } + + /** + * Output only. The latest restores of the metastore service. + * + * Generated from protobuf field repeated .google.cloud.metastore.v1beta.Restore restores = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array<\Google\Cloud\Metastore\V1beta\Restore>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRestores($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Metastore\V1beta\Restore::class); + $this->restores = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/MoveTableToDatabaseRequest.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/MoveTableToDatabaseRequest.php new file mode 100644 index 000000000000..cb5c97e47bce --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/MoveTableToDatabaseRequest.php @@ -0,0 +1,178 @@ +google.cloud.metastore.v1beta.MoveTableToDatabaseRequest + */ +class MoveTableToDatabaseRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The relative resource name of the metastore service to mutate + * metadata, in the following format: + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * + * Generated from protobuf field string service = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $service = ''; + /** + * Required. The name of the table to be moved. + * + * Generated from protobuf field string table_name = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $table_name = ''; + /** + * Required. The name of the database where the table resides. + * + * Generated from protobuf field string db_name = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $db_name = ''; + /** + * Required. The name of the database where the table should be moved. + * + * Generated from protobuf field string destination_db_name = 4 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $destination_db_name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $service + * Required. The relative resource name of the metastore service to mutate + * metadata, in the following format: + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * @type string $table_name + * Required. The name of the table to be moved. + * @type string $db_name + * Required. The name of the database where the table resides. + * @type string $destination_db_name + * Required. The name of the database where the table should be moved. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Beta\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Required. The relative resource name of the metastore service to mutate + * metadata, in the following format: + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * + * Generated from protobuf field string service = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getService() + { + return $this->service; + } + + /** + * Required. The relative resource name of the metastore service to mutate + * metadata, in the following format: + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * + * Generated from protobuf field string service = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setService($var) + { + GPBUtil::checkString($var, True); + $this->service = $var; + + return $this; + } + + /** + * Required. The name of the table to be moved. + * + * Generated from protobuf field string table_name = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getTableName() + { + return $this->table_name; + } + + /** + * Required. The name of the table to be moved. + * + * Generated from protobuf field string table_name = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setTableName($var) + { + GPBUtil::checkString($var, True); + $this->table_name = $var; + + return $this; + } + + /** + * Required. The name of the database where the table resides. + * + * Generated from protobuf field string db_name = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getDbName() + { + return $this->db_name; + } + + /** + * Required. The name of the database where the table resides. + * + * Generated from protobuf field string db_name = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setDbName($var) + { + GPBUtil::checkString($var, True); + $this->db_name = $var; + + return $this; + } + + /** + * Required. The name of the database where the table should be moved. + * + * Generated from protobuf field string destination_db_name = 4 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getDestinationDbName() + { + return $this->destination_db_name; + } + + /** + * Required. The name of the database where the table should be moved. + * + * Generated from protobuf field string destination_db_name = 4 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setDestinationDbName($var) + { + GPBUtil::checkString($var, True); + $this->destination_db_name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/MoveTableToDatabaseResponse.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/MoveTableToDatabaseResponse.php new file mode 100644 index 000000000000..d37cfad3e623 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/MoveTableToDatabaseResponse.php @@ -0,0 +1,34 @@ +google.cloud.metastore.v1beta.MoveTableToDatabaseResponse + */ +class MoveTableToDatabaseResponse extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Beta\Metastore::initOnce(); + parent::__construct($data); + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/NetworkConfig.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/NetworkConfig.php new file mode 100644 index 000000000000..c59d58f344fb --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/NetworkConfig.php @@ -0,0 +1,109 @@ +google.cloud.metastore.v1beta.NetworkConfig + */ +class NetworkConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Immutable. The consumer-side network configuration for the Dataproc + * Metastore instance. + * + * Generated from protobuf field repeated .google.cloud.metastore.v1beta.NetworkConfig.Consumer consumers = 1 [(.google.api.field_behavior) = IMMUTABLE]; + */ + private $consumers; + /** + * Enables custom routes to be imported and exported for the Dataproc + * Metastore service's peered VPC network. + * + * Generated from protobuf field bool custom_routes_enabled = 2; + */ + protected $custom_routes_enabled = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Metastore\V1beta\NetworkConfig\Consumer>|\Google\Protobuf\Internal\RepeatedField $consumers + * Immutable. The consumer-side network configuration for the Dataproc + * Metastore instance. + * @type bool $custom_routes_enabled + * Enables custom routes to be imported and exported for the Dataproc + * Metastore service's peered VPC network. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Beta\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Immutable. The consumer-side network configuration for the Dataproc + * Metastore instance. + * + * Generated from protobuf field repeated .google.cloud.metastore.v1beta.NetworkConfig.Consumer consumers = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getConsumers() + { + return $this->consumers; + } + + /** + * Immutable. The consumer-side network configuration for the Dataproc + * Metastore instance. + * + * Generated from protobuf field repeated .google.cloud.metastore.v1beta.NetworkConfig.Consumer consumers = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * @param array<\Google\Cloud\Metastore\V1beta\NetworkConfig\Consumer>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setConsumers($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Metastore\V1beta\NetworkConfig\Consumer::class); + $this->consumers = $arr; + + return $this; + } + + /** + * Enables custom routes to be imported and exported for the Dataproc + * Metastore service's peered VPC network. + * + * Generated from protobuf field bool custom_routes_enabled = 2; + * @return bool + */ + public function getCustomRoutesEnabled() + { + return $this->custom_routes_enabled; + } + + /** + * Enables custom routes to be imported and exported for the Dataproc + * Metastore service's peered VPC network. + * + * Generated from protobuf field bool custom_routes_enabled = 2; + * @param bool $var + * @return $this + */ + public function setCustomRoutesEnabled($var) + { + GPBUtil::checkBool($var); + $this->custom_routes_enabled = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/NetworkConfig/Consumer.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/NetworkConfig/Consumer.php new file mode 100644 index 000000000000..6db4093fea06 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/NetworkConfig/Consumer.php @@ -0,0 +1,134 @@ +google.cloud.metastore.v1beta.NetworkConfig.Consumer + */ +class Consumer extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The URI of the endpoint used to access the metastore + * service. + * + * Generated from protobuf field string endpoint_uri = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $endpoint_uri = ''; + protected $vpc_resource; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $subnetwork + * Immutable. The subnetwork of the customer project from which an IP + * address is reserved and used as the Dataproc Metastore service's + * endpoint. It is accessible to hosts in the subnet and to all + * hosts in a subnet in the same region and same network. There must + * be at least one IP address available in the subnet's primary range. The + * subnet is specified in the following form: + * `projects/{project_number}/regions/{region_id}/subnetworks/{subnetwork_id}` + * @type string $endpoint_uri + * Output only. The URI of the endpoint used to access the metastore + * service. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Beta\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Immutable. The subnetwork of the customer project from which an IP + * address is reserved and used as the Dataproc Metastore service's + * endpoint. It is accessible to hosts in the subnet and to all + * hosts in a subnet in the same region and same network. There must + * be at least one IP address available in the subnet's primary range. The + * subnet is specified in the following form: + * `projects/{project_number}/regions/{region_id}/subnetworks/{subnetwork_id}` + * + * Generated from protobuf field string subnetwork = 1 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.resource_reference) = { + * @return string + */ + public function getSubnetwork() + { + return $this->readOneof(1); + } + + public function hasSubnetwork() + { + return $this->hasOneof(1); + } + + /** + * Immutable. The subnetwork of the customer project from which an IP + * address is reserved and used as the Dataproc Metastore service's + * endpoint. It is accessible to hosts in the subnet and to all + * hosts in a subnet in the same region and same network. There must + * be at least one IP address available in the subnet's primary range. The + * subnet is specified in the following form: + * `projects/{project_number}/regions/{region_id}/subnetworks/{subnetwork_id}` + * + * Generated from protobuf field string subnetwork = 1 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setSubnetwork($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * Output only. The URI of the endpoint used to access the metastore + * service. + * + * Generated from protobuf field string endpoint_uri = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getEndpointUri() + { + return $this->endpoint_uri; + } + + /** + * Output only. The URI of the endpoint used to access the metastore + * service. + * + * Generated from protobuf field string endpoint_uri = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setEndpointUri($var) + { + GPBUtil::checkString($var, True); + $this->endpoint_uri = $var; + + return $this; + } + + /** + * @return string + */ + public function getVpcResource() + { + return $this->whichOneof("vpc_resource"); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Consumer::class, \Google\Cloud\Metastore\V1beta\NetworkConfig_Consumer::class); + diff --git a/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/NetworkConfig_Consumer.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/NetworkConfig_Consumer.php new file mode 100644 index 000000000000..8f7e3889933d --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/NetworkConfig_Consumer.php @@ -0,0 +1,16 @@ +google.cloud.metastore.v1beta.OperationMetadata + */ +class OperationMetadata 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. Server-defined resource path for the target of the operation. + * + * Generated from protobuf field string target = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $target = ''; + /** + * Output only. Name of the verb executed by the operation. + * + * Generated from protobuf field string verb = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $verb = ''; + /** + * Output only. Human-readable status of the operation, if any. + * + * Generated from protobuf field string status_message = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $status_message = ''; + /** + * Output only. Identifies whether the caller has requested cancellation + * of the operation. Operations that have successfully been cancelled + * have [Operation.error][] value with a + * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + * `Code.CANCELLED`. + * + * Generated from protobuf field bool requested_cancellation = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $requested_cancellation = false; + /** + * Output only. API version used to start the operation. + * + * Generated from protobuf field string api_version = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $api_version = ''; + + /** + * 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 string $target + * Output only. Server-defined resource path for the target of the operation. + * @type string $verb + * Output only. Name of the verb executed by the operation. + * @type string $status_message + * Output only. Human-readable status of the operation, if any. + * @type bool $requested_cancellation + * Output only. Identifies whether the caller has requested cancellation + * of the operation. Operations that have successfully been cancelled + * have [Operation.error][] value with a + * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + * `Code.CANCELLED`. + * @type string $api_version + * Output only. API version used to start the operation. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Beta\Metastore::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. Server-defined resource path for the target of the operation. + * + * Generated from protobuf field string target = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getTarget() + { + return $this->target; + } + + /** + * Output only. Server-defined resource path for the target of the operation. + * + * Generated from protobuf field string target = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setTarget($var) + { + GPBUtil::checkString($var, True); + $this->target = $var; + + return $this; + } + + /** + * Output only. Name of the verb executed by the operation. + * + * Generated from protobuf field string verb = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getVerb() + { + return $this->verb; + } + + /** + * Output only. Name of the verb executed by the operation. + * + * Generated from protobuf field string verb = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setVerb($var) + { + GPBUtil::checkString($var, True); + $this->verb = $var; + + return $this; + } + + /** + * Output only. Human-readable status of the operation, if any. + * + * Generated from protobuf field string status_message = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getStatusMessage() + { + return $this->status_message; + } + + /** + * Output only. Human-readable status of the operation, if any. + * + * Generated from protobuf field string status_message = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setStatusMessage($var) + { + GPBUtil::checkString($var, True); + $this->status_message = $var; + + return $this; + } + + /** + * Output only. Identifies whether the caller has requested cancellation + * of the operation. Operations that have successfully been cancelled + * have [Operation.error][] value with a + * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + * `Code.CANCELLED`. + * + * Generated from protobuf field bool requested_cancellation = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return bool + */ + public function getRequestedCancellation() + { + return $this->requested_cancellation; + } + + /** + * Output only. Identifies whether the caller has requested cancellation + * of the operation. Operations that have successfully been cancelled + * have [Operation.error][] value with a + * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + * `Code.CANCELLED`. + * + * Generated from protobuf field bool requested_cancellation = 6 [(.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. API version used to start the operation. + * + * Generated from protobuf field string api_version = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getApiVersion() + { + return $this->api_version; + } + + /** + * Output only. API version used to start the operation. + * + * Generated from protobuf field string api_version = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setApiVersion($var) + { + GPBUtil::checkString($var, True); + $this->api_version = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/QueryMetadataRequest.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/QueryMetadataRequest.php new file mode 100644 index 000000000000..fcab55a190ee --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/QueryMetadataRequest.php @@ -0,0 +1,114 @@ +google.cloud.metastore.v1beta.QueryMetadataRequest + */ +class QueryMetadataRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The relative resource name of the metastore service to query + * metadata, in the following format: + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * + * Generated from protobuf field string service = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $service = ''; + /** + * Required. A read-only SQL query to execute against the metadata database. + * The query cannot change or mutate the data. + * + * Generated from protobuf field string query = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $query = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $service + * Required. The relative resource name of the metastore service to query + * metadata, in the following format: + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * @type string $query + * Required. A read-only SQL query to execute against the metadata database. + * The query cannot change or mutate the data. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Beta\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Required. The relative resource name of the metastore service to query + * metadata, in the following format: + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * + * Generated from protobuf field string service = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getService() + { + return $this->service; + } + + /** + * Required. The relative resource name of the metastore service to query + * metadata, in the following format: + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * + * Generated from protobuf field string service = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setService($var) + { + GPBUtil::checkString($var, True); + $this->service = $var; + + return $this; + } + + /** + * Required. A read-only SQL query to execute against the metadata database. + * The query cannot change or mutate the data. + * + * Generated from protobuf field string query = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getQuery() + { + return $this->query; + } + + /** + * Required. A read-only SQL query to execute against the metadata database. + * The query cannot change or mutate the data. + * + * Generated from protobuf field string query = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setQuery($var) + { + GPBUtil::checkString($var, True); + $this->query = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/QueryMetadataResponse.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/QueryMetadataResponse.php new file mode 100644 index 000000000000..c9ce754485c8 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/QueryMetadataResponse.php @@ -0,0 +1,80 @@ +google.cloud.metastore.v1beta.QueryMetadataResponse + */ +class QueryMetadataResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The manifest URI is link to a JSON instance in Cloud Storage. + * This instance manifests immediately along with QueryMetadataResponse. The + * content of the URI is not retriable until the long-running operation query + * against the metadata finishes. + * + * Generated from protobuf field string result_manifest_uri = 1; + */ + protected $result_manifest_uri = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $result_manifest_uri + * The manifest URI is link to a JSON instance in Cloud Storage. + * This instance manifests immediately along with QueryMetadataResponse. The + * content of the URI is not retriable until the long-running operation query + * against the metadata finishes. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Beta\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * The manifest URI is link to a JSON instance in Cloud Storage. + * This instance manifests immediately along with QueryMetadataResponse. The + * content of the URI is not retriable until the long-running operation query + * against the metadata finishes. + * + * Generated from protobuf field string result_manifest_uri = 1; + * @return string + */ + public function getResultManifestUri() + { + return $this->result_manifest_uri; + } + + /** + * The manifest URI is link to a JSON instance in Cloud Storage. + * This instance manifests immediately along with QueryMetadataResponse. The + * content of the URI is not retriable until the long-running operation query + * against the metadata finishes. + * + * Generated from protobuf field string result_manifest_uri = 1; + * @param string $var + * @return $this + */ + public function setResultManifestUri($var) + { + GPBUtil::checkString($var, True); + $this->result_manifest_uri = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/RemoveIamPolicyRequest.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/RemoveIamPolicyRequest.php new file mode 100644 index 000000000000..ef9bdbaada41 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/RemoveIamPolicyRequest.php @@ -0,0 +1,122 @@ +google.cloud.metastore.v1beta.RemoveIamPolicyRequest + */ +class RemoveIamPolicyRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The relative resource name of the dataplane resource to remove + * IAM policy, in the following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}/databases/{database_id}` + * or + * `projects/{project_id}/locations/{location_id}/services/{service_id}/databases/{database_id}/tables/{table_id}`. + * + * Generated from protobuf field string resource = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $resource = ''; + /** + * Optional. Removes IAM policy attached to database or table asynchronously + * when it is set. The default is false. + * + * Generated from protobuf field bool asynchronous = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $asynchronous = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $resource + * Required. The relative resource name of the dataplane resource to remove + * IAM policy, in the following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}/databases/{database_id}` + * or + * `projects/{project_id}/locations/{location_id}/services/{service_id}/databases/{database_id}/tables/{table_id}`. + * @type bool $asynchronous + * Optional. Removes IAM policy attached to database or table asynchronously + * when it is set. The default is false. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Beta\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Required. The relative resource name of the dataplane resource to remove + * IAM policy, in the following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}/databases/{database_id}` + * or + * `projects/{project_id}/locations/{location_id}/services/{service_id}/databases/{database_id}/tables/{table_id}`. + * + * Generated from protobuf field string resource = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getResource() + { + return $this->resource; + } + + /** + * Required. The relative resource name of the dataplane resource to remove + * IAM policy, in the following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}/databases/{database_id}` + * or + * `projects/{project_id}/locations/{location_id}/services/{service_id}/databases/{database_id}/tables/{table_id}`. + * + * Generated from protobuf field string resource = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setResource($var) + { + GPBUtil::checkString($var, True); + $this->resource = $var; + + return $this; + } + + /** + * Optional. Removes IAM policy attached to database or table asynchronously + * when it is set. The default is false. + * + * Generated from protobuf field bool asynchronous = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getAsynchronous() + { + return $this->asynchronous; + } + + /** + * Optional. Removes IAM policy attached to database or table asynchronously + * when it is set. The default is false. + * + * Generated from protobuf field bool asynchronous = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setAsynchronous($var) + { + GPBUtil::checkBool($var); + $this->asynchronous = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/RemoveIamPolicyResponse.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/RemoveIamPolicyResponse.php new file mode 100644 index 000000000000..97cd799fd970 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/RemoveIamPolicyResponse.php @@ -0,0 +1,68 @@ +google.cloud.metastore.v1beta.RemoveIamPolicyResponse + */ +class RemoveIamPolicyResponse extends \Google\Protobuf\Internal\Message +{ + /** + * True if the policy is successfully removed. + * + * Generated from protobuf field bool success = 1; + */ + protected $success = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $success + * True if the policy is successfully removed. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Beta\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * True if the policy is successfully removed. + * + * Generated from protobuf field bool success = 1; + * @return bool + */ + public function getSuccess() + { + return $this->success; + } + + /** + * True if the policy is successfully removed. + * + * Generated from protobuf field bool success = 1; + * @param bool $var + * @return $this + */ + public function setSuccess($var) + { + GPBUtil::checkBool($var); + $this->success = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/Restore.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/Restore.php new file mode 100644 index 000000000000..08b45e5feddb --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/Restore.php @@ -0,0 +1,269 @@ +google.cloud.metastore.v1beta.Restore + */ +class Restore extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The time when the restore started. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $start_time = null; + /** + * Output only. The time when the restore ended. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $end_time = null; + /** + * Output only. The current state of the restore. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.Restore.State state = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Output only. The relative resource name of the metastore service backup to + * restore from, in the following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + * + * Generated from protobuf field string backup = 4 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + */ + protected $backup = ''; + /** + * Output only. The type of restore. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.Restore.RestoreType type = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $type = 0; + /** + * Output only. The restore details containing the revision of the service to + * be restored to, in format of JSON. + * + * Generated from protobuf field string details = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $details = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Timestamp $start_time + * Output only. The time when the restore started. + * @type \Google\Protobuf\Timestamp $end_time + * Output only. The time when the restore ended. + * @type int $state + * Output only. The current state of the restore. + * @type string $backup + * Output only. The relative resource name of the metastore service backup to + * restore from, in the following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + * @type int $type + * Output only. The type of restore. + * @type string $details + * Output only. The restore details containing the revision of the service to + * be restored to, in format of JSON. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Beta\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The time when the restore started. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getStartTime() + { + return $this->start_time; + } + + public function hasStartTime() + { + return isset($this->start_time); + } + + public function clearStartTime() + { + unset($this->start_time); + } + + /** + * Output only. The time when the restore started. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setStartTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->start_time = $var; + + return $this; + } + + /** + * Output only. The time when the restore ended. + * + * 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 when the restore ended. + * + * 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 current state of the restore. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.Restore.State state = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. The current state of the restore. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.Restore.State state = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Metastore\V1beta\Restore\State::class); + $this->state = $var; + + return $this; + } + + /** + * Output only. The relative resource name of the metastore service backup to + * restore from, in the following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + * + * Generated from protobuf field string backup = 4 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + * @return string + */ + public function getBackup() + { + return $this->backup; + } + + /** + * Output only. The relative resource name of the metastore service backup to + * restore from, in the following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + * + * Generated from protobuf field string backup = 4 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setBackup($var) + { + GPBUtil::checkString($var, True); + $this->backup = $var; + + return $this; + } + + /** + * Output only. The type of restore. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.Restore.RestoreType type = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * Output only. The type of restore. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.Restore.RestoreType type = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Metastore\V1beta\Restore\RestoreType::class); + $this->type = $var; + + return $this; + } + + /** + * Output only. The restore details containing the revision of the service to + * be restored to, in format of JSON. + * + * Generated from protobuf field string details = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getDetails() + { + return $this->details; + } + + /** + * Output only. The restore details containing the revision of the service to + * be restored to, in format of JSON. + * + * Generated from protobuf field string details = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setDetails($var) + { + GPBUtil::checkString($var, True); + $this->details = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/Restore/RestoreType.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/Restore/RestoreType.php new file mode 100644 index 000000000000..72d5ccd06ea4 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/Restore/RestoreType.php @@ -0,0 +1,64 @@ +google.cloud.metastore.v1beta.Restore.RestoreType + */ +class RestoreType +{ + /** + * The restore type is unknown. + * + * Generated from protobuf enum RESTORE_TYPE_UNSPECIFIED = 0; + */ + const RESTORE_TYPE_UNSPECIFIED = 0; + /** + * The service's metadata and configuration are restored. + * + * Generated from protobuf enum FULL = 1; + */ + const FULL = 1; + /** + * Only the service's metadata is restored. + * + * Generated from protobuf enum METADATA_ONLY = 2; + */ + const METADATA_ONLY = 2; + + private static $valueToName = [ + self::RESTORE_TYPE_UNSPECIFIED => 'RESTORE_TYPE_UNSPECIFIED', + self::FULL => 'FULL', + self::METADATA_ONLY => 'METADATA_ONLY', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(RestoreType::class, \Google\Cloud\Metastore\V1beta\Restore_RestoreType::class); + diff --git a/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/Restore/State.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/Restore/State.php new file mode 100644 index 000000000000..9d8d0bc75bfa --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/Restore/State.php @@ -0,0 +1,78 @@ +google.cloud.metastore.v1beta.Restore.State + */ +class State +{ + /** + * The state of the metadata restore is unknown. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The metadata restore is running. + * + * Generated from protobuf enum RUNNING = 1; + */ + const RUNNING = 1; + /** + * The metadata restore completed successfully. + * + * Generated from protobuf enum SUCCEEDED = 2; + */ + const SUCCEEDED = 2; + /** + * The metadata restore failed. + * + * Generated from protobuf enum FAILED = 3; + */ + const FAILED = 3; + /** + * The metadata restore is cancelled. + * + * Generated from protobuf enum CANCELLED = 4; + */ + const CANCELLED = 4; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::RUNNING => 'RUNNING', + self::SUCCEEDED => 'SUCCEEDED', + self::FAILED => 'FAILED', + self::CANCELLED => 'CANCELLED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\Metastore\V1beta\Restore_State::class); + diff --git a/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/RestoreServiceRequest.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/RestoreServiceRequest.php new file mode 100644 index 000000000000..9b2a11f70b4d --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/RestoreServiceRequest.php @@ -0,0 +1,221 @@ +google.cloud.metastore.v1beta.RestoreServiceRequest + */ +class RestoreServiceRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The relative resource name of the metastore service to run + * restore, in the following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * + * Generated from protobuf field string service = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $service = ''; + /** + * Required. The relative resource name of the metastore service backup to + * restore from, in the following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + * + * Generated from protobuf field string backup = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $backup = ''; + /** + * Optional. The type of restore. If unspecified, defaults to `METADATA_ONLY`. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.Restore.RestoreType restore_type = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $restore_type = 0; + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $service + * Required. The relative resource name of the metastore service to run + * restore, in the following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * @type string $backup + * Required. The relative resource name of the metastore service backup to + * restore from, in the following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + * @type int $restore_type + * Optional. The type of restore. If unspecified, defaults to `METADATA_ONLY`. + * @type string $request_id + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Beta\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Required. The relative resource name of the metastore service to run + * restore, in the following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * + * Generated from protobuf field string service = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getService() + { + return $this->service; + } + + /** + * Required. The relative resource name of the metastore service to run + * restore, in the following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * + * Generated from protobuf field string service = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setService($var) + { + GPBUtil::checkString($var, True); + $this->service = $var; + + return $this; + } + + /** + * Required. The relative resource name of the metastore service backup to + * restore from, in the following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + * + * Generated from protobuf field string backup = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getBackup() + { + return $this->backup; + } + + /** + * Required. The relative resource name of the metastore service backup to + * restore from, in the following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + * + * Generated from protobuf field string backup = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setBackup($var) + { + GPBUtil::checkString($var, True); + $this->backup = $var; + + return $this; + } + + /** + * Optional. The type of restore. If unspecified, defaults to `METADATA_ONLY`. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.Restore.RestoreType restore_type = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getRestoreType() + { + return $this->restore_type; + } + + /** + * Optional. The type of restore. If unspecified, defaults to `METADATA_ONLY`. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.Restore.RestoreType restore_type = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setRestoreType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Metastore\V1beta\Restore\RestoreType::class); + $this->restore_type = $var; + + return $this; + } + + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @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/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/Restore_RestoreType.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/Restore_RestoreType.php new file mode 100644 index 000000000000..84ae8965aa18 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/Restore_RestoreType.php @@ -0,0 +1,16 @@ +google.cloud.metastore.v1beta.ScalingConfig + */ +class ScalingConfig extends \Google\Protobuf\Internal\Message +{ + protected $scaling_model; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $instance_size + * An enum of readable instance sizes, with each instance size mapping to a + * float value (e.g. InstanceSize.EXTRA_SMALL = scaling_factor(0.1)) + * @type float $scaling_factor + * Scaling factor, increments of 0.1 for values less than 1.0, and + * increments of 1.0 for values greater than 1.0. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Beta\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * An enum of readable instance sizes, with each instance size mapping to a + * float value (e.g. InstanceSize.EXTRA_SMALL = scaling_factor(0.1)) + * + * Generated from protobuf field .google.cloud.metastore.v1beta.ScalingConfig.InstanceSize instance_size = 1; + * @return int + */ + public function getInstanceSize() + { + return $this->readOneof(1); + } + + public function hasInstanceSize() + { + return $this->hasOneof(1); + } + + /** + * An enum of readable instance sizes, with each instance size mapping to a + * float value (e.g. InstanceSize.EXTRA_SMALL = scaling_factor(0.1)) + * + * Generated from protobuf field .google.cloud.metastore.v1beta.ScalingConfig.InstanceSize instance_size = 1; + * @param int $var + * @return $this + */ + public function setInstanceSize($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Metastore\V1beta\ScalingConfig\InstanceSize::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * Scaling factor, increments of 0.1 for values less than 1.0, and + * increments of 1.0 for values greater than 1.0. + * + * Generated from protobuf field float scaling_factor = 2; + * @return float + */ + public function getScalingFactor() + { + return $this->readOneof(2); + } + + public function hasScalingFactor() + { + return $this->hasOneof(2); + } + + /** + * Scaling factor, increments of 0.1 for values less than 1.0, and + * increments of 1.0 for values greater than 1.0. + * + * Generated from protobuf field float scaling_factor = 2; + * @param float $var + * @return $this + */ + public function setScalingFactor($var) + { + GPBUtil::checkFloat($var); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * @return string + */ + public function getScalingModel() + { + return $this->whichOneof("scaling_model"); + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/ScalingConfig/InstanceSize.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/ScalingConfig/InstanceSize.php new file mode 100644 index 000000000000..5b62c489ed94 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/ScalingConfig/InstanceSize.php @@ -0,0 +1,85 @@ +google.cloud.metastore.v1beta.ScalingConfig.InstanceSize + */ +class InstanceSize +{ + /** + * Unspecified instance size + * + * Generated from protobuf enum INSTANCE_SIZE_UNSPECIFIED = 0; + */ + const INSTANCE_SIZE_UNSPECIFIED = 0; + /** + * Extra small instance size, maps to a scaling factor of 0.1. + * + * Generated from protobuf enum EXTRA_SMALL = 1; + */ + const EXTRA_SMALL = 1; + /** + * Small instance size, maps to a scaling factor of 0.5. + * + * Generated from protobuf enum SMALL = 2; + */ + const SMALL = 2; + /** + * Medium instance size, maps to a scaling factor of 1.0. + * + * Generated from protobuf enum MEDIUM = 3; + */ + const MEDIUM = 3; + /** + * Large instance size, maps to a scaling factor of 3.0. + * + * Generated from protobuf enum LARGE = 4; + */ + const LARGE = 4; + /** + * Extra large instance size, maps to a scaling factor of 6.0. + * + * Generated from protobuf enum EXTRA_LARGE = 5; + */ + const EXTRA_LARGE = 5; + + private static $valueToName = [ + self::INSTANCE_SIZE_UNSPECIFIED => 'INSTANCE_SIZE_UNSPECIFIED', + self::EXTRA_SMALL => 'EXTRA_SMALL', + self::SMALL => 'SMALL', + self::MEDIUM => 'MEDIUM', + self::LARGE => 'LARGE', + self::EXTRA_LARGE => 'EXTRA_LARGE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(InstanceSize::class, \Google\Cloud\Metastore\V1beta\ScalingConfig_InstanceSize::class); + diff --git a/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/ScalingConfig_InstanceSize.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/ScalingConfig_InstanceSize.php new file mode 100644 index 000000000000..98f36a9a11ff --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/ScalingConfig_InstanceSize.php @@ -0,0 +1,16 @@ +google.cloud.metastore.v1beta.Secret + */ +class Secret extends \Google\Protobuf\Internal\Message +{ + protected $value; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $cloud_secret + * The relative resource name of a Secret Manager secret version, in the + * following form: + * `projects/{project_number}/secrets/{secret_id}/versions/{version_id}`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Beta\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * The relative resource name of a Secret Manager secret version, in the + * following form: + * `projects/{project_number}/secrets/{secret_id}/versions/{version_id}`. + * + * Generated from protobuf field string cloud_secret = 2; + * @return string + */ + public function getCloudSecret() + { + return $this->readOneof(2); + } + + public function hasCloudSecret() + { + return $this->hasOneof(2); + } + + /** + * The relative resource name of a Secret Manager secret version, in the + * following form: + * `projects/{project_number}/secrets/{secret_id}/versions/{version_id}`. + * + * Generated from protobuf field string cloud_secret = 2; + * @param string $var + * @return $this + */ + public function setCloudSecret($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * @return string + */ + public function getValue() + { + return $this->whichOneof("value"); + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/Service.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/Service.php new file mode 100644 index 000000000000..5c9d221a90af --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/Service.php @@ -0,0 +1,942 @@ +google.cloud.metastore.v1beta.Service + */ +class Service extends \Google\Protobuf\Internal\Message +{ + /** + * Immutable. The relative resource name of the metastore service, in the + * following format: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + */ + protected $name = ''; + /** + * Output only. The time when the metastore service was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. The time when the metastore service was last updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * User-defined labels for the metastore service. + * + * Generated from protobuf field map labels = 4; + */ + private $labels; + /** + * Immutable. The relative resource name of the VPC network on which the + * instance can be accessed. It is specified in the following form: + * `projects/{project_number}/global/networks/{network_id}`. + * + * Generated from protobuf field string network = 7 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.resource_reference) = { + */ + protected $network = ''; + /** + * Output only. The URI of the endpoint used to access the metastore service. + * + * Generated from protobuf field string endpoint_uri = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $endpoint_uri = ''; + /** + * The TCP port at which the metastore service is reached. Default: 9083. + * + * Generated from protobuf field int32 port = 9; + */ + protected $port = 0; + /** + * Output only. The current state of the metastore service. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.Service.State state = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Output only. Additional information about the current state of the + * metastore service, if available. + * + * Generated from protobuf field string state_message = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state_message = ''; + /** + * Output only. A Cloud Storage URI (starting with `gs://`) that specifies + * where artifacts related to the metastore service are stored. + * + * Generated from protobuf field string artifact_gcs_uri = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $artifact_gcs_uri = ''; + /** + * The tier of the service. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.Service.Tier tier = 13; + */ + protected $tier = 0; + /** + * The setting that defines how metastore metadata should be integrated with + * external services and systems. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.MetadataIntegration metadata_integration = 14; + */ + protected $metadata_integration = null; + /** + * The one hour maintenance window of the metastore service. This specifies + * when the service can be restarted for maintenance purposes in UTC time. + * Maintenance window is not needed for services with the SPANNER + * database type. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.MaintenanceWindow maintenance_window = 15; + */ + protected $maintenance_window = null; + /** + * Output only. The globally unique resource identifier of the metastore + * service. + * + * Generated from protobuf field string uid = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $uid = ''; + /** + * Output only. The metadata management activities of the metastore service. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.MetadataManagementActivity metadata_management_activity = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $metadata_management_activity = null; + /** + * Immutable. The release channel of the service. + * If unspecified, defaults to `STABLE`. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.Service.ReleaseChannel release_channel = 19 [(.google.api.field_behavior) = IMMUTABLE]; + */ + protected $release_channel = 0; + /** + * Immutable. Information used to configure the Dataproc Metastore service to + * encrypt customer data at rest. Cannot be updated. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.EncryptionConfig encryption_config = 20 [(.google.api.field_behavior) = IMMUTABLE]; + */ + protected $encryption_config = null; + /** + * The configuration specifying the network settings for the + * Dataproc Metastore service. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.NetworkConfig network_config = 21; + */ + protected $network_config = null; + /** + * Immutable. The database type that the Metastore service stores its data. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.Service.DatabaseType database_type = 22 [(.google.api.field_behavior) = IMMUTABLE]; + */ + protected $database_type = 0; + /** + * The configuration specifying telemetry settings for the Dataproc Metastore + * service. If unspecified defaults to `JSON`. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.TelemetryConfig telemetry_config = 23; + */ + protected $telemetry_config = null; + /** + * Scaling configuration of the metastore service. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.ScalingConfig scaling_config = 24; + */ + protected $scaling_config = null; + protected $metastore_config; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Metastore\V1beta\HiveMetastoreConfig $hive_metastore_config + * Configuration information specific to running Hive metastore + * software as the metastore service. + * @type string $name + * Immutable. The relative resource name of the metastore service, in the + * following format: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The time when the metastore service was created. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. The time when the metastore service was last updated. + * @type array|\Google\Protobuf\Internal\MapField $labels + * User-defined labels for the metastore service. + * @type string $network + * Immutable. The relative resource name of the VPC network on which the + * instance can be accessed. It is specified in the following form: + * `projects/{project_number}/global/networks/{network_id}`. + * @type string $endpoint_uri + * Output only. The URI of the endpoint used to access the metastore service. + * @type int $port + * The TCP port at which the metastore service is reached. Default: 9083. + * @type int $state + * Output only. The current state of the metastore service. + * @type string $state_message + * Output only. Additional information about the current state of the + * metastore service, if available. + * @type string $artifact_gcs_uri + * Output only. A Cloud Storage URI (starting with `gs://`) that specifies + * where artifacts related to the metastore service are stored. + * @type int $tier + * The tier of the service. + * @type \Google\Cloud\Metastore\V1beta\MetadataIntegration $metadata_integration + * The setting that defines how metastore metadata should be integrated with + * external services and systems. + * @type \Google\Cloud\Metastore\V1beta\MaintenanceWindow $maintenance_window + * The one hour maintenance window of the metastore service. This specifies + * when the service can be restarted for maintenance purposes in UTC time. + * Maintenance window is not needed for services with the SPANNER + * database type. + * @type string $uid + * Output only. The globally unique resource identifier of the metastore + * service. + * @type \Google\Cloud\Metastore\V1beta\MetadataManagementActivity $metadata_management_activity + * Output only. The metadata management activities of the metastore service. + * @type int $release_channel + * Immutable. The release channel of the service. + * If unspecified, defaults to `STABLE`. + * @type \Google\Cloud\Metastore\V1beta\EncryptionConfig $encryption_config + * Immutable. Information used to configure the Dataproc Metastore service to + * encrypt customer data at rest. Cannot be updated. + * @type \Google\Cloud\Metastore\V1beta\NetworkConfig $network_config + * The configuration specifying the network settings for the + * Dataproc Metastore service. + * @type int $database_type + * Immutable. The database type that the Metastore service stores its data. + * @type \Google\Cloud\Metastore\V1beta\TelemetryConfig $telemetry_config + * The configuration specifying telemetry settings for the Dataproc Metastore + * service. If unspecified defaults to `JSON`. + * @type \Google\Cloud\Metastore\V1beta\ScalingConfig $scaling_config + * Scaling configuration of the metastore service. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Beta\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Configuration information specific to running Hive metastore + * software as the metastore service. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.HiveMetastoreConfig hive_metastore_config = 5; + * @return \Google\Cloud\Metastore\V1beta\HiveMetastoreConfig|null + */ + public function getHiveMetastoreConfig() + { + return $this->readOneof(5); + } + + public function hasHiveMetastoreConfig() + { + return $this->hasOneof(5); + } + + /** + * Configuration information specific to running Hive metastore + * software as the metastore service. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.HiveMetastoreConfig hive_metastore_config = 5; + * @param \Google\Cloud\Metastore\V1beta\HiveMetastoreConfig $var + * @return $this + */ + public function setHiveMetastoreConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Metastore\V1beta\HiveMetastoreConfig::class); + $this->writeOneof(5, $var); + + return $this; + } + + /** + * Immutable. The relative resource name of the metastore service, in the + * following format: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Immutable. The relative resource name of the metastore service, in the + * following format: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. The time when the metastore service was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.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 when the metastore service was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.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 when the metastore service was last updated. + * + * 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 when the metastore service was last updated. + * + * 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; + } + + /** + * User-defined labels for the metastore service. + * + * Generated from protobuf field map labels = 4; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * User-defined labels for the metastore service. + * + * Generated from protobuf field map labels = 4; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + + /** + * Immutable. The relative resource name of the VPC network on which the + * instance can be accessed. It is specified in the following form: + * `projects/{project_number}/global/networks/{network_id}`. + * + * Generated from protobuf field string network = 7 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.resource_reference) = { + * @return string + */ + public function getNetwork() + { + return $this->network; + } + + /** + * Immutable. The relative resource name of the VPC network on which the + * instance can be accessed. It is specified in the following form: + * `projects/{project_number}/global/networks/{network_id}`. + * + * Generated from protobuf field string network = 7 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setNetwork($var) + { + GPBUtil::checkString($var, True); + $this->network = $var; + + return $this; + } + + /** + * Output only. The URI of the endpoint used to access the metastore service. + * + * Generated from protobuf field string endpoint_uri = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getEndpointUri() + { + return $this->endpoint_uri; + } + + /** + * Output only. The URI of the endpoint used to access the metastore service. + * + * Generated from protobuf field string endpoint_uri = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setEndpointUri($var) + { + GPBUtil::checkString($var, True); + $this->endpoint_uri = $var; + + return $this; + } + + /** + * The TCP port at which the metastore service is reached. Default: 9083. + * + * Generated from protobuf field int32 port = 9; + * @return int + */ + public function getPort() + { + return $this->port; + } + + /** + * The TCP port at which the metastore service is reached. Default: 9083. + * + * Generated from protobuf field int32 port = 9; + * @param int $var + * @return $this + */ + public function setPort($var) + { + GPBUtil::checkInt32($var); + $this->port = $var; + + return $this; + } + + /** + * Output only. The current state of the metastore service. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.Service.State state = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. The current state of the metastore service. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.Service.State state = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Metastore\V1beta\Service\State::class); + $this->state = $var; + + return $this; + } + + /** + * Output only. Additional information about the current state of the + * metastore service, if available. + * + * Generated from protobuf field string state_message = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getStateMessage() + { + return $this->state_message; + } + + /** + * Output only. Additional information about the current state of the + * metastore service, if available. + * + * Generated from protobuf field string state_message = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setStateMessage($var) + { + GPBUtil::checkString($var, True); + $this->state_message = $var; + + return $this; + } + + /** + * Output only. A Cloud Storage URI (starting with `gs://`) that specifies + * where artifacts related to the metastore service are stored. + * + * Generated from protobuf field string artifact_gcs_uri = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getArtifactGcsUri() + { + return $this->artifact_gcs_uri; + } + + /** + * Output only. A Cloud Storage URI (starting with `gs://`) that specifies + * where artifacts related to the metastore service are stored. + * + * Generated from protobuf field string artifact_gcs_uri = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setArtifactGcsUri($var) + { + GPBUtil::checkString($var, True); + $this->artifact_gcs_uri = $var; + + return $this; + } + + /** + * The tier of the service. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.Service.Tier tier = 13; + * @return int + */ + public function getTier() + { + return $this->tier; + } + + /** + * The tier of the service. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.Service.Tier tier = 13; + * @param int $var + * @return $this + */ + public function setTier($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Metastore\V1beta\Service\Tier::class); + $this->tier = $var; + + return $this; + } + + /** + * The setting that defines how metastore metadata should be integrated with + * external services and systems. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.MetadataIntegration metadata_integration = 14; + * @return \Google\Cloud\Metastore\V1beta\MetadataIntegration|null + */ + public function getMetadataIntegration() + { + return $this->metadata_integration; + } + + public function hasMetadataIntegration() + { + return isset($this->metadata_integration); + } + + public function clearMetadataIntegration() + { + unset($this->metadata_integration); + } + + /** + * The setting that defines how metastore metadata should be integrated with + * external services and systems. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.MetadataIntegration metadata_integration = 14; + * @param \Google\Cloud\Metastore\V1beta\MetadataIntegration $var + * @return $this + */ + public function setMetadataIntegration($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Metastore\V1beta\MetadataIntegration::class); + $this->metadata_integration = $var; + + return $this; + } + + /** + * The one hour maintenance window of the metastore service. This specifies + * when the service can be restarted for maintenance purposes in UTC time. + * Maintenance window is not needed for services with the SPANNER + * database type. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.MaintenanceWindow maintenance_window = 15; + * @return \Google\Cloud\Metastore\V1beta\MaintenanceWindow|null + */ + public function getMaintenanceWindow() + { + return $this->maintenance_window; + } + + public function hasMaintenanceWindow() + { + return isset($this->maintenance_window); + } + + public function clearMaintenanceWindow() + { + unset($this->maintenance_window); + } + + /** + * The one hour maintenance window of the metastore service. This specifies + * when the service can be restarted for maintenance purposes in UTC time. + * Maintenance window is not needed for services with the SPANNER + * database type. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.MaintenanceWindow maintenance_window = 15; + * @param \Google\Cloud\Metastore\V1beta\MaintenanceWindow $var + * @return $this + */ + public function setMaintenanceWindow($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Metastore\V1beta\MaintenanceWindow::class); + $this->maintenance_window = $var; + + return $this; + } + + /** + * Output only. The globally unique resource identifier of the metastore + * service. + * + * Generated from protobuf field string uid = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getUid() + { + return $this->uid; + } + + /** + * Output only. The globally unique resource identifier of the metastore + * service. + * + * Generated from protobuf field string uid = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setUid($var) + { + GPBUtil::checkString($var, True); + $this->uid = $var; + + return $this; + } + + /** + * Output only. The metadata management activities of the metastore service. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.MetadataManagementActivity metadata_management_activity = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\Metastore\V1beta\MetadataManagementActivity|null + */ + public function getMetadataManagementActivity() + { + return $this->metadata_management_activity; + } + + public function hasMetadataManagementActivity() + { + return isset($this->metadata_management_activity); + } + + public function clearMetadataManagementActivity() + { + unset($this->metadata_management_activity); + } + + /** + * Output only. The metadata management activities of the metastore service. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.MetadataManagementActivity metadata_management_activity = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\Metastore\V1beta\MetadataManagementActivity $var + * @return $this + */ + public function setMetadataManagementActivity($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Metastore\V1beta\MetadataManagementActivity::class); + $this->metadata_management_activity = $var; + + return $this; + } + + /** + * Immutable. The release channel of the service. + * If unspecified, defaults to `STABLE`. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.Service.ReleaseChannel release_channel = 19 [(.google.api.field_behavior) = IMMUTABLE]; + * @return int + */ + public function getReleaseChannel() + { + return $this->release_channel; + } + + /** + * Immutable. The release channel of the service. + * If unspecified, defaults to `STABLE`. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.Service.ReleaseChannel release_channel = 19 [(.google.api.field_behavior) = IMMUTABLE]; + * @param int $var + * @return $this + */ + public function setReleaseChannel($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Metastore\V1beta\Service\ReleaseChannel::class); + $this->release_channel = $var; + + return $this; + } + + /** + * Immutable. Information used to configure the Dataproc Metastore service to + * encrypt customer data at rest. Cannot be updated. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.EncryptionConfig encryption_config = 20 [(.google.api.field_behavior) = IMMUTABLE]; + * @return \Google\Cloud\Metastore\V1beta\EncryptionConfig|null + */ + public function getEncryptionConfig() + { + return $this->encryption_config; + } + + public function hasEncryptionConfig() + { + return isset($this->encryption_config); + } + + public function clearEncryptionConfig() + { + unset($this->encryption_config); + } + + /** + * Immutable. Information used to configure the Dataproc Metastore service to + * encrypt customer data at rest. Cannot be updated. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.EncryptionConfig encryption_config = 20 [(.google.api.field_behavior) = IMMUTABLE]; + * @param \Google\Cloud\Metastore\V1beta\EncryptionConfig $var + * @return $this + */ + public function setEncryptionConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Metastore\V1beta\EncryptionConfig::class); + $this->encryption_config = $var; + + return $this; + } + + /** + * The configuration specifying the network settings for the + * Dataproc Metastore service. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.NetworkConfig network_config = 21; + * @return \Google\Cloud\Metastore\V1beta\NetworkConfig|null + */ + public function getNetworkConfig() + { + return $this->network_config; + } + + public function hasNetworkConfig() + { + return isset($this->network_config); + } + + public function clearNetworkConfig() + { + unset($this->network_config); + } + + /** + * The configuration specifying the network settings for the + * Dataproc Metastore service. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.NetworkConfig network_config = 21; + * @param \Google\Cloud\Metastore\V1beta\NetworkConfig $var + * @return $this + */ + public function setNetworkConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Metastore\V1beta\NetworkConfig::class); + $this->network_config = $var; + + return $this; + } + + /** + * Immutable. The database type that the Metastore service stores its data. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.Service.DatabaseType database_type = 22 [(.google.api.field_behavior) = IMMUTABLE]; + * @return int + */ + public function getDatabaseType() + { + return $this->database_type; + } + + /** + * Immutable. The database type that the Metastore service stores its data. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.Service.DatabaseType database_type = 22 [(.google.api.field_behavior) = IMMUTABLE]; + * @param int $var + * @return $this + */ + public function setDatabaseType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Metastore\V1beta\Service\DatabaseType::class); + $this->database_type = $var; + + return $this; + } + + /** + * The configuration specifying telemetry settings for the Dataproc Metastore + * service. If unspecified defaults to `JSON`. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.TelemetryConfig telemetry_config = 23; + * @return \Google\Cloud\Metastore\V1beta\TelemetryConfig|null + */ + public function getTelemetryConfig() + { + return $this->telemetry_config; + } + + public function hasTelemetryConfig() + { + return isset($this->telemetry_config); + } + + public function clearTelemetryConfig() + { + unset($this->telemetry_config); + } + + /** + * The configuration specifying telemetry settings for the Dataproc Metastore + * service. If unspecified defaults to `JSON`. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.TelemetryConfig telemetry_config = 23; + * @param \Google\Cloud\Metastore\V1beta\TelemetryConfig $var + * @return $this + */ + public function setTelemetryConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Metastore\V1beta\TelemetryConfig::class); + $this->telemetry_config = $var; + + return $this; + } + + /** + * Scaling configuration of the metastore service. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.ScalingConfig scaling_config = 24; + * @return \Google\Cloud\Metastore\V1beta\ScalingConfig|null + */ + public function getScalingConfig() + { + return $this->scaling_config; + } + + public function hasScalingConfig() + { + return isset($this->scaling_config); + } + + public function clearScalingConfig() + { + unset($this->scaling_config); + } + + /** + * Scaling configuration of the metastore service. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.ScalingConfig scaling_config = 24; + * @param \Google\Cloud\Metastore\V1beta\ScalingConfig $var + * @return $this + */ + public function setScalingConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Metastore\V1beta\ScalingConfig::class); + $this->scaling_config = $var; + + return $this; + } + + /** + * @return string + */ + public function getMetastoreConfig() + { + return $this->whichOneof("metastore_config"); + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/Service/DatabaseType.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/Service/DatabaseType.php new file mode 100644 index 000000000000..d4c91edc9267 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/Service/DatabaseType.php @@ -0,0 +1,64 @@ +google.cloud.metastore.v1beta.Service.DatabaseType + */ +class DatabaseType +{ + /** + * The DATABASE_TYPE is not set. + * + * Generated from protobuf enum DATABASE_TYPE_UNSPECIFIED = 0; + */ + const DATABASE_TYPE_UNSPECIFIED = 0; + /** + * MySQL is used to persist the metastore data. + * + * Generated from protobuf enum MYSQL = 1; + */ + const MYSQL = 1; + /** + * Spanner is used to persist the metastore data. + * + * Generated from protobuf enum SPANNER = 2; + */ + const SPANNER = 2; + + private static $valueToName = [ + self::DATABASE_TYPE_UNSPECIFIED => 'DATABASE_TYPE_UNSPECIFIED', + self::MYSQL => 'MYSQL', + self::SPANNER => 'SPANNER', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(DatabaseType::class, \Google\Cloud\Metastore\V1beta\Service_DatabaseType::class); + diff --git a/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/Service/ReleaseChannel.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/Service/ReleaseChannel.php new file mode 100644 index 000000000000..1faf78badb2d --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/Service/ReleaseChannel.php @@ -0,0 +1,69 @@ +google.cloud.metastore.v1beta.Service.ReleaseChannel + */ +class ReleaseChannel +{ + /** + * Release channel is not specified. + * + * Generated from protobuf enum RELEASE_CHANNEL_UNSPECIFIED = 0; + */ + const RELEASE_CHANNEL_UNSPECIFIED = 0; + /** + * The `CANARY` release channel contains the newest features, which may be + * unstable and subject to unresolved issues with no known workarounds. + * Services using the `CANARY` release channel are not subject to any SLAs. + * + * Generated from protobuf enum CANARY = 1; + */ + const CANARY = 1; + /** + * The `STABLE` release channel contains features that are considered stable + * and have been validated for production use. + * + * Generated from protobuf enum STABLE = 2; + */ + const STABLE = 2; + + private static $valueToName = [ + self::RELEASE_CHANNEL_UNSPECIFIED => 'RELEASE_CHANNEL_UNSPECIFIED', + self::CANARY => 'CANARY', + self::STABLE => 'STABLE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ReleaseChannel::class, \Google\Cloud\Metastore\V1beta\Service_ReleaseChannel::class); + diff --git a/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/Service/State.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/Service/State.php new file mode 100644 index 000000000000..fb8f23bdab4f --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/Service/State.php @@ -0,0 +1,102 @@ +google.cloud.metastore.v1beta.Service.State + */ +class State +{ + /** + * The state of the metastore service is unknown. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The metastore service is in the process of being created. + * + * Generated from protobuf enum CREATING = 1; + */ + const CREATING = 1; + /** + * The metastore service is running and ready to serve queries. + * + * Generated from protobuf enum ACTIVE = 2; + */ + const ACTIVE = 2; + /** + * The metastore service is entering suspension. Its query-serving + * availability may cease unexpectedly. + * + * Generated from protobuf enum SUSPENDING = 3; + */ + const SUSPENDING = 3; + /** + * The metastore service is suspended and unable to serve queries. + * + * Generated from protobuf enum SUSPENDED = 4; + */ + const SUSPENDED = 4; + /** + * The metastore service is being updated. It remains usable but cannot + * accept additional update requests or be deleted at this time. + * + * Generated from protobuf enum UPDATING = 5; + */ + const UPDATING = 5; + /** + * The metastore service is undergoing deletion. It cannot be used. + * + * Generated from protobuf enum DELETING = 6; + */ + const DELETING = 6; + /** + * The metastore service has encountered an error and cannot be used. The + * metastore service should be deleted. + * + * Generated from protobuf enum ERROR = 7; + */ + const ERROR = 7; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::CREATING => 'CREATING', + self::ACTIVE => 'ACTIVE', + self::SUSPENDING => 'SUSPENDING', + self::SUSPENDED => 'SUSPENDED', + self::UPDATING => 'UPDATING', + self::DELETING => 'DELETING', + self::ERROR => 'ERROR', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\Metastore\V1beta\Service_State::class); + diff --git a/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/Service/Tier.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/Service/Tier.php new file mode 100644 index 000000000000..efef7c59b6c1 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/Service/Tier.php @@ -0,0 +1,66 @@ +google.cloud.metastore.v1beta.Service.Tier + */ +class Tier +{ + /** + * The tier is not set. + * + * Generated from protobuf enum TIER_UNSPECIFIED = 0; + */ + const TIER_UNSPECIFIED = 0; + /** + * The developer tier provides limited scalability and no fault tolerance. + * Good for low-cost proof-of-concept. + * + * Generated from protobuf enum DEVELOPER = 1; + */ + const DEVELOPER = 1; + /** + * The enterprise tier provides multi-zone high availability, and sufficient + * scalability for enterprise-level Dataproc Metastore workloads. + * + * Generated from protobuf enum ENTERPRISE = 3; + */ + const ENTERPRISE = 3; + + private static $valueToName = [ + self::TIER_UNSPECIFIED => 'TIER_UNSPECIFIED', + self::DEVELOPER => 'DEVELOPER', + self::ENTERPRISE => 'ENTERPRISE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Tier::class, \Google\Cloud\Metastore\V1beta\Service_Tier::class); + diff --git a/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/Service_DatabaseType.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/Service_DatabaseType.php new file mode 100644 index 000000000000..d33433a81c8d --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/Service_DatabaseType.php @@ -0,0 +1,16 @@ +google.cloud.metastore.v1beta.TelemetryConfig + */ +class TelemetryConfig extends \Google\Protobuf\Internal\Message +{ + /** + * The output format of the Dataproc Metastore service's logs. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.TelemetryConfig.LogFormat log_format = 1; + */ + protected $log_format = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $log_format + * The output format of the Dataproc Metastore service's logs. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Beta\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * The output format of the Dataproc Metastore service's logs. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.TelemetryConfig.LogFormat log_format = 1; + * @return int + */ + public function getLogFormat() + { + return $this->log_format; + } + + /** + * The output format of the Dataproc Metastore service's logs. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.TelemetryConfig.LogFormat log_format = 1; + * @param int $var + * @return $this + */ + public function setLogFormat($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Metastore\V1beta\TelemetryConfig\LogFormat::class); + $this->log_format = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/TelemetryConfig/LogFormat.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/TelemetryConfig/LogFormat.php new file mode 100644 index 000000000000..31a5ac103767 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/TelemetryConfig/LogFormat.php @@ -0,0 +1,62 @@ +google.cloud.metastore.v1beta.TelemetryConfig.LogFormat + */ +class LogFormat +{ + /** + * The LOG_FORMAT is not set. + * + * Generated from protobuf enum LOG_FORMAT_UNSPECIFIED = 0; + */ + const LOG_FORMAT_UNSPECIFIED = 0; + /** + * Logging output uses the legacy `textPayload` format. + * + * Generated from protobuf enum LEGACY = 1; + */ + const LEGACY = 1; + /** + * Logging output uses the `jsonPayload` format. + * + * Generated from protobuf enum JSON = 2; + */ + const JSON = 2; + + private static $valueToName = [ + self::LOG_FORMAT_UNSPECIFIED => 'LOG_FORMAT_UNSPECIFIED', + self::LEGACY => 'LEGACY', + self::JSON => 'JSON', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(LogFormat::class, \Google\Cloud\Metastore\V1beta\TelemetryConfig_LogFormat::class); + diff --git a/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/TelemetryConfig_LogFormat.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/TelemetryConfig_LogFormat.php new file mode 100644 index 000000000000..006ce0549bcc --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/TelemetryConfig_LogFormat.php @@ -0,0 +1,16 @@ +google.cloud.metastore.v1beta.UpdateFederationRequest + */ +class UpdateFederationRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. A field mask used to specify the fields to be overwritten in the + * metastore federation resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $update_mask = null; + /** + * Required. The metastore federation to update. The server only merges fields + * in the service if they are specified in `update_mask`. + * The metastore federation's `name` field is used to identify the + * metastore service to be updated. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.Federation federation = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $federation = null; + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\FieldMask $update_mask + * Required. A field mask used to specify the fields to be overwritten in the + * metastore federation resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + * @type \Google\Cloud\Metastore\V1beta\Federation $federation + * Required. The metastore federation to update. The server only merges fields + * in the service if they are specified in `update_mask`. + * The metastore federation's `name` field is used to identify the + * metastore service to be updated. + * @type string $request_id + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Beta\MetastoreFederation::initOnce(); + parent::__construct($data); + } + + /** + * Required. A field mask used to specify the fields to be overwritten in the + * metastore federation resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Required. A field mask used to specify the fields to be overwritten in the + * metastore federation resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + + /** + * Required. The metastore federation to update. The server only merges fields + * in the service if they are specified in `update_mask`. + * The metastore federation's `name` field is used to identify the + * metastore service to be updated. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.Federation federation = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Metastore\V1beta\Federation|null + */ + public function getFederation() + { + return $this->federation; + } + + public function hasFederation() + { + return isset($this->federation); + } + + public function clearFederation() + { + unset($this->federation); + } + + /** + * Required. The metastore federation to update. The server only merges fields + * in the service if they are specified in `update_mask`. + * The metastore federation's `name` field is used to identify the + * metastore service to be updated. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.Federation federation = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Metastore\V1beta\Federation $var + * @return $this + */ + public function setFederation($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Metastore\V1beta\Federation::class); + $this->federation = $var; + + return $this; + } + + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @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/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/UpdateMetadataImportRequest.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/UpdateMetadataImportRequest.php new file mode 100644 index 000000000000..35e60aa3db85 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/UpdateMetadataImportRequest.php @@ -0,0 +1,216 @@ +google.cloud.metastore.v1beta.UpdateMetadataImportRequest + */ +class UpdateMetadataImportRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. A field mask used to specify the fields to be overwritten in the + * metadata import resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $update_mask = null; + /** + * Required. The metadata import to update. The server only merges fields + * in the import if they are specified in `update_mask`. + * The metadata import's `name` field is used to identify the metastore + * import to be updated. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.MetadataImport metadata_import = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $metadata_import = null; + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\FieldMask $update_mask + * Required. A field mask used to specify the fields to be overwritten in the + * metadata import resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + * @type \Google\Cloud\Metastore\V1beta\MetadataImport $metadata_import + * Required. The metadata import to update. The server only merges fields + * in the import if they are specified in `update_mask`. + * The metadata import's `name` field is used to identify the metastore + * import to be updated. + * @type string $request_id + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Beta\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Required. A field mask used to specify the fields to be overwritten in the + * metadata import resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Required. A field mask used to specify the fields to be overwritten in the + * metadata import resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + + /** + * Required. The metadata import to update. The server only merges fields + * in the import if they are specified in `update_mask`. + * The metadata import's `name` field is used to identify the metastore + * import to be updated. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.MetadataImport metadata_import = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Metastore\V1beta\MetadataImport|null + */ + public function getMetadataImport() + { + return $this->metadata_import; + } + + public function hasMetadataImport() + { + return isset($this->metadata_import); + } + + public function clearMetadataImport() + { + unset($this->metadata_import); + } + + /** + * Required. The metadata import to update. The server only merges fields + * in the import if they are specified in `update_mask`. + * The metadata import's `name` field is used to identify the metastore + * import to be updated. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.MetadataImport metadata_import = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Metastore\V1beta\MetadataImport $var + * @return $this + */ + public function setMetadataImport($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Metastore\V1beta\MetadataImport::class); + $this->metadata_import = $var; + + return $this; + } + + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @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/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/UpdateServiceRequest.php b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/UpdateServiceRequest.php new file mode 100644 index 000000000000..9be41ddacfb9 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/proto/src/Google/Cloud/Metastore/V1beta/UpdateServiceRequest.php @@ -0,0 +1,216 @@ +google.cloud.metastore.v1beta.UpdateServiceRequest + */ +class UpdateServiceRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. A field mask used to specify the fields to be overwritten in the + * metastore service resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $update_mask = null; + /** + * Required. The metastore service to update. The server only merges fields + * in the service if they are specified in `update_mask`. + * The metastore service's `name` field is used to identify the metastore + * service to be updated. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.Service service = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $service = null; + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\FieldMask $update_mask + * Required. A field mask used to specify the fields to be overwritten in the + * metastore service resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + * @type \Google\Cloud\Metastore\V1beta\Service $service + * Required. The metastore service to update. The server only merges fields + * in the service if they are specified in `update_mask`. + * The metastore service's `name` field is used to identify the metastore + * service to be updated. + * @type string $request_id + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Metastore\V1Beta\Metastore::initOnce(); + parent::__construct($data); + } + + /** + * Required. A field mask used to specify the fields to be overwritten in the + * metastore service resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Required. A field mask used to specify the fields to be overwritten in the + * metastore service resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + + /** + * Required. The metastore service to update. The server only merges fields + * in the service if they are specified in `update_mask`. + * The metastore service's `name` field is used to identify the metastore + * service to be updated. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.Service service = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Metastore\V1beta\Service|null + */ + public function getService() + { + return $this->service; + } + + public function hasService() + { + return isset($this->service); + } + + public function clearService() + { + unset($this->service); + } + + /** + * Required. The metastore service to update. The server only merges fields + * in the service if they are specified in `update_mask`. + * The metastore service's `name` field is used to identify the metastore + * service to be updated. + * + * Generated from protobuf field .google.cloud.metastore.v1beta.Service service = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Metastore\V1beta\Service $var + * @return $this + */ + public function setService($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Metastore\V1beta\Service::class); + $this->service = $var; + + return $this; + } + + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @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/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreClient/alter_metadata_resource_location.php b/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreClient/alter_metadata_resource_location.php new file mode 100644 index 000000000000..b5d37b845685 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreClient/alter_metadata_resource_location.php @@ -0,0 +1,101 @@ +alterMetadataResourceLocation( + $formattedService, + $resourceName, + $locationUri + ); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var AlterMetadataResourceLocationResponse $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 +{ + $formattedService = DataprocMetastoreClient::serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $resourceName = '[RESOURCE_NAME]'; + $locationUri = '[LOCATION_URI]'; + + alter_metadata_resource_location_sample($formattedService, $resourceName, $locationUri); +} +// [END metastore_v1beta_generated_DataprocMetastore_AlterMetadataResourceLocation_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreClient/create_backup.php b/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreClient/create_backup.php new file mode 100644 index 000000000000..a603526cb3c6 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreClient/create_backup.php @@ -0,0 +1,91 @@ +createBackup($formattedParent, $backupId, $backup); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Backup $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 +{ + $formattedParent = DataprocMetastoreClient::serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $backupId = '[BACKUP_ID]'; + + create_backup_sample($formattedParent, $backupId); +} +// [END metastore_v1beta_generated_DataprocMetastore_CreateBackup_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreClient/create_metadata_import.php b/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreClient/create_metadata_import.php new file mode 100644 index 000000000000..ae0f345e42db --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreClient/create_metadata_import.php @@ -0,0 +1,95 @@ +createMetadataImport( + $formattedParent, + $metadataImportId, + $metadataImport + ); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var MetadataImport $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 +{ + $formattedParent = DataprocMetastoreClient::serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $metadataImportId = '[METADATA_IMPORT_ID]'; + + create_metadata_import_sample($formattedParent, $metadataImportId); +} +// [END metastore_v1beta_generated_DataprocMetastore_CreateMetadataImport_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreClient/create_service.php b/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreClient/create_service.php new file mode 100644 index 000000000000..7d019284e7ef --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreClient/create_service.php @@ -0,0 +1,91 @@ +createService($formattedParent, $serviceId, $service); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Service $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 +{ + $formattedParent = DataprocMetastoreClient::locationName('[PROJECT]', '[LOCATION]'); + $serviceId = '[SERVICE_ID]'; + + create_service_sample($formattedParent, $serviceId); +} +// [END metastore_v1beta_generated_DataprocMetastore_CreateService_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreClient/delete_backup.php b/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreClient/delete_backup.php new file mode 100644 index 000000000000..a92842b6ec7f --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreClient/delete_backup.php @@ -0,0 +1,83 @@ +deleteBackup($formattedName); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + printf('Operation completed successfully.' . PHP_EOL); + } 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 = DataprocMetastoreClient::backupName( + '[PROJECT]', + '[LOCATION]', + '[SERVICE]', + '[BACKUP]' + ); + + delete_backup_sample($formattedName); +} +// [END metastore_v1beta_generated_DataprocMetastore_DeleteBackup_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreClient/delete_service.php b/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreClient/delete_service.php new file mode 100644 index 000000000000..397bd3744e6c --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreClient/delete_service.php @@ -0,0 +1,78 @@ +deleteService($formattedName); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + printf('Operation completed successfully.' . PHP_EOL); + } 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 = DataprocMetastoreClient::serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + + delete_service_sample($formattedName); +} +// [END metastore_v1beta_generated_DataprocMetastore_DeleteService_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreClient/export_metadata.php b/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreClient/export_metadata.php new file mode 100644 index 000000000000..29c1a7fd9fd3 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreClient/export_metadata.php @@ -0,0 +1,81 @@ +exportMetadata($formattedService); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var MetadataExport $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 +{ + $formattedService = DataprocMetastoreClient::serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + + export_metadata_sample($formattedService); +} +// [END metastore_v1beta_generated_DataprocMetastore_ExportMetadata_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreClient/get_backup.php b/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreClient/get_backup.php new file mode 100644 index 000000000000..6b86bbd01528 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreClient/get_backup.php @@ -0,0 +1,74 @@ +getBackup($formattedName); + 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 = DataprocMetastoreClient::backupName( + '[PROJECT]', + '[LOCATION]', + '[SERVICE]', + '[BACKUP]' + ); + + get_backup_sample($formattedName); +} +// [END metastore_v1beta_generated_DataprocMetastore_GetBackup_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreClient/get_iam_policy.php b/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreClient/get_iam_policy.php new file mode 100644 index 000000000000..96ac7aab167b --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreClient/get_iam_policy.php @@ -0,0 +1,67 @@ +getIamPolicy($resource); + 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 +{ + $resource = '[RESOURCE]'; + + get_iam_policy_sample($resource); +} +// [END metastore_v1beta_generated_DataprocMetastore_GetIamPolicy_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreClient/get_location.php b/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreClient/get_location.php new file mode 100644 index 000000000000..ea7b5b2d9cf1 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreClient/get_location.php @@ -0,0 +1,53 @@ +getLocation(); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END metastore_v1beta_generated_DataprocMetastore_GetLocation_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreClient/get_metadata_import.php b/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreClient/get_metadata_import.php new file mode 100644 index 000000000000..13624d63072b --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreClient/get_metadata_import.php @@ -0,0 +1,74 @@ +getMetadataImport($formattedName); + 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 = DataprocMetastoreClient::metadataImportName( + '[PROJECT]', + '[LOCATION]', + '[SERVICE]', + '[METADATA_IMPORT]' + ); + + get_metadata_import_sample($formattedName); +} +// [END metastore_v1beta_generated_DataprocMetastore_GetMetadataImport_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreClient/get_service.php b/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreClient/get_service.php new file mode 100644 index 000000000000..d233092a4e6e --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreClient/get_service.php @@ -0,0 +1,69 @@ +getService($formattedName); + 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 = DataprocMetastoreClient::serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + + get_service_sample($formattedName); +} +// [END metastore_v1beta_generated_DataprocMetastore_GetService_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreClient/list_backups.php b/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreClient/list_backups.php new file mode 100644 index 000000000000..d6aaacb05085 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreClient/list_backups.php @@ -0,0 +1,74 @@ +listBackups($formattedParent); + + /** @var Backup $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 = DataprocMetastoreClient::serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + + list_backups_sample($formattedParent); +} +// [END metastore_v1beta_generated_DataprocMetastore_ListBackups_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreClient/list_locations.php b/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreClient/list_locations.php new file mode 100644 index 000000000000..dd923fcfc359 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreClient/list_locations.php @@ -0,0 +1,58 @@ +listLocations(); + + /** @var Location $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()); + } +} +// [END metastore_v1beta_generated_DataprocMetastore_ListLocations_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreClient/list_metadata_imports.php b/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreClient/list_metadata_imports.php new file mode 100644 index 000000000000..f80ae9e84e58 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreClient/list_metadata_imports.php @@ -0,0 +1,74 @@ +listMetadataImports($formattedParent); + + /** @var MetadataImport $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 = DataprocMetastoreClient::serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + + list_metadata_imports_sample($formattedParent); +} +// [END metastore_v1beta_generated_DataprocMetastore_ListMetadataImports_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreClient/list_services.php b/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreClient/list_services.php new file mode 100644 index 000000000000..0c72d222ef52 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreClient/list_services.php @@ -0,0 +1,74 @@ +listServices($formattedParent); + + /** @var Service $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 = DataprocMetastoreClient::locationName('[PROJECT]', '[LOCATION]'); + + list_services_sample($formattedParent); +} +// [END metastore_v1beta_generated_DataprocMetastore_ListServices_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreClient/move_table_to_database.php b/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreClient/move_table_to_database.php new file mode 100644 index 000000000000..6bfc3fd33233 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreClient/move_table_to_database.php @@ -0,0 +1,96 @@ +moveTableToDatabase( + $formattedService, + $tableName, + $dbName, + $destinationDbName + ); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var MoveTableToDatabaseResponse $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 +{ + $formattedService = DataprocMetastoreClient::serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $tableName = '[TABLE_NAME]'; + $dbName = '[DB_NAME]'; + $destinationDbName = '[DESTINATION_DB_NAME]'; + + move_table_to_database_sample($formattedService, $tableName, $dbName, $destinationDbName); +} +// [END metastore_v1beta_generated_DataprocMetastore_MoveTableToDatabase_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreClient/query_metadata.php b/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreClient/query_metadata.php new file mode 100644 index 000000000000..9fb4b916e4e2 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreClient/query_metadata.php @@ -0,0 +1,84 @@ +queryMetadata($formattedService, $query); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var QueryMetadataResponse $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 +{ + $formattedService = DataprocMetastoreClient::serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $query = '[QUERY]'; + + query_metadata_sample($formattedService, $query); +} +// [END metastore_v1beta_generated_DataprocMetastore_QueryMetadata_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreClient/remove_iam_policy.php b/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreClient/remove_iam_policy.php new file mode 100644 index 000000000000..c8e4271237da --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreClient/remove_iam_policy.php @@ -0,0 +1,70 @@ +removeIamPolicy($resource); + 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 +{ + $resource = '[RESOURCE]'; + + remove_iam_policy_sample($resource); +} +// [END metastore_v1beta_generated_DataprocMetastore_RemoveIamPolicy_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreClient/restore_service.php b/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreClient/restore_service.php new file mode 100644 index 000000000000..e886ef6ca1a2 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreClient/restore_service.php @@ -0,0 +1,92 @@ +restoreService($formattedService, $formattedBackup); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Restore $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 +{ + $formattedService = DataprocMetastoreClient::serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $formattedBackup = DataprocMetastoreClient::backupName( + '[PROJECT]', + '[LOCATION]', + '[SERVICE]', + '[BACKUP]' + ); + + restore_service_sample($formattedService, $formattedBackup); +} +// [END metastore_v1beta_generated_DataprocMetastore_RestoreService_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreClient/set_iam_policy.php b/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreClient/set_iam_policy.php new file mode 100644 index 000000000000..cd590a2f3518 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreClient/set_iam_policy.php @@ -0,0 +1,73 @@ +setIamPolicy($resource, $policy); + 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 +{ + $resource = '[RESOURCE]'; + + set_iam_policy_sample($resource); +} +// [END metastore_v1beta_generated_DataprocMetastore_SetIamPolicy_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreClient/test_iam_permissions.php b/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreClient/test_iam_permissions.php new file mode 100644 index 000000000000..83fe208c22d3 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreClient/test_iam_permissions.php @@ -0,0 +1,80 @@ +testIamPermissions($resource, $permissions); + 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 +{ + $resource = '[RESOURCE]'; + $permissionsElement = '[PERMISSIONS]'; + + test_iam_permissions_sample($resource, $permissionsElement); +} +// [END metastore_v1beta_generated_DataprocMetastore_TestIamPermissions_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreClient/update_metadata_import.php b/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreClient/update_metadata_import.php new file mode 100644 index 000000000000..2f99663b4568 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreClient/update_metadata_import.php @@ -0,0 +1,71 @@ +updateMetadataImport($updateMask, $metadataImport); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var MetadataImport $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()); + } +} +// [END metastore_v1beta_generated_DataprocMetastore_UpdateMetadataImport_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreClient/update_service.php b/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreClient/update_service.php new file mode 100644 index 000000000000..ee17c466e535 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreClient/update_service.php @@ -0,0 +1,70 @@ +updateService($updateMask, $service); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Service $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()); + } +} +// [END metastore_v1beta_generated_DataprocMetastore_UpdateService_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreFederationClient/create_federation.php b/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreFederationClient/create_federation.php new file mode 100644 index 000000000000..b5c8953a0cd7 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreFederationClient/create_federation.php @@ -0,0 +1,95 @@ +createFederation( + $formattedParent, + $federationId, + $federation + ); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Federation $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 +{ + $formattedParent = DataprocMetastoreFederationClient::locationName('[PROJECT]', '[LOCATION]'); + $federationId = '[FEDERATION_ID]'; + + create_federation_sample($formattedParent, $federationId); +} +// [END metastore_v1beta_generated_DataprocMetastoreFederation_CreateFederation_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreFederationClient/delete_federation.php b/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreFederationClient/delete_federation.php new file mode 100644 index 000000000000..9b337b917717 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreFederationClient/delete_federation.php @@ -0,0 +1,82 @@ +deleteFederation($formattedName); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + printf('Operation completed successfully.' . PHP_EOL); + } 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 = DataprocMetastoreFederationClient::federationName( + '[PROJECT]', + '[LOCATION]', + '[FEDERATION]' + ); + + delete_federation_sample($formattedName); +} +// [END metastore_v1beta_generated_DataprocMetastoreFederation_DeleteFederation_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreFederationClient/get_federation.php b/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreFederationClient/get_federation.php new file mode 100644 index 000000000000..51fe7862e41c --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreFederationClient/get_federation.php @@ -0,0 +1,73 @@ +getFederation($formattedName); + 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 = DataprocMetastoreFederationClient::federationName( + '[PROJECT]', + '[LOCATION]', + '[FEDERATION]' + ); + + get_federation_sample($formattedName); +} +// [END metastore_v1beta_generated_DataprocMetastoreFederation_GetFederation_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreFederationClient/get_iam_policy.php b/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreFederationClient/get_iam_policy.php new file mode 100644 index 000000000000..30777f6fbd2f --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreFederationClient/get_iam_policy.php @@ -0,0 +1,67 @@ +getIamPolicy($resource); + 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 +{ + $resource = '[RESOURCE]'; + + get_iam_policy_sample($resource); +} +// [END metastore_v1beta_generated_DataprocMetastoreFederation_GetIamPolicy_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreFederationClient/get_location.php b/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreFederationClient/get_location.php new file mode 100644 index 000000000000..a157404a1576 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreFederationClient/get_location.php @@ -0,0 +1,53 @@ +getLocation(); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END metastore_v1beta_generated_DataprocMetastoreFederation_GetLocation_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreFederationClient/list_federations.php b/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreFederationClient/list_federations.php new file mode 100644 index 000000000000..e79a851f2c43 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreFederationClient/list_federations.php @@ -0,0 +1,73 @@ +listFederations($formattedParent); + + /** @var Federation $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 = DataprocMetastoreFederationClient::locationName('[PROJECT]', '[LOCATION]'); + + list_federations_sample($formattedParent); +} +// [END metastore_v1beta_generated_DataprocMetastoreFederation_ListFederations_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreFederationClient/list_locations.php b/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreFederationClient/list_locations.php new file mode 100644 index 000000000000..2311820512b7 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreFederationClient/list_locations.php @@ -0,0 +1,58 @@ +listLocations(); + + /** @var Location $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()); + } +} +// [END metastore_v1beta_generated_DataprocMetastoreFederation_ListLocations_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreFederationClient/set_iam_policy.php b/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreFederationClient/set_iam_policy.php new file mode 100644 index 000000000000..8366028a71c5 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreFederationClient/set_iam_policy.php @@ -0,0 +1,73 @@ +setIamPolicy($resource, $policy); + 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 +{ + $resource = '[RESOURCE]'; + + set_iam_policy_sample($resource); +} +// [END metastore_v1beta_generated_DataprocMetastoreFederation_SetIamPolicy_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreFederationClient/test_iam_permissions.php b/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreFederationClient/test_iam_permissions.php new file mode 100644 index 000000000000..e6521f6b3015 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreFederationClient/test_iam_permissions.php @@ -0,0 +1,80 @@ +testIamPermissions($resource, $permissions); + 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 +{ + $resource = '[RESOURCE]'; + $permissionsElement = '[PERMISSIONS]'; + + test_iam_permissions_sample($resource, $permissionsElement); +} +// [END metastore_v1beta_generated_DataprocMetastoreFederation_TestIamPermissions_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreFederationClient/update_federation.php b/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreFederationClient/update_federation.php new file mode 100644 index 000000000000..4135f83f171b --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/samples/V1beta/DataprocMetastoreFederationClient/update_federation.php @@ -0,0 +1,70 @@ +updateFederation($updateMask, $federation); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Federation $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()); + } +} +// [END metastore_v1beta_generated_DataprocMetastoreFederation_UpdateFederation_sync] diff --git a/owl-bot-staging/DataprocMetastore/v1beta/src/V1beta/DataprocMetastoreClient.php b/owl-bot-staging/DataprocMetastore/v1beta/src/V1beta/DataprocMetastoreClient.php new file mode 100644 index 000000000000..f5039e8600ed --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/src/V1beta/DataprocMetastoreClient.php @@ -0,0 +1,36 @@ +locationName('[PROJECT]', '[LOCATION]'); + * $federationId = 'federation_id'; + * $federation = new Federation(); + * $operationResponse = $dataprocMetastoreFederationClient->createFederation($formattedParent, $federationId, $federation); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $dataprocMetastoreFederationClient->createFederation($formattedParent, $federationId, $federation); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $dataprocMetastoreFederationClient->resumeOperation($operationName, 'createFederation'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $dataprocMetastoreFederationClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + * + * @experimental + */ +class DataprocMetastoreFederationGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.metastore.v1beta.DataprocMetastoreFederation'; + + /** The default address of the service. */ + const SERVICE_ADDRESS = 'metastore.googleapis.com'; + + /** The default port of the service. */ + const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + ]; + + private static $federationNameTemplate; + + private static $locationNameTemplate; + + private static $pathTemplateMap; + + private $operationsClient; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/dataproc_metastore_federation_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/dataproc_metastore_federation_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/dataproc_metastore_federation_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/dataproc_metastore_federation_rest_client_config.php', + ], + ], + ]; + } + + private static function getFederationNameTemplate() + { + if (self::$federationNameTemplate == null) { + self::$federationNameTemplate = new PathTemplate('projects/{project}/locations/{location}/federations/{federation}'); + } + + return self::$federationNameTemplate; + } + + private static function getLocationNameTemplate() + { + if (self::$locationNameTemplate == null) { + self::$locationNameTemplate = new PathTemplate('projects/{project}/locations/{location}'); + } + + return self::$locationNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'federation' => self::getFederationNameTemplate(), + 'location' => self::getLocationNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a federation + * resource. + * + * @param string $project + * @param string $location + * @param string $federation + * + * @return string The formatted federation resource. + * + * @experimental + */ + public static function federationName($project, $location, $federation) + { + return self::getFederationNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'federation' => $federation, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a location + * resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted location resource. + * + * @experimental + */ + public static function locationName($project, $location) + { + return self::getLocationNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - federation: projects/{project}/locations/{location}/federations/{federation} + * - location: projects/{project}/locations/{location} + * + * 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. + * + * @experimental + */ + public static function parseName($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * Return an OperationsClient object with the same endpoint as $this. + * + * @return OperationsClient + * + * @experimental + */ + 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 + * + * @experimental + */ + 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; + } + + /** + * 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 'metastore.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. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *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' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods 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 + * + * @experimental + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + $this->operationsClient = $this->createOperationsClient($clientOptions); + } + + /** + * Creates a metastore federation in a project and location. + * + * Sample code: + * ``` + * $dataprocMetastoreFederationClient = new DataprocMetastoreFederationClient(); + * try { + * $formattedParent = $dataprocMetastoreFederationClient->locationName('[PROJECT]', '[LOCATION]'); + * $federationId = 'federation_id'; + * $federation = new Federation(); + * $operationResponse = $dataprocMetastoreFederationClient->createFederation($formattedParent, $federationId, $federation); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $dataprocMetastoreFederationClient->createFederation($formattedParent, $federationId, $federation); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $dataprocMetastoreFederationClient->resumeOperation($operationName, 'createFederation'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $dataprocMetastoreFederationClient->close(); + * } + * ``` + * + * @param string $parent Required. The relative resource name of the location in which to create a + * federation service, in the following form: + * + * `projects/{project_number}/locations/{location_id}`. + * @param string $federationId Required. The ID of the metastore federation, which is used as the final + * component of the metastore federation's name. + * + * This value must be between 2 and 63 characters long inclusive, begin with a + * letter, end with a letter or number, and consist of alpha-numeric + * ASCII characters or hyphens. + * @param Federation $federation Required. The Metastore Federation to create. The `name` field is + * ignored. The ID of the created metastore federation must be + * provided in the request's `federation_id` field. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function createFederation($parent, $federationId, $federation, array $optionalArgs = []) + { + $request = new CreateFederationRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setFederationId($federationId); + $request->setFederation($federation); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateFederation', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Deletes a single federation. + * + * Sample code: + * ``` + * $dataprocMetastoreFederationClient = new DataprocMetastoreFederationClient(); + * try { + * $formattedName = $dataprocMetastoreFederationClient->federationName('[PROJECT]', '[LOCATION]', '[FEDERATION]'); + * $operationResponse = $dataprocMetastoreFederationClient->deleteFederation($formattedName); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $dataprocMetastoreFederationClient->deleteFederation($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $dataprocMetastoreFederationClient->resumeOperation($operationName, 'deleteFederation'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $dataprocMetastoreFederationClient->close(); + * } + * ``` + * + * @param string $name Required. The relative resource name of the metastore federation to delete, + * in the following form: + * + * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function deleteFederation($name, array $optionalArgs = []) + { + $request = new DeleteFederationRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('DeleteFederation', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Gets the details of a single federation. + * + * Sample code: + * ``` + * $dataprocMetastoreFederationClient = new DataprocMetastoreFederationClient(); + * try { + * $formattedName = $dataprocMetastoreFederationClient->federationName('[PROJECT]', '[LOCATION]', '[FEDERATION]'); + * $response = $dataprocMetastoreFederationClient->getFederation($formattedName); + * } finally { + * $dataprocMetastoreFederationClient->close(); + * } + * ``` + * + * @param string $name Required. The relative resource name of the metastore federation to + * retrieve, in the following form: + * + * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + * @param array $optionalArgs { + * 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 \Google\Cloud\Metastore\V1beta\Federation + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function getFederation($name, array $optionalArgs = []) + { + $request = new GetFederationRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetFederation', Federation::class, $optionalArgs, $request)->wait(); + } + + /** + * Lists federations in a project and location. + * + * Sample code: + * ``` + * $dataprocMetastoreFederationClient = new DataprocMetastoreFederationClient(); + * try { + * $formattedParent = $dataprocMetastoreFederationClient->locationName('[PROJECT]', '[LOCATION]'); + * // Iterate over pages of elements + * $pagedResponse = $dataprocMetastoreFederationClient->listFederations($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $dataprocMetastoreFederationClient->listFederations($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $dataprocMetastoreFederationClient->close(); + * } + * ``` + * + * @param string $parent Required. The relative resource name of the location of metastore + * federations to list, in the following form: + * `projects/{project_number}/locations/{location_id}`. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type string $filter + * Optional. The filter to apply to list results. + * @type string $orderBy + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @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 \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function listFederations($parent, array $optionalArgs = []) + { + $request = new ListFederationsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListFederations', $optionalArgs, ListFederationsResponse::class, $request); + } + + /** + * Updates the fields of a federation. + * + * Sample code: + * ``` + * $dataprocMetastoreFederationClient = new DataprocMetastoreFederationClient(); + * try { + * $updateMask = new FieldMask(); + * $federation = new Federation(); + * $operationResponse = $dataprocMetastoreFederationClient->updateFederation($updateMask, $federation); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $dataprocMetastoreFederationClient->updateFederation($updateMask, $federation); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $dataprocMetastoreFederationClient->resumeOperation($operationName, 'updateFederation'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $dataprocMetastoreFederationClient->close(); + * } + * ``` + * + * @param FieldMask $updateMask Required. A field mask used to specify the fields to be overwritten in the + * metastore federation resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + * @param Federation $federation Required. The metastore federation to update. The server only merges fields + * in the service if they are specified in `update_mask`. + * + * The metastore federation's `name` field is used to identify the + * metastore service to be updated. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function updateFederation($updateMask, $federation, array $optionalArgs = []) + { + $request = new UpdateFederationRequest(); + $requestParamHeaders = []; + $request->setUpdateMask($updateMask); + $request->setFederation($federation); + $requestParamHeaders['federation.name'] = $federation->getName(); + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('UpdateFederation', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Gets information about a location. + * + * Sample code: + * ``` + * $dataprocMetastoreFederationClient = new DataprocMetastoreFederationClient(); + * try { + * $response = $dataprocMetastoreFederationClient->getLocation(); + * } finally { + * $dataprocMetastoreFederationClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * Resource name for the location. + * @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 \Google\Cloud\Location\Location + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function getLocation(array $optionalArgs = []) + { + $request = new GetLocationRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetLocation', Location::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.cloud.location.Locations')->wait(); + } + + /** + * Lists information about the supported locations for this service. + * + * Sample code: + * ``` + * $dataprocMetastoreFederationClient = new DataprocMetastoreFederationClient(); + * try { + * // Iterate over pages of elements + * $pagedResponse = $dataprocMetastoreFederationClient->listLocations(); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $dataprocMetastoreFederationClient->listLocations(); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $dataprocMetastoreFederationClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * The resource that owns the locations collection, if applicable. + * @type string $filter + * The standard list filter. + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @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 \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function listLocations(array $optionalArgs = []) + { + $request = new ListLocationsRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListLocations', $optionalArgs, ListLocationsResponse::class, $request, 'google.cloud.location.Locations'); + } + + /** + * Gets the access control policy for a resource. Returns an empty policy + if the resource exists and does not have a policy set. + * + * Sample code: + * ``` + * $dataprocMetastoreFederationClient = new DataprocMetastoreFederationClient(); + * try { + * $resource = 'resource'; + * $response = $dataprocMetastoreFederationClient->getIamPolicy($resource); + * } finally { + * $dataprocMetastoreFederationClient->close(); + * } + * ``` + * + * @param string $resource REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param array $optionalArgs { + * Optional. + * + * @type GetPolicyOptions $options + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. + * @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 \Google\Cloud\Iam\V1\Policy + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function getIamPolicy($resource, array $optionalArgs = []) + { + $request = new GetIamPolicyRequest(); + $requestParamHeaders = []; + $request->setResource($resource); + $requestParamHeaders['resource'] = $resource; + if (isset($optionalArgs['options'])) { + $request->setOptions($optionalArgs['options']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetIamPolicy', Policy::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.iam.v1.IAMPolicy')->wait(); + } + + /** + * Sets the access control policy on the specified resource. Replaces + any existing policy. + + Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` + errors. + * + * Sample code: + * ``` + * $dataprocMetastoreFederationClient = new DataprocMetastoreFederationClient(); + * try { + * $resource = 'resource'; + * $policy = new Policy(); + * $response = $dataprocMetastoreFederationClient->setIamPolicy($resource, $policy); + * } finally { + * $dataprocMetastoreFederationClient->close(); + * } + * ``` + * + * @param string $resource REQUIRED: The resource for which the policy is being specified. + * See the operation documentation for the appropriate value for this field. + * @param Policy $policy REQUIRED: The complete policy to be applied to the `resource`. The size of + * the policy is limited to a few 10s of KB. An empty policy is a + * valid policy but certain Cloud Platform services (such as Projects) + * might reject them. + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only + * the fields in the mask will be modified. If no mask is provided, the + * following default mask is used: + * + * `paths: "bindings, etag"` + * @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 \Google\Cloud\Iam\V1\Policy + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function setIamPolicy($resource, $policy, array $optionalArgs = []) + { + $request = new SetIamPolicyRequest(); + $requestParamHeaders = []; + $request->setResource($resource); + $request->setPolicy($policy); + $requestParamHeaders['resource'] = $resource; + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('SetIamPolicy', Policy::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.iam.v1.IAMPolicy')->wait(); + } + + /** + * Returns permissions that a caller has on the specified resource. If the + resource does not exist, this will return an empty set of + permissions, not a `NOT_FOUND` error. + + Note: This operation is designed to be used for building + permission-aware UIs and command-line tools, not for authorization + checking. This operation may "fail open" without warning. + * + * Sample code: + * ``` + * $dataprocMetastoreFederationClient = new DataprocMetastoreFederationClient(); + * try { + * $resource = 'resource'; + * $permissions = []; + * $response = $dataprocMetastoreFederationClient->testIamPermissions($resource, $permissions); + * } finally { + * $dataprocMetastoreFederationClient->close(); + * } + * ``` + * + * @param string $resource REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param string[] $permissions The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @param array $optionalArgs { + * 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 \Google\Cloud\Iam\V1\TestIamPermissionsResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function testIamPermissions($resource, $permissions, array $optionalArgs = []) + { + $request = new TestIamPermissionsRequest(); + $requestParamHeaders = []; + $request->setResource($resource); + $request->setPermissions($permissions); + $requestParamHeaders['resource'] = $resource; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('TestIamPermissions', TestIamPermissionsResponse::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.iam.v1.IAMPolicy')->wait(); + } +} diff --git a/owl-bot-staging/DataprocMetastore/v1beta/src/V1beta/Gapic/DataprocMetastoreGapicClient.php b/owl-bot-staging/DataprocMetastore/v1beta/src/V1beta/Gapic/DataprocMetastoreGapicClient.php new file mode 100644 index 000000000000..9758ccf67a8b --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/src/V1beta/Gapic/DataprocMetastoreGapicClient.php @@ -0,0 +1,2399 @@ +serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + * $resourceName = 'resource_name'; + * $locationUri = 'location_uri'; + * $operationResponse = $dataprocMetastoreClient->alterMetadataResourceLocation($formattedService, $resourceName, $locationUri); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $dataprocMetastoreClient->alterMetadataResourceLocation($formattedService, $resourceName, $locationUri); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $dataprocMetastoreClient->resumeOperation($operationName, 'alterMetadataResourceLocation'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $dataprocMetastoreClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + * + * @experimental + */ +class DataprocMetastoreGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.metastore.v1beta.DataprocMetastore'; + + /** The default address of the service. */ + const SERVICE_ADDRESS = 'metastore.googleapis.com'; + + /** The default port of the service. */ + const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + ]; + + private static $backupNameTemplate; + + private static $lakeNameTemplate; + + private static $locationNameTemplate; + + private static $metadataImportNameTemplate; + + private static $networkNameTemplate; + + private static $serviceNameTemplate; + + private static $subnetworkNameTemplate; + + private static $pathTemplateMap; + + private $operationsClient; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/dataproc_metastore_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/dataproc_metastore_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/dataproc_metastore_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/dataproc_metastore_rest_client_config.php', + ], + ], + ]; + } + + private static function getBackupNameTemplate() + { + if (self::$backupNameTemplate == null) { + self::$backupNameTemplate = new PathTemplate('projects/{project}/locations/{location}/services/{service}/backups/{backup}'); + } + + return self::$backupNameTemplate; + } + + private static function getLakeNameTemplate() + { + if (self::$lakeNameTemplate == null) { + self::$lakeNameTemplate = new PathTemplate('projects/{project}/locations/{location}/lakes/{lake}'); + } + + return self::$lakeNameTemplate; + } + + private static function getLocationNameTemplate() + { + if (self::$locationNameTemplate == null) { + self::$locationNameTemplate = new PathTemplate('projects/{project}/locations/{location}'); + } + + return self::$locationNameTemplate; + } + + private static function getMetadataImportNameTemplate() + { + if (self::$metadataImportNameTemplate == null) { + self::$metadataImportNameTemplate = new PathTemplate('projects/{project}/locations/{location}/services/{service}/metadataImports/{metadata_import}'); + } + + return self::$metadataImportNameTemplate; + } + + private static function getNetworkNameTemplate() + { + if (self::$networkNameTemplate == null) { + self::$networkNameTemplate = new PathTemplate('projects/{project}/global/networks/{network}'); + } + + return self::$networkNameTemplate; + } + + private static function getServiceNameTemplate() + { + if (self::$serviceNameTemplate == null) { + self::$serviceNameTemplate = new PathTemplate('projects/{project}/locations/{location}/services/{service}'); + } + + return self::$serviceNameTemplate; + } + + private static function getSubnetworkNameTemplate() + { + if (self::$subnetworkNameTemplate == null) { + self::$subnetworkNameTemplate = new PathTemplate('projects/{project}/regions/{region}/subnetworks/{subnetwork}'); + } + + return self::$subnetworkNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'backup' => self::getBackupNameTemplate(), + 'lake' => self::getLakeNameTemplate(), + 'location' => self::getLocationNameTemplate(), + 'metadataImport' => self::getMetadataImportNameTemplate(), + 'network' => self::getNetworkNameTemplate(), + 'service' => self::getServiceNameTemplate(), + 'subnetwork' => self::getSubnetworkNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a backup + * resource. + * + * @param string $project + * @param string $location + * @param string $service + * @param string $backup + * + * @return string The formatted backup resource. + * + * @experimental + */ + public static function backupName($project, $location, $service, $backup) + { + return self::getBackupNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'service' => $service, + 'backup' => $backup, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a lake + * resource. + * + * @param string $project + * @param string $location + * @param string $lake + * + * @return string The formatted lake resource. + * + * @experimental + */ + public static function lakeName($project, $location, $lake) + { + return self::getLakeNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'lake' => $lake, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a location + * resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted location resource. + * + * @experimental + */ + public static function locationName($project, $location) + { + return self::getLocationNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * metadata_import resource. + * + * @param string $project + * @param string $location + * @param string $service + * @param string $metadataImport + * + * @return string The formatted metadata_import resource. + * + * @experimental + */ + public static function metadataImportName($project, $location, $service, $metadataImport) + { + return self::getMetadataImportNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'service' => $service, + 'metadata_import' => $metadataImport, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a network + * resource. + * + * @param string $project + * @param string $network + * + * @return string The formatted network resource. + * + * @experimental + */ + public static function networkName($project, $network) + { + return self::getNetworkNameTemplate()->render([ + 'project' => $project, + 'network' => $network, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a service + * resource. + * + * @param string $project + * @param string $location + * @param string $service + * + * @return string The formatted service resource. + * + * @experimental + */ + public static function serviceName($project, $location, $service) + { + return self::getServiceNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'service' => $service, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a subnetwork + * resource. + * + * @param string $project + * @param string $region + * @param string $subnetwork + * + * @return string The formatted subnetwork resource. + * + * @experimental + */ + public static function subnetworkName($project, $region, $subnetwork) + { + return self::getSubnetworkNameTemplate()->render([ + 'project' => $project, + 'region' => $region, + 'subnetwork' => $subnetwork, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - backup: projects/{project}/locations/{location}/services/{service}/backups/{backup} + * - lake: projects/{project}/locations/{location}/lakes/{lake} + * - location: projects/{project}/locations/{location} + * - metadataImport: projects/{project}/locations/{location}/services/{service}/metadataImports/{metadata_import} + * - network: projects/{project}/global/networks/{network} + * - service: projects/{project}/locations/{location}/services/{service} + * - subnetwork: projects/{project}/regions/{region}/subnetworks/{subnetwork} + * + * 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. + * + * @experimental + */ + public static function parseName($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * Return an OperationsClient object with the same endpoint as $this. + * + * @return OperationsClient + * + * @experimental + */ + 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 + * + * @experimental + */ + 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; + } + + /** + * 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 'metastore.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. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *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' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods 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 + * + * @experimental + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + $this->operationsClient = $this->createOperationsClient($clientOptions); + } + + /** + * Alter metadata resource location. The metadata resource can be a database, + * table, or partition. This functionality only updates the parent directory + * for the respective metadata resource and does not transfer any existing + * data to the new location. + * + * Sample code: + * ``` + * $dataprocMetastoreClient = new DataprocMetastoreClient(); + * try { + * $formattedService = $dataprocMetastoreClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + * $resourceName = 'resource_name'; + * $locationUri = 'location_uri'; + * $operationResponse = $dataprocMetastoreClient->alterMetadataResourceLocation($formattedService, $resourceName, $locationUri); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $dataprocMetastoreClient->alterMetadataResourceLocation($formattedService, $resourceName, $locationUri); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $dataprocMetastoreClient->resumeOperation($operationName, 'alterMetadataResourceLocation'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $dataprocMetastoreClient->close(); + * } + * ``` + * + * @param string $service Required. The relative resource name of the metastore service to mutate + * metadata, in the following format: + * + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * @param string $resourceName Required. The relative metadata resource name in the following format. + * + * `databases/{database_id}` + * or + * `databases/{database_id}/tables/{table_id}` + * or + * `databases/{database_id}/tables/{table_id}/partitions/{partition_id}` + * @param string $locationUri Required. The new location URI for the metadata resource. + * @param array $optionalArgs { + * 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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function alterMetadataResourceLocation($service, $resourceName, $locationUri, array $optionalArgs = []) + { + $request = new AlterMetadataResourceLocationRequest(); + $requestParamHeaders = []; + $request->setService($service); + $request->setResourceName($resourceName); + $request->setLocationUri($locationUri); + $requestParamHeaders['service'] = $service; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('AlterMetadataResourceLocation', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Creates a new backup in a given project and location. + * + * Sample code: + * ``` + * $dataprocMetastoreClient = new DataprocMetastoreClient(); + * try { + * $formattedParent = $dataprocMetastoreClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + * $backupId = 'backup_id'; + * $backup = new Backup(); + * $operationResponse = $dataprocMetastoreClient->createBackup($formattedParent, $backupId, $backup); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $dataprocMetastoreClient->createBackup($formattedParent, $backupId, $backup); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $dataprocMetastoreClient->resumeOperation($operationName, 'createBackup'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $dataprocMetastoreClient->close(); + * } + * ``` + * + * @param string $parent Required. The relative resource name of the service in which to create a + * backup of the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * @param string $backupId Required. The ID of the backup, which is used as the final component of the + * backup's name. + * + * This value must be between 1 and 64 characters long, begin with a letter, + * end with a letter or number, and consist of alpha-numeric ASCII characters + * or hyphens. + * @param Backup $backup Required. The backup to create. The `name` field is ignored. The ID of the + * created backup must be provided in the request's `backup_id` field. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function createBackup($parent, $backupId, $backup, array $optionalArgs = []) + { + $request = new CreateBackupRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setBackupId($backupId); + $request->setBackup($backup); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateBackup', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Creates a new MetadataImport in a given project and location. + * + * Sample code: + * ``` + * $dataprocMetastoreClient = new DataprocMetastoreClient(); + * try { + * $formattedParent = $dataprocMetastoreClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + * $metadataImportId = 'metadata_import_id'; + * $metadataImport = new MetadataImport(); + * $operationResponse = $dataprocMetastoreClient->createMetadataImport($formattedParent, $metadataImportId, $metadataImport); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $dataprocMetastoreClient->createMetadataImport($formattedParent, $metadataImportId, $metadataImport); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $dataprocMetastoreClient->resumeOperation($operationName, 'createMetadataImport'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $dataprocMetastoreClient->close(); + * } + * ``` + * + * @param string $parent Required. The relative resource name of the service in which to create a + * metastore import, in the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * @param string $metadataImportId Required. The ID of the metadata import, which is used as the final + * component of the metadata import's name. + * + * This value must be between 1 and 64 characters long, begin with a letter, + * end with a letter or number, and consist of alpha-numeric ASCII characters + * or hyphens. + * @param MetadataImport $metadataImport Required. The metadata import to create. The `name` field is ignored. The + * ID of the created metadata import must be provided in the request's + * `metadata_import_id` field. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function createMetadataImport($parent, $metadataImportId, $metadataImport, array $optionalArgs = []) + { + $request = new CreateMetadataImportRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setMetadataImportId($metadataImportId); + $request->setMetadataImport($metadataImport); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateMetadataImport', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Creates a metastore service in a project and location. + * + * Sample code: + * ``` + * $dataprocMetastoreClient = new DataprocMetastoreClient(); + * try { + * $formattedParent = $dataprocMetastoreClient->locationName('[PROJECT]', '[LOCATION]'); + * $serviceId = 'service_id'; + * $service = new Service(); + * $operationResponse = $dataprocMetastoreClient->createService($formattedParent, $serviceId, $service); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $dataprocMetastoreClient->createService($formattedParent, $serviceId, $service); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $dataprocMetastoreClient->resumeOperation($operationName, 'createService'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $dataprocMetastoreClient->close(); + * } + * ``` + * + * @param string $parent Required. The relative resource name of the location in which to create a + * metastore service, in the following form: + * + * `projects/{project_number}/locations/{location_id}`. + * @param string $serviceId Required. The ID of the metastore service, which is used as the final + * component of the metastore service's name. + * + * This value must be between 2 and 63 characters long inclusive, begin with a + * letter, end with a letter or number, and consist of alpha-numeric + * ASCII characters or hyphens. + * @param Service $service Required. The Metastore service to create. The `name` field is + * ignored. The ID of the created metastore service must be provided in + * the request's `service_id` field. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function createService($parent, $serviceId, $service, array $optionalArgs = []) + { + $request = new CreateServiceRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setServiceId($serviceId); + $request->setService($service); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateService', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Deletes a single backup. + * + * Sample code: + * ``` + * $dataprocMetastoreClient = new DataprocMetastoreClient(); + * try { + * $formattedName = $dataprocMetastoreClient->backupName('[PROJECT]', '[LOCATION]', '[SERVICE]', '[BACKUP]'); + * $operationResponse = $dataprocMetastoreClient->deleteBackup($formattedName); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $dataprocMetastoreClient->deleteBackup($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $dataprocMetastoreClient->resumeOperation($operationName, 'deleteBackup'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $dataprocMetastoreClient->close(); + * } + * ``` + * + * @param string $name Required. The relative resource name of the backup to delete, in the + * following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function deleteBackup($name, array $optionalArgs = []) + { + $request = new DeleteBackupRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('DeleteBackup', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Deletes a single service. + * + * Sample code: + * ``` + * $dataprocMetastoreClient = new DataprocMetastoreClient(); + * try { + * $formattedName = $dataprocMetastoreClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + * $operationResponse = $dataprocMetastoreClient->deleteService($formattedName); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $dataprocMetastoreClient->deleteService($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $dataprocMetastoreClient->resumeOperation($operationName, 'deleteService'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $dataprocMetastoreClient->close(); + * } + * ``` + * + * @param string $name Required. The relative resource name of the metastore service to delete, in + * the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function deleteService($name, array $optionalArgs = []) + { + $request = new DeleteServiceRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('DeleteService', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Exports metadata from a service. + * + * Sample code: + * ``` + * $dataprocMetastoreClient = new DataprocMetastoreClient(); + * try { + * $formattedService = $dataprocMetastoreClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + * $operationResponse = $dataprocMetastoreClient->exportMetadata($formattedService); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $dataprocMetastoreClient->exportMetadata($formattedService); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $dataprocMetastoreClient->resumeOperation($operationName, 'exportMetadata'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $dataprocMetastoreClient->close(); + * } + * ``` + * + * @param string $service Required. The relative resource name of the metastore service to run + * export, in the following form: + * + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * @param array $optionalArgs { + * Optional. + * + * @type string $destinationGcsFolder + * A Cloud Storage URI of a folder, in the format + * `gs:///`. A sub-folder + * `` containing exported files will be created below it. + * @type string $requestId + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @type int $databaseDumpType + * Optional. The type of the database dump. If unspecified, defaults to + * `MYSQL`. + * For allowed values, use constants defined on {@see \Google\Cloud\Metastore\V1beta\DatabaseDumpSpec\Type} + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function exportMetadata($service, array $optionalArgs = []) + { + $request = new ExportMetadataRequest(); + $requestParamHeaders = []; + $request->setService($service); + $requestParamHeaders['service'] = $service; + if (isset($optionalArgs['destinationGcsFolder'])) { + $request->setDestinationGcsFolder($optionalArgs['destinationGcsFolder']); + } + + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + if (isset($optionalArgs['databaseDumpType'])) { + $request->setDatabaseDumpType($optionalArgs['databaseDumpType']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('ExportMetadata', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Gets details of a single backup. + * + * Sample code: + * ``` + * $dataprocMetastoreClient = new DataprocMetastoreClient(); + * try { + * $formattedName = $dataprocMetastoreClient->backupName('[PROJECT]', '[LOCATION]', '[SERVICE]', '[BACKUP]'); + * $response = $dataprocMetastoreClient->getBackup($formattedName); + * } finally { + * $dataprocMetastoreClient->close(); + * } + * ``` + * + * @param string $name Required. The relative resource name of the backup to retrieve, in the + * following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + * @param array $optionalArgs { + * 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 \Google\Cloud\Metastore\V1beta\Backup + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function getBackup($name, array $optionalArgs = []) + { + $request = new GetBackupRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetBackup', Backup::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets details of a single import. + * + * Sample code: + * ``` + * $dataprocMetastoreClient = new DataprocMetastoreClient(); + * try { + * $formattedName = $dataprocMetastoreClient->metadataImportName('[PROJECT]', '[LOCATION]', '[SERVICE]', '[METADATA_IMPORT]'); + * $response = $dataprocMetastoreClient->getMetadataImport($formattedName); + * } finally { + * $dataprocMetastoreClient->close(); + * } + * ``` + * + * @param string $name Required. The relative resource name of the metadata import to retrieve, in + * the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{import_id}`. + * @param array $optionalArgs { + * 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 \Google\Cloud\Metastore\V1beta\MetadataImport + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function getMetadataImport($name, array $optionalArgs = []) + { + $request = new GetMetadataImportRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetMetadataImport', MetadataImport::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets the details of a single service. + * + * Sample code: + * ``` + * $dataprocMetastoreClient = new DataprocMetastoreClient(); + * try { + * $formattedName = $dataprocMetastoreClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + * $response = $dataprocMetastoreClient->getService($formattedName); + * } finally { + * $dataprocMetastoreClient->close(); + * } + * ``` + * + * @param string $name Required. The relative resource name of the metastore service to retrieve, + * in the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * @param array $optionalArgs { + * 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 \Google\Cloud\Metastore\V1beta\Service + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function getService($name, array $optionalArgs = []) + { + $request = new GetServiceRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetService', Service::class, $optionalArgs, $request)->wait(); + } + + /** + * Lists backups in a service. + * + * Sample code: + * ``` + * $dataprocMetastoreClient = new DataprocMetastoreClient(); + * try { + * $formattedParent = $dataprocMetastoreClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + * // Iterate over pages of elements + * $pagedResponse = $dataprocMetastoreClient->listBackups($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $dataprocMetastoreClient->listBackups($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $dataprocMetastoreClient->close(); + * } + * ``` + * + * @param string $parent Required. The relative resource name of the service whose backups to + * list, in the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type string $filter + * Optional. The filter to apply to list results. + * @type string $orderBy + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @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 \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function listBackups($parent, array $optionalArgs = []) + { + $request = new ListBackupsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListBackups', $optionalArgs, ListBackupsResponse::class, $request); + } + + /** + * Lists imports in a service. + * + * Sample code: + * ``` + * $dataprocMetastoreClient = new DataprocMetastoreClient(); + * try { + * $formattedParent = $dataprocMetastoreClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + * // Iterate over pages of elements + * $pagedResponse = $dataprocMetastoreClient->listMetadataImports($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $dataprocMetastoreClient->listMetadataImports($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $dataprocMetastoreClient->close(); + * } + * ``` + * + * @param string $parent Required. The relative resource name of the service whose metadata imports + * to list, in the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type string $filter + * Optional. The filter to apply to list results. + * @type string $orderBy + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @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 \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function listMetadataImports($parent, array $optionalArgs = []) + { + $request = new ListMetadataImportsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListMetadataImports', $optionalArgs, ListMetadataImportsResponse::class, $request); + } + + /** + * Lists services in a project and location. + * + * Sample code: + * ``` + * $dataprocMetastoreClient = new DataprocMetastoreClient(); + * try { + * $formattedParent = $dataprocMetastoreClient->locationName('[PROJECT]', '[LOCATION]'); + * // Iterate over pages of elements + * $pagedResponse = $dataprocMetastoreClient->listServices($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $dataprocMetastoreClient->listServices($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $dataprocMetastoreClient->close(); + * } + * ``` + * + * @param string $parent Required. The relative resource name of the location of metastore services + * to list, in the following form: + * + * `projects/{project_number}/locations/{location_id}`. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type string $filter + * Optional. The filter to apply to list results. + * @type string $orderBy + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @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 \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function listServices($parent, array $optionalArgs = []) + { + $request = new ListServicesRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListServices', $optionalArgs, ListServicesResponse::class, $request); + } + + /** + * Move a table to another database. + * + * Sample code: + * ``` + * $dataprocMetastoreClient = new DataprocMetastoreClient(); + * try { + * $formattedService = $dataprocMetastoreClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + * $tableName = 'table_name'; + * $dbName = 'db_name'; + * $destinationDbName = 'destination_db_name'; + * $operationResponse = $dataprocMetastoreClient->moveTableToDatabase($formattedService, $tableName, $dbName, $destinationDbName); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $dataprocMetastoreClient->moveTableToDatabase($formattedService, $tableName, $dbName, $destinationDbName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $dataprocMetastoreClient->resumeOperation($operationName, 'moveTableToDatabase'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $dataprocMetastoreClient->close(); + * } + * ``` + * + * @param string $service Required. The relative resource name of the metastore service to mutate + * metadata, in the following format: + * + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * @param string $tableName Required. The name of the table to be moved. + * @param string $dbName Required. The name of the database where the table resides. + * @param string $destinationDbName Required. The name of the database where the table should be moved. + * @param array $optionalArgs { + * 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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function moveTableToDatabase($service, $tableName, $dbName, $destinationDbName, array $optionalArgs = []) + { + $request = new MoveTableToDatabaseRequest(); + $requestParamHeaders = []; + $request->setService($service); + $request->setTableName($tableName); + $request->setDbName($dbName); + $request->setDestinationDbName($destinationDbName); + $requestParamHeaders['service'] = $service; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('MoveTableToDatabase', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Query DPMS metadata. + * + * Sample code: + * ``` + * $dataprocMetastoreClient = new DataprocMetastoreClient(); + * try { + * $formattedService = $dataprocMetastoreClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + * $query = 'query'; + * $operationResponse = $dataprocMetastoreClient->queryMetadata($formattedService, $query); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $dataprocMetastoreClient->queryMetadata($formattedService, $query); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $dataprocMetastoreClient->resumeOperation($operationName, 'queryMetadata'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $dataprocMetastoreClient->close(); + * } + * ``` + * + * @param string $service Required. The relative resource name of the metastore service to query + * metadata, in the following format: + * + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * @param string $query Required. A read-only SQL query to execute against the metadata database. + * The query cannot change or mutate the data. + * @param array $optionalArgs { + * 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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function queryMetadata($service, $query, array $optionalArgs = []) + { + $request = new QueryMetadataRequest(); + $requestParamHeaders = []; + $request->setService($service); + $request->setQuery($query); + $requestParamHeaders['service'] = $service; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('QueryMetadata', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Removes the attached IAM policies for a resource + * + * Sample code: + * ``` + * $dataprocMetastoreClient = new DataprocMetastoreClient(); + * try { + * $resource = 'resource'; + * $response = $dataprocMetastoreClient->removeIamPolicy($resource); + * } finally { + * $dataprocMetastoreClient->close(); + * } + * ``` + * + * @param string $resource Required. The relative resource name of the dataplane resource to remove + * IAM policy, in the following form: + * + * `projects/{project_id}/locations/{location_id}/services/{service_id}/databases/{database_id}` + * or + * `projects/{project_id}/locations/{location_id}/services/{service_id}/databases/{database_id}/tables/{table_id}`. + * @param array $optionalArgs { + * Optional. + * + * @type bool $asynchronous + * Optional. Removes IAM policy attached to database or table asynchronously + * when it is set. The default is false. + * @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 \Google\Cloud\Metastore\V1beta\RemoveIamPolicyResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function removeIamPolicy($resource, array $optionalArgs = []) + { + $request = new RemoveIamPolicyRequest(); + $requestParamHeaders = []; + $request->setResource($resource); + $requestParamHeaders['resource'] = $resource; + if (isset($optionalArgs['asynchronous'])) { + $request->setAsynchronous($optionalArgs['asynchronous']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('RemoveIamPolicy', RemoveIamPolicyResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Restores a service from a backup. + * + * Sample code: + * ``` + * $dataprocMetastoreClient = new DataprocMetastoreClient(); + * try { + * $formattedService = $dataprocMetastoreClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + * $formattedBackup = $dataprocMetastoreClient->backupName('[PROJECT]', '[LOCATION]', '[SERVICE]', '[BACKUP]'); + * $operationResponse = $dataprocMetastoreClient->restoreService($formattedService, $formattedBackup); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $dataprocMetastoreClient->restoreService($formattedService, $formattedBackup); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $dataprocMetastoreClient->resumeOperation($operationName, 'restoreService'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $dataprocMetastoreClient->close(); + * } + * ``` + * + * @param string $service Required. The relative resource name of the metastore service to run + * restore, in the following form: + * + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * @param string $backup Required. The relative resource name of the metastore service backup to + * restore from, in the following form: + * + * `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + * @param array $optionalArgs { + * Optional. + * + * @type int $restoreType + * Optional. The type of restore. If unspecified, defaults to `METADATA_ONLY`. + * For allowed values, use constants defined on {@see \Google\Cloud\Metastore\V1beta\Restore\RestoreType} + * @type string $requestId + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function restoreService($service, $backup, array $optionalArgs = []) + { + $request = new RestoreServiceRequest(); + $requestParamHeaders = []; + $request->setService($service); + $request->setBackup($backup); + $requestParamHeaders['service'] = $service; + if (isset($optionalArgs['restoreType'])) { + $request->setRestoreType($optionalArgs['restoreType']); + } + + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('RestoreService', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Updates a single import. + * Only the description field of MetadataImport is supported to be updated. + * + * Sample code: + * ``` + * $dataprocMetastoreClient = new DataprocMetastoreClient(); + * try { + * $updateMask = new FieldMask(); + * $metadataImport = new MetadataImport(); + * $operationResponse = $dataprocMetastoreClient->updateMetadataImport($updateMask, $metadataImport); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $dataprocMetastoreClient->updateMetadataImport($updateMask, $metadataImport); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $dataprocMetastoreClient->resumeOperation($operationName, 'updateMetadataImport'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $dataprocMetastoreClient->close(); + * } + * ``` + * + * @param FieldMask $updateMask Required. A field mask used to specify the fields to be overwritten in the + * metadata import resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + * @param MetadataImport $metadataImport Required. The metadata import to update. The server only merges fields + * in the import if they are specified in `update_mask`. + * + * The metadata import's `name` field is used to identify the metastore + * import to be updated. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function updateMetadataImport($updateMask, $metadataImport, array $optionalArgs = []) + { + $request = new UpdateMetadataImportRequest(); + $requestParamHeaders = []; + $request->setUpdateMask($updateMask); + $request->setMetadataImport($metadataImport); + $requestParamHeaders['metadata_import.name'] = $metadataImport->getName(); + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('UpdateMetadataImport', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Updates the parameters of a single service. + * + * Sample code: + * ``` + * $dataprocMetastoreClient = new DataprocMetastoreClient(); + * try { + * $updateMask = new FieldMask(); + * $service = new Service(); + * $operationResponse = $dataprocMetastoreClient->updateService($updateMask, $service); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $dataprocMetastoreClient->updateService($updateMask, $service); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $dataprocMetastoreClient->resumeOperation($operationName, 'updateService'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $dataprocMetastoreClient->close(); + * } + * ``` + * + * @param FieldMask $updateMask Required. A field mask used to specify the fields to be overwritten in the + * metastore service resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + * @param Service $service Required. The metastore service to update. The server only merges fields + * in the service if they are specified in `update_mask`. + * + * The metastore service's `name` field is used to identify the metastore + * service to be updated. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function updateService($updateMask, $service, array $optionalArgs = []) + { + $request = new UpdateServiceRequest(); + $requestParamHeaders = []; + $request->setUpdateMask($updateMask); + $request->setService($service); + $requestParamHeaders['service.name'] = $service->getName(); + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('UpdateService', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Gets information about a location. + * + * Sample code: + * ``` + * $dataprocMetastoreClient = new DataprocMetastoreClient(); + * try { + * $response = $dataprocMetastoreClient->getLocation(); + * } finally { + * $dataprocMetastoreClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * Resource name for the location. + * @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 \Google\Cloud\Location\Location + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function getLocation(array $optionalArgs = []) + { + $request = new GetLocationRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetLocation', Location::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.cloud.location.Locations')->wait(); + } + + /** + * Lists information about the supported locations for this service. + * + * Sample code: + * ``` + * $dataprocMetastoreClient = new DataprocMetastoreClient(); + * try { + * // Iterate over pages of elements + * $pagedResponse = $dataprocMetastoreClient->listLocations(); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $dataprocMetastoreClient->listLocations(); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $dataprocMetastoreClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * The resource that owns the locations collection, if applicable. + * @type string $filter + * The standard list filter. + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @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 \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function listLocations(array $optionalArgs = []) + { + $request = new ListLocationsRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListLocations', $optionalArgs, ListLocationsResponse::class, $request, 'google.cloud.location.Locations'); + } + + /** + * Gets the access control policy for a resource. Returns an empty policy + if the resource exists and does not have a policy set. + * + * Sample code: + * ``` + * $dataprocMetastoreClient = new DataprocMetastoreClient(); + * try { + * $resource = 'resource'; + * $response = $dataprocMetastoreClient->getIamPolicy($resource); + * } finally { + * $dataprocMetastoreClient->close(); + * } + * ``` + * + * @param string $resource REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param array $optionalArgs { + * Optional. + * + * @type GetPolicyOptions $options + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. + * @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 \Google\Cloud\Iam\V1\Policy + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function getIamPolicy($resource, array $optionalArgs = []) + { + $request = new GetIamPolicyRequest(); + $requestParamHeaders = []; + $request->setResource($resource); + $requestParamHeaders['resource'] = $resource; + if (isset($optionalArgs['options'])) { + $request->setOptions($optionalArgs['options']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetIamPolicy', Policy::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.iam.v1.IAMPolicy')->wait(); + } + + /** + * Sets the access control policy on the specified resource. Replaces + any existing policy. + + Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` + errors. + * + * Sample code: + * ``` + * $dataprocMetastoreClient = new DataprocMetastoreClient(); + * try { + * $resource = 'resource'; + * $policy = new Policy(); + * $response = $dataprocMetastoreClient->setIamPolicy($resource, $policy); + * } finally { + * $dataprocMetastoreClient->close(); + * } + * ``` + * + * @param string $resource REQUIRED: The resource for which the policy is being specified. + * See the operation documentation for the appropriate value for this field. + * @param Policy $policy REQUIRED: The complete policy to be applied to the `resource`. The size of + * the policy is limited to a few 10s of KB. An empty policy is a + * valid policy but certain Cloud Platform services (such as Projects) + * might reject them. + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only + * the fields in the mask will be modified. If no mask is provided, the + * following default mask is used: + * + * `paths: "bindings, etag"` + * @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 \Google\Cloud\Iam\V1\Policy + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function setIamPolicy($resource, $policy, array $optionalArgs = []) + { + $request = new SetIamPolicyRequest(); + $requestParamHeaders = []; + $request->setResource($resource); + $request->setPolicy($policy); + $requestParamHeaders['resource'] = $resource; + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('SetIamPolicy', Policy::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.iam.v1.IAMPolicy')->wait(); + } + + /** + * Returns permissions that a caller has on the specified resource. If the + resource does not exist, this will return an empty set of + permissions, not a `NOT_FOUND` error. + + Note: This operation is designed to be used for building + permission-aware UIs and command-line tools, not for authorization + checking. This operation may "fail open" without warning. + * + * Sample code: + * ``` + * $dataprocMetastoreClient = new DataprocMetastoreClient(); + * try { + * $resource = 'resource'; + * $permissions = []; + * $response = $dataprocMetastoreClient->testIamPermissions($resource, $permissions); + * } finally { + * $dataprocMetastoreClient->close(); + * } + * ``` + * + * @param string $resource REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param string[] $permissions The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @param array $optionalArgs { + * 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 \Google\Cloud\Iam\V1\TestIamPermissionsResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function testIamPermissions($resource, $permissions, array $optionalArgs = []) + { + $request = new TestIamPermissionsRequest(); + $requestParamHeaders = []; + $request->setResource($resource); + $request->setPermissions($permissions); + $requestParamHeaders['resource'] = $resource; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('TestIamPermissions', TestIamPermissionsResponse::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.iam.v1.IAMPolicy')->wait(); + } +} diff --git a/owl-bot-staging/DataprocMetastore/v1beta/src/V1beta/gapic_metadata.json b/owl-bot-staging/DataprocMetastore/v1beta/src/V1beta/gapic_metadata.json new file mode 100644 index 000000000000..1e01d02ccb35 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/src/V1beta/gapic_metadata.json @@ -0,0 +1,197 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services\/RPCs to the corresponding library clients\/methods", + "language": "php", + "protoPackage": "google.cloud.metastore.v1beta", + "libraryPackage": "Google\\Cloud\\Metastore\\V1beta", + "services": { + "DataprocMetastore": { + "clients": { + "grpc": { + "libraryClient": "DataprocMetastoreGapicClient", + "rpcs": { + "AlterMetadataResourceLocation": { + "methods": [ + "alterMetadataResourceLocation" + ] + }, + "CreateBackup": { + "methods": [ + "createBackup" + ] + }, + "CreateMetadataImport": { + "methods": [ + "createMetadataImport" + ] + }, + "CreateService": { + "methods": [ + "createService" + ] + }, + "DeleteBackup": { + "methods": [ + "deleteBackup" + ] + }, + "DeleteService": { + "methods": [ + "deleteService" + ] + }, + "ExportMetadata": { + "methods": [ + "exportMetadata" + ] + }, + "GetBackup": { + "methods": [ + "getBackup" + ] + }, + "GetMetadataImport": { + "methods": [ + "getMetadataImport" + ] + }, + "GetService": { + "methods": [ + "getService" + ] + }, + "ListBackups": { + "methods": [ + "listBackups" + ] + }, + "ListMetadataImports": { + "methods": [ + "listMetadataImports" + ] + }, + "ListServices": { + "methods": [ + "listServices" + ] + }, + "MoveTableToDatabase": { + "methods": [ + "moveTableToDatabase" + ] + }, + "QueryMetadata": { + "methods": [ + "queryMetadata" + ] + }, + "RemoveIamPolicy": { + "methods": [ + "removeIamPolicy" + ] + }, + "RestoreService": { + "methods": [ + "restoreService" + ] + }, + "UpdateMetadataImport": { + "methods": [ + "updateMetadataImport" + ] + }, + "UpdateService": { + "methods": [ + "updateService" + ] + }, + "GetLocation": { + "methods": [ + "getLocation" + ] + }, + "ListLocations": { + "methods": [ + "listLocations" + ] + }, + "GetIamPolicy": { + "methods": [ + "getIamPolicy" + ] + }, + "SetIamPolicy": { + "methods": [ + "setIamPolicy" + ] + }, + "TestIamPermissions": { + "methods": [ + "testIamPermissions" + ] + } + } + } + } + }, + "DataprocMetastoreFederation": { + "clients": { + "grpc": { + "libraryClient": "DataprocMetastoreFederationGapicClient", + "rpcs": { + "CreateFederation": { + "methods": [ + "createFederation" + ] + }, + "DeleteFederation": { + "methods": [ + "deleteFederation" + ] + }, + "GetFederation": { + "methods": [ + "getFederation" + ] + }, + "ListFederations": { + "methods": [ + "listFederations" + ] + }, + "UpdateFederation": { + "methods": [ + "updateFederation" + ] + }, + "GetLocation": { + "methods": [ + "getLocation" + ] + }, + "ListLocations": { + "methods": [ + "listLocations" + ] + }, + "GetIamPolicy": { + "methods": [ + "getIamPolicy" + ] + }, + "SetIamPolicy": { + "methods": [ + "setIamPolicy" + ] + }, + "TestIamPermissions": { + "methods": [ + "testIamPermissions" + ] + } + } + } + } + } + } +} \ No newline at end of file diff --git a/owl-bot-staging/DataprocMetastore/v1beta/src/V1beta/resources/dataproc_metastore_client_config.json b/owl-bot-staging/DataprocMetastore/v1beta/src/V1beta/resources/dataproc_metastore_client_config.json new file mode 100644 index 000000000000..f641af0265f2 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/src/V1beta/resources/dataproc_metastore_client_config.json @@ -0,0 +1,164 @@ +{ + "interfaces": { + "google.cloud.metastore.v1beta.DataprocMetastore": { + "retry_codes": { + "no_retry_codes": [], + "retry_policy_1_codes": [ + "UNAVAILABLE" + ], + "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": 1.3, + "max_retry_delay_millis": 10000, + "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": { + "AlterMetadataResourceLocation": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "CreateBackup": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "CreateMetadataImport": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "CreateService": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "DeleteBackup": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "DeleteService": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "ExportMetadata": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "GetBackup": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetMetadataImport": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetService": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListBackups": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListMetadataImports": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListServices": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "MoveTableToDatabase": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "QueryMetadata": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "RemoveIamPolicy": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "RestoreService": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "UpdateMetadataImport": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "UpdateService": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "GetLocation": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListLocations": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetIamPolicy": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "SetIamPolicy": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "TestIamPermissions": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + } + } + } + } +} diff --git a/owl-bot-staging/DataprocMetastore/v1beta/src/V1beta/resources/dataproc_metastore_descriptor_config.php b/owl-bot-staging/DataprocMetastore/v1beta/src/V1beta/resources/dataproc_metastore_descriptor_config.php new file mode 100644 index 000000000000..dda1e9b12646 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/src/V1beta/resources/dataproc_metastore_descriptor_config.php @@ -0,0 +1,181 @@ + [ + 'google.cloud.metastore.v1beta.DataprocMetastore' => [ + 'AlterMetadataResourceLocation' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Metastore\V1beta\AlterMetadataResourceLocationResponse', + 'metadataReturnType' => '\Google\Cloud\Metastore\V1beta\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'CreateBackup' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Metastore\V1beta\Backup', + 'metadataReturnType' => '\Google\Cloud\Metastore\V1beta\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'CreateMetadataImport' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Metastore\V1beta\MetadataImport', + 'metadataReturnType' => '\Google\Cloud\Metastore\V1beta\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'CreateService' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Metastore\V1beta\Service', + 'metadataReturnType' => '\Google\Cloud\Metastore\V1beta\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'DeleteBackup' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\Metastore\V1beta\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'DeleteService' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\Metastore\V1beta\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'ExportMetadata' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Metastore\V1beta\MetadataExport', + 'metadataReturnType' => '\Google\Cloud\Metastore\V1beta\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'MoveTableToDatabase' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Metastore\V1beta\MoveTableToDatabaseResponse', + 'metadataReturnType' => '\Google\Cloud\Metastore\V1beta\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'QueryMetadata' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Metastore\V1beta\QueryMetadataResponse', + 'metadataReturnType' => '\Google\Cloud\Metastore\V1beta\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'RestoreService' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Metastore\V1beta\Restore', + 'metadataReturnType' => '\Google\Cloud\Metastore\V1beta\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'UpdateMetadataImport' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Metastore\V1beta\MetadataImport', + 'metadataReturnType' => '\Google\Cloud\Metastore\V1beta\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'UpdateService' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Metastore\V1beta\Service', + 'metadataReturnType' => '\Google\Cloud\Metastore\V1beta\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'ListBackups' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getBackups', + ], + ], + 'ListMetadataImports' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getMetadataImports', + ], + ], + 'ListServices' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getServices', + ], + ], + 'GetLocation' => [ + 'interfaceOverride' => 'google.cloud.location.Locations', + ], + 'ListLocations' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getLocations', + ], + 'interfaceOverride' => 'google.cloud.location.Locations', + ], + 'GetIamPolicy' => [ + 'interfaceOverride' => 'google.iam.v1.IAMPolicy', + ], + 'SetIamPolicy' => [ + 'interfaceOverride' => 'google.iam.v1.IAMPolicy', + ], + 'TestIamPermissions' => [ + 'interfaceOverride' => 'google.iam.v1.IAMPolicy', + ], + ], + ], +]; diff --git a/owl-bot-staging/DataprocMetastore/v1beta/src/V1beta/resources/dataproc_metastore_federation_client_config.json b/owl-bot-staging/DataprocMetastore/v1beta/src/V1beta/resources/dataproc_metastore_federation_client_config.json new file mode 100644 index 000000000000..79bcf744ef44 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/src/V1beta/resources/dataproc_metastore_federation_client_config.json @@ -0,0 +1,72 @@ +{ + "interfaces": { + "google.cloud.metastore.v1beta.DataprocMetastoreFederation": { + "retry_codes": { + "no_retry_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 + } + }, + "methods": { + "CreateFederation": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "DeleteFederation": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "GetFederation": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "ListFederations": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "UpdateFederation": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "GetLocation": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "ListLocations": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "GetIamPolicy": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "SetIamPolicy": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "TestIamPermissions": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + } + } + } + } +} diff --git a/owl-bot-staging/DataprocMetastore/v1beta/src/V1beta/resources/dataproc_metastore_federation_descriptor_config.php b/owl-bot-staging/DataprocMetastore/v1beta/src/V1beta/resources/dataproc_metastore_federation_descriptor_config.php new file mode 100644 index 000000000000..97796f6e3c5e --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/src/V1beta/resources/dataproc_metastore_federation_descriptor_config.php @@ -0,0 +1,71 @@ + [ + 'google.cloud.metastore.v1beta.DataprocMetastoreFederation' => [ + 'CreateFederation' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Metastore\V1beta\Federation', + 'metadataReturnType' => '\Google\Cloud\Metastore\V1beta\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'DeleteFederation' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\Metastore\V1beta\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'UpdateFederation' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Metastore\V1beta\Federation', + 'metadataReturnType' => '\Google\Cloud\Metastore\V1beta\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'ListFederations' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getFederations', + ], + ], + 'GetLocation' => [ + 'interfaceOverride' => 'google.cloud.location.Locations', + ], + 'ListLocations' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getLocations', + ], + 'interfaceOverride' => 'google.cloud.location.Locations', + ], + 'GetIamPolicy' => [ + 'interfaceOverride' => 'google.iam.v1.IAMPolicy', + ], + 'SetIamPolicy' => [ + 'interfaceOverride' => 'google.iam.v1.IAMPolicy', + ], + 'TestIamPermissions' => [ + 'interfaceOverride' => 'google.iam.v1.IAMPolicy', + ], + ], + ], +]; diff --git a/owl-bot-staging/DataprocMetastore/v1beta/src/V1beta/resources/dataproc_metastore_federation_rest_client_config.php b/owl-bot-staging/DataprocMetastore/v1beta/src/V1beta/resources/dataproc_metastore_federation_rest_client_config.php new file mode 100644 index 000000000000..8a7cd63d635b --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/src/V1beta/resources/dataproc_metastore_federation_rest_client_config.php @@ -0,0 +1,243 @@ + [ + 'google.cloud.location.Locations' => [ + 'GetLocation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListLocations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*}/locations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + 'google.cloud.metastore.v1beta.DataprocMetastoreFederation' => [ + 'CreateFederation' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{parent=projects/*/locations/*}/federations', + 'body' => 'federation', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'federation_id', + ], + ], + 'DeleteFederation' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/federations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetFederation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/federations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListFederations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{parent=projects/*/locations/*}/federations', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'UpdateFederation' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1beta/{federation.name=projects/*/locations/*/federations/*}', + 'body' => 'federation', + 'placeholders' => [ + 'federation.name' => [ + 'getters' => [ + 'getFederation', + 'getName', + ], + ], + ], + 'queryParams' => [ + 'update_mask', + ], + ], + ], + 'google.iam.v1.IAMPolicy' => [ + 'GetIamPolicy' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{resource=projects/*/locations/*/services/*}:getIamPolicy', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{resource=projects/*/locations/*/services/*/backups/*}:getIamPolicy', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{resource=projects/*/locations/*/services/*/databases/*}:getIamPolicy', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{resource=projects/*/locations/*/services/*/databases/*/tables/*}:getIamPolicy', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{resource=projects/*/locations/*/federations/*}:getIamPolicy', + ], + ], + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + 'SetIamPolicy' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{resource=projects/*/locations/*/services/*}:setIamPolicy', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{resource=projects/*/locations/*/services/*/backups/*}:setIamPolicy', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{resource=projects/*/locations/*/services/*/databases/*}:setIamPolicy', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{resource=projects/*/locations/*/services/*/databases/*/tables/*}:setIamPolicy', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{resource=projects/*/locations/*/federations/*}:setIamPolicy', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + 'TestIamPermissions' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{resource=projects/*/locations/*/services/*}:testIamPermissions', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{resource=projects/*/locations/*/services/*/backups/*}:testIamPermissions', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{resource=projects/*/locations/*/services/*/databases/*}:testIamPermissions', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{resource=projects/*/locations/*/services/*/databases/*/tables/*}:testIamPermissions', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{resource=projects/*/locations/*/federations/*}:testIamPermissions', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + ], + 'google.longrunning.Operations' => [ + 'CancelOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/operations/*}:cancel', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteOperation' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetOperation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListOperations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*}/operations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/DataprocMetastore/v1beta/src/V1beta/resources/dataproc_metastore_rest_client_config.php b/owl-bot-staging/DataprocMetastore/v1beta/src/V1beta/resources/dataproc_metastore_rest_client_config.php new file mode 100644 index 000000000000..b199ccc74cfc --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/src/V1beta/resources/dataproc_metastore_rest_client_config.php @@ -0,0 +1,416 @@ + [ + 'google.cloud.location.Locations' => [ + 'GetLocation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListLocations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*}/locations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + 'google.cloud.metastore.v1beta.DataprocMetastore' => [ + 'AlterMetadataResourceLocation' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{service=projects/*/locations/*/services/*}:alterLocation', + 'body' => '*', + 'placeholders' => [ + 'service' => [ + 'getters' => [ + 'getService', + ], + ], + ], + ], + 'CreateBackup' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{parent=projects/*/locations/*/services/*}/backups', + 'body' => 'backup', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'backup_id', + ], + ], + 'CreateMetadataImport' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{parent=projects/*/locations/*/services/*}/metadataImports', + 'body' => 'metadata_import', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'metadata_import_id', + ], + ], + 'CreateService' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{parent=projects/*/locations/*}/services', + 'body' => 'service', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'service_id', + ], + ], + 'DeleteBackup' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/services/*/backups/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteService' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/services/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ExportMetadata' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{service=projects/*/locations/*/services/*}:exportMetadata', + 'body' => '*', + 'placeholders' => [ + 'service' => [ + 'getters' => [ + 'getService', + ], + ], + ], + ], + 'GetBackup' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/services/*/backups/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetMetadataImport' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/services/*/metadataImports/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetService' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/services/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListBackups' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{parent=projects/*/locations/*/services/*}/backups', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListMetadataImports' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{parent=projects/*/locations/*/services/*}/metadataImports', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListServices' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{parent=projects/*/locations/*}/services', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'MoveTableToDatabase' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{service=projects/*/locations/*/services/*}:moveTableToDatabase', + 'body' => '*', + 'placeholders' => [ + 'service' => [ + 'getters' => [ + 'getService', + ], + ], + ], + ], + 'QueryMetadata' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{service=projects/*/locations/*/services/*}:queryMetadata', + 'body' => '*', + 'placeholders' => [ + 'service' => [ + 'getters' => [ + 'getService', + ], + ], + ], + ], + 'RemoveIamPolicy' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{resource=projects/*/locations/*/services/*/**}:removeIamPolicy', + 'body' => '*', + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + 'RestoreService' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{service=projects/*/locations/*/services/*}:restore', + 'body' => '*', + 'placeholders' => [ + 'service' => [ + 'getters' => [ + 'getService', + ], + ], + ], + ], + 'UpdateMetadataImport' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1beta/{metadata_import.name=projects/*/locations/*/services/*/metadataImports/*}', + 'body' => 'metadata_import', + 'placeholders' => [ + 'metadata_import.name' => [ + 'getters' => [ + 'getMetadataImport', + 'getName', + ], + ], + ], + 'queryParams' => [ + 'update_mask', + ], + ], + 'UpdateService' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1beta/{service.name=projects/*/locations/*/services/*}', + 'body' => 'service', + 'placeholders' => [ + 'service.name' => [ + 'getters' => [ + 'getService', + 'getName', + ], + ], + ], + 'queryParams' => [ + 'update_mask', + ], + ], + ], + 'google.iam.v1.IAMPolicy' => [ + 'GetIamPolicy' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{resource=projects/*/locations/*/services/*}:getIamPolicy', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{resource=projects/*/locations/*/services/*/backups/*}:getIamPolicy', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{resource=projects/*/locations/*/services/*/databases/*}:getIamPolicy', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{resource=projects/*/locations/*/services/*/databases/*/tables/*}:getIamPolicy', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{resource=projects/*/locations/*/federations/*}:getIamPolicy', + ], + ], + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + 'SetIamPolicy' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{resource=projects/*/locations/*/services/*}:setIamPolicy', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{resource=projects/*/locations/*/services/*/backups/*}:setIamPolicy', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{resource=projects/*/locations/*/services/*/databases/*}:setIamPolicy', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{resource=projects/*/locations/*/services/*/databases/*/tables/*}:setIamPolicy', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{resource=projects/*/locations/*/federations/*}:setIamPolicy', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + 'TestIamPermissions' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{resource=projects/*/locations/*/services/*}:testIamPermissions', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{resource=projects/*/locations/*/services/*/backups/*}:testIamPermissions', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{resource=projects/*/locations/*/services/*/databases/*}:testIamPermissions', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{resource=projects/*/locations/*/services/*/databases/*/tables/*}:testIamPermissions', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{resource=projects/*/locations/*/federations/*}:testIamPermissions', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + ], + 'google.longrunning.Operations' => [ + 'CancelOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/operations/*}:cancel', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteOperation' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetOperation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListOperations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*}/operations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/DataprocMetastore/v1beta/tests/Unit/V1beta/DataprocMetastoreClientTest.php b/owl-bot-staging/DataprocMetastore/v1beta/tests/Unit/V1beta/DataprocMetastoreClientTest.php new file mode 100644 index 000000000000..adcb52fb1c30 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/tests/Unit/V1beta/DataprocMetastoreClientTest.php @@ -0,0 +1,2364 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return DataprocMetastoreClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new DataprocMetastoreClient($options); + } + + /** @test */ + public function alterMetadataResourceLocationTest() + { + $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/alterMetadataResourceLocationTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new AlterMetadataResourceLocationResponse(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/alterMetadataResourceLocationTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedService = $gapicClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $resourceName = 'resourceName979421212'; + $locationUri = 'locationUri-57953822'; + $response = $gapicClient->alterMetadataResourceLocation($formattedService, $resourceName, $locationUri); + $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.cloud.metastore.v1beta.DataprocMetastore/AlterMetadataResourceLocation', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getService(); + $this->assertProtobufEquals($formattedService, $actualValue); + $actualValue = $actualApiRequestObject->getResourceName(); + $this->assertProtobufEquals($resourceName, $actualValue); + $actualValue = $actualApiRequestObject->getLocationUri(); + $this->assertProtobufEquals($locationUri, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/alterMetadataResourceLocationTest'); + $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 alterMetadataResourceLocationExceptionTest() + { + $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/alterMetadataResourceLocationTest'); + $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 + $formattedService = $gapicClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $resourceName = 'resourceName979421212'; + $locationUri = 'locationUri-57953822'; + $response = $gapicClient->alterMetadataResourceLocation($formattedService, $resourceName, $locationUri); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/alterMetadataResourceLocationTest'); + 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 createBackupTest() + { + $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/createBackupTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $expectedResponse = new Backup(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createBackupTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $backupId = 'backupId1355353272'; + $backup = new Backup(); + $response = $gapicClient->createBackup($formattedParent, $backupId, $backup); + $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.cloud.metastore.v1beta.DataprocMetastore/CreateBackup', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getBackupId(); + $this->assertProtobufEquals($backupId, $actualValue); + $actualValue = $actualApiRequestObject->getBackup(); + $this->assertProtobufEquals($backup, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createBackupTest'); + $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 createBackupExceptionTest() + { + $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/createBackupTest'); + $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 + $formattedParent = $gapicClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $backupId = 'backupId1355353272'; + $backup = new Backup(); + $response = $gapicClient->createBackup($formattedParent, $backupId, $backup); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createBackupTest'); + 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 createMetadataImportTest() + { + $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/createMetadataImportTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $expectedResponse = new MetadataImport(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createMetadataImportTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $metadataImportId = 'metadataImportId-476076315'; + $metadataImport = new MetadataImport(); + $response = $gapicClient->createMetadataImport($formattedParent, $metadataImportId, $metadataImport); + $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.cloud.metastore.v1beta.DataprocMetastore/CreateMetadataImport', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getMetadataImportId(); + $this->assertProtobufEquals($metadataImportId, $actualValue); + $actualValue = $actualApiRequestObject->getMetadataImport(); + $this->assertProtobufEquals($metadataImport, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createMetadataImportTest'); + $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 createMetadataImportExceptionTest() + { + $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/createMetadataImportTest'); + $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 + $formattedParent = $gapicClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $metadataImportId = 'metadataImportId-476076315'; + $metadataImport = new MetadataImport(); + $response = $gapicClient->createMetadataImport($formattedParent, $metadataImportId, $metadataImport); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createMetadataImportTest'); + 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 createServiceTest() + { + $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/createServiceTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $network = 'network1843485230'; + $endpointUri = 'endpointUri-850313278'; + $port = 3446913; + $stateMessage = 'stateMessage29641305'; + $artifactGcsUri = 'artifactGcsUri1337121495'; + $uid = 'uid115792'; + $expectedResponse = new Service(); + $expectedResponse->setName($name); + $expectedResponse->setNetwork($network); + $expectedResponse->setEndpointUri($endpointUri); + $expectedResponse->setPort($port); + $expectedResponse->setStateMessage($stateMessage); + $expectedResponse->setArtifactGcsUri($artifactGcsUri); + $expectedResponse->setUid($uid); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createServiceTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $serviceId = 'serviceId-1724763419'; + $service = new Service(); + $response = $gapicClient->createService($formattedParent, $serviceId, $service); + $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.cloud.metastore.v1beta.DataprocMetastore/CreateService', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getServiceId(); + $this->assertProtobufEquals($serviceId, $actualValue); + $actualValue = $actualApiRequestObject->getService(); + $this->assertProtobufEquals($service, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createServiceTest'); + $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 createServiceExceptionTest() + { + $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/createServiceTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $serviceId = 'serviceId-1724763419'; + $service = new Service(); + $response = $gapicClient->createService($formattedParent, $serviceId, $service); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createServiceTest'); + 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 deleteBackupTest() + { + $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/deleteBackupTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteBackupTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->backupName('[PROJECT]', '[LOCATION]', '[SERVICE]', '[BACKUP]'); + $response = $gapicClient->deleteBackup($formattedName); + $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.cloud.metastore.v1beta.DataprocMetastore/DeleteBackup', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteBackupTest'); + $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 deleteBackupExceptionTest() + { + $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/deleteBackupTest'); + $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->backupName('[PROJECT]', '[LOCATION]', '[SERVICE]', '[BACKUP]'); + $response = $gapicClient->deleteBackup($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteBackupTest'); + 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 deleteServiceTest() + { + $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/deleteServiceTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteServiceTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $response = $gapicClient->deleteService($formattedName); + $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.cloud.metastore.v1beta.DataprocMetastore/DeleteService', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteServiceTest'); + $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 deleteServiceExceptionTest() + { + $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/deleteServiceTest'); + $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->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $response = $gapicClient->deleteService($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteServiceTest'); + 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 exportMetadataTest() + { + $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/exportMetadataTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $destinationGcsUri = 'destinationGcsUri1386421523'; + $expectedResponse = new MetadataExport(); + $expectedResponse->setDestinationGcsUri($destinationGcsUri); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/exportMetadataTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedService = $gapicClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $response = $gapicClient->exportMetadata($formattedService); + $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.cloud.metastore.v1beta.DataprocMetastore/ExportMetadata', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getService(); + $this->assertProtobufEquals($formattedService, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/exportMetadataTest'); + $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 exportMetadataExceptionTest() + { + $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/exportMetadataTest'); + $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 + $formattedService = $gapicClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $response = $gapicClient->exportMetadata($formattedService); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/exportMetadataTest'); + 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 getBackupTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $description = 'description-1724546052'; + $expectedResponse = new Backup(); + $expectedResponse->setName($name2); + $expectedResponse->setDescription($description); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->backupName('[PROJECT]', '[LOCATION]', '[SERVICE]', '[BACKUP]'); + $response = $gapicClient->getBackup($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.metastore.v1beta.DataprocMetastore/GetBackup', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getBackupExceptionTest() + { + $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->backupName('[PROJECT]', '[LOCATION]', '[SERVICE]', '[BACKUP]'); + try { + $gapicClient->getBackup($formattedName); + // 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 getMetadataImportTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $description = 'description-1724546052'; + $expectedResponse = new MetadataImport(); + $expectedResponse->setName($name2); + $expectedResponse->setDescription($description); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->metadataImportName('[PROJECT]', '[LOCATION]', '[SERVICE]', '[METADATA_IMPORT]'); + $response = $gapicClient->getMetadataImport($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.metastore.v1beta.DataprocMetastore/GetMetadataImport', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getMetadataImportExceptionTest() + { + $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->metadataImportName('[PROJECT]', '[LOCATION]', '[SERVICE]', '[METADATA_IMPORT]'); + try { + $gapicClient->getMetadataImport($formattedName); + // 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 getServiceTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $network = 'network1843485230'; + $endpointUri = 'endpointUri-850313278'; + $port = 3446913; + $stateMessage = 'stateMessage29641305'; + $artifactGcsUri = 'artifactGcsUri1337121495'; + $uid = 'uid115792'; + $expectedResponse = new Service(); + $expectedResponse->setName($name2); + $expectedResponse->setNetwork($network); + $expectedResponse->setEndpointUri($endpointUri); + $expectedResponse->setPort($port); + $expectedResponse->setStateMessage($stateMessage); + $expectedResponse->setArtifactGcsUri($artifactGcsUri); + $expectedResponse->setUid($uid); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $response = $gapicClient->getService($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.metastore.v1beta.DataprocMetastore/GetService', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getServiceExceptionTest() + { + $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->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + try { + $gapicClient->getService($formattedName); + // 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 listBackupsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $backupsElement = new Backup(); + $backups = [ + $backupsElement, + ]; + $expectedResponse = new ListBackupsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setBackups($backups); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $response = $gapicClient->listBackups($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getBackups()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.metastore.v1beta.DataprocMetastore/ListBackups', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listBackupsExceptionTest() + { + $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->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + try { + $gapicClient->listBackups($formattedParent); + // 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 listMetadataImportsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $metadataImportsElement = new MetadataImport(); + $metadataImports = [ + $metadataImportsElement, + ]; + $expectedResponse = new ListMetadataImportsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setMetadataImports($metadataImports); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $response = $gapicClient->listMetadataImports($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getMetadataImports()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.metastore.v1beta.DataprocMetastore/ListMetadataImports', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listMetadataImportsExceptionTest() + { + $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->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + try { + $gapicClient->listMetadataImports($formattedParent); + // 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 listServicesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $servicesElement = new Service(); + $services = [ + $servicesElement, + ]; + $expectedResponse = new ListServicesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setServices($services); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->listServices($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getServices()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.metastore.v1beta.DataprocMetastore/ListServices', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listServicesExceptionTest() + { + $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->locationName('[PROJECT]', '[LOCATION]'); + try { + $gapicClient->listServices($formattedParent); + // 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 moveTableToDatabaseTest() + { + $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/moveTableToDatabaseTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new MoveTableToDatabaseResponse(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/moveTableToDatabaseTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedService = $gapicClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $tableName = 'tableName-1504630692'; + $dbName = 'dbName1452819884'; + $destinationDbName = 'destinationDbName-1322761605'; + $response = $gapicClient->moveTableToDatabase($formattedService, $tableName, $dbName, $destinationDbName); + $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.cloud.metastore.v1beta.DataprocMetastore/MoveTableToDatabase', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getService(); + $this->assertProtobufEquals($formattedService, $actualValue); + $actualValue = $actualApiRequestObject->getTableName(); + $this->assertProtobufEquals($tableName, $actualValue); + $actualValue = $actualApiRequestObject->getDbName(); + $this->assertProtobufEquals($dbName, $actualValue); + $actualValue = $actualApiRequestObject->getDestinationDbName(); + $this->assertProtobufEquals($destinationDbName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/moveTableToDatabaseTest'); + $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 moveTableToDatabaseExceptionTest() + { + $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/moveTableToDatabaseTest'); + $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 + $formattedService = $gapicClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $tableName = 'tableName-1504630692'; + $dbName = 'dbName1452819884'; + $destinationDbName = 'destinationDbName-1322761605'; + $response = $gapicClient->moveTableToDatabase($formattedService, $tableName, $dbName, $destinationDbName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/moveTableToDatabaseTest'); + 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 queryMetadataTest() + { + $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/queryMetadataTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $resultManifestUri = 'resultManifestUri-1050940354'; + $expectedResponse = new QueryMetadataResponse(); + $expectedResponse->setResultManifestUri($resultManifestUri); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/queryMetadataTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedService = $gapicClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $query = 'query107944136'; + $response = $gapicClient->queryMetadata($formattedService, $query); + $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.cloud.metastore.v1beta.DataprocMetastore/QueryMetadata', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getService(); + $this->assertProtobufEquals($formattedService, $actualValue); + $actualValue = $actualApiRequestObject->getQuery(); + $this->assertProtobufEquals($query, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/queryMetadataTest'); + $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 queryMetadataExceptionTest() + { + $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/queryMetadataTest'); + $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 + $formattedService = $gapicClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $query = 'query107944136'; + $response = $gapicClient->queryMetadata($formattedService, $query); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/queryMetadataTest'); + 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 removeIamPolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $success = false; + $expectedResponse = new RemoveIamPolicyResponse(); + $expectedResponse->setSuccess($success); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $response = $gapicClient->removeIamPolicy($resource); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.metastore.v1beta.DataprocMetastore/RemoveIamPolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function removeIamPolicyExceptionTest() + { + $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 + $resource = 'resource-341064690'; + try { + $gapicClient->removeIamPolicy($resource); + // 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 restoreServiceTest() + { + $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/restoreServiceTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $backup2 = 'backup22121930997'; + $details = 'details1557721666'; + $expectedResponse = new Restore(); + $expectedResponse->setBackup($backup2); + $expectedResponse->setDetails($details); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/restoreServiceTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedService = $gapicClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $formattedBackup = $gapicClient->backupName('[PROJECT]', '[LOCATION]', '[SERVICE]', '[BACKUP]'); + $response = $gapicClient->restoreService($formattedService, $formattedBackup); + $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.cloud.metastore.v1beta.DataprocMetastore/RestoreService', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getService(); + $this->assertProtobufEquals($formattedService, $actualValue); + $actualValue = $actualApiRequestObject->getBackup(); + $this->assertProtobufEquals($formattedBackup, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/restoreServiceTest'); + $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 restoreServiceExceptionTest() + { + $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/restoreServiceTest'); + $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 + $formattedService = $gapicClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); + $formattedBackup = $gapicClient->backupName('[PROJECT]', '[LOCATION]', '[SERVICE]', '[BACKUP]'); + $response = $gapicClient->restoreService($formattedService, $formattedBackup); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/restoreServiceTest'); + 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 updateMetadataImportTest() + { + $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/updateMetadataImportTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $expectedResponse = new MetadataImport(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateMetadataImportTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $updateMask = new FieldMask(); + $metadataImport = new MetadataImport(); + $response = $gapicClient->updateMetadataImport($updateMask, $metadataImport); + $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.cloud.metastore.v1beta.DataprocMetastore/UpdateMetadataImport', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $actualValue = $actualApiRequestObject->getMetadataImport(); + $this->assertProtobufEquals($metadataImport, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateMetadataImportTest'); + $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 updateMetadataImportExceptionTest() + { + $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/updateMetadataImportTest'); + $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 + $updateMask = new FieldMask(); + $metadataImport = new MetadataImport(); + $response = $gapicClient->updateMetadataImport($updateMask, $metadataImport); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateMetadataImportTest'); + 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 updateServiceTest() + { + $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/updateServiceTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $network = 'network1843485230'; + $endpointUri = 'endpointUri-850313278'; + $port = 3446913; + $stateMessage = 'stateMessage29641305'; + $artifactGcsUri = 'artifactGcsUri1337121495'; + $uid = 'uid115792'; + $expectedResponse = new Service(); + $expectedResponse->setName($name); + $expectedResponse->setNetwork($network); + $expectedResponse->setEndpointUri($endpointUri); + $expectedResponse->setPort($port); + $expectedResponse->setStateMessage($stateMessage); + $expectedResponse->setArtifactGcsUri($artifactGcsUri); + $expectedResponse->setUid($uid); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateServiceTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $updateMask = new FieldMask(); + $service = new Service(); + $response = $gapicClient->updateService($updateMask, $service); + $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.cloud.metastore.v1beta.DataprocMetastore/UpdateService', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $actualValue = $actualApiRequestObject->getService(); + $this->assertProtobufEquals($service, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateServiceTest'); + $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 updateServiceExceptionTest() + { + $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/updateServiceTest'); + $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 + $updateMask = new FieldMask(); + $service = new Service(); + $response = $gapicClient->updateService($updateMask, $service); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateServiceTest'); + 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 getLocationTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $locationId = 'locationId552319461'; + $displayName = 'displayName1615086568'; + $expectedResponse = new Location(); + $expectedResponse->setName($name2); + $expectedResponse->setLocationId($locationId); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + $response = $gapicClient->getLocation(); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/GetLocation', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getLocationExceptionTest() + { + $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); + try { + $gapicClient->getLocation(); + // 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 listLocationsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $locationsElement = new Location(); + $locations = [ + $locationsElement, + ]; + $expectedResponse = new ListLocationsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setLocations($locations); + $transport->addResponse($expectedResponse); + $response = $gapicClient->listLocations(); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getLocations()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/ListLocations', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listLocationsExceptionTest() + { + $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); + try { + $gapicClient->listLocations(); + // 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 getIamPolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $version = 351608024; + $etag = '21'; + $expectedResponse = new Policy(); + $expectedResponse->setVersion($version); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $response = $gapicClient->getIamPolicy($resource); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.iam.v1.IAMPolicy/GetIamPolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getIamPolicyExceptionTest() + { + $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 + $resource = 'resource-341064690'; + try { + $gapicClient->getIamPolicy($resource); + // 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 setIamPolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $version = 351608024; + $etag = '21'; + $expectedResponse = new Policy(); + $expectedResponse->setVersion($version); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $policy = new Policy(); + $response = $gapicClient->setIamPolicy($resource, $policy); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.iam.v1.IAMPolicy/SetIamPolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $actualValue = $actualRequestObject->getPolicy(); + $this->assertProtobufEquals($policy, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function setIamPolicyExceptionTest() + { + $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 + $resource = 'resource-341064690'; + $policy = new Policy(); + try { + $gapicClient->setIamPolicy($resource, $policy); + // 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 testIamPermissionsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new TestIamPermissionsResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $permissions = []; + $response = $gapicClient->testIamPermissions($resource, $permissions); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.iam.v1.IAMPolicy/TestIamPermissions', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $actualValue = $actualRequestObject->getPermissions(); + $this->assertProtobufEquals($permissions, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function testIamPermissionsExceptionTest() + { + $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 + $resource = 'resource-341064690'; + $permissions = []; + try { + $gapicClient->testIamPermissions($resource, $permissions); + // 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()); + } +} diff --git a/owl-bot-staging/DataprocMetastore/v1beta/tests/Unit/V1beta/DataprocMetastoreFederationClientTest.php b/owl-bot-staging/DataprocMetastore/v1beta/tests/Unit/V1beta/DataprocMetastoreFederationClientTest.php new file mode 100644 index 000000000000..3554dd56c728 --- /dev/null +++ b/owl-bot-staging/DataprocMetastore/v1beta/tests/Unit/V1beta/DataprocMetastoreFederationClientTest.php @@ -0,0 +1,901 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return DataprocMetastoreFederationClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new DataprocMetastoreFederationClient($options); + } + + /** @test */ + public function createFederationTest() + { + $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/createFederationTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $version = 'version351608024'; + $endpointUri = 'endpointUri-850313278'; + $stateMessage = 'stateMessage29641305'; + $uid = 'uid115792'; + $expectedResponse = new Federation(); + $expectedResponse->setName($name); + $expectedResponse->setVersion($version); + $expectedResponse->setEndpointUri($endpointUri); + $expectedResponse->setStateMessage($stateMessage); + $expectedResponse->setUid($uid); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createFederationTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $federationId = 'federationId-1338699881'; + $federation = new Federation(); + $response = $gapicClient->createFederation($formattedParent, $federationId, $federation); + $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.cloud.metastore.v1beta.DataprocMetastoreFederation/CreateFederation', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getFederationId(); + $this->assertProtobufEquals($federationId, $actualValue); + $actualValue = $actualApiRequestObject->getFederation(); + $this->assertProtobufEquals($federation, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createFederationTest'); + $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 createFederationExceptionTest() + { + $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/createFederationTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $federationId = 'federationId-1338699881'; + $federation = new Federation(); + $response = $gapicClient->createFederation($formattedParent, $federationId, $federation); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createFederationTest'); + 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 deleteFederationTest() + { + $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/deleteFederationTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteFederationTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->federationName('[PROJECT]', '[LOCATION]', '[FEDERATION]'); + $response = $gapicClient->deleteFederation($formattedName); + $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.cloud.metastore.v1beta.DataprocMetastoreFederation/DeleteFederation', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteFederationTest'); + $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 deleteFederationExceptionTest() + { + $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/deleteFederationTest'); + $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->federationName('[PROJECT]', '[LOCATION]', '[FEDERATION]'); + $response = $gapicClient->deleteFederation($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteFederationTest'); + 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 getFederationTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $version = 'version351608024'; + $endpointUri = 'endpointUri-850313278'; + $stateMessage = 'stateMessage29641305'; + $uid = 'uid115792'; + $expectedResponse = new Federation(); + $expectedResponse->setName($name2); + $expectedResponse->setVersion($version); + $expectedResponse->setEndpointUri($endpointUri); + $expectedResponse->setStateMessage($stateMessage); + $expectedResponse->setUid($uid); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->federationName('[PROJECT]', '[LOCATION]', '[FEDERATION]'); + $response = $gapicClient->getFederation($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.metastore.v1beta.DataprocMetastoreFederation/GetFederation', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getFederationExceptionTest() + { + $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->federationName('[PROJECT]', '[LOCATION]', '[FEDERATION]'); + try { + $gapicClient->getFederation($formattedName); + // 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 listFederationsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $federationsElement = new Federation(); + $federations = [ + $federationsElement, + ]; + $expectedResponse = new ListFederationsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setFederations($federations); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->listFederations($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getFederations()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.metastore.v1beta.DataprocMetastoreFederation/ListFederations', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listFederationsExceptionTest() + { + $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->locationName('[PROJECT]', '[LOCATION]'); + try { + $gapicClient->listFederations($formattedParent); + // 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 updateFederationTest() + { + $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/updateFederationTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $version = 'version351608024'; + $endpointUri = 'endpointUri-850313278'; + $stateMessage = 'stateMessage29641305'; + $uid = 'uid115792'; + $expectedResponse = new Federation(); + $expectedResponse->setName($name); + $expectedResponse->setVersion($version); + $expectedResponse->setEndpointUri($endpointUri); + $expectedResponse->setStateMessage($stateMessage); + $expectedResponse->setUid($uid); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateFederationTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $updateMask = new FieldMask(); + $federation = new Federation(); + $response = $gapicClient->updateFederation($updateMask, $federation); + $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.cloud.metastore.v1beta.DataprocMetastoreFederation/UpdateFederation', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $actualValue = $actualApiRequestObject->getFederation(); + $this->assertProtobufEquals($federation, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateFederationTest'); + $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 updateFederationExceptionTest() + { + $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/updateFederationTest'); + $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 + $updateMask = new FieldMask(); + $federation = new Federation(); + $response = $gapicClient->updateFederation($updateMask, $federation); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateFederationTest'); + 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 getLocationTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $locationId = 'locationId552319461'; + $displayName = 'displayName1615086568'; + $expectedResponse = new Location(); + $expectedResponse->setName($name2); + $expectedResponse->setLocationId($locationId); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + $response = $gapicClient->getLocation(); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/GetLocation', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getLocationExceptionTest() + { + $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); + try { + $gapicClient->getLocation(); + // 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 listLocationsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $locationsElement = new Location(); + $locations = [ + $locationsElement, + ]; + $expectedResponse = new ListLocationsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setLocations($locations); + $transport->addResponse($expectedResponse); + $response = $gapicClient->listLocations(); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getLocations()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/ListLocations', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listLocationsExceptionTest() + { + $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); + try { + $gapicClient->listLocations(); + // 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 getIamPolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $version = 351608024; + $etag = '21'; + $expectedResponse = new Policy(); + $expectedResponse->setVersion($version); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $response = $gapicClient->getIamPolicy($resource); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.iam.v1.IAMPolicy/GetIamPolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getIamPolicyExceptionTest() + { + $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 + $resource = 'resource-341064690'; + try { + $gapicClient->getIamPolicy($resource); + // 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 setIamPolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $version = 351608024; + $etag = '21'; + $expectedResponse = new Policy(); + $expectedResponse->setVersion($version); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $policy = new Policy(); + $response = $gapicClient->setIamPolicy($resource, $policy); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.iam.v1.IAMPolicy/SetIamPolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $actualValue = $actualRequestObject->getPolicy(); + $this->assertProtobufEquals($policy, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function setIamPolicyExceptionTest() + { + $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 + $resource = 'resource-341064690'; + $policy = new Policy(); + try { + $gapicClient->setIamPolicy($resource, $policy); + // 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 testIamPermissionsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new TestIamPermissionsResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $permissions = []; + $response = $gapicClient->testIamPermissions($resource, $permissions); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.iam.v1.IAMPolicy/TestIamPermissions', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $actualValue = $actualRequestObject->getPermissions(); + $this->assertProtobufEquals($permissions, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function testIamPermissionsExceptionTest() + { + $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 + $resource = 'resource-341064690'; + $permissions = []; + try { + $gapicClient->testIamPermissions($resource, $permissions); + // 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()); + } +} diff --git a/owl-bot-staging/DatastoreAdmin/v1/proto/src/GPBMetadata/Google/Datastore/Admin/V1/DatastoreAdmin.php b/owl-bot-staging/DatastoreAdmin/v1/proto/src/GPBMetadata/Google/Datastore/Admin/V1/DatastoreAdmin.php new file mode 100644 index 000000000000..b83cde9487af Binary files /dev/null and b/owl-bot-staging/DatastoreAdmin/v1/proto/src/GPBMetadata/Google/Datastore/Admin/V1/DatastoreAdmin.php differ diff --git a/owl-bot-staging/DatastoreAdmin/v1/proto/src/GPBMetadata/Google/Datastore/Admin/V1/Index.php b/owl-bot-staging/DatastoreAdmin/v1/proto/src/GPBMetadata/Google/Datastore/Admin/V1/Index.php new file mode 100644 index 000000000000..b0ddf381e8df Binary files /dev/null and b/owl-bot-staging/DatastoreAdmin/v1/proto/src/GPBMetadata/Google/Datastore/Admin/V1/Index.php differ diff --git a/owl-bot-staging/DatastoreAdmin/v1/proto/src/GPBMetadata/Google/Datastore/Admin/V1/Migration.php b/owl-bot-staging/DatastoreAdmin/v1/proto/src/GPBMetadata/Google/Datastore/Admin/V1/Migration.php new file mode 100644 index 000000000000..53596831cf26 Binary files /dev/null and b/owl-bot-staging/DatastoreAdmin/v1/proto/src/GPBMetadata/Google/Datastore/Admin/V1/Migration.php differ diff --git a/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/CommonMetadata.php b/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/CommonMetadata.php new file mode 100644 index 000000000000..dcfe0430c233 --- /dev/null +++ b/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/CommonMetadata.php @@ -0,0 +1,231 @@ +google.datastore.admin.v1.CommonMetadata + */ +class CommonMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * The time that work began on the operation. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 1; + */ + protected $start_time = null; + /** + * The time the operation ended, either successfully or otherwise. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2; + */ + protected $end_time = null; + /** + * The type of the operation. Can be used as a filter in + * ListOperationsRequest. + * + * Generated from protobuf field .google.datastore.admin.v1.OperationType operation_type = 3; + */ + protected $operation_type = 0; + /** + * The client-assigned labels which were provided when the operation was + * created. May also include additional labels. + * + * Generated from protobuf field map labels = 4; + */ + private $labels; + /** + * The current state of the Operation. + * + * Generated from protobuf field .google.datastore.admin.v1.CommonMetadata.State state = 5; + */ + protected $state = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Timestamp $start_time + * The time that work began on the operation. + * @type \Google\Protobuf\Timestamp $end_time + * The time the operation ended, either successfully or otherwise. + * @type int $operation_type + * The type of the operation. Can be used as a filter in + * ListOperationsRequest. + * @type array|\Google\Protobuf\Internal\MapField $labels + * The client-assigned labels which were provided when the operation was + * created. May also include additional labels. + * @type int $state + * The current state of the Operation. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Datastore\Admin\V1\DatastoreAdmin::initOnce(); + parent::__construct($data); + } + + /** + * The time that work began on the operation. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 1; + * @return \Google\Protobuf\Timestamp|null + */ + public function getStartTime() + { + return $this->start_time; + } + + public function hasStartTime() + { + return isset($this->start_time); + } + + public function clearStartTime() + { + unset($this->start_time); + } + + /** + * The time that work began on the operation. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 1; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setStartTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->start_time = $var; + + return $this; + } + + /** + * The time the operation ended, either successfully or otherwise. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2; + * @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); + } + + /** + * The time the operation ended, either successfully or otherwise. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setEndTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->end_time = $var; + + return $this; + } + + /** + * The type of the operation. Can be used as a filter in + * ListOperationsRequest. + * + * Generated from protobuf field .google.datastore.admin.v1.OperationType operation_type = 3; + * @return int + */ + public function getOperationType() + { + return $this->operation_type; + } + + /** + * The type of the operation. Can be used as a filter in + * ListOperationsRequest. + * + * Generated from protobuf field .google.datastore.admin.v1.OperationType operation_type = 3; + * @param int $var + * @return $this + */ + public function setOperationType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Datastore\Admin\V1\OperationType::class); + $this->operation_type = $var; + + return $this; + } + + /** + * The client-assigned labels which were provided when the operation was + * created. May also include additional labels. + * + * Generated from protobuf field map labels = 4; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * The client-assigned labels which were provided when the operation was + * created. May also include additional labels. + * + * Generated from protobuf field map labels = 4; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + + /** + * The current state of the Operation. + * + * Generated from protobuf field .google.datastore.admin.v1.CommonMetadata.State state = 5; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * The current state of the Operation. + * + * Generated from protobuf field .google.datastore.admin.v1.CommonMetadata.State state = 5; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Datastore\Admin\V1\CommonMetadata\State::class); + $this->state = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/CommonMetadata/State.php b/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/CommonMetadata/State.php new file mode 100644 index 000000000000..d4285dea144b --- /dev/null +++ b/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/CommonMetadata/State.php @@ -0,0 +1,101 @@ +google.datastore.admin.v1.CommonMetadata.State + */ +class State +{ + /** + * Unspecified. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * Request is being prepared for processing. + * + * Generated from protobuf enum INITIALIZING = 1; + */ + const INITIALIZING = 1; + /** + * Request is actively being processed. + * + * Generated from protobuf enum PROCESSING = 2; + */ + const PROCESSING = 2; + /** + * Request is in the process of being cancelled after user called + * google.longrunning.Operations.CancelOperation on the operation. + * + * Generated from protobuf enum CANCELLING = 3; + */ + const CANCELLING = 3; + /** + * Request has been processed and is in its finalization stage. + * + * Generated from protobuf enum FINALIZING = 4; + */ + const FINALIZING = 4; + /** + * Request has completed successfully. + * + * Generated from protobuf enum SUCCESSFUL = 5; + */ + const SUCCESSFUL = 5; + /** + * Request has finished being processed, but encountered an error. + * + * Generated from protobuf enum FAILED = 6; + */ + const FAILED = 6; + /** + * Request has finished being cancelled after user called + * google.longrunning.Operations.CancelOperation. + * + * Generated from protobuf enum CANCELLED = 7; + */ + const CANCELLED = 7; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::INITIALIZING => 'INITIALIZING', + self::PROCESSING => 'PROCESSING', + self::CANCELLING => 'CANCELLING', + self::FINALIZING => 'FINALIZING', + self::SUCCESSFUL => 'SUCCESSFUL', + self::FAILED => 'FAILED', + self::CANCELLED => 'CANCELLED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\Datastore\Admin\V1\CommonMetadata_State::class); + diff --git a/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/CommonMetadata_State.php b/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/CommonMetadata_State.php new file mode 100644 index 000000000000..a45f91e926fb --- /dev/null +++ b/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/CommonMetadata_State.php @@ -0,0 +1,16 @@ +google.datastore.admin.v1.CreateIndexRequest + */ +class CreateIndexRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Project ID against which to make the request. + * + * Generated from protobuf field string project_id = 1; + */ + protected $project_id = ''; + /** + * The index to create. The name and state fields are output only and will be + * ignored. Single property indexes cannot be created or deleted. + * + * Generated from protobuf field .google.datastore.admin.v1.Index index = 3; + */ + protected $index = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $project_id + * Project ID against which to make the request. + * @type \Google\Cloud\Datastore\Admin\V1\Index $index + * The index to create. The name and state fields are output only and will be + * ignored. Single property indexes cannot be created or deleted. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Datastore\Admin\V1\DatastoreAdmin::initOnce(); + parent::__construct($data); + } + + /** + * Project ID against which to make the request. + * + * Generated from protobuf field string project_id = 1; + * @return string + */ + public function getProjectId() + { + return $this->project_id; + } + + /** + * Project ID against which to make the request. + * + * Generated from protobuf field string project_id = 1; + * @param string $var + * @return $this + */ + public function setProjectId($var) + { + GPBUtil::checkString($var, True); + $this->project_id = $var; + + return $this; + } + + /** + * The index to create. The name and state fields are output only and will be + * ignored. Single property indexes cannot be created or deleted. + * + * Generated from protobuf field .google.datastore.admin.v1.Index index = 3; + * @return \Google\Cloud\Datastore\Admin\V1\Index|null + */ + public function getIndex() + { + return $this->index; + } + + public function hasIndex() + { + return isset($this->index); + } + + public function clearIndex() + { + unset($this->index); + } + + /** + * The index to create. The name and state fields are output only and will be + * ignored. Single property indexes cannot be created or deleted. + * + * Generated from protobuf field .google.datastore.admin.v1.Index index = 3; + * @param \Google\Cloud\Datastore\Admin\V1\Index $var + * @return $this + */ + public function setIndex($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Datastore\Admin\V1\Index::class); + $this->index = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/DatastoreAdminGrpcClient.php b/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/DatastoreAdminGrpcClient.php new file mode 100644 index 000000000000..caa6f90837da --- /dev/null +++ b/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/DatastoreAdminGrpcClient.php @@ -0,0 +1,220 @@ +_simpleRequest('/google.datastore.admin.v1.DatastoreAdmin/ExportEntities', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Imports entities into Google Cloud Datastore. Existing entities with the + * same key are overwritten. The import occurs in the background and its + * progress can be monitored and managed via the Operation resource that is + * created. If an ImportEntities operation is cancelled, it is possible + * that a subset of the data has already been imported to Cloud Datastore. + * @param \Google\Cloud\Datastore\Admin\V1\ImportEntitiesRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function ImportEntities(\Google\Cloud\Datastore\Admin\V1\ImportEntitiesRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.datastore.admin.v1.DatastoreAdmin/ImportEntities', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Creates the specified index. + * A newly created index's initial state is `CREATING`. On completion of the + * returned [google.longrunning.Operation][google.longrunning.Operation], the state will be `READY`. + * If the index already exists, the call will return an `ALREADY_EXISTS` + * status. + * + * During index creation, the process could result in an error, in which + * case the index will move to the `ERROR` state. The process can be recovered + * by fixing the data that caused the error, removing the index with + * [delete][google.datastore.admin.v1.DatastoreAdmin.DeleteIndex], then + * re-creating the index with [create] + * [google.datastore.admin.v1.DatastoreAdmin.CreateIndex]. + * + * Indexes with a single property cannot be created. + * @param \Google\Cloud\Datastore\Admin\V1\CreateIndexRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function CreateIndex(\Google\Cloud\Datastore\Admin\V1\CreateIndexRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.datastore.admin.v1.DatastoreAdmin/CreateIndex', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Deletes an existing index. + * An index can only be deleted if it is in a `READY` or `ERROR` state. On + * successful execution of the request, the index will be in a `DELETING` + * [state][google.datastore.admin.v1.Index.State]. And on completion of the + * returned [google.longrunning.Operation][google.longrunning.Operation], the index will be removed. + * + * During index deletion, the process could result in an error, in which + * case the index will move to the `ERROR` state. The process can be recovered + * by fixing the data that caused the error, followed by calling + * [delete][google.datastore.admin.v1.DatastoreAdmin.DeleteIndex] again. + * @param \Google\Cloud\Datastore\Admin\V1\DeleteIndexRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function DeleteIndex(\Google\Cloud\Datastore\Admin\V1\DeleteIndexRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.datastore.admin.v1.DatastoreAdmin/DeleteIndex', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Gets an index. + * @param \Google\Cloud\Datastore\Admin\V1\GetIndexRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function GetIndex(\Google\Cloud\Datastore\Admin\V1\GetIndexRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.datastore.admin.v1.DatastoreAdmin/GetIndex', + $argument, + ['\Google\Cloud\Datastore\Admin\V1\Index', 'decode'], + $metadata, $options); + } + + /** + * Lists the indexes that match the specified filters. Datastore uses an + * eventually consistent query to fetch the list of indexes and may + * occasionally return stale results. + * @param \Google\Cloud\Datastore\Admin\V1\ListIndexesRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function ListIndexes(\Google\Cloud\Datastore\Admin\V1\ListIndexesRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.datastore.admin.v1.DatastoreAdmin/ListIndexes', + $argument, + ['\Google\Cloud\Datastore\Admin\V1\ListIndexesResponse', 'decode'], + $metadata, $options); + } + +} diff --git a/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/DatastoreFirestoreMigrationMetadata.php b/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/DatastoreFirestoreMigrationMetadata.php new file mode 100644 index 000000000000..eac72af58463 --- /dev/null +++ b/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/DatastoreFirestoreMigrationMetadata.php @@ -0,0 +1,114 @@ +google.datastore.admin.v1.DatastoreFirestoreMigrationMetadata + */ +class DatastoreFirestoreMigrationMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * The current state of migration from Cloud Datastore to Cloud Firestore in + * Datastore mode. + * + * Generated from protobuf field .google.datastore.admin.v1.MigrationState migration_state = 1; + */ + protected $migration_state = 0; + /** + * The current step of migration from Cloud Datastore to Cloud Firestore in + * Datastore mode. + * + * Generated from protobuf field .google.datastore.admin.v1.MigrationStep migration_step = 2; + */ + protected $migration_step = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $migration_state + * The current state of migration from Cloud Datastore to Cloud Firestore in + * Datastore mode. + * @type int $migration_step + * The current step of migration from Cloud Datastore to Cloud Firestore in + * Datastore mode. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Datastore\Admin\V1\DatastoreAdmin::initOnce(); + parent::__construct($data); + } + + /** + * The current state of migration from Cloud Datastore to Cloud Firestore in + * Datastore mode. + * + * Generated from protobuf field .google.datastore.admin.v1.MigrationState migration_state = 1; + * @return int + */ + public function getMigrationState() + { + return $this->migration_state; + } + + /** + * The current state of migration from Cloud Datastore to Cloud Firestore in + * Datastore mode. + * + * Generated from protobuf field .google.datastore.admin.v1.MigrationState migration_state = 1; + * @param int $var + * @return $this + */ + public function setMigrationState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Datastore\Admin\V1\MigrationState::class); + $this->migration_state = $var; + + return $this; + } + + /** + * The current step of migration from Cloud Datastore to Cloud Firestore in + * Datastore mode. + * + * Generated from protobuf field .google.datastore.admin.v1.MigrationStep migration_step = 2; + * @return int + */ + public function getMigrationStep() + { + return $this->migration_step; + } + + /** + * The current step of migration from Cloud Datastore to Cloud Firestore in + * Datastore mode. + * + * Generated from protobuf field .google.datastore.admin.v1.MigrationStep migration_step = 2; + * @param int $var + * @return $this + */ + public function setMigrationStep($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Datastore\Admin\V1\MigrationStep::class); + $this->migration_step = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/DeleteIndexRequest.php b/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/DeleteIndexRequest.php new file mode 100644 index 000000000000..330322229f48 --- /dev/null +++ b/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/DeleteIndexRequest.php @@ -0,0 +1,102 @@ +google.datastore.admin.v1.DeleteIndexRequest + */ +class DeleteIndexRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Project ID against which to make the request. + * + * Generated from protobuf field string project_id = 1; + */ + protected $project_id = ''; + /** + * The resource ID of the index to delete. + * + * Generated from protobuf field string index_id = 3; + */ + protected $index_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $project_id + * Project ID against which to make the request. + * @type string $index_id + * The resource ID of the index to delete. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Datastore\Admin\V1\DatastoreAdmin::initOnce(); + parent::__construct($data); + } + + /** + * Project ID against which to make the request. + * + * Generated from protobuf field string project_id = 1; + * @return string + */ + public function getProjectId() + { + return $this->project_id; + } + + /** + * Project ID against which to make the request. + * + * Generated from protobuf field string project_id = 1; + * @param string $var + * @return $this + */ + public function setProjectId($var) + { + GPBUtil::checkString($var, True); + $this->project_id = $var; + + return $this; + } + + /** + * The resource ID of the index to delete. + * + * Generated from protobuf field string index_id = 3; + * @return string + */ + public function getIndexId() + { + return $this->index_id; + } + + /** + * The resource ID of the index to delete. + * + * Generated from protobuf field string index_id = 3; + * @param string $var + * @return $this + */ + public function setIndexId($var) + { + GPBUtil::checkString($var, True); + $this->index_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/EntityFilter.php b/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/EntityFilter.php new file mode 100644 index 000000000000..c03b62ee37e7 --- /dev/null +++ b/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/EntityFilter.php @@ -0,0 +1,134 @@ +google.datastore.admin.v1.EntityFilter + */ +class EntityFilter extends \Google\Protobuf\Internal\Message +{ + /** + * If empty, then this represents all kinds. + * + * Generated from protobuf field repeated string kinds = 1; + */ + private $kinds; + /** + * An empty list represents all namespaces. This is the preferred + * usage for projects that don't use namespaces. + * An empty string element represents the default namespace. This should be + * used if the project has data in non-default namespaces, but doesn't want to + * include them. + * Each namespace in this list must be unique. + * + * Generated from protobuf field repeated string namespace_ids = 2; + */ + private $namespace_ids; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $kinds + * If empty, then this represents all kinds. + * @type array|\Google\Protobuf\Internal\RepeatedField $namespace_ids + * An empty list represents all namespaces. This is the preferred + * usage for projects that don't use namespaces. + * An empty string element represents the default namespace. This should be + * used if the project has data in non-default namespaces, but doesn't want to + * include them. + * Each namespace in this list must be unique. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Datastore\Admin\V1\DatastoreAdmin::initOnce(); + parent::__construct($data); + } + + /** + * If empty, then this represents all kinds. + * + * Generated from protobuf field repeated string kinds = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getKinds() + { + return $this->kinds; + } + + /** + * If empty, then this represents all kinds. + * + * Generated from protobuf field repeated string kinds = 1; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setKinds($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->kinds = $arr; + + return $this; + } + + /** + * An empty list represents all namespaces. This is the preferred + * usage for projects that don't use namespaces. + * An empty string element represents the default namespace. This should be + * used if the project has data in non-default namespaces, but doesn't want to + * include them. + * Each namespace in this list must be unique. + * + * Generated from protobuf field repeated string namespace_ids = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getNamespaceIds() + { + return $this->namespace_ids; + } + + /** + * An empty list represents all namespaces. This is the preferred + * usage for projects that don't use namespaces. + * An empty string element represents the default namespace. This should be + * used if the project has data in non-default namespaces, but doesn't want to + * include them. + * Each namespace in this list must be unique. + * + * Generated from protobuf field repeated string namespace_ids = 2; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setNamespaceIds($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->namespace_ids = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/ExportEntitiesMetadata.php b/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/ExportEntitiesMetadata.php new file mode 100644 index 000000000000..72554a9ea05e --- /dev/null +++ b/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/ExportEntitiesMetadata.php @@ -0,0 +1,259 @@ +google.datastore.admin.v1.ExportEntitiesMetadata + */ +class ExportEntitiesMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * Metadata common to all Datastore Admin operations. + * + * Generated from protobuf field .google.datastore.admin.v1.CommonMetadata common = 1; + */ + protected $common = null; + /** + * An estimate of the number of entities processed. + * + * Generated from protobuf field .google.datastore.admin.v1.Progress progress_entities = 2; + */ + protected $progress_entities = null; + /** + * An estimate of the number of bytes processed. + * + * Generated from protobuf field .google.datastore.admin.v1.Progress progress_bytes = 3; + */ + protected $progress_bytes = null; + /** + * Description of which entities are being exported. + * + * Generated from protobuf field .google.datastore.admin.v1.EntityFilter entity_filter = 4; + */ + protected $entity_filter = null; + /** + * Location for the export metadata and data files. This will be the same + * value as the + * [google.datastore.admin.v1.ExportEntitiesRequest.output_url_prefix][google.datastore.admin.v1.ExportEntitiesRequest.output_url_prefix] + * field. The final output location is provided in + * [google.datastore.admin.v1.ExportEntitiesResponse.output_url][google.datastore.admin.v1.ExportEntitiesResponse.output_url]. + * + * Generated from protobuf field string output_url_prefix = 5; + */ + protected $output_url_prefix = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Datastore\Admin\V1\CommonMetadata $common + * Metadata common to all Datastore Admin operations. + * @type \Google\Cloud\Datastore\Admin\V1\Progress $progress_entities + * An estimate of the number of entities processed. + * @type \Google\Cloud\Datastore\Admin\V1\Progress $progress_bytes + * An estimate of the number of bytes processed. + * @type \Google\Cloud\Datastore\Admin\V1\EntityFilter $entity_filter + * Description of which entities are being exported. + * @type string $output_url_prefix + * Location for the export metadata and data files. This will be the same + * value as the + * [google.datastore.admin.v1.ExportEntitiesRequest.output_url_prefix][google.datastore.admin.v1.ExportEntitiesRequest.output_url_prefix] + * field. The final output location is provided in + * [google.datastore.admin.v1.ExportEntitiesResponse.output_url][google.datastore.admin.v1.ExportEntitiesResponse.output_url]. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Datastore\Admin\V1\DatastoreAdmin::initOnce(); + parent::__construct($data); + } + + /** + * Metadata common to all Datastore Admin operations. + * + * Generated from protobuf field .google.datastore.admin.v1.CommonMetadata common = 1; + * @return \Google\Cloud\Datastore\Admin\V1\CommonMetadata|null + */ + public function getCommon() + { + return $this->common; + } + + public function hasCommon() + { + return isset($this->common); + } + + public function clearCommon() + { + unset($this->common); + } + + /** + * Metadata common to all Datastore Admin operations. + * + * Generated from protobuf field .google.datastore.admin.v1.CommonMetadata common = 1; + * @param \Google\Cloud\Datastore\Admin\V1\CommonMetadata $var + * @return $this + */ + public function setCommon($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Datastore\Admin\V1\CommonMetadata::class); + $this->common = $var; + + return $this; + } + + /** + * An estimate of the number of entities processed. + * + * Generated from protobuf field .google.datastore.admin.v1.Progress progress_entities = 2; + * @return \Google\Cloud\Datastore\Admin\V1\Progress|null + */ + public function getProgressEntities() + { + return $this->progress_entities; + } + + public function hasProgressEntities() + { + return isset($this->progress_entities); + } + + public function clearProgressEntities() + { + unset($this->progress_entities); + } + + /** + * An estimate of the number of entities processed. + * + * Generated from protobuf field .google.datastore.admin.v1.Progress progress_entities = 2; + * @param \Google\Cloud\Datastore\Admin\V1\Progress $var + * @return $this + */ + public function setProgressEntities($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Datastore\Admin\V1\Progress::class); + $this->progress_entities = $var; + + return $this; + } + + /** + * An estimate of the number of bytes processed. + * + * Generated from protobuf field .google.datastore.admin.v1.Progress progress_bytes = 3; + * @return \Google\Cloud\Datastore\Admin\V1\Progress|null + */ + public function getProgressBytes() + { + return $this->progress_bytes; + } + + public function hasProgressBytes() + { + return isset($this->progress_bytes); + } + + public function clearProgressBytes() + { + unset($this->progress_bytes); + } + + /** + * An estimate of the number of bytes processed. + * + * Generated from protobuf field .google.datastore.admin.v1.Progress progress_bytes = 3; + * @param \Google\Cloud\Datastore\Admin\V1\Progress $var + * @return $this + */ + public function setProgressBytes($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Datastore\Admin\V1\Progress::class); + $this->progress_bytes = $var; + + return $this; + } + + /** + * Description of which entities are being exported. + * + * Generated from protobuf field .google.datastore.admin.v1.EntityFilter entity_filter = 4; + * @return \Google\Cloud\Datastore\Admin\V1\EntityFilter|null + */ + public function getEntityFilter() + { + return $this->entity_filter; + } + + public function hasEntityFilter() + { + return isset($this->entity_filter); + } + + public function clearEntityFilter() + { + unset($this->entity_filter); + } + + /** + * Description of which entities are being exported. + * + * Generated from protobuf field .google.datastore.admin.v1.EntityFilter entity_filter = 4; + * @param \Google\Cloud\Datastore\Admin\V1\EntityFilter $var + * @return $this + */ + public function setEntityFilter($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Datastore\Admin\V1\EntityFilter::class); + $this->entity_filter = $var; + + return $this; + } + + /** + * Location for the export metadata and data files. This will be the same + * value as the + * [google.datastore.admin.v1.ExportEntitiesRequest.output_url_prefix][google.datastore.admin.v1.ExportEntitiesRequest.output_url_prefix] + * field. The final output location is provided in + * [google.datastore.admin.v1.ExportEntitiesResponse.output_url][google.datastore.admin.v1.ExportEntitiesResponse.output_url]. + * + * Generated from protobuf field string output_url_prefix = 5; + * @return string + */ + public function getOutputUrlPrefix() + { + return $this->output_url_prefix; + } + + /** + * Location for the export metadata and data files. This will be the same + * value as the + * [google.datastore.admin.v1.ExportEntitiesRequest.output_url_prefix][google.datastore.admin.v1.ExportEntitiesRequest.output_url_prefix] + * field. The final output location is provided in + * [google.datastore.admin.v1.ExportEntitiesResponse.output_url][google.datastore.admin.v1.ExportEntitiesResponse.output_url]. + * + * Generated from protobuf field string output_url_prefix = 5; + * @param string $var + * @return $this + */ + public function setOutputUrlPrefix($var) + { + GPBUtil::checkString($var, True); + $this->output_url_prefix = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/ExportEntitiesRequest.php b/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/ExportEntitiesRequest.php new file mode 100644 index 000000000000..6101ab0fd7a9 --- /dev/null +++ b/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/ExportEntitiesRequest.php @@ -0,0 +1,272 @@ +google.datastore.admin.v1.ExportEntitiesRequest + */ +class ExportEntitiesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Project ID against which to make the request. + * + * Generated from protobuf field string project_id = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $project_id = ''; + /** + * Client-assigned labels. + * + * Generated from protobuf field map labels = 2; + */ + private $labels; + /** + * Description of what data from the project is included in the export. + * + * Generated from protobuf field .google.datastore.admin.v1.EntityFilter entity_filter = 3; + */ + protected $entity_filter = null; + /** + * Required. Location for the export metadata and data files. + * The full resource URL of the external storage location. Currently, only + * Google Cloud Storage is supported. So output_url_prefix should be of the + * form: `gs://BUCKET_NAME[/NAMESPACE_PATH]`, where `BUCKET_NAME` is the + * name of the Cloud Storage bucket and `NAMESPACE_PATH` is an optional Cloud + * Storage namespace path (this is not a Cloud Datastore namespace). For more + * information about Cloud Storage namespace paths, see + * [Object name + * considerations](https://cloud.google.com/storage/docs/naming#object-considerations). + * The resulting files will be nested deeper than the specified URL prefix. + * The final output URL will be provided in the + * [google.datastore.admin.v1.ExportEntitiesResponse.output_url][google.datastore.admin.v1.ExportEntitiesResponse.output_url] field. That + * value should be used for subsequent ImportEntities operations. + * By nesting the data files deeper, the same Cloud Storage bucket can be used + * in multiple ExportEntities operations without conflict. + * + * Generated from protobuf field string output_url_prefix = 4 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $output_url_prefix = ''; + + /** + * @param string $projectId Required. Project ID against which to make the request. + * @param array $labels Client-assigned labels. + * @param \Google\Cloud\Datastore\Admin\V1\EntityFilter $entityFilter Description of what data from the project is included in the export. + * @param string $outputUrlPrefix Required. Location for the export metadata and data files. + * + * The full resource URL of the external storage location. Currently, only + * Google Cloud Storage is supported. So output_url_prefix should be of the + * form: `gs://BUCKET_NAME[/NAMESPACE_PATH]`, where `BUCKET_NAME` is the + * name of the Cloud Storage bucket and `NAMESPACE_PATH` is an optional Cloud + * Storage namespace path (this is not a Cloud Datastore namespace). For more + * information about Cloud Storage namespace paths, see + * [Object name + * considerations](https://cloud.google.com/storage/docs/naming#object-considerations). + * + * The resulting files will be nested deeper than the specified URL prefix. + * The final output URL will be provided in the + * [google.datastore.admin.v1.ExportEntitiesResponse.output_url][google.datastore.admin.v1.ExportEntitiesResponse.output_url] field. That + * value should be used for subsequent ImportEntities operations. + * + * By nesting the data files deeper, the same Cloud Storage bucket can be used + * in multiple ExportEntities operations without conflict. + * + * @return \Google\Cloud\Datastore\Admin\V1\ExportEntitiesRequest + * + * @experimental + */ + public static function build(string $projectId, array $labels, \Google\Cloud\Datastore\Admin\V1\EntityFilter $entityFilter, string $outputUrlPrefix): self + { + return (new self()) + ->setProjectId($projectId) + ->setLabels($labels) + ->setEntityFilter($entityFilter) + ->setOutputUrlPrefix($outputUrlPrefix); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $project_id + * Required. Project ID against which to make the request. + * @type array|\Google\Protobuf\Internal\MapField $labels + * Client-assigned labels. + * @type \Google\Cloud\Datastore\Admin\V1\EntityFilter $entity_filter + * Description of what data from the project is included in the export. + * @type string $output_url_prefix + * Required. Location for the export metadata and data files. + * The full resource URL of the external storage location. Currently, only + * Google Cloud Storage is supported. So output_url_prefix should be of the + * form: `gs://BUCKET_NAME[/NAMESPACE_PATH]`, where `BUCKET_NAME` is the + * name of the Cloud Storage bucket and `NAMESPACE_PATH` is an optional Cloud + * Storage namespace path (this is not a Cloud Datastore namespace). For more + * information about Cloud Storage namespace paths, see + * [Object name + * considerations](https://cloud.google.com/storage/docs/naming#object-considerations). + * The resulting files will be nested deeper than the specified URL prefix. + * The final output URL will be provided in the + * [google.datastore.admin.v1.ExportEntitiesResponse.output_url][google.datastore.admin.v1.ExportEntitiesResponse.output_url] field. That + * value should be used for subsequent ImportEntities operations. + * By nesting the data files deeper, the same Cloud Storage bucket can be used + * in multiple ExportEntities operations without conflict. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Datastore\Admin\V1\DatastoreAdmin::initOnce(); + parent::__construct($data); + } + + /** + * Required. Project ID against which to make the request. + * + * Generated from protobuf field string project_id = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getProjectId() + { + return $this->project_id; + } + + /** + * Required. Project ID against which to make the request. + * + * Generated from protobuf field string project_id = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setProjectId($var) + { + GPBUtil::checkString($var, True); + $this->project_id = $var; + + return $this; + } + + /** + * Client-assigned labels. + * + * Generated from protobuf field map labels = 2; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * Client-assigned labels. + * + * Generated from protobuf field map labels = 2; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + + /** + * Description of what data from the project is included in the export. + * + * Generated from protobuf field .google.datastore.admin.v1.EntityFilter entity_filter = 3; + * @return \Google\Cloud\Datastore\Admin\V1\EntityFilter|null + */ + public function getEntityFilter() + { + return $this->entity_filter; + } + + public function hasEntityFilter() + { + return isset($this->entity_filter); + } + + public function clearEntityFilter() + { + unset($this->entity_filter); + } + + /** + * Description of what data from the project is included in the export. + * + * Generated from protobuf field .google.datastore.admin.v1.EntityFilter entity_filter = 3; + * @param \Google\Cloud\Datastore\Admin\V1\EntityFilter $var + * @return $this + */ + public function setEntityFilter($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Datastore\Admin\V1\EntityFilter::class); + $this->entity_filter = $var; + + return $this; + } + + /** + * Required. Location for the export metadata and data files. + * The full resource URL of the external storage location. Currently, only + * Google Cloud Storage is supported. So output_url_prefix should be of the + * form: `gs://BUCKET_NAME[/NAMESPACE_PATH]`, where `BUCKET_NAME` is the + * name of the Cloud Storage bucket and `NAMESPACE_PATH` is an optional Cloud + * Storage namespace path (this is not a Cloud Datastore namespace). For more + * information about Cloud Storage namespace paths, see + * [Object name + * considerations](https://cloud.google.com/storage/docs/naming#object-considerations). + * The resulting files will be nested deeper than the specified URL prefix. + * The final output URL will be provided in the + * [google.datastore.admin.v1.ExportEntitiesResponse.output_url][google.datastore.admin.v1.ExportEntitiesResponse.output_url] field. That + * value should be used for subsequent ImportEntities operations. + * By nesting the data files deeper, the same Cloud Storage bucket can be used + * in multiple ExportEntities operations without conflict. + * + * Generated from protobuf field string output_url_prefix = 4 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getOutputUrlPrefix() + { + return $this->output_url_prefix; + } + + /** + * Required. Location for the export metadata and data files. + * The full resource URL of the external storage location. Currently, only + * Google Cloud Storage is supported. So output_url_prefix should be of the + * form: `gs://BUCKET_NAME[/NAMESPACE_PATH]`, where `BUCKET_NAME` is the + * name of the Cloud Storage bucket and `NAMESPACE_PATH` is an optional Cloud + * Storage namespace path (this is not a Cloud Datastore namespace). For more + * information about Cloud Storage namespace paths, see + * [Object name + * considerations](https://cloud.google.com/storage/docs/naming#object-considerations). + * The resulting files will be nested deeper than the specified URL prefix. + * The final output URL will be provided in the + * [google.datastore.admin.v1.ExportEntitiesResponse.output_url][google.datastore.admin.v1.ExportEntitiesResponse.output_url] field. That + * value should be used for subsequent ImportEntities operations. + * By nesting the data files deeper, the same Cloud Storage bucket can be used + * in multiple ExportEntities operations without conflict. + * + * Generated from protobuf field string output_url_prefix = 4 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setOutputUrlPrefix($var) + { + GPBUtil::checkString($var, True); + $this->output_url_prefix = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/ExportEntitiesResponse.php b/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/ExportEntitiesResponse.php new file mode 100644 index 000000000000..f7e9ac101543 --- /dev/null +++ b/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/ExportEntitiesResponse.php @@ -0,0 +1,80 @@ +google.datastore.admin.v1.ExportEntitiesResponse + */ +class ExportEntitiesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Location of the output metadata file. This can be used to begin an import + * into Cloud Datastore (this project or another project). See + * [google.datastore.admin.v1.ImportEntitiesRequest.input_url][google.datastore.admin.v1.ImportEntitiesRequest.input_url]. + * Only present if the operation completed successfully. + * + * Generated from protobuf field string output_url = 1; + */ + protected $output_url = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $output_url + * Location of the output metadata file. This can be used to begin an import + * into Cloud Datastore (this project or another project). See + * [google.datastore.admin.v1.ImportEntitiesRequest.input_url][google.datastore.admin.v1.ImportEntitiesRequest.input_url]. + * Only present if the operation completed successfully. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Datastore\Admin\V1\DatastoreAdmin::initOnce(); + parent::__construct($data); + } + + /** + * Location of the output metadata file. This can be used to begin an import + * into Cloud Datastore (this project or another project). See + * [google.datastore.admin.v1.ImportEntitiesRequest.input_url][google.datastore.admin.v1.ImportEntitiesRequest.input_url]. + * Only present if the operation completed successfully. + * + * Generated from protobuf field string output_url = 1; + * @return string + */ + public function getOutputUrl() + { + return $this->output_url; + } + + /** + * Location of the output metadata file. This can be used to begin an import + * into Cloud Datastore (this project or another project). See + * [google.datastore.admin.v1.ImportEntitiesRequest.input_url][google.datastore.admin.v1.ImportEntitiesRequest.input_url]. + * Only present if the operation completed successfully. + * + * Generated from protobuf field string output_url = 1; + * @param string $var + * @return $this + */ + public function setOutputUrl($var) + { + GPBUtil::checkString($var, True); + $this->output_url = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/GetIndexRequest.php b/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/GetIndexRequest.php new file mode 100644 index 000000000000..0f73f4cafac2 --- /dev/null +++ b/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/GetIndexRequest.php @@ -0,0 +1,101 @@ +google.datastore.admin.v1.GetIndexRequest + */ +class GetIndexRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Project ID against which to make the request. + * + * Generated from protobuf field string project_id = 1; + */ + protected $project_id = ''; + /** + * The resource ID of the index to get. + * + * Generated from protobuf field string index_id = 3; + */ + protected $index_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $project_id + * Project ID against which to make the request. + * @type string $index_id + * The resource ID of the index to get. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Datastore\Admin\V1\DatastoreAdmin::initOnce(); + parent::__construct($data); + } + + /** + * Project ID against which to make the request. + * + * Generated from protobuf field string project_id = 1; + * @return string + */ + public function getProjectId() + { + return $this->project_id; + } + + /** + * Project ID against which to make the request. + * + * Generated from protobuf field string project_id = 1; + * @param string $var + * @return $this + */ + public function setProjectId($var) + { + GPBUtil::checkString($var, True); + $this->project_id = $var; + + return $this; + } + + /** + * The resource ID of the index to get. + * + * Generated from protobuf field string index_id = 3; + * @return string + */ + public function getIndexId() + { + return $this->index_id; + } + + /** + * The resource ID of the index to get. + * + * Generated from protobuf field string index_id = 3; + * @param string $var + * @return $this + */ + public function setIndexId($var) + { + GPBUtil::checkString($var, True); + $this->index_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/ImportEntitiesMetadata.php b/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/ImportEntitiesMetadata.php new file mode 100644 index 000000000000..9a6983928986 --- /dev/null +++ b/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/ImportEntitiesMetadata.php @@ -0,0 +1,247 @@ +google.datastore.admin.v1.ImportEntitiesMetadata + */ +class ImportEntitiesMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * Metadata common to all Datastore Admin operations. + * + * Generated from protobuf field .google.datastore.admin.v1.CommonMetadata common = 1; + */ + protected $common = null; + /** + * An estimate of the number of entities processed. + * + * Generated from protobuf field .google.datastore.admin.v1.Progress progress_entities = 2; + */ + protected $progress_entities = null; + /** + * An estimate of the number of bytes processed. + * + * Generated from protobuf field .google.datastore.admin.v1.Progress progress_bytes = 3; + */ + protected $progress_bytes = null; + /** + * Description of which entities are being imported. + * + * Generated from protobuf field .google.datastore.admin.v1.EntityFilter entity_filter = 4; + */ + protected $entity_filter = null; + /** + * The location of the import metadata file. This will be the same value as + * the [google.datastore.admin.v1.ExportEntitiesResponse.output_url][google.datastore.admin.v1.ExportEntitiesResponse.output_url] field. + * + * Generated from protobuf field string input_url = 5; + */ + protected $input_url = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Datastore\Admin\V1\CommonMetadata $common + * Metadata common to all Datastore Admin operations. + * @type \Google\Cloud\Datastore\Admin\V1\Progress $progress_entities + * An estimate of the number of entities processed. + * @type \Google\Cloud\Datastore\Admin\V1\Progress $progress_bytes + * An estimate of the number of bytes processed. + * @type \Google\Cloud\Datastore\Admin\V1\EntityFilter $entity_filter + * Description of which entities are being imported. + * @type string $input_url + * The location of the import metadata file. This will be the same value as + * the [google.datastore.admin.v1.ExportEntitiesResponse.output_url][google.datastore.admin.v1.ExportEntitiesResponse.output_url] field. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Datastore\Admin\V1\DatastoreAdmin::initOnce(); + parent::__construct($data); + } + + /** + * Metadata common to all Datastore Admin operations. + * + * Generated from protobuf field .google.datastore.admin.v1.CommonMetadata common = 1; + * @return \Google\Cloud\Datastore\Admin\V1\CommonMetadata|null + */ + public function getCommon() + { + return $this->common; + } + + public function hasCommon() + { + return isset($this->common); + } + + public function clearCommon() + { + unset($this->common); + } + + /** + * Metadata common to all Datastore Admin operations. + * + * Generated from protobuf field .google.datastore.admin.v1.CommonMetadata common = 1; + * @param \Google\Cloud\Datastore\Admin\V1\CommonMetadata $var + * @return $this + */ + public function setCommon($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Datastore\Admin\V1\CommonMetadata::class); + $this->common = $var; + + return $this; + } + + /** + * An estimate of the number of entities processed. + * + * Generated from protobuf field .google.datastore.admin.v1.Progress progress_entities = 2; + * @return \Google\Cloud\Datastore\Admin\V1\Progress|null + */ + public function getProgressEntities() + { + return $this->progress_entities; + } + + public function hasProgressEntities() + { + return isset($this->progress_entities); + } + + public function clearProgressEntities() + { + unset($this->progress_entities); + } + + /** + * An estimate of the number of entities processed. + * + * Generated from protobuf field .google.datastore.admin.v1.Progress progress_entities = 2; + * @param \Google\Cloud\Datastore\Admin\V1\Progress $var + * @return $this + */ + public function setProgressEntities($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Datastore\Admin\V1\Progress::class); + $this->progress_entities = $var; + + return $this; + } + + /** + * An estimate of the number of bytes processed. + * + * Generated from protobuf field .google.datastore.admin.v1.Progress progress_bytes = 3; + * @return \Google\Cloud\Datastore\Admin\V1\Progress|null + */ + public function getProgressBytes() + { + return $this->progress_bytes; + } + + public function hasProgressBytes() + { + return isset($this->progress_bytes); + } + + public function clearProgressBytes() + { + unset($this->progress_bytes); + } + + /** + * An estimate of the number of bytes processed. + * + * Generated from protobuf field .google.datastore.admin.v1.Progress progress_bytes = 3; + * @param \Google\Cloud\Datastore\Admin\V1\Progress $var + * @return $this + */ + public function setProgressBytes($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Datastore\Admin\V1\Progress::class); + $this->progress_bytes = $var; + + return $this; + } + + /** + * Description of which entities are being imported. + * + * Generated from protobuf field .google.datastore.admin.v1.EntityFilter entity_filter = 4; + * @return \Google\Cloud\Datastore\Admin\V1\EntityFilter|null + */ + public function getEntityFilter() + { + return $this->entity_filter; + } + + public function hasEntityFilter() + { + return isset($this->entity_filter); + } + + public function clearEntityFilter() + { + unset($this->entity_filter); + } + + /** + * Description of which entities are being imported. + * + * Generated from protobuf field .google.datastore.admin.v1.EntityFilter entity_filter = 4; + * @param \Google\Cloud\Datastore\Admin\V1\EntityFilter $var + * @return $this + */ + public function setEntityFilter($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Datastore\Admin\V1\EntityFilter::class); + $this->entity_filter = $var; + + return $this; + } + + /** + * The location of the import metadata file. This will be the same value as + * the [google.datastore.admin.v1.ExportEntitiesResponse.output_url][google.datastore.admin.v1.ExportEntitiesResponse.output_url] field. + * + * Generated from protobuf field string input_url = 5; + * @return string + */ + public function getInputUrl() + { + return $this->input_url; + } + + /** + * The location of the import metadata file. This will be the same value as + * the [google.datastore.admin.v1.ExportEntitiesResponse.output_url][google.datastore.admin.v1.ExportEntitiesResponse.output_url] field. + * + * Generated from protobuf field string input_url = 5; + * @param string $var + * @return $this + */ + public function setInputUrl($var) + { + GPBUtil::checkString($var, True); + $this->input_url = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/ImportEntitiesRequest.php b/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/ImportEntitiesRequest.php new file mode 100644 index 000000000000..f13247ebe556 --- /dev/null +++ b/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/ImportEntitiesRequest.php @@ -0,0 +1,270 @@ +google.datastore.admin.v1.ImportEntitiesRequest + */ +class ImportEntitiesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Project ID against which to make the request. + * + * Generated from protobuf field string project_id = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $project_id = ''; + /** + * Client-assigned labels. + * + * Generated from protobuf field map labels = 2; + */ + private $labels; + /** + * Required. The full resource URL of the external storage location. Currently, only + * Google Cloud Storage is supported. So input_url should be of the form: + * `gs://BUCKET_NAME[/NAMESPACE_PATH]/OVERALL_EXPORT_METADATA_FILE`, where + * `BUCKET_NAME` is the name of the Cloud Storage bucket, `NAMESPACE_PATH` is + * an optional Cloud Storage namespace path (this is not a Cloud Datastore + * namespace), and `OVERALL_EXPORT_METADATA_FILE` is the metadata file written + * by the ExportEntities operation. For more information about Cloud Storage + * namespace paths, see + * [Object name + * considerations](https://cloud.google.com/storage/docs/naming#object-considerations). + * For more information, see + * [google.datastore.admin.v1.ExportEntitiesResponse.output_url][google.datastore.admin.v1.ExportEntitiesResponse.output_url]. + * + * Generated from protobuf field string input_url = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $input_url = ''; + /** + * Optionally specify which kinds/namespaces are to be imported. If provided, + * the list must be a subset of the EntityFilter used in creating the export, + * otherwise a FAILED_PRECONDITION error will be returned. If no filter is + * specified then all entities from the export are imported. + * + * Generated from protobuf field .google.datastore.admin.v1.EntityFilter entity_filter = 4; + */ + protected $entity_filter = null; + + /** + * @param string $projectId Required. Project ID against which to make the request. + * @param array $labels Client-assigned labels. + * @param string $inputUrl Required. The full resource URL of the external storage location. Currently, only + * Google Cloud Storage is supported. So input_url should be of the form: + * `gs://BUCKET_NAME[/NAMESPACE_PATH]/OVERALL_EXPORT_METADATA_FILE`, where + * `BUCKET_NAME` is the name of the Cloud Storage bucket, `NAMESPACE_PATH` is + * an optional Cloud Storage namespace path (this is not a Cloud Datastore + * namespace), and `OVERALL_EXPORT_METADATA_FILE` is the metadata file written + * by the ExportEntities operation. For more information about Cloud Storage + * namespace paths, see + * [Object name + * considerations](https://cloud.google.com/storage/docs/naming#object-considerations). + * + * For more information, see + * [google.datastore.admin.v1.ExportEntitiesResponse.output_url][google.datastore.admin.v1.ExportEntitiesResponse.output_url]. + * @param \Google\Cloud\Datastore\Admin\V1\EntityFilter $entityFilter Optionally specify which kinds/namespaces are to be imported. If provided, + * the list must be a subset of the EntityFilter used in creating the export, + * otherwise a FAILED_PRECONDITION error will be returned. If no filter is + * specified then all entities from the export are imported. + * + * @return \Google\Cloud\Datastore\Admin\V1\ImportEntitiesRequest + * + * @experimental + */ + public static function build(string $projectId, array $labels, string $inputUrl, \Google\Cloud\Datastore\Admin\V1\EntityFilter $entityFilter): self + { + return (new self()) + ->setProjectId($projectId) + ->setLabels($labels) + ->setInputUrl($inputUrl) + ->setEntityFilter($entityFilter); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $project_id + * Required. Project ID against which to make the request. + * @type array|\Google\Protobuf\Internal\MapField $labels + * Client-assigned labels. + * @type string $input_url + * Required. The full resource URL of the external storage location. Currently, only + * Google Cloud Storage is supported. So input_url should be of the form: + * `gs://BUCKET_NAME[/NAMESPACE_PATH]/OVERALL_EXPORT_METADATA_FILE`, where + * `BUCKET_NAME` is the name of the Cloud Storage bucket, `NAMESPACE_PATH` is + * an optional Cloud Storage namespace path (this is not a Cloud Datastore + * namespace), and `OVERALL_EXPORT_METADATA_FILE` is the metadata file written + * by the ExportEntities operation. For more information about Cloud Storage + * namespace paths, see + * [Object name + * considerations](https://cloud.google.com/storage/docs/naming#object-considerations). + * For more information, see + * [google.datastore.admin.v1.ExportEntitiesResponse.output_url][google.datastore.admin.v1.ExportEntitiesResponse.output_url]. + * @type \Google\Cloud\Datastore\Admin\V1\EntityFilter $entity_filter + * Optionally specify which kinds/namespaces are to be imported. If provided, + * the list must be a subset of the EntityFilter used in creating the export, + * otherwise a FAILED_PRECONDITION error will be returned. If no filter is + * specified then all entities from the export are imported. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Datastore\Admin\V1\DatastoreAdmin::initOnce(); + parent::__construct($data); + } + + /** + * Required. Project ID against which to make the request. + * + * Generated from protobuf field string project_id = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getProjectId() + { + return $this->project_id; + } + + /** + * Required. Project ID against which to make the request. + * + * Generated from protobuf field string project_id = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setProjectId($var) + { + GPBUtil::checkString($var, True); + $this->project_id = $var; + + return $this; + } + + /** + * Client-assigned labels. + * + * Generated from protobuf field map labels = 2; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * Client-assigned labels. + * + * Generated from protobuf field map labels = 2; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + + /** + * Required. The full resource URL of the external storage location. Currently, only + * Google Cloud Storage is supported. So input_url should be of the form: + * `gs://BUCKET_NAME[/NAMESPACE_PATH]/OVERALL_EXPORT_METADATA_FILE`, where + * `BUCKET_NAME` is the name of the Cloud Storage bucket, `NAMESPACE_PATH` is + * an optional Cloud Storage namespace path (this is not a Cloud Datastore + * namespace), and `OVERALL_EXPORT_METADATA_FILE` is the metadata file written + * by the ExportEntities operation. For more information about Cloud Storage + * namespace paths, see + * [Object name + * considerations](https://cloud.google.com/storage/docs/naming#object-considerations). + * For more information, see + * [google.datastore.admin.v1.ExportEntitiesResponse.output_url][google.datastore.admin.v1.ExportEntitiesResponse.output_url]. + * + * Generated from protobuf field string input_url = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getInputUrl() + { + return $this->input_url; + } + + /** + * Required. The full resource URL of the external storage location. Currently, only + * Google Cloud Storage is supported. So input_url should be of the form: + * `gs://BUCKET_NAME[/NAMESPACE_PATH]/OVERALL_EXPORT_METADATA_FILE`, where + * `BUCKET_NAME` is the name of the Cloud Storage bucket, `NAMESPACE_PATH` is + * an optional Cloud Storage namespace path (this is not a Cloud Datastore + * namespace), and `OVERALL_EXPORT_METADATA_FILE` is the metadata file written + * by the ExportEntities operation. For more information about Cloud Storage + * namespace paths, see + * [Object name + * considerations](https://cloud.google.com/storage/docs/naming#object-considerations). + * For more information, see + * [google.datastore.admin.v1.ExportEntitiesResponse.output_url][google.datastore.admin.v1.ExportEntitiesResponse.output_url]. + * + * Generated from protobuf field string input_url = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setInputUrl($var) + { + GPBUtil::checkString($var, True); + $this->input_url = $var; + + return $this; + } + + /** + * Optionally specify which kinds/namespaces are to be imported. If provided, + * the list must be a subset of the EntityFilter used in creating the export, + * otherwise a FAILED_PRECONDITION error will be returned. If no filter is + * specified then all entities from the export are imported. + * + * Generated from protobuf field .google.datastore.admin.v1.EntityFilter entity_filter = 4; + * @return \Google\Cloud\Datastore\Admin\V1\EntityFilter|null + */ + public function getEntityFilter() + { + return $this->entity_filter; + } + + public function hasEntityFilter() + { + return isset($this->entity_filter); + } + + public function clearEntityFilter() + { + unset($this->entity_filter); + } + + /** + * Optionally specify which kinds/namespaces are to be imported. If provided, + * the list must be a subset of the EntityFilter used in creating the export, + * otherwise a FAILED_PRECONDITION error will be returned. If no filter is + * specified then all entities from the export are imported. + * + * Generated from protobuf field .google.datastore.admin.v1.EntityFilter entity_filter = 4; + * @param \Google\Cloud\Datastore\Admin\V1\EntityFilter $var + * @return $this + */ + public function setEntityFilter($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Datastore\Admin\V1\EntityFilter::class); + $this->entity_filter = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/Index.php b/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/Index.php new file mode 100644 index 000000000000..1b88f0f6c067 --- /dev/null +++ b/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/Index.php @@ -0,0 +1,237 @@ +google.datastore.admin.v1.Index + */ +class Index extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. Project ID. + * + * Generated from protobuf field string project_id = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $project_id = ''; + /** + * Output only. The resource ID of the index. + * + * Generated from protobuf field string index_id = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $index_id = ''; + /** + * Required. The entity kind to which this index applies. + * + * Generated from protobuf field string kind = 4 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $kind = ''; + /** + * Required. The index's ancestor mode. Must not be ANCESTOR_MODE_UNSPECIFIED. + * + * Generated from protobuf field .google.datastore.admin.v1.Index.AncestorMode ancestor = 5 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $ancestor = 0; + /** + * Required. An ordered sequence of property names and their index attributes. + * + * Generated from protobuf field repeated .google.datastore.admin.v1.Index.IndexedProperty properties = 6 [(.google.api.field_behavior) = REQUIRED]; + */ + private $properties; + /** + * Output only. The state of the index. + * + * Generated from protobuf field .google.datastore.admin.v1.Index.State state = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $project_id + * Output only. Project ID. + * @type string $index_id + * Output only. The resource ID of the index. + * @type string $kind + * Required. The entity kind to which this index applies. + * @type int $ancestor + * Required. The index's ancestor mode. Must not be ANCESTOR_MODE_UNSPECIFIED. + * @type array<\Google\Cloud\Datastore\Admin\V1\Index\IndexedProperty>|\Google\Protobuf\Internal\RepeatedField $properties + * Required. An ordered sequence of property names and their index attributes. + * @type int $state + * Output only. The state of the index. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Datastore\Admin\V1\Index::initOnce(); + parent::__construct($data); + } + + /** + * Output only. Project ID. + * + * Generated from protobuf field string project_id = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getProjectId() + { + return $this->project_id; + } + + /** + * Output only. Project ID. + * + * Generated from protobuf field string project_id = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setProjectId($var) + { + GPBUtil::checkString($var, True); + $this->project_id = $var; + + return $this; + } + + /** + * Output only. The resource ID of the index. + * + * Generated from protobuf field string index_id = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getIndexId() + { + return $this->index_id; + } + + /** + * Output only. The resource ID of the index. + * + * Generated from protobuf field string index_id = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setIndexId($var) + { + GPBUtil::checkString($var, True); + $this->index_id = $var; + + return $this; + } + + /** + * Required. The entity kind to which this index applies. + * + * Generated from protobuf field string kind = 4 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getKind() + { + return $this->kind; + } + + /** + * Required. The entity kind to which this index applies. + * + * Generated from protobuf field string kind = 4 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setKind($var) + { + GPBUtil::checkString($var, True); + $this->kind = $var; + + return $this; + } + + /** + * Required. The index's ancestor mode. Must not be ANCESTOR_MODE_UNSPECIFIED. + * + * Generated from protobuf field .google.datastore.admin.v1.Index.AncestorMode ancestor = 5 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getAncestor() + { + return $this->ancestor; + } + + /** + * Required. The index's ancestor mode. Must not be ANCESTOR_MODE_UNSPECIFIED. + * + * Generated from protobuf field .google.datastore.admin.v1.Index.AncestorMode ancestor = 5 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setAncestor($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Datastore\Admin\V1\Index\AncestorMode::class); + $this->ancestor = $var; + + return $this; + } + + /** + * Required. An ordered sequence of property names and their index attributes. + * + * Generated from protobuf field repeated .google.datastore.admin.v1.Index.IndexedProperty properties = 6 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getProperties() + { + return $this->properties; + } + + /** + * Required. An ordered sequence of property names and their index attributes. + * + * Generated from protobuf field repeated .google.datastore.admin.v1.Index.IndexedProperty properties = 6 [(.google.api.field_behavior) = REQUIRED]; + * @param array<\Google\Cloud\Datastore\Admin\V1\Index\IndexedProperty>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setProperties($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Datastore\Admin\V1\Index\IndexedProperty::class); + $this->properties = $arr; + + return $this; + } + + /** + * Output only. The state of the index. + * + * Generated from protobuf field .google.datastore.admin.v1.Index.State state = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. The state of the index. + * + * Generated from protobuf field .google.datastore.admin.v1.Index.State state = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Datastore\Admin\V1\Index\State::class); + $this->state = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/Index/AncestorMode.php b/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/Index/AncestorMode.php new file mode 100644 index 000000000000..24e87cb45bf3 --- /dev/null +++ b/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/Index/AncestorMode.php @@ -0,0 +1,65 @@ +google.datastore.admin.v1.Index.AncestorMode + */ +class AncestorMode +{ + /** + * The ancestor mode is unspecified. + * + * Generated from protobuf enum ANCESTOR_MODE_UNSPECIFIED = 0; + */ + const ANCESTOR_MODE_UNSPECIFIED = 0; + /** + * Do not include the entity's ancestors in the index. + * + * Generated from protobuf enum NONE = 1; + */ + const NONE = 1; + /** + * Include all the entity's ancestors in the index. + * + * Generated from protobuf enum ALL_ANCESTORS = 2; + */ + const ALL_ANCESTORS = 2; + + private static $valueToName = [ + self::ANCESTOR_MODE_UNSPECIFIED => 'ANCESTOR_MODE_UNSPECIFIED', + self::NONE => 'NONE', + self::ALL_ANCESTORS => 'ALL_ANCESTORS', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(AncestorMode::class, \Google\Cloud\Datastore\Admin\V1\Index_AncestorMode::class); + diff --git a/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/Index/Direction.php b/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/Index/Direction.php new file mode 100644 index 000000000000..bee71a7181e5 --- /dev/null +++ b/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/Index/Direction.php @@ -0,0 +1,66 @@ +google.datastore.admin.v1.Index.Direction + */ +class Direction +{ + /** + * The direction is unspecified. + * + * Generated from protobuf enum DIRECTION_UNSPECIFIED = 0; + */ + const DIRECTION_UNSPECIFIED = 0; + /** + * The property's values are indexed so as to support sequencing in + * ascending order and also query by <, >, <=, >=, and =. + * + * Generated from protobuf enum ASCENDING = 1; + */ + const ASCENDING = 1; + /** + * The property's values are indexed so as to support sequencing in + * descending order and also query by <, >, <=, >=, and =. + * + * Generated from protobuf enum DESCENDING = 2; + */ + const DESCENDING = 2; + + private static $valueToName = [ + self::DIRECTION_UNSPECIFIED => 'DIRECTION_UNSPECIFIED', + self::ASCENDING => 'ASCENDING', + self::DESCENDING => 'DESCENDING', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Direction::class, \Google\Cloud\Datastore\Admin\V1\Index_Direction::class); + diff --git a/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/Index/IndexedProperty.php b/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/Index/IndexedProperty.php new file mode 100644 index 000000000000..7869c24a98b6 --- /dev/null +++ b/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/Index/IndexedProperty.php @@ -0,0 +1,104 @@ +google.datastore.admin.v1.Index.IndexedProperty + */ +class IndexedProperty extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The property name to index. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $name = ''; + /** + * Required. The indexed property's direction. Must not be DIRECTION_UNSPECIFIED. + * + * Generated from protobuf field .google.datastore.admin.v1.Index.Direction direction = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $direction = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The property name to index. + * @type int $direction + * Required. The indexed property's direction. Must not be DIRECTION_UNSPECIFIED. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Datastore\Admin\V1\Index::initOnce(); + parent::__construct($data); + } + + /** + * Required. The property name to index. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The property name to index. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Required. The indexed property's direction. Must not be DIRECTION_UNSPECIFIED. + * + * Generated from protobuf field .google.datastore.admin.v1.Index.Direction direction = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getDirection() + { + return $this->direction; + } + + /** + * Required. The indexed property's direction. Must not be DIRECTION_UNSPECIFIED. + * + * Generated from protobuf field .google.datastore.admin.v1.Index.Direction direction = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setDirection($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Datastore\Admin\V1\Index\Direction::class); + $this->direction = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(IndexedProperty::class, \Google\Cloud\Datastore\Admin\V1\Index_IndexedProperty::class); + diff --git a/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/Index/State.php b/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/Index/State.php new file mode 100644 index 000000000000..6d8678652c21 --- /dev/null +++ b/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/Index/State.php @@ -0,0 +1,91 @@ +google.datastore.admin.v1.Index.State + */ +class State +{ + /** + * The state is unspecified. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The index is being created, and cannot be used by queries. + * There is an active long-running operation for the index. + * The index is updated when writing an entity. + * Some index data may exist. + * + * Generated from protobuf enum CREATING = 1; + */ + const CREATING = 1; + /** + * The index is ready to be used. + * The index is updated when writing an entity. + * The index is fully populated from all stored entities it applies to. + * + * Generated from protobuf enum READY = 2; + */ + const READY = 2; + /** + * The index is being deleted, and cannot be used by queries. + * There is an active long-running operation for the index. + * The index is not updated when writing an entity. + * Some index data may exist. + * + * Generated from protobuf enum DELETING = 3; + */ + const DELETING = 3; + /** + * The index was being created or deleted, but something went wrong. + * The index cannot by used by queries. + * There is no active long-running operation for the index, + * and the most recently finished long-running operation failed. + * The index is not updated when writing an entity. + * Some index data may exist. + * + * Generated from protobuf enum ERROR = 4; + */ + const ERROR = 4; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::CREATING => 'CREATING', + self::READY => 'READY', + self::DELETING => 'DELETING', + self::ERROR => 'ERROR', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\Datastore\Admin\V1\Index_State::class); + diff --git a/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/IndexOperationMetadata.php b/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/IndexOperationMetadata.php new file mode 100644 index 000000000000..78ebf07e1ff0 --- /dev/null +++ b/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/IndexOperationMetadata.php @@ -0,0 +1,155 @@ +google.datastore.admin.v1.IndexOperationMetadata + */ +class IndexOperationMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * Metadata common to all Datastore Admin operations. + * + * Generated from protobuf field .google.datastore.admin.v1.CommonMetadata common = 1; + */ + protected $common = null; + /** + * An estimate of the number of entities processed. + * + * Generated from protobuf field .google.datastore.admin.v1.Progress progress_entities = 2; + */ + protected $progress_entities = null; + /** + * The index resource ID that this operation is acting on. + * + * Generated from protobuf field string index_id = 3; + */ + protected $index_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Datastore\Admin\V1\CommonMetadata $common + * Metadata common to all Datastore Admin operations. + * @type \Google\Cloud\Datastore\Admin\V1\Progress $progress_entities + * An estimate of the number of entities processed. + * @type string $index_id + * The index resource ID that this operation is acting on. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Datastore\Admin\V1\DatastoreAdmin::initOnce(); + parent::__construct($data); + } + + /** + * Metadata common to all Datastore Admin operations. + * + * Generated from protobuf field .google.datastore.admin.v1.CommonMetadata common = 1; + * @return \Google\Cloud\Datastore\Admin\V1\CommonMetadata|null + */ + public function getCommon() + { + return $this->common; + } + + public function hasCommon() + { + return isset($this->common); + } + + public function clearCommon() + { + unset($this->common); + } + + /** + * Metadata common to all Datastore Admin operations. + * + * Generated from protobuf field .google.datastore.admin.v1.CommonMetadata common = 1; + * @param \Google\Cloud\Datastore\Admin\V1\CommonMetadata $var + * @return $this + */ + public function setCommon($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Datastore\Admin\V1\CommonMetadata::class); + $this->common = $var; + + return $this; + } + + /** + * An estimate of the number of entities processed. + * + * Generated from protobuf field .google.datastore.admin.v1.Progress progress_entities = 2; + * @return \Google\Cloud\Datastore\Admin\V1\Progress|null + */ + public function getProgressEntities() + { + return $this->progress_entities; + } + + public function hasProgressEntities() + { + return isset($this->progress_entities); + } + + public function clearProgressEntities() + { + unset($this->progress_entities); + } + + /** + * An estimate of the number of entities processed. + * + * Generated from protobuf field .google.datastore.admin.v1.Progress progress_entities = 2; + * @param \Google\Cloud\Datastore\Admin\V1\Progress $var + * @return $this + */ + public function setProgressEntities($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Datastore\Admin\V1\Progress::class); + $this->progress_entities = $var; + + return $this; + } + + /** + * The index resource ID that this operation is acting on. + * + * Generated from protobuf field string index_id = 3; + * @return string + */ + public function getIndexId() + { + return $this->index_id; + } + + /** + * The index resource ID that this operation is acting on. + * + * Generated from protobuf field string index_id = 3; + * @param string $var + * @return $this + */ + public function setIndexId($var) + { + GPBUtil::checkString($var, True); + $this->index_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/Index_AncestorMode.php b/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/Index_AncestorMode.php new file mode 100644 index 000000000000..656e50ede55a --- /dev/null +++ b/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/Index_AncestorMode.php @@ -0,0 +1,16 @@ +google.datastore.admin.v1.ListIndexesRequest + */ +class ListIndexesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Project ID against which to make the request. + * + * Generated from protobuf field string project_id = 1; + */ + protected $project_id = ''; + /** + * Generated from protobuf field string filter = 3; + */ + protected $filter = ''; + /** + * The maximum number of items to return. If zero, then all results will be + * returned. + * + * Generated from protobuf field int32 page_size = 4; + */ + protected $page_size = 0; + /** + * The next_page_token value returned from a previous List request, if any. + * + * Generated from protobuf field string page_token = 5; + */ + protected $page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $project_id + * Project ID against which to make the request. + * @type string $filter + * @type int $page_size + * The maximum number of items to return. If zero, then all results will be + * returned. + * @type string $page_token + * The next_page_token value returned from a previous List request, if any. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Datastore\Admin\V1\DatastoreAdmin::initOnce(); + parent::__construct($data); + } + + /** + * Project ID against which to make the request. + * + * Generated from protobuf field string project_id = 1; + * @return string + */ + public function getProjectId() + { + return $this->project_id; + } + + /** + * Project ID against which to make the request. + * + * Generated from protobuf field string project_id = 1; + * @param string $var + * @return $this + */ + public function setProjectId($var) + { + GPBUtil::checkString($var, True); + $this->project_id = $var; + + return $this; + } + + /** + * Generated from protobuf field string filter = 3; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Generated from protobuf field string filter = 3; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * The maximum number of items to return. If zero, then all results will be + * returned. + * + * Generated from protobuf field int32 page_size = 4; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of items to return. If zero, then all results will be + * returned. + * + * Generated from protobuf field int32 page_size = 4; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * The next_page_token value returned from a previous List request, if any. + * + * Generated from protobuf field string page_token = 5; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * The next_page_token value returned from a previous List request, if any. + * + * Generated from protobuf field string page_token = 5; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/ListIndexesResponse.php b/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/ListIndexesResponse.php new file mode 100644 index 000000000000..24c9caf57fab --- /dev/null +++ b/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/ListIndexesResponse.php @@ -0,0 +1,102 @@ +google.datastore.admin.v1.ListIndexesResponse + */ +class ListIndexesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The indexes. + * + * Generated from protobuf field repeated .google.datastore.admin.v1.Index indexes = 1; + */ + private $indexes; + /** + * The standard List next-page token. + * + * 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\Datastore\Admin\V1\Index>|\Google\Protobuf\Internal\RepeatedField $indexes + * The indexes. + * @type string $next_page_token + * The standard List next-page token. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Datastore\Admin\V1\DatastoreAdmin::initOnce(); + parent::__construct($data); + } + + /** + * The indexes. + * + * Generated from protobuf field repeated .google.datastore.admin.v1.Index indexes = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getIndexes() + { + return $this->indexes; + } + + /** + * The indexes. + * + * Generated from protobuf field repeated .google.datastore.admin.v1.Index indexes = 1; + * @param array<\Google\Cloud\Datastore\Admin\V1\Index>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setIndexes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Datastore\Admin\V1\Index::class); + $this->indexes = $arr; + + return $this; + } + + /** + * The standard List next-page token. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * The standard List next-page token. + * + * 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/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/MigrationProgressEvent.php b/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/MigrationProgressEvent.php new file mode 100644 index 000000000000..ad713f55b622 --- /dev/null +++ b/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/MigrationProgressEvent.php @@ -0,0 +1,152 @@ +google.datastore.admin.v1.MigrationProgressEvent + */ +class MigrationProgressEvent extends \Google\Protobuf\Internal\Message +{ + /** + * The step that is starting. + * An event with step set to `START` indicates that the migration + * has been reverted back to the initial pre-migration state. + * + * Generated from protobuf field .google.datastore.admin.v1.MigrationStep step = 1; + */ + protected $step = 0; + protected $step_details; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $step + * The step that is starting. + * An event with step set to `START` indicates that the migration + * has been reverted back to the initial pre-migration state. + * @type \Google\Cloud\Datastore\Admin\V1\MigrationProgressEvent\PrepareStepDetails $prepare_step_details + * Details for the `PREPARE` step. + * @type \Google\Cloud\Datastore\Admin\V1\MigrationProgressEvent\RedirectWritesStepDetails $redirect_writes_step_details + * Details for the `REDIRECT_WRITES` step. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Datastore\Admin\V1\Migration::initOnce(); + parent::__construct($data); + } + + /** + * The step that is starting. + * An event with step set to `START` indicates that the migration + * has been reverted back to the initial pre-migration state. + * + * Generated from protobuf field .google.datastore.admin.v1.MigrationStep step = 1; + * @return int + */ + public function getStep() + { + return $this->step; + } + + /** + * The step that is starting. + * An event with step set to `START` indicates that the migration + * has been reverted back to the initial pre-migration state. + * + * Generated from protobuf field .google.datastore.admin.v1.MigrationStep step = 1; + * @param int $var + * @return $this + */ + public function setStep($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Datastore\Admin\V1\MigrationStep::class); + $this->step = $var; + + return $this; + } + + /** + * Details for the `PREPARE` step. + * + * Generated from protobuf field .google.datastore.admin.v1.MigrationProgressEvent.PrepareStepDetails prepare_step_details = 2; + * @return \Google\Cloud\Datastore\Admin\V1\MigrationProgressEvent\PrepareStepDetails|null + */ + public function getPrepareStepDetails() + { + return $this->readOneof(2); + } + + public function hasPrepareStepDetails() + { + return $this->hasOneof(2); + } + + /** + * Details for the `PREPARE` step. + * + * Generated from protobuf field .google.datastore.admin.v1.MigrationProgressEvent.PrepareStepDetails prepare_step_details = 2; + * @param \Google\Cloud\Datastore\Admin\V1\MigrationProgressEvent\PrepareStepDetails $var + * @return $this + */ + public function setPrepareStepDetails($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Datastore\Admin\V1\MigrationProgressEvent\PrepareStepDetails::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * Details for the `REDIRECT_WRITES` step. + * + * Generated from protobuf field .google.datastore.admin.v1.MigrationProgressEvent.RedirectWritesStepDetails redirect_writes_step_details = 3; + * @return \Google\Cloud\Datastore\Admin\V1\MigrationProgressEvent\RedirectWritesStepDetails|null + */ + public function getRedirectWritesStepDetails() + { + return $this->readOneof(3); + } + + public function hasRedirectWritesStepDetails() + { + return $this->hasOneof(3); + } + + /** + * Details for the `REDIRECT_WRITES` step. + * + * Generated from protobuf field .google.datastore.admin.v1.MigrationProgressEvent.RedirectWritesStepDetails redirect_writes_step_details = 3; + * @param \Google\Cloud\Datastore\Admin\V1\MigrationProgressEvent\RedirectWritesStepDetails $var + * @return $this + */ + public function setRedirectWritesStepDetails($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Datastore\Admin\V1\MigrationProgressEvent\RedirectWritesStepDetails::class); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * @return string + */ + public function getStepDetails() + { + return $this->whichOneof("step_details"); + } + +} + diff --git a/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/MigrationProgressEvent/ConcurrencyMode.php b/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/MigrationProgressEvent/ConcurrencyMode.php new file mode 100644 index 000000000000..6ac75957b07a --- /dev/null +++ b/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/MigrationProgressEvent/ConcurrencyMode.php @@ -0,0 +1,71 @@ +google.datastore.admin.v1.MigrationProgressEvent.ConcurrencyMode + */ +class ConcurrencyMode +{ + /** + * Unspecified. + * + * Generated from protobuf enum CONCURRENCY_MODE_UNSPECIFIED = 0; + */ + const CONCURRENCY_MODE_UNSPECIFIED = 0; + /** + * Pessimistic concurrency. + * + * Generated from protobuf enum PESSIMISTIC = 1; + */ + const PESSIMISTIC = 1; + /** + * Optimistic concurrency. + * + * Generated from protobuf enum OPTIMISTIC = 2; + */ + const OPTIMISTIC = 2; + /** + * Optimistic concurrency with entity groups. + * + * Generated from protobuf enum OPTIMISTIC_WITH_ENTITY_GROUPS = 3; + */ + const OPTIMISTIC_WITH_ENTITY_GROUPS = 3; + + private static $valueToName = [ + self::CONCURRENCY_MODE_UNSPECIFIED => 'CONCURRENCY_MODE_UNSPECIFIED', + self::PESSIMISTIC => 'PESSIMISTIC', + self::OPTIMISTIC => 'OPTIMISTIC', + self::OPTIMISTIC_WITH_ENTITY_GROUPS => 'OPTIMISTIC_WITH_ENTITY_GROUPS', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ConcurrencyMode::class, \Google\Cloud\Datastore\Admin\V1\MigrationProgressEvent_ConcurrencyMode::class); + diff --git a/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/MigrationProgressEvent/PrepareStepDetails.php b/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/MigrationProgressEvent/PrepareStepDetails.php new file mode 100644 index 000000000000..9182ec0e8fc2 --- /dev/null +++ b/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/MigrationProgressEvent/PrepareStepDetails.php @@ -0,0 +1,74 @@ +google.datastore.admin.v1.MigrationProgressEvent.PrepareStepDetails + */ +class PrepareStepDetails extends \Google\Protobuf\Internal\Message +{ + /** + * The concurrency mode this database will use when it reaches the + * `REDIRECT_WRITES` step. + * + * Generated from protobuf field .google.datastore.admin.v1.MigrationProgressEvent.ConcurrencyMode concurrency_mode = 1; + */ + protected $concurrency_mode = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $concurrency_mode + * The concurrency mode this database will use when it reaches the + * `REDIRECT_WRITES` step. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Datastore\Admin\V1\Migration::initOnce(); + parent::__construct($data); + } + + /** + * The concurrency mode this database will use when it reaches the + * `REDIRECT_WRITES` step. + * + * Generated from protobuf field .google.datastore.admin.v1.MigrationProgressEvent.ConcurrencyMode concurrency_mode = 1; + * @return int + */ + public function getConcurrencyMode() + { + return $this->concurrency_mode; + } + + /** + * The concurrency mode this database will use when it reaches the + * `REDIRECT_WRITES` step. + * + * Generated from protobuf field .google.datastore.admin.v1.MigrationProgressEvent.ConcurrencyMode concurrency_mode = 1; + * @param int $var + * @return $this + */ + public function setConcurrencyMode($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Datastore\Admin\V1\MigrationProgressEvent\ConcurrencyMode::class); + $this->concurrency_mode = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(PrepareStepDetails::class, \Google\Cloud\Datastore\Admin\V1\MigrationProgressEvent_PrepareStepDetails::class); + diff --git a/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/MigrationProgressEvent/RedirectWritesStepDetails.php b/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/MigrationProgressEvent/RedirectWritesStepDetails.php new file mode 100644 index 000000000000..62927870dda3 --- /dev/null +++ b/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/MigrationProgressEvent/RedirectWritesStepDetails.php @@ -0,0 +1,70 @@ +google.datastore.admin.v1.MigrationProgressEvent.RedirectWritesStepDetails + */ +class RedirectWritesStepDetails extends \Google\Protobuf\Internal\Message +{ + /** + * Ths concurrency mode for this database. + * + * Generated from protobuf field .google.datastore.admin.v1.MigrationProgressEvent.ConcurrencyMode concurrency_mode = 1; + */ + protected $concurrency_mode = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $concurrency_mode + * Ths concurrency mode for this database. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Datastore\Admin\V1\Migration::initOnce(); + parent::__construct($data); + } + + /** + * Ths concurrency mode for this database. + * + * Generated from protobuf field .google.datastore.admin.v1.MigrationProgressEvent.ConcurrencyMode concurrency_mode = 1; + * @return int + */ + public function getConcurrencyMode() + { + return $this->concurrency_mode; + } + + /** + * Ths concurrency mode for this database. + * + * Generated from protobuf field .google.datastore.admin.v1.MigrationProgressEvent.ConcurrencyMode concurrency_mode = 1; + * @param int $var + * @return $this + */ + public function setConcurrencyMode($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Datastore\Admin\V1\MigrationProgressEvent\ConcurrencyMode::class); + $this->concurrency_mode = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(RedirectWritesStepDetails::class, \Google\Cloud\Datastore\Admin\V1\MigrationProgressEvent_RedirectWritesStepDetails::class); + diff --git a/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/MigrationProgressEvent_ConcurrencyMode.php b/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/MigrationProgressEvent_ConcurrencyMode.php new file mode 100644 index 000000000000..39c6bb126d8b --- /dev/null +++ b/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/MigrationProgressEvent_ConcurrencyMode.php @@ -0,0 +1,16 @@ +google.datastore.admin.v1.MigrationState + */ +class MigrationState +{ + /** + * Unspecified. + * + * Generated from protobuf enum MIGRATION_STATE_UNSPECIFIED = 0; + */ + const MIGRATION_STATE_UNSPECIFIED = 0; + /** + * The migration is running. + * + * Generated from protobuf enum RUNNING = 1; + */ + const RUNNING = 1; + /** + * The migration is paused. + * + * Generated from protobuf enum PAUSED = 2; + */ + const PAUSED = 2; + /** + * The migration is complete. + * + * Generated from protobuf enum COMPLETE = 3; + */ + const COMPLETE = 3; + + private static $valueToName = [ + self::MIGRATION_STATE_UNSPECIFIED => 'MIGRATION_STATE_UNSPECIFIED', + self::RUNNING => 'RUNNING', + self::PAUSED => 'PAUSED', + self::COMPLETE => 'COMPLETE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/MigrationStateEvent.php b/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/MigrationStateEvent.php new file mode 100644 index 000000000000..12ce4113a770 --- /dev/null +++ b/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/MigrationStateEvent.php @@ -0,0 +1,69 @@ +google.datastore.admin.v1.MigrationStateEvent + */ +class MigrationStateEvent extends \Google\Protobuf\Internal\Message +{ + /** + * The new state of the migration. + * + * Generated from protobuf field .google.datastore.admin.v1.MigrationState state = 1; + */ + protected $state = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $state + * The new state of the migration. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Datastore\Admin\V1\Migration::initOnce(); + parent::__construct($data); + } + + /** + * The new state of the migration. + * + * Generated from protobuf field .google.datastore.admin.v1.MigrationState state = 1; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * The new state of the migration. + * + * Generated from protobuf field .google.datastore.admin.v1.MigrationState state = 1; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Datastore\Admin\V1\MigrationState::class); + $this->state = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/MigrationStep.php b/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/MigrationStep.php new file mode 100644 index 000000000000..b20fab7b5f1a --- /dev/null +++ b/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/MigrationStep.php @@ -0,0 +1,97 @@ +google.datastore.admin.v1.MigrationStep + */ +class MigrationStep +{ + /** + * Unspecified. + * + * Generated from protobuf enum MIGRATION_STEP_UNSPECIFIED = 0; + */ + const MIGRATION_STEP_UNSPECIFIED = 0; + /** + * Pre-migration: the database is prepared for migration. + * + * Generated from protobuf enum PREPARE = 6; + */ + const PREPARE = 6; + /** + * Start of migration. + * + * Generated from protobuf enum START = 1; + */ + const START = 1; + /** + * Writes are applied synchronously to at least one replica. + * + * Generated from protobuf enum APPLY_WRITES_SYNCHRONOUSLY = 7; + */ + const APPLY_WRITES_SYNCHRONOUSLY = 7; + /** + * Data is copied to Cloud Firestore and then verified to match the data in + * Cloud Datastore. + * + * Generated from protobuf enum COPY_AND_VERIFY = 2; + */ + const COPY_AND_VERIFY = 2; + /** + * Eventually-consistent reads are redirected to Cloud Firestore. + * + * Generated from protobuf enum REDIRECT_EVENTUALLY_CONSISTENT_READS = 3; + */ + const REDIRECT_EVENTUALLY_CONSISTENT_READS = 3; + /** + * Strongly-consistent reads are redirected to Cloud Firestore. + * + * Generated from protobuf enum REDIRECT_STRONGLY_CONSISTENT_READS = 4; + */ + const REDIRECT_STRONGLY_CONSISTENT_READS = 4; + /** + * Writes are redirected to Cloud Firestore. + * + * Generated from protobuf enum REDIRECT_WRITES = 5; + */ + const REDIRECT_WRITES = 5; + + private static $valueToName = [ + self::MIGRATION_STEP_UNSPECIFIED => 'MIGRATION_STEP_UNSPECIFIED', + self::PREPARE => 'PREPARE', + self::START => 'START', + self::APPLY_WRITES_SYNCHRONOUSLY => 'APPLY_WRITES_SYNCHRONOUSLY', + self::COPY_AND_VERIFY => 'COPY_AND_VERIFY', + self::REDIRECT_EVENTUALLY_CONSISTENT_READS => 'REDIRECT_EVENTUALLY_CONSISTENT_READS', + self::REDIRECT_STRONGLY_CONSISTENT_READS => 'REDIRECT_STRONGLY_CONSISTENT_READS', + self::REDIRECT_WRITES => 'REDIRECT_WRITES', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/OperationType.php b/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/OperationType.php new file mode 100644 index 000000000000..f4a310a591f4 --- /dev/null +++ b/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/OperationType.php @@ -0,0 +1,75 @@ +google.datastore.admin.v1.OperationType + */ +class OperationType +{ + /** + * Unspecified. + * + * Generated from protobuf enum OPERATION_TYPE_UNSPECIFIED = 0; + */ + const OPERATION_TYPE_UNSPECIFIED = 0; + /** + * ExportEntities. + * + * Generated from protobuf enum EXPORT_ENTITIES = 1; + */ + const EXPORT_ENTITIES = 1; + /** + * ImportEntities. + * + * Generated from protobuf enum IMPORT_ENTITIES = 2; + */ + const IMPORT_ENTITIES = 2; + /** + * CreateIndex. + * + * Generated from protobuf enum CREATE_INDEX = 3; + */ + const CREATE_INDEX = 3; + /** + * DeleteIndex. + * + * Generated from protobuf enum DELETE_INDEX = 4; + */ + const DELETE_INDEX = 4; + + private static $valueToName = [ + self::OPERATION_TYPE_UNSPECIFIED => 'OPERATION_TYPE_UNSPECIFIED', + self::EXPORT_ENTITIES => 'EXPORT_ENTITIES', + self::IMPORT_ENTITIES => 'IMPORT_ENTITIES', + self::CREATE_INDEX => 'CREATE_INDEX', + self::DELETE_INDEX => 'DELETE_INDEX', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/Progress.php b/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/Progress.php new file mode 100644 index 000000000000..698275844e5b --- /dev/null +++ b/owl-bot-staging/DatastoreAdmin/v1/proto/src/Google/Cloud/Datastore/Admin/V1/Progress.php @@ -0,0 +1,109 @@ +google.datastore.admin.v1.Progress + */ +class Progress extends \Google\Protobuf\Internal\Message +{ + /** + * The amount of work that has been completed. Note that this may be greater + * than work_estimated. + * + * Generated from protobuf field int64 work_completed = 1; + */ + protected $work_completed = 0; + /** + * An estimate of how much work needs to be performed. May be zero if the + * work estimate is unavailable. + * + * Generated from protobuf field int64 work_estimated = 2; + */ + protected $work_estimated = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int|string $work_completed + * The amount of work that has been completed. Note that this may be greater + * than work_estimated. + * @type int|string $work_estimated + * An estimate of how much work needs to be performed. May be zero if the + * work estimate is unavailable. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Datastore\Admin\V1\DatastoreAdmin::initOnce(); + parent::__construct($data); + } + + /** + * The amount of work that has been completed. Note that this may be greater + * than work_estimated. + * + * Generated from protobuf field int64 work_completed = 1; + * @return int|string + */ + public function getWorkCompleted() + { + return $this->work_completed; + } + + /** + * The amount of work that has been completed. Note that this may be greater + * than work_estimated. + * + * Generated from protobuf field int64 work_completed = 1; + * @param int|string $var + * @return $this + */ + public function setWorkCompleted($var) + { + GPBUtil::checkInt64($var); + $this->work_completed = $var; + + return $this; + } + + /** + * An estimate of how much work needs to be performed. May be zero if the + * work estimate is unavailable. + * + * Generated from protobuf field int64 work_estimated = 2; + * @return int|string + */ + public function getWorkEstimated() + { + return $this->work_estimated; + } + + /** + * An estimate of how much work needs to be performed. May be zero if the + * work estimate is unavailable. + * + * Generated from protobuf field int64 work_estimated = 2; + * @param int|string $var + * @return $this + */ + public function setWorkEstimated($var) + { + GPBUtil::checkInt64($var); + $this->work_estimated = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DatastoreAdmin/v1/samples/V1/DatastoreAdminClient/create_index.php b/owl-bot-staging/DatastoreAdmin/v1/samples/V1/DatastoreAdminClient/create_index.php new file mode 100644 index 000000000000..c572c60e0fde --- /dev/null +++ b/owl-bot-staging/DatastoreAdmin/v1/samples/V1/DatastoreAdminClient/create_index.php @@ -0,0 +1,82 @@ +createIndex($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Index $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()); + } +} +// [END datastore_v1_generated_DatastoreAdmin_CreateIndex_sync] diff --git a/owl-bot-staging/DatastoreAdmin/v1/samples/V1/DatastoreAdminClient/delete_index.php b/owl-bot-staging/DatastoreAdmin/v1/samples/V1/DatastoreAdminClient/delete_index.php new file mode 100644 index 000000000000..e8e8a6153ffe --- /dev/null +++ b/owl-bot-staging/DatastoreAdmin/v1/samples/V1/DatastoreAdminClient/delete_index.php @@ -0,0 +1,78 @@ +deleteIndex($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Index $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()); + } +} +// [END datastore_v1_generated_DatastoreAdmin_DeleteIndex_sync] diff --git a/owl-bot-staging/DatastoreAdmin/v1/samples/V1/DatastoreAdminClient/export_entities.php b/owl-bot-staging/DatastoreAdmin/v1/samples/V1/DatastoreAdminClient/export_entities.php new file mode 100644 index 000000000000..fd033dfe21c6 --- /dev/null +++ b/owl-bot-staging/DatastoreAdmin/v1/samples/V1/DatastoreAdminClient/export_entities.php @@ -0,0 +1,109 @@ +setProjectId($projectId) + ->setOutputUrlPrefix($outputUrlPrefix); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $datastoreAdminClient->exportEntities($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var ExportEntitiesResponse $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 +{ + $projectId = '[PROJECT_ID]'; + $outputUrlPrefix = '[OUTPUT_URL_PREFIX]'; + + export_entities_sample($projectId, $outputUrlPrefix); +} +// [END datastore_v1_generated_DatastoreAdmin_ExportEntities_sync] diff --git a/owl-bot-staging/DatastoreAdmin/v1/samples/V1/DatastoreAdminClient/get_index.php b/owl-bot-staging/DatastoreAdmin/v1/samples/V1/DatastoreAdminClient/get_index.php new file mode 100644 index 000000000000..f435a5846b75 --- /dev/null +++ b/owl-bot-staging/DatastoreAdmin/v1/samples/V1/DatastoreAdminClient/get_index.php @@ -0,0 +1,57 @@ +getIndex($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END datastore_v1_generated_DatastoreAdmin_GetIndex_sync] diff --git a/owl-bot-staging/DatastoreAdmin/v1/samples/V1/DatastoreAdminClient/import_entities.php b/owl-bot-staging/DatastoreAdmin/v1/samples/V1/DatastoreAdminClient/import_entities.php new file mode 100644 index 000000000000..e0a340886762 --- /dev/null +++ b/owl-bot-staging/DatastoreAdmin/v1/samples/V1/DatastoreAdminClient/import_entities.php @@ -0,0 +1,98 @@ +setProjectId($projectId) + ->setInputUrl($inputUrl); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $datastoreAdminClient->importEntities($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + printf('Operation completed successfully.' . PHP_EOL); + } 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 +{ + $projectId = '[PROJECT_ID]'; + $inputUrl = '[INPUT_URL]'; + + import_entities_sample($projectId, $inputUrl); +} +// [END datastore_v1_generated_DatastoreAdmin_ImportEntities_sync] diff --git a/owl-bot-staging/DatastoreAdmin/v1/samples/V1/DatastoreAdminClient/list_indexes.php b/owl-bot-staging/DatastoreAdmin/v1/samples/V1/DatastoreAdminClient/list_indexes.php new file mode 100644 index 000000000000..f5b9703118d4 --- /dev/null +++ b/owl-bot-staging/DatastoreAdmin/v1/samples/V1/DatastoreAdminClient/list_indexes.php @@ -0,0 +1,64 @@ +listIndexes($request); + + /** @var Index $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()); + } +} +// [END datastore_v1_generated_DatastoreAdmin_ListIndexes_sync] diff --git a/owl-bot-staging/DatastoreAdmin/v1/src/V1/Client/BaseClient/DatastoreAdminBaseClient.php b/owl-bot-staging/DatastoreAdmin/v1/src/V1/Client/BaseClient/DatastoreAdminBaseClient.php new file mode 100644 index 000000000000..f3b056ae840a --- /dev/null +++ b/owl-bot-staging/DatastoreAdmin/v1/src/V1/Client/BaseClient/DatastoreAdminBaseClient.php @@ -0,0 +1,448 @@ + self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../../resources/datastore_admin_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../../resources/datastore_admin_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../../resources/datastore_admin_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../../resources/datastore_admin_rest_client_config.php', + ], + ], + ]; + } + + /** + * 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; + } + + /** + * 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 'datastore.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. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *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' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods 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 the specified index. + * A newly created index's initial state is `CREATING`. On completion of the + * returned [google.longrunning.Operation][google.longrunning.Operation], the state will be `READY`. + * If the index already exists, the call will return an `ALREADY_EXISTS` + * status. + * + * During index creation, the process could result in an error, in which + * case the index will move to the `ERROR` state. The process can be recovered + * by fixing the data that caused the error, removing the index with + * [delete][google.datastore.admin.v1.DatastoreAdmin.DeleteIndex], then + * re-creating the index with [create] + * [google.datastore.admin.v1.DatastoreAdmin.CreateIndex]. + * + * Indexes with a single property cannot be created. + * + * The async variant is {@see self::createIndexAsync()} . + * + * @param CreateIndexRequest $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 createIndex(CreateIndexRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('CreateIndex', $request, $callOptions)->wait(); + } + + /** + * Deletes an existing index. + * An index can only be deleted if it is in a `READY` or `ERROR` state. On + * successful execution of the request, the index will be in a `DELETING` + * [state][google.datastore.admin.v1.Index.State]. And on completion of the + * returned [google.longrunning.Operation][google.longrunning.Operation], the index will be removed. + * + * During index deletion, the process could result in an error, in which + * case the index will move to the `ERROR` state. The process can be recovered + * by fixing the data that caused the error, followed by calling + * [delete][google.datastore.admin.v1.DatastoreAdmin.DeleteIndex] again. + * + * The async variant is {@see self::deleteIndexAsync()} . + * + * @param DeleteIndexRequest $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 deleteIndex(DeleteIndexRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('DeleteIndex', $request, $callOptions)->wait(); + } + + /** + * Exports a copy of all or a subset of entities from Google Cloud Datastore + * to another storage system, such as Google Cloud Storage. Recent updates to + * entities may not be reflected in the export. The export occurs in the + * background and its progress can be monitored and managed via the + * Operation resource that is created. The output of an export may only be + * used once the associated operation is done. If an export operation is + * cancelled before completion it may leave partial data behind in Google + * Cloud Storage. + * + * The async variant is {@see self::exportEntitiesAsync()} . + * + * @param ExportEntitiesRequest $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 exportEntities(ExportEntitiesRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('ExportEntities', $request, $callOptions)->wait(); + } + + /** + * Gets an index. + * + * The async variant is {@see self::getIndexAsync()} . + * + * @param GetIndexRequest $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 Index + * + * @throws ApiException Thrown if the API call fails. + */ + public function getIndex(GetIndexRequest $request, array $callOptions = []): Index + { + return $this->startApiCall('GetIndex', $request, $callOptions)->wait(); + } + + /** + * Imports entities into Google Cloud Datastore. Existing entities with the + * same key are overwritten. The import occurs in the background and its + * progress can be monitored and managed via the Operation resource that is + * created. If an ImportEntities operation is cancelled, it is possible + * that a subset of the data has already been imported to Cloud Datastore. + * + * The async variant is {@see self::importEntitiesAsync()} . + * + * @param ImportEntitiesRequest $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 importEntities(ImportEntitiesRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('ImportEntities', $request, $callOptions)->wait(); + } + + /** + * Lists the indexes that match the specified filters. Datastore uses an + * eventually consistent query to fetch the list of indexes and may + * occasionally return stale results. + * + * The async variant is {@see self::listIndexesAsync()} . + * + * @param ListIndexesRequest $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 listIndexes(ListIndexesRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListIndexes', $request, $callOptions); + } +} diff --git a/owl-bot-staging/DatastoreAdmin/v1/src/V1/Client/DatastoreAdminClient.php b/owl-bot-staging/DatastoreAdmin/v1/src/V1/Client/DatastoreAdminClient.php new file mode 100644 index 000000000000..7b6254c8a128 --- /dev/null +++ b/owl-bot-staging/DatastoreAdmin/v1/src/V1/Client/DatastoreAdminClient.php @@ -0,0 +1,40 @@ +createIndex(); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $datastoreAdminClient->createIndex(); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $datastoreAdminClient->resumeOperation($operationName, 'createIndex'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $datastoreAdminClient->close(); + * } + * ``` + */ +class DatastoreAdminGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.datastore.admin.v1.DatastoreAdmin'; + + /** The default address of the service. */ + const SERVICE_ADDRESS = 'datastore.googleapis.com'; + + /** The default port of the service. */ + const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/datastore', + ]; + + private $operationsClient; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/datastore_admin_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/datastore_admin_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/datastore_admin_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/datastore_admin_rest_client_config.php', + ], + ], + ]; + } + + /** + * 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; + } + + /** + * 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 'datastore.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. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *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' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods 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); + } + + /** + * Creates the specified index. + * A newly created index's initial state is `CREATING`. On completion of the + * returned [google.longrunning.Operation][google.longrunning.Operation], the state will be `READY`. + * If the index already exists, the call will return an `ALREADY_EXISTS` + * status. + * + * During index creation, the process could result in an error, in which + * case the index will move to the `ERROR` state. The process can be recovered + * by fixing the data that caused the error, removing the index with + * [delete][google.datastore.admin.v1.DatastoreAdmin.DeleteIndex], then + * re-creating the index with [create] + * [google.datastore.admin.v1.DatastoreAdmin.CreateIndex]. + * + * Indexes with a single property cannot be created. + * + * Sample code: + * ``` + * $datastoreAdminClient = new DatastoreAdminClient(); + * try { + * $operationResponse = $datastoreAdminClient->createIndex(); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $datastoreAdminClient->createIndex(); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $datastoreAdminClient->resumeOperation($operationName, 'createIndex'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $datastoreAdminClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $projectId + * Project ID against which to make the request. + * @type Index $index + * The index to create. The name and state fields are output only and will be + * ignored. Single property indexes cannot be created or deleted. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function createIndex(array $optionalArgs = []) + { + $request = new CreateIndexRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['projectId'])) { + $request->setProjectId($optionalArgs['projectId']); + $requestParamHeaders['project_id'] = $optionalArgs['projectId']; + } + + if (isset($optionalArgs['index'])) { + $request->setIndex($optionalArgs['index']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateIndex', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Deletes an existing index. + * An index can only be deleted if it is in a `READY` or `ERROR` state. On + * successful execution of the request, the index will be in a `DELETING` + * [state][google.datastore.admin.v1.Index.State]. And on completion of the + * returned [google.longrunning.Operation][google.longrunning.Operation], the index will be removed. + * + * During index deletion, the process could result in an error, in which + * case the index will move to the `ERROR` state. The process can be recovered + * by fixing the data that caused the error, followed by calling + * [delete][google.datastore.admin.v1.DatastoreAdmin.DeleteIndex] again. + * + * Sample code: + * ``` + * $datastoreAdminClient = new DatastoreAdminClient(); + * try { + * $operationResponse = $datastoreAdminClient->deleteIndex(); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $datastoreAdminClient->deleteIndex(); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $datastoreAdminClient->resumeOperation($operationName, 'deleteIndex'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $datastoreAdminClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $projectId + * Project ID against which to make the request. + * @type string $indexId + * The resource ID of the index to delete. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function deleteIndex(array $optionalArgs = []) + { + $request = new DeleteIndexRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['projectId'])) { + $request->setProjectId($optionalArgs['projectId']); + $requestParamHeaders['project_id'] = $optionalArgs['projectId']; + } + + if (isset($optionalArgs['indexId'])) { + $request->setIndexId($optionalArgs['indexId']); + $requestParamHeaders['index_id'] = $optionalArgs['indexId']; + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('DeleteIndex', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Exports a copy of all or a subset of entities from Google Cloud Datastore + * to another storage system, such as Google Cloud Storage. Recent updates to + * entities may not be reflected in the export. The export occurs in the + * background and its progress can be monitored and managed via the + * Operation resource that is created. The output of an export may only be + * used once the associated operation is done. If an export operation is + * cancelled before completion it may leave partial data behind in Google + * Cloud Storage. + * + * Sample code: + * ``` + * $datastoreAdminClient = new DatastoreAdminClient(); + * try { + * $projectId = 'project_id'; + * $outputUrlPrefix = 'output_url_prefix'; + * $operationResponse = $datastoreAdminClient->exportEntities($projectId, $outputUrlPrefix); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $datastoreAdminClient->exportEntities($projectId, $outputUrlPrefix); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $datastoreAdminClient->resumeOperation($operationName, 'exportEntities'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $datastoreAdminClient->close(); + * } + * ``` + * + * @param string $projectId Required. Project ID against which to make the request. + * @param string $outputUrlPrefix Required. Location for the export metadata and data files. + * + * The full resource URL of the external storage location. Currently, only + * Google Cloud Storage is supported. So output_url_prefix should be of the + * form: `gs://BUCKET_NAME[/NAMESPACE_PATH]`, where `BUCKET_NAME` is the + * name of the Cloud Storage bucket and `NAMESPACE_PATH` is an optional Cloud + * Storage namespace path (this is not a Cloud Datastore namespace). For more + * information about Cloud Storage namespace paths, see + * [Object name + * considerations](https://cloud.google.com/storage/docs/naming#object-considerations). + * + * The resulting files will be nested deeper than the specified URL prefix. + * The final output URL will be provided in the + * [google.datastore.admin.v1.ExportEntitiesResponse.output_url][google.datastore.admin.v1.ExportEntitiesResponse.output_url] field. That + * value should be used for subsequent ImportEntities operations. + * + * By nesting the data files deeper, the same Cloud Storage bucket can be used + * in multiple ExportEntities operations without conflict. + * @param array $optionalArgs { + * Optional. + * + * @type array $labels + * Client-assigned labels. + * @type EntityFilter $entityFilter + * Description of what data from the project is included in the export. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function exportEntities($projectId, $outputUrlPrefix, array $optionalArgs = []) + { + $request = new ExportEntitiesRequest(); + $requestParamHeaders = []; + $request->setProjectId($projectId); + $request->setOutputUrlPrefix($outputUrlPrefix); + $requestParamHeaders['project_id'] = $projectId; + if (isset($optionalArgs['labels'])) { + $request->setLabels($optionalArgs['labels']); + } + + if (isset($optionalArgs['entityFilter'])) { + $request->setEntityFilter($optionalArgs['entityFilter']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('ExportEntities', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Gets an index. + * + * Sample code: + * ``` + * $datastoreAdminClient = new DatastoreAdminClient(); + * try { + * $response = $datastoreAdminClient->getIndex(); + * } finally { + * $datastoreAdminClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $projectId + * Project ID against which to make the request. + * @type string $indexId + * The resource ID of the index to get. + * @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 \Google\Cloud\Datastore\Admin\V1\Index + * + * @throws ApiException if the remote call fails + */ + public function getIndex(array $optionalArgs = []) + { + $request = new GetIndexRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['projectId'])) { + $request->setProjectId($optionalArgs['projectId']); + $requestParamHeaders['project_id'] = $optionalArgs['projectId']; + } + + if (isset($optionalArgs['indexId'])) { + $request->setIndexId($optionalArgs['indexId']); + $requestParamHeaders['index_id'] = $optionalArgs['indexId']; + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetIndex', Index::class, $optionalArgs, $request)->wait(); + } + + /** + * Imports entities into Google Cloud Datastore. Existing entities with the + * same key are overwritten. The import occurs in the background and its + * progress can be monitored and managed via the Operation resource that is + * created. If an ImportEntities operation is cancelled, it is possible + * that a subset of the data has already been imported to Cloud Datastore. + * + * Sample code: + * ``` + * $datastoreAdminClient = new DatastoreAdminClient(); + * try { + * $projectId = 'project_id'; + * $inputUrl = 'input_url'; + * $operationResponse = $datastoreAdminClient->importEntities($projectId, $inputUrl); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $datastoreAdminClient->importEntities($projectId, $inputUrl); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $datastoreAdminClient->resumeOperation($operationName, 'importEntities'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $datastoreAdminClient->close(); + * } + * ``` + * + * @param string $projectId Required. Project ID against which to make the request. + * @param string $inputUrl Required. The full resource URL of the external storage location. Currently, only + * Google Cloud Storage is supported. So input_url should be of the form: + * `gs://BUCKET_NAME[/NAMESPACE_PATH]/OVERALL_EXPORT_METADATA_FILE`, where + * `BUCKET_NAME` is the name of the Cloud Storage bucket, `NAMESPACE_PATH` is + * an optional Cloud Storage namespace path (this is not a Cloud Datastore + * namespace), and `OVERALL_EXPORT_METADATA_FILE` is the metadata file written + * by the ExportEntities operation. For more information about Cloud Storage + * namespace paths, see + * [Object name + * considerations](https://cloud.google.com/storage/docs/naming#object-considerations). + * + * For more information, see + * [google.datastore.admin.v1.ExportEntitiesResponse.output_url][google.datastore.admin.v1.ExportEntitiesResponse.output_url]. + * @param array $optionalArgs { + * Optional. + * + * @type array $labels + * Client-assigned labels. + * @type EntityFilter $entityFilter + * Optionally specify which kinds/namespaces are to be imported. If provided, + * the list must be a subset of the EntityFilter used in creating the export, + * otherwise a FAILED_PRECONDITION error will be returned. If no filter is + * specified then all entities from the export are imported. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function importEntities($projectId, $inputUrl, array $optionalArgs = []) + { + $request = new ImportEntitiesRequest(); + $requestParamHeaders = []; + $request->setProjectId($projectId); + $request->setInputUrl($inputUrl); + $requestParamHeaders['project_id'] = $projectId; + if (isset($optionalArgs['labels'])) { + $request->setLabels($optionalArgs['labels']); + } + + if (isset($optionalArgs['entityFilter'])) { + $request->setEntityFilter($optionalArgs['entityFilter']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('ImportEntities', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Lists the indexes that match the specified filters. Datastore uses an + * eventually consistent query to fetch the list of indexes and may + * occasionally return stale results. + * + * Sample code: + * ``` + * $datastoreAdminClient = new DatastoreAdminClient(); + * try { + * // Iterate over pages of elements + * $pagedResponse = $datastoreAdminClient->listIndexes(); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $datastoreAdminClient->listIndexes(); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $datastoreAdminClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $projectId + * Project ID against which to make the request. + * @type string $filter + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @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 \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listIndexes(array $optionalArgs = []) + { + $request = new ListIndexesRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['projectId'])) { + $request->setProjectId($optionalArgs['projectId']); + $requestParamHeaders['project_id'] = $optionalArgs['projectId']; + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListIndexes', $optionalArgs, ListIndexesResponse::class, $request); + } +} diff --git a/owl-bot-staging/DatastoreAdmin/v1/src/V1/gapic_metadata.json b/owl-bot-staging/DatastoreAdmin/v1/src/V1/gapic_metadata.json new file mode 100644 index 000000000000..3f24235779cc --- /dev/null +++ b/owl-bot-staging/DatastoreAdmin/v1/src/V1/gapic_metadata.json @@ -0,0 +1,48 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services\/RPCs to the corresponding library clients\/methods", + "language": "php", + "protoPackage": "google.datastore.admin.v1", + "libraryPackage": "Google\\Cloud\\Datastore\\Admin\\V1", + "services": { + "DatastoreAdmin": { + "clients": { + "grpc": { + "libraryClient": "DatastoreAdminGapicClient", + "rpcs": { + "CreateIndex": { + "methods": [ + "createIndex" + ] + }, + "DeleteIndex": { + "methods": [ + "deleteIndex" + ] + }, + "ExportEntities": { + "methods": [ + "exportEntities" + ] + }, + "GetIndex": { + "methods": [ + "getIndex" + ] + }, + "ImportEntities": { + "methods": [ + "importEntities" + ] + }, + "ListIndexes": { + "methods": [ + "listIndexes" + ] + } + } + } + } + } + } +} \ No newline at end of file diff --git a/owl-bot-staging/DatastoreAdmin/v1/src/V1/resources/datastore_admin_client_config.json b/owl-bot-staging/DatastoreAdmin/v1/src/V1/resources/datastore_admin_client_config.json new file mode 100644 index 000000000000..42085b1e5e25 --- /dev/null +++ b/owl-bot-staging/DatastoreAdmin/v1/src/V1/resources/datastore_admin_client_config.json @@ -0,0 +1,75 @@ +{ + "interfaces": { + "google.datastore.admin.v1.DatastoreAdmin": { + "retry_codes": { + "no_retry_codes": [], + "no_retry_1_codes": [], + "retry_policy_1_codes": [ + "UNAVAILABLE", + "DEADLINE_EXCEEDED" + ] + }, + "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 + }, + "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 + }, + "retry_policy_1_params": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 60000 + } + }, + "methods": { + "CreateIndex": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "DeleteIndex": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "ExportEntities": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "GetIndex": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ImportEntities": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "ListIndexes": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + } + } + } + } +} diff --git a/owl-bot-staging/DatastoreAdmin/v1/src/V1/resources/datastore_admin_descriptor_config.php b/owl-bot-staging/DatastoreAdmin/v1/src/V1/resources/datastore_admin_descriptor_config.php new file mode 100644 index 000000000000..e2891b13099f --- /dev/null +++ b/owl-bot-staging/DatastoreAdmin/v1/src/V1/resources/datastore_admin_descriptor_config.php @@ -0,0 +1,128 @@ + [ + 'google.datastore.admin.v1.DatastoreAdmin' => [ + 'CreateIndex' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Datastore\Admin\V1\Index', + 'metadataReturnType' => '\Google\Cloud\Datastore\Admin\V1\IndexOperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'project_id', + 'fieldAccessors' => [ + 'getProjectId', + ], + ], + ], + ], + 'DeleteIndex' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Datastore\Admin\V1\Index', + 'metadataReturnType' => '\Google\Cloud\Datastore\Admin\V1\IndexOperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'project_id', + 'fieldAccessors' => [ + 'getProjectId', + ], + ], + [ + 'keyName' => 'index_id', + 'fieldAccessors' => [ + 'getIndexId', + ], + ], + ], + ], + 'ExportEntities' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Datastore\Admin\V1\ExportEntitiesResponse', + 'metadataReturnType' => '\Google\Cloud\Datastore\Admin\V1\ExportEntitiesMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'project_id', + 'fieldAccessors' => [ + 'getProjectId', + ], + ], + ], + ], + 'ImportEntities' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\Datastore\Admin\V1\ImportEntitiesMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'project_id', + 'fieldAccessors' => [ + 'getProjectId', + ], + ], + ], + ], + 'GetIndex' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Datastore\Admin\V1\Index', + 'headerParams' => [ + [ + 'keyName' => 'project_id', + 'fieldAccessors' => [ + 'getProjectId', + ], + ], + [ + 'keyName' => 'index_id', + 'fieldAccessors' => [ + 'getIndexId', + ], + ], + ], + ], + 'ListIndexes' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getIndexes', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Datastore\Admin\V1\ListIndexesResponse', + 'headerParams' => [ + [ + 'keyName' => 'project_id', + 'fieldAccessors' => [ + 'getProjectId', + ], + ], + ], + ], + ], + ], +]; diff --git a/owl-bot-staging/DatastoreAdmin/v1/src/V1/resources/datastore_admin_rest_client_config.php b/owl-bot-staging/DatastoreAdmin/v1/src/V1/resources/datastore_admin_rest_client_config.php new file mode 100644 index 000000000000..08331544a7e6 --- /dev/null +++ b/owl-bot-staging/DatastoreAdmin/v1/src/V1/resources/datastore_admin_rest_client_config.php @@ -0,0 +1,134 @@ + [ + 'google.datastore.admin.v1.DatastoreAdmin' => [ + 'CreateIndex' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/projects/{project_id}/indexes', + 'body' => 'index', + 'placeholders' => [ + 'project_id' => [ + 'getters' => [ + 'getProjectId', + ], + ], + ], + ], + 'DeleteIndex' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/projects/{project_id}/indexes/{index_id}', + 'placeholders' => [ + 'index_id' => [ + 'getters' => [ + 'getIndexId', + ], + ], + 'project_id' => [ + 'getters' => [ + 'getProjectId', + ], + ], + ], + ], + 'ExportEntities' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/projects/{project_id}:export', + 'body' => '*', + 'placeholders' => [ + 'project_id' => [ + 'getters' => [ + 'getProjectId', + ], + ], + ], + ], + 'GetIndex' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/projects/{project_id}/indexes/{index_id}', + 'placeholders' => [ + 'index_id' => [ + 'getters' => [ + 'getIndexId', + ], + ], + 'project_id' => [ + 'getters' => [ + 'getProjectId', + ], + ], + ], + ], + 'ImportEntities' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/projects/{project_id}:import', + 'body' => '*', + 'placeholders' => [ + 'project_id' => [ + 'getters' => [ + 'getProjectId', + ], + ], + ], + ], + 'ListIndexes' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/projects/{project_id}/indexes', + 'placeholders' => [ + 'project_id' => [ + 'getters' => [ + 'getProjectId', + ], + ], + ], + ], + ], + 'google.longrunning.Operations' => [ + 'CancelOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/operations/*}:cancel', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteOperation' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetOperation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListOperations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*}/operations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/DatastoreAdmin/v1/tests/Unit/V1/Client/DatastoreAdminClientTest.php b/owl-bot-staging/DatastoreAdmin/v1/tests/Unit/V1/Client/DatastoreAdminClientTest.php new file mode 100644 index 000000000000..f183c3c2f2ce --- /dev/null +++ b/owl-bot-staging/DatastoreAdmin/v1/tests/Unit/V1/Client/DatastoreAdminClientTest.php @@ -0,0 +1,757 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return DatastoreAdminClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new DatastoreAdminClient($options); + } + + /** @test */ + public function createIndexTest() + { + $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/createIndexTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $projectId2 = 'projectId2939242356'; + $indexId = 'indexId112508840'; + $kind = 'kind3292052'; + $expectedResponse = new Index(); + $expectedResponse->setProjectId($projectId2); + $expectedResponse->setIndexId($indexId); + $expectedResponse->setKind($kind); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createIndexTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + $request = new CreateIndexRequest(); + $response = $gapicClient->createIndex($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.datastore.admin.v1.DatastoreAdmin/CreateIndex', $actualApiFuncCall); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createIndexTest'); + $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 createIndexExceptionTest() + { + $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/createIndexTest'); + $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); + $request = new CreateIndexRequest(); + $response = $gapicClient->createIndex($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createIndexTest'); + 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 deleteIndexTest() + { + $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/deleteIndexTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $projectId2 = 'projectId2939242356'; + $indexId2 = 'indexId2746815835'; + $kind = 'kind3292052'; + $expectedResponse = new Index(); + $expectedResponse->setProjectId($projectId2); + $expectedResponse->setIndexId($indexId2); + $expectedResponse->setKind($kind); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteIndexTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + $request = new DeleteIndexRequest(); + $response = $gapicClient->deleteIndex($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.datastore.admin.v1.DatastoreAdmin/DeleteIndex', $actualApiFuncCall); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteIndexTest'); + $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 deleteIndexExceptionTest() + { + $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/deleteIndexTest'); + $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); + $request = new DeleteIndexRequest(); + $response = $gapicClient->deleteIndex($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteIndexTest'); + 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 exportEntitiesTest() + { + $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/exportEntitiesTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $outputUrl = 'outputUrl-1273518799'; + $expectedResponse = new ExportEntitiesResponse(); + $expectedResponse->setOutputUrl($outputUrl); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/exportEntitiesTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $projectId = 'projectId-1969970175'; + $outputUrlPrefix = 'outputUrlPrefix1058210144'; + $request = (new ExportEntitiesRequest()) + ->setProjectId($projectId) + ->setOutputUrlPrefix($outputUrlPrefix); + $response = $gapicClient->exportEntities($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.datastore.admin.v1.DatastoreAdmin/ExportEntities', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getProjectId(); + $this->assertProtobufEquals($projectId, $actualValue); + $actualValue = $actualApiRequestObject->getOutputUrlPrefix(); + $this->assertProtobufEquals($outputUrlPrefix, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/exportEntitiesTest'); + $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 exportEntitiesExceptionTest() + { + $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/exportEntitiesTest'); + $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 + $projectId = 'projectId-1969970175'; + $outputUrlPrefix = 'outputUrlPrefix1058210144'; + $request = (new ExportEntitiesRequest()) + ->setProjectId($projectId) + ->setOutputUrlPrefix($outputUrlPrefix); + $response = $gapicClient->exportEntities($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/exportEntitiesTest'); + 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 getIndexTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $projectId2 = 'projectId2939242356'; + $indexId2 = 'indexId2746815835'; + $kind = 'kind3292052'; + $expectedResponse = new Index(); + $expectedResponse->setProjectId($projectId2); + $expectedResponse->setIndexId($indexId2); + $expectedResponse->setKind($kind); + $transport->addResponse($expectedResponse); + $request = new GetIndexRequest(); + $response = $gapicClient->getIndex($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.datastore.admin.v1.DatastoreAdmin/GetIndex', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getIndexExceptionTest() + { + $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); + $request = new GetIndexRequest(); + try { + $gapicClient->getIndex($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 importEntitiesTest() + { + $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/importEntitiesTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/importEntitiesTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $projectId = 'projectId-1969970175'; + $inputUrl = 'inputUrl1707300730'; + $request = (new ImportEntitiesRequest()) + ->setProjectId($projectId) + ->setInputUrl($inputUrl); + $response = $gapicClient->importEntities($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.datastore.admin.v1.DatastoreAdmin/ImportEntities', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getProjectId(); + $this->assertProtobufEquals($projectId, $actualValue); + $actualValue = $actualApiRequestObject->getInputUrl(); + $this->assertProtobufEquals($inputUrl, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/importEntitiesTest'); + $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 importEntitiesExceptionTest() + { + $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/importEntitiesTest'); + $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 + $projectId = 'projectId-1969970175'; + $inputUrl = 'inputUrl1707300730'; + $request = (new ImportEntitiesRequest()) + ->setProjectId($projectId) + ->setInputUrl($inputUrl); + $response = $gapicClient->importEntities($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/importEntitiesTest'); + 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 listIndexesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $indexesElement = new Index(); + $indexes = [ + $indexesElement, + ]; + $expectedResponse = new ListIndexesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setIndexes($indexes); + $transport->addResponse($expectedResponse); + $request = new ListIndexesRequest(); + $response = $gapicClient->listIndexes($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getIndexes()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.datastore.admin.v1.DatastoreAdmin/ListIndexes', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listIndexesExceptionTest() + { + $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); + $request = new ListIndexesRequest(); + try { + $gapicClient->listIndexes($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 createIndexAsyncTest() + { + $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/createIndexTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $projectId2 = 'projectId2939242356'; + $indexId = 'indexId112508840'; + $kind = 'kind3292052'; + $expectedResponse = new Index(); + $expectedResponse->setProjectId($projectId2); + $expectedResponse->setIndexId($indexId); + $expectedResponse->setKind($kind); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createIndexTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + $request = new CreateIndexRequest(); + $response = $gapicClient->createIndexAsync($request)->wait(); + $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.datastore.admin.v1.DatastoreAdmin/CreateIndex', $actualApiFuncCall); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createIndexTest'); + $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()); + } +} diff --git a/owl-bot-staging/DatastoreAdmin/v1/tests/Unit/V1/DatastoreAdminClientTest.php b/owl-bot-staging/DatastoreAdmin/v1/tests/Unit/V1/DatastoreAdminClientTest.php new file mode 100644 index 000000000000..64af0e10aeb5 --- /dev/null +++ b/owl-bot-staging/DatastoreAdmin/v1/tests/Unit/V1/DatastoreAdminClientTest.php @@ -0,0 +1,666 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return DatastoreAdminClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new DatastoreAdminClient($options); + } + + /** @test */ + public function createIndexTest() + { + $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/createIndexTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $projectId2 = 'projectId2939242356'; + $indexId = 'indexId112508840'; + $kind = 'kind3292052'; + $expectedResponse = new Index(); + $expectedResponse->setProjectId($projectId2); + $expectedResponse->setIndexId($indexId); + $expectedResponse->setKind($kind); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createIndexTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + $response = $gapicClient->createIndex(); + $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.datastore.admin.v1.DatastoreAdmin/CreateIndex', $actualApiFuncCall); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createIndexTest'); + $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 createIndexExceptionTest() + { + $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/createIndexTest'); + $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); + $response = $gapicClient->createIndex(); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createIndexTest'); + 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 deleteIndexTest() + { + $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/deleteIndexTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $projectId2 = 'projectId2939242356'; + $indexId2 = 'indexId2746815835'; + $kind = 'kind3292052'; + $expectedResponse = new Index(); + $expectedResponse->setProjectId($projectId2); + $expectedResponse->setIndexId($indexId2); + $expectedResponse->setKind($kind); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteIndexTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + $response = $gapicClient->deleteIndex(); + $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.datastore.admin.v1.DatastoreAdmin/DeleteIndex', $actualApiFuncCall); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteIndexTest'); + $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 deleteIndexExceptionTest() + { + $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/deleteIndexTest'); + $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); + $response = $gapicClient->deleteIndex(); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteIndexTest'); + 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 exportEntitiesTest() + { + $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/exportEntitiesTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $outputUrl = 'outputUrl-1273518799'; + $expectedResponse = new ExportEntitiesResponse(); + $expectedResponse->setOutputUrl($outputUrl); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/exportEntitiesTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $projectId = 'projectId-1969970175'; + $outputUrlPrefix = 'outputUrlPrefix1058210144'; + $response = $gapicClient->exportEntities($projectId, $outputUrlPrefix); + $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.datastore.admin.v1.DatastoreAdmin/ExportEntities', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getProjectId(); + $this->assertProtobufEquals($projectId, $actualValue); + $actualValue = $actualApiRequestObject->getOutputUrlPrefix(); + $this->assertProtobufEquals($outputUrlPrefix, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/exportEntitiesTest'); + $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 exportEntitiesExceptionTest() + { + $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/exportEntitiesTest'); + $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 + $projectId = 'projectId-1969970175'; + $outputUrlPrefix = 'outputUrlPrefix1058210144'; + $response = $gapicClient->exportEntities($projectId, $outputUrlPrefix); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/exportEntitiesTest'); + 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 getIndexTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $projectId2 = 'projectId2939242356'; + $indexId2 = 'indexId2746815835'; + $kind = 'kind3292052'; + $expectedResponse = new Index(); + $expectedResponse->setProjectId($projectId2); + $expectedResponse->setIndexId($indexId2); + $expectedResponse->setKind($kind); + $transport->addResponse($expectedResponse); + $response = $gapicClient->getIndex(); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.datastore.admin.v1.DatastoreAdmin/GetIndex', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getIndexExceptionTest() + { + $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); + try { + $gapicClient->getIndex(); + // 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 importEntitiesTest() + { + $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/importEntitiesTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/importEntitiesTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $projectId = 'projectId-1969970175'; + $inputUrl = 'inputUrl1707300730'; + $response = $gapicClient->importEntities($projectId, $inputUrl); + $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.datastore.admin.v1.DatastoreAdmin/ImportEntities', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getProjectId(); + $this->assertProtobufEquals($projectId, $actualValue); + $actualValue = $actualApiRequestObject->getInputUrl(); + $this->assertProtobufEquals($inputUrl, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/importEntitiesTest'); + $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 importEntitiesExceptionTest() + { + $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/importEntitiesTest'); + $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 + $projectId = 'projectId-1969970175'; + $inputUrl = 'inputUrl1707300730'; + $response = $gapicClient->importEntities($projectId, $inputUrl); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/importEntitiesTest'); + 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 listIndexesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $indexesElement = new Index(); + $indexes = [ + $indexesElement, + ]; + $expectedResponse = new ListIndexesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setIndexes($indexes); + $transport->addResponse($expectedResponse); + $response = $gapicClient->listIndexes(); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getIndexes()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.datastore.admin.v1.DatastoreAdmin/ListIndexes', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listIndexesExceptionTest() + { + $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); + try { + $gapicClient->listIndexes(); + // 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()); + } +} diff --git a/owl-bot-staging/Deploy/v1/proto/src/GPBMetadata/Google/Cloud/Deploy/V1/CloudDeploy.php b/owl-bot-staging/Deploy/v1/proto/src/GPBMetadata/Google/Cloud/Deploy/V1/CloudDeploy.php new file mode 100644 index 000000000000..7a452656acde Binary files /dev/null and b/owl-bot-staging/Deploy/v1/proto/src/GPBMetadata/Google/Cloud/Deploy/V1/CloudDeploy.php differ diff --git a/owl-bot-staging/Deploy/v1/proto/src/GPBMetadata/Google/Cloud/Deploy/V1/DeliverypipelineNotificationPayload.php b/owl-bot-staging/Deploy/v1/proto/src/GPBMetadata/Google/Cloud/Deploy/V1/DeliverypipelineNotificationPayload.php new file mode 100644 index 000000000000..b9331ab0fb29 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/GPBMetadata/Google/Cloud/Deploy/V1/DeliverypipelineNotificationPayload.php @@ -0,0 +1,32 @@ +internalAddGeneratedFile( + ' +ß +Bgoogle/cloud/deploy/v1/deliverypipeline_notification_payload.protogoogle.cloud.deploy.v1"{ +!DeliveryPipelineNotificationEvent +message (  +delivery_pipeline ( * +type (2.google.cloud.deploy.v1.TypeB| +com.google.cloud.deploy.v1B(DeliveryPipelineNotificationPayloadProtoPZ2cloud.google.com/go/deploy/apiv1/deploypb;deploypbbproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/GPBMetadata/Google/Cloud/Deploy/V1/JobrunNotificationPayload.php b/owl-bot-staging/Deploy/v1/proto/src/GPBMetadata/Google/Cloud/Deploy/V1/JobrunNotificationPayload.php new file mode 100644 index 000000000000..dc9a3000723f --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/GPBMetadata/Google/Cloud/Deploy/V1/JobrunNotificationPayload.php @@ -0,0 +1,36 @@ +internalAddGeneratedFile( + ' +‹ +8google/cloud/deploy/v1/jobrun_notification_payload.protogoogle.cloud.deploy.v1"º +JobRunNotificationEvent +message (  +job_run (  + pipeline_uid (  + release_uid (  + rollout_uid (  + target_id ( * +type (2.google.cloud.deploy.v1.TypeBr +com.google.cloud.deploy.v1BJobRunNotificationPayloadProtoPZ2cloud.google.com/go/deploy/apiv1/deploypb;deploypbbproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/GPBMetadata/Google/Cloud/Deploy/V1/LogEnums.php b/owl-bot-staging/Deploy/v1/proto/src/GPBMetadata/Google/Cloud/Deploy/V1/LogEnums.php new file mode 100644 index 000000000000..dd6b7d9ffbff Binary files /dev/null and b/owl-bot-staging/Deploy/v1/proto/src/GPBMetadata/Google/Cloud/Deploy/V1/LogEnums.php differ diff --git a/owl-bot-staging/Deploy/v1/proto/src/GPBMetadata/Google/Cloud/Deploy/V1/ReleaseNotificationPayload.php b/owl-bot-staging/Deploy/v1/proto/src/GPBMetadata/Google/Cloud/Deploy/V1/ReleaseNotificationPayload.php new file mode 100644 index 000000000000..83d7773edb02 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/GPBMetadata/Google/Cloud/Deploy/V1/ReleaseNotificationPayload.php @@ -0,0 +1,32 @@ +internalAddGeneratedFile( + ' +º +9google/cloud/deploy/v1/release_notification_payload.protogoogle.cloud.deploy.v1"h +ReleaseNotificationEvent +message (  +release ( * +type (2.google.cloud.deploy.v1.TypeBs +com.google.cloud.deploy.v1BReleaseNotificationPayloadProtoPZ2cloud.google.com/go/deploy/apiv1/deploypb;deploypbbproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/GPBMetadata/Google/Cloud/Deploy/V1/ReleaseRenderPayload.php b/owl-bot-staging/Deploy/v1/proto/src/GPBMetadata/Google/Cloud/Deploy/V1/ReleaseRenderPayload.php new file mode 100644 index 000000000000..de716878e6a7 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/GPBMetadata/Google/Cloud/Deploy/V1/ReleaseRenderPayload.php @@ -0,0 +1,30 @@ +internalAddGeneratedFile( + ' +ü +3google/cloud/deploy/v1/release_render_payload.protogoogle.cloud.deploy.v1"6 +ReleaseRenderEvent +message (  +release ( Bm +com.google.cloud.deploy.v1BReleaseRenderPayloadProtoPZ2cloud.google.com/go/deploy/apiv1/deploypb;deploypbbproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/GPBMetadata/Google/Cloud/Deploy/V1/RolloutNotificationPayload.php b/owl-bot-staging/Deploy/v1/proto/src/GPBMetadata/Google/Cloud/Deploy/V1/RolloutNotificationPayload.php new file mode 100644 index 000000000000..ca8674a581f6 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/GPBMetadata/Google/Cloud/Deploy/V1/RolloutNotificationPayload.php @@ -0,0 +1,35 @@ +internalAddGeneratedFile( + ' +ù +9google/cloud/deploy/v1/rollout_notification_payload.protogoogle.cloud.deploy.v1"¦ +RolloutNotificationEvent +message (  + pipeline_uid (  + release_uid (  +rollout ( * +type (2.google.cloud.deploy.v1.Type + target_id ( Bs +com.google.cloud.deploy.v1BRolloutNotificationPayloadProtoPZ2cloud.google.com/go/deploy/apiv1/deploypb;deploypbbproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/GPBMetadata/Google/Cloud/Deploy/V1/TargetNotificationPayload.php b/owl-bot-staging/Deploy/v1/proto/src/GPBMetadata/Google/Cloud/Deploy/V1/TargetNotificationPayload.php new file mode 100644 index 000000000000..712c49b2d540 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/GPBMetadata/Google/Cloud/Deploy/V1/TargetNotificationPayload.php @@ -0,0 +1,32 @@ +internalAddGeneratedFile( + ' +¶ +8google/cloud/deploy/v1/target_notification_payload.protogoogle.cloud.deploy.v1"f +TargetNotificationEvent +message (  +target ( * +type (2.google.cloud.deploy.v1.TypeBr +com.google.cloud.deploy.v1BTargetNotificationPayloadProtoPZ2cloud.google.com/go/deploy/apiv1/deploypb;deploypbbproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/AbandonReleaseRequest.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/AbandonReleaseRequest.php new file mode 100644 index 000000000000..8ec76e6c8a19 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/AbandonReleaseRequest.php @@ -0,0 +1,91 @@ +google.cloud.deploy.v1.AbandonReleaseRequest + */ +class AbandonReleaseRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the Release. Format is + * projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/ + * releases/{release}. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. Name of the Release. Format is + * projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/ + * releases/{release}. Please see + * {@see CloudDeployClient::releaseName()} for help formatting this field. + * + * @return \Google\Cloud\Deploy\V1\AbandonReleaseRequest + * + * @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 Release. Format is + * projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/ + * releases/{release}. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the Release. Format is + * projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/ + * releases/{release}. + * + * 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. Name of the Release. Format is + * projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/ + * releases/{release}. + * + * 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; + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/AbandonReleaseResponse.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/AbandonReleaseResponse.php new file mode 100644 index 000000000000..0c9a99c6c1de --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/AbandonReleaseResponse.php @@ -0,0 +1,33 @@ +google.cloud.deploy.v1.AbandonReleaseResponse + */ +class AbandonReleaseResponse extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/AdvanceChildRolloutJob.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/AdvanceChildRolloutJob.php new file mode 100644 index 000000000000..aecd9a83cdcf --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/AdvanceChildRolloutJob.php @@ -0,0 +1,33 @@ +google.cloud.deploy.v1.AdvanceChildRolloutJob + */ +class AdvanceChildRolloutJob extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/AdvanceChildRolloutJobRun.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/AdvanceChildRolloutJobRun.php new file mode 100644 index 000000000000..a450032b3208 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/AdvanceChildRolloutJobRun.php @@ -0,0 +1,110 @@ +google.cloud.deploy.v1.AdvanceChildRolloutJobRun + */ +class AdvanceChildRolloutJobRun extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. Name of the `ChildRollout`. Format is projects/{project}/ + * locations/{location}/deliveryPipelines/{deliveryPipeline}/ + * releases/{release}/rollouts/[a-z][a-z0-9\-]{0,62}. + * + * Generated from protobuf field string rollout = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $rollout = ''; + /** + * Output only. the ID of the ChildRollout's Phase. + * + * Generated from protobuf field string rollout_phase_id = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $rollout_phase_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $rollout + * Output only. Name of the `ChildRollout`. Format is projects/{project}/ + * locations/{location}/deliveryPipelines/{deliveryPipeline}/ + * releases/{release}/rollouts/[a-z][a-z0-9\-]{0,62}. + * @type string $rollout_phase_id + * Output only. the ID of the ChildRollout's Phase. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * Output only. Name of the `ChildRollout`. Format is projects/{project}/ + * locations/{location}/deliveryPipelines/{deliveryPipeline}/ + * releases/{release}/rollouts/[a-z][a-z0-9\-]{0,62}. + * + * Generated from protobuf field string rollout = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getRollout() + { + return $this->rollout; + } + + /** + * Output only. Name of the `ChildRollout`. Format is projects/{project}/ + * locations/{location}/deliveryPipelines/{deliveryPipeline}/ + * releases/{release}/rollouts/[a-z][a-z0-9\-]{0,62}. + * + * Generated from protobuf field string rollout = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setRollout($var) + { + GPBUtil::checkString($var, True); + $this->rollout = $var; + + return $this; + } + + /** + * Output only. the ID of the ChildRollout's Phase. + * + * Generated from protobuf field string rollout_phase_id = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getRolloutPhaseId() + { + return $this->rollout_phase_id; + } + + /** + * Output only. the ID of the ChildRollout's Phase. + * + * Generated from protobuf field string rollout_phase_id = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setRolloutPhaseId($var) + { + GPBUtil::checkString($var, True); + $this->rollout_phase_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/AdvanceRolloutRequest.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/AdvanceRolloutRequest.php new file mode 100644 index 000000000000..8e124ea7928f --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/AdvanceRolloutRequest.php @@ -0,0 +1,127 @@ +google.cloud.deploy.v1.AdvanceRolloutRequest + */ +class AdvanceRolloutRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the Rollout. Format is + * projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/ + * releases/{release}/rollouts/{rollout}. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Required. The phase ID to advance the `Rollout` to. + * + * Generated from protobuf field string phase_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $phase_id = ''; + + /** + * @param string $name Required. Name of the Rollout. Format is + * projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/ + * releases/{release}/rollouts/{rollout}. Please see + * {@see CloudDeployClient::rolloutName()} for help formatting this field. + * @param string $phaseId Required. The phase ID to advance the `Rollout` to. + * + * @return \Google\Cloud\Deploy\V1\AdvanceRolloutRequest + * + * @experimental + */ + public static function build(string $name, string $phaseId): self + { + return (new self()) + ->setName($name) + ->setPhaseId($phaseId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Name of the Rollout. Format is + * projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/ + * releases/{release}/rollouts/{rollout}. + * @type string $phase_id + * Required. The phase ID to advance the `Rollout` to. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the Rollout. Format is + * projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/ + * releases/{release}/rollouts/{rollout}. + * + * 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. Name of the Rollout. Format is + * projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/ + * releases/{release}/rollouts/{rollout}. + * + * 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; + } + + /** + * Required. The phase ID to advance the `Rollout` to. + * + * Generated from protobuf field string phase_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getPhaseId() + { + return $this->phase_id; + } + + /** + * Required. The phase ID to advance the `Rollout` to. + * + * Generated from protobuf field string phase_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setPhaseId($var) + { + GPBUtil::checkString($var, True); + $this->phase_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/AdvanceRolloutResponse.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/AdvanceRolloutResponse.php new file mode 100644 index 000000000000..14f85ee02712 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/AdvanceRolloutResponse.php @@ -0,0 +1,33 @@ +google.cloud.deploy.v1.AdvanceRolloutResponse + */ +class AdvanceRolloutResponse extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/AnthosCluster.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/AnthosCluster.php new file mode 100644 index 000000000000..b40d7369ecc3 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/AnthosCluster.php @@ -0,0 +1,75 @@ +google.cloud.deploy.v1.AnthosCluster + */ +class AnthosCluster extends \Google\Protobuf\Internal\Message +{ + /** + * Membership of the GKE Hub-registered cluster to which to apply the Skaffold + * configuration. Format is + * `projects/{project}/locations/{location}/memberships/{membership_name}`. + * + * Generated from protobuf field string membership = 1 [(.google.api.resource_reference) = { + */ + protected $membership = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $membership + * Membership of the GKE Hub-registered cluster to which to apply the Skaffold + * configuration. Format is + * `projects/{project}/locations/{location}/memberships/{membership_name}`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * Membership of the GKE Hub-registered cluster to which to apply the Skaffold + * configuration. Format is + * `projects/{project}/locations/{location}/memberships/{membership_name}`. + * + * Generated from protobuf field string membership = 1 [(.google.api.resource_reference) = { + * @return string + */ + public function getMembership() + { + return $this->membership; + } + + /** + * Membership of the GKE Hub-registered cluster to which to apply the Skaffold + * configuration. Format is + * `projects/{project}/locations/{location}/memberships/{membership_name}`. + * + * Generated from protobuf field string membership = 1 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setMembership($var) + { + GPBUtil::checkString($var, True); + $this->membership = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/ApproveRolloutRequest.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/ApproveRolloutRequest.php new file mode 100644 index 000000000000..250151c98ce2 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/ApproveRolloutRequest.php @@ -0,0 +1,125 @@ +google.cloud.deploy.v1.ApproveRolloutRequest + */ +class ApproveRolloutRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the Rollout. Format is + * projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/ + * releases/{release}/rollouts/{rollout}. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Required. True = approve; false = reject + * + * Generated from protobuf field bool approved = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $approved = false; + + /** + * @param string $name Required. Name of the Rollout. Format is + * projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/ + * releases/{release}/rollouts/{rollout}. Please see + * {@see CloudDeployClient::rolloutName()} for help formatting this field. + * + * @return \Google\Cloud\Deploy\V1\ApproveRolloutRequest + * + * @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 Rollout. Format is + * projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/ + * releases/{release}/rollouts/{rollout}. + * @type bool $approved + * Required. True = approve; false = reject + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the Rollout. Format is + * projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/ + * releases/{release}/rollouts/{rollout}. + * + * 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. Name of the Rollout. Format is + * projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/ + * releases/{release}/rollouts/{rollout}. + * + * 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; + } + + /** + * Required. True = approve; false = reject + * + * Generated from protobuf field bool approved = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return bool + */ + public function getApproved() + { + return $this->approved; + } + + /** + * Required. True = approve; false = reject + * + * Generated from protobuf field bool approved = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param bool $var + * @return $this + */ + public function setApproved($var) + { + GPBUtil::checkBool($var); + $this->approved = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/ApproveRolloutResponse.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/ApproveRolloutResponse.php new file mode 100644 index 000000000000..afac40c7146c --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/ApproveRolloutResponse.php @@ -0,0 +1,33 @@ +google.cloud.deploy.v1.ApproveRolloutResponse + */ +class ApproveRolloutResponse extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/BuildArtifact.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/BuildArtifact.php new file mode 100644 index 000000000000..23cd5da0a754 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/BuildArtifact.php @@ -0,0 +1,109 @@ +google.cloud.deploy.v1.BuildArtifact + */ +class BuildArtifact extends \Google\Protobuf\Internal\Message +{ + /** + * Image name in Skaffold configuration. + * + * Generated from protobuf field string image = 3; + */ + protected $image = ''; + /** + * Image tag to use. This will generally be the full path to an image, such + * as "gcr.io/my-project/busybox:1.2.3" or + * "gcr.io/my-project/busybox@sha256:abc123". + * + * Generated from protobuf field string tag = 2; + */ + protected $tag = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $image + * Image name in Skaffold configuration. + * @type string $tag + * Image tag to use. This will generally be the full path to an image, such + * as "gcr.io/my-project/busybox:1.2.3" or + * "gcr.io/my-project/busybox@sha256:abc123". + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * Image name in Skaffold configuration. + * + * Generated from protobuf field string image = 3; + * @return string + */ + public function getImage() + { + return $this->image; + } + + /** + * Image name in Skaffold configuration. + * + * Generated from protobuf field string image = 3; + * @param string $var + * @return $this + */ + public function setImage($var) + { + GPBUtil::checkString($var, True); + $this->image = $var; + + return $this; + } + + /** + * Image tag to use. This will generally be the full path to an image, such + * as "gcr.io/my-project/busybox:1.2.3" or + * "gcr.io/my-project/busybox@sha256:abc123". + * + * Generated from protobuf field string tag = 2; + * @return string + */ + public function getTag() + { + return $this->tag; + } + + /** + * Image tag to use. This will generally be the full path to an image, such + * as "gcr.io/my-project/busybox:1.2.3" or + * "gcr.io/my-project/busybox@sha256:abc123". + * + * Generated from protobuf field string tag = 2; + * @param string $var + * @return $this + */ + public function setTag($var) + { + GPBUtil::checkString($var, True); + $this->tag = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Canary.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Canary.php new file mode 100644 index 000000000000..929faf223233 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Canary.php @@ -0,0 +1,166 @@ +google.cloud.deploy.v1.Canary + */ +class Canary extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. Runtime specific configurations for the deployment strategy. The + * runtime configuration is used to determine how Cloud Deploy will split + * traffic to enable a progressive deployment. + * + * Generated from protobuf field .google.cloud.deploy.v1.RuntimeConfig runtime_config = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $runtime_config = null; + protected $mode; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Deploy\V1\RuntimeConfig $runtime_config + * Optional. Runtime specific configurations for the deployment strategy. The + * runtime configuration is used to determine how Cloud Deploy will split + * traffic to enable a progressive deployment. + * @type \Google\Cloud\Deploy\V1\CanaryDeployment $canary_deployment + * Configures the progressive based deployment for a Target. + * @type \Google\Cloud\Deploy\V1\CustomCanaryDeployment $custom_canary_deployment + * Configures the progressive based deployment for a Target, but allows + * customizing at the phase level where a phase represents each of the + * percentage deployments. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * Optional. Runtime specific configurations for the deployment strategy. The + * runtime configuration is used to determine how Cloud Deploy will split + * traffic to enable a progressive deployment. + * + * Generated from protobuf field .google.cloud.deploy.v1.RuntimeConfig runtime_config = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\Deploy\V1\RuntimeConfig|null + */ + public function getRuntimeConfig() + { + return $this->runtime_config; + } + + public function hasRuntimeConfig() + { + return isset($this->runtime_config); + } + + public function clearRuntimeConfig() + { + unset($this->runtime_config); + } + + /** + * Optional. Runtime specific configurations for the deployment strategy. The + * runtime configuration is used to determine how Cloud Deploy will split + * traffic to enable a progressive deployment. + * + * Generated from protobuf field .google.cloud.deploy.v1.RuntimeConfig runtime_config = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\Deploy\V1\RuntimeConfig $var + * @return $this + */ + public function setRuntimeConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Deploy\V1\RuntimeConfig::class); + $this->runtime_config = $var; + + return $this; + } + + /** + * Configures the progressive based deployment for a Target. + * + * Generated from protobuf field .google.cloud.deploy.v1.CanaryDeployment canary_deployment = 2; + * @return \Google\Cloud\Deploy\V1\CanaryDeployment|null + */ + public function getCanaryDeployment() + { + return $this->readOneof(2); + } + + public function hasCanaryDeployment() + { + return $this->hasOneof(2); + } + + /** + * Configures the progressive based deployment for a Target. + * + * Generated from protobuf field .google.cloud.deploy.v1.CanaryDeployment canary_deployment = 2; + * @param \Google\Cloud\Deploy\V1\CanaryDeployment $var + * @return $this + */ + public function setCanaryDeployment($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Deploy\V1\CanaryDeployment::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * Configures the progressive based deployment for a Target, but allows + * customizing at the phase level where a phase represents each of the + * percentage deployments. + * + * Generated from protobuf field .google.cloud.deploy.v1.CustomCanaryDeployment custom_canary_deployment = 3; + * @return \Google\Cloud\Deploy\V1\CustomCanaryDeployment|null + */ + public function getCustomCanaryDeployment() + { + return $this->readOneof(3); + } + + public function hasCustomCanaryDeployment() + { + return $this->hasOneof(3); + } + + /** + * Configures the progressive based deployment for a Target, but allows + * customizing at the phase level where a phase represents each of the + * percentage deployments. + * + * Generated from protobuf field .google.cloud.deploy.v1.CustomCanaryDeployment custom_canary_deployment = 3; + * @param \Google\Cloud\Deploy\V1\CustomCanaryDeployment $var + * @return $this + */ + public function setCustomCanaryDeployment($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Deploy\V1\CustomCanaryDeployment::class); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * @return string + */ + public function getMode() + { + return $this->whichOneof("mode"); + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/CanaryDeployment.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/CanaryDeployment.php new file mode 100644 index 000000000000..c3825233ea7c --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/CanaryDeployment.php @@ -0,0 +1,109 @@ +google.cloud.deploy.v1.CanaryDeployment + */ +class CanaryDeployment extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The percentage based deployments that will occur as a part of a + * `Rollout`. List is expected in ascending order and each integer n is + * 0 <= n < 100. + * + * Generated from protobuf field repeated int32 percentages = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private $percentages; + /** + * Whether to run verify tests after each percentage deployment. + * + * Generated from protobuf field bool verify = 2; + */ + protected $verify = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $percentages + * Required. The percentage based deployments that will occur as a part of a + * `Rollout`. List is expected in ascending order and each integer n is + * 0 <= n < 100. + * @type bool $verify + * Whether to run verify tests after each percentage deployment. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * Required. The percentage based deployments that will occur as a part of a + * `Rollout`. List is expected in ascending order and each integer n is + * 0 <= n < 100. + * + * Generated from protobuf field repeated int32 percentages = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getPercentages() + { + return $this->percentages; + } + + /** + * Required. The percentage based deployments that will occur as a part of a + * `Rollout`. List is expected in ascending order and each integer n is + * 0 <= n < 100. + * + * Generated from protobuf field repeated int32 percentages = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setPercentages($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); + $this->percentages = $arr; + + return $this; + } + + /** + * Whether to run verify tests after each percentage deployment. + * + * Generated from protobuf field bool verify = 2; + * @return bool + */ + public function getVerify() + { + return $this->verify; + } + + /** + * Whether to run verify tests after each percentage deployment. + * + * Generated from protobuf field bool verify = 2; + * @param bool $var + * @return $this + */ + public function setVerify($var) + { + GPBUtil::checkBool($var); + $this->verify = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/CancelRolloutRequest.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/CancelRolloutRequest.php new file mode 100644 index 000000000000..853c773e3f84 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/CancelRolloutRequest.php @@ -0,0 +1,91 @@ +google.cloud.deploy.v1.CancelRolloutRequest + */ +class CancelRolloutRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the Rollout. Format is + * projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/ + * releases/{release}/rollouts/{rollout}. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. Name of the Rollout. Format is + * projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/ + * releases/{release}/rollouts/{rollout}. Please see + * {@see CloudDeployClient::rolloutName()} for help formatting this field. + * + * @return \Google\Cloud\Deploy\V1\CancelRolloutRequest + * + * @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 Rollout. Format is + * projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/ + * releases/{release}/rollouts/{rollout}. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the Rollout. Format is + * projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/ + * releases/{release}/rollouts/{rollout}. + * + * 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. Name of the Rollout. Format is + * projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/ + * releases/{release}/rollouts/{rollout}. + * + * 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; + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/CancelRolloutResponse.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/CancelRolloutResponse.php new file mode 100644 index 000000000000..c7b2af7c39ac --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/CancelRolloutResponse.php @@ -0,0 +1,33 @@ +google.cloud.deploy.v1.CancelRolloutResponse + */ +class CancelRolloutResponse extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/ChildRolloutJobs.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/ChildRolloutJobs.php new file mode 100644 index 000000000000..a5fb687936dd --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/ChildRolloutJobs.php @@ -0,0 +1,101 @@ +google.cloud.deploy.v1.ChildRolloutJobs + */ +class ChildRolloutJobs extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. List of CreateChildRolloutJobs + * + * Generated from protobuf field repeated .google.cloud.deploy.v1.Job create_rollout_jobs = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $create_rollout_jobs; + /** + * Output only. List of AdvanceChildRolloutJobs + * + * Generated from protobuf field repeated .google.cloud.deploy.v1.Job advance_rollout_jobs = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $advance_rollout_jobs; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Deploy\V1\Job>|\Google\Protobuf\Internal\RepeatedField $create_rollout_jobs + * Output only. List of CreateChildRolloutJobs + * @type array<\Google\Cloud\Deploy\V1\Job>|\Google\Protobuf\Internal\RepeatedField $advance_rollout_jobs + * Output only. List of AdvanceChildRolloutJobs + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * Output only. List of CreateChildRolloutJobs + * + * Generated from protobuf field repeated .google.cloud.deploy.v1.Job create_rollout_jobs = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getCreateRolloutJobs() + { + return $this->create_rollout_jobs; + } + + /** + * Output only. List of CreateChildRolloutJobs + * + * Generated from protobuf field repeated .google.cloud.deploy.v1.Job create_rollout_jobs = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array<\Google\Cloud\Deploy\V1\Job>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setCreateRolloutJobs($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Deploy\V1\Job::class); + $this->create_rollout_jobs = $arr; + + return $this; + } + + /** + * Output only. List of AdvanceChildRolloutJobs + * + * Generated from protobuf field repeated .google.cloud.deploy.v1.Job advance_rollout_jobs = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAdvanceRolloutJobs() + { + return $this->advance_rollout_jobs; + } + + /** + * Output only. List of AdvanceChildRolloutJobs + * + * Generated from protobuf field repeated .google.cloud.deploy.v1.Job advance_rollout_jobs = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array<\Google\Cloud\Deploy\V1\Job>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAdvanceRolloutJobs($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Deploy\V1\Job::class); + $this->advance_rollout_jobs = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/CloudDeployGrpcClient.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/CloudDeployGrpcClient.php new file mode 100644 index 000000000000..7bf0ba22d867 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/CloudDeployGrpcClient.php @@ -0,0 +1,426 @@ +_simpleRequest('/google.cloud.deploy.v1.CloudDeploy/ListDeliveryPipelines', + $argument, + ['\Google\Cloud\Deploy\V1\ListDeliveryPipelinesResponse', 'decode'], + $metadata, $options); + } + + /** + * Gets details of a single DeliveryPipeline. + * @param \Google\Cloud\Deploy\V1\GetDeliveryPipelineRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function GetDeliveryPipeline(\Google\Cloud\Deploy\V1\GetDeliveryPipelineRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.deploy.v1.CloudDeploy/GetDeliveryPipeline', + $argument, + ['\Google\Cloud\Deploy\V1\DeliveryPipeline', 'decode'], + $metadata, $options); + } + + /** + * Creates a new DeliveryPipeline in a given project and location. + * @param \Google\Cloud\Deploy\V1\CreateDeliveryPipelineRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function CreateDeliveryPipeline(\Google\Cloud\Deploy\V1\CreateDeliveryPipelineRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.deploy.v1.CloudDeploy/CreateDeliveryPipeline', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Updates the parameters of a single DeliveryPipeline. + * @param \Google\Cloud\Deploy\V1\UpdateDeliveryPipelineRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function UpdateDeliveryPipeline(\Google\Cloud\Deploy\V1\UpdateDeliveryPipelineRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.deploy.v1.CloudDeploy/UpdateDeliveryPipeline', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Deletes a single DeliveryPipeline. + * @param \Google\Cloud\Deploy\V1\DeleteDeliveryPipelineRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function DeleteDeliveryPipeline(\Google\Cloud\Deploy\V1\DeleteDeliveryPipelineRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.deploy.v1.CloudDeploy/DeleteDeliveryPipeline', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Lists Targets in a given project and location. + * @param \Google\Cloud\Deploy\V1\ListTargetsRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function ListTargets(\Google\Cloud\Deploy\V1\ListTargetsRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.deploy.v1.CloudDeploy/ListTargets', + $argument, + ['\Google\Cloud\Deploy\V1\ListTargetsResponse', 'decode'], + $metadata, $options); + } + + /** + * Gets details of a single Target. + * @param \Google\Cloud\Deploy\V1\GetTargetRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function GetTarget(\Google\Cloud\Deploy\V1\GetTargetRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.deploy.v1.CloudDeploy/GetTarget', + $argument, + ['\Google\Cloud\Deploy\V1\Target', 'decode'], + $metadata, $options); + } + + /** + * Creates a new Target in a given project and location. + * @param \Google\Cloud\Deploy\V1\CreateTargetRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function CreateTarget(\Google\Cloud\Deploy\V1\CreateTargetRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.deploy.v1.CloudDeploy/CreateTarget', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Updates the parameters of a single Target. + * @param \Google\Cloud\Deploy\V1\UpdateTargetRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function UpdateTarget(\Google\Cloud\Deploy\V1\UpdateTargetRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.deploy.v1.CloudDeploy/UpdateTarget', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Deletes a single Target. + * @param \Google\Cloud\Deploy\V1\DeleteTargetRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function DeleteTarget(\Google\Cloud\Deploy\V1\DeleteTargetRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.deploy.v1.CloudDeploy/DeleteTarget', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Lists Releases in a given project and location. + * @param \Google\Cloud\Deploy\V1\ListReleasesRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function ListReleases(\Google\Cloud\Deploy\V1\ListReleasesRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.deploy.v1.CloudDeploy/ListReleases', + $argument, + ['\Google\Cloud\Deploy\V1\ListReleasesResponse', 'decode'], + $metadata, $options); + } + + /** + * Gets details of a single Release. + * @param \Google\Cloud\Deploy\V1\GetReleaseRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function GetRelease(\Google\Cloud\Deploy\V1\GetReleaseRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.deploy.v1.CloudDeploy/GetRelease', + $argument, + ['\Google\Cloud\Deploy\V1\Release', 'decode'], + $metadata, $options); + } + + /** + * Creates a new Release in a given project and location. + * @param \Google\Cloud\Deploy\V1\CreateReleaseRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function CreateRelease(\Google\Cloud\Deploy\V1\CreateReleaseRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.deploy.v1.CloudDeploy/CreateRelease', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Abandons a Release in the Delivery Pipeline. + * @param \Google\Cloud\Deploy\V1\AbandonReleaseRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function AbandonRelease(\Google\Cloud\Deploy\V1\AbandonReleaseRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.deploy.v1.CloudDeploy/AbandonRelease', + $argument, + ['\Google\Cloud\Deploy\V1\AbandonReleaseResponse', 'decode'], + $metadata, $options); + } + + /** + * Approves a Rollout. + * @param \Google\Cloud\Deploy\V1\ApproveRolloutRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function ApproveRollout(\Google\Cloud\Deploy\V1\ApproveRolloutRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.deploy.v1.CloudDeploy/ApproveRollout', + $argument, + ['\Google\Cloud\Deploy\V1\ApproveRolloutResponse', 'decode'], + $metadata, $options); + } + + /** + * Advances a Rollout in a given project and location. + * @param \Google\Cloud\Deploy\V1\AdvanceRolloutRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function AdvanceRollout(\Google\Cloud\Deploy\V1\AdvanceRolloutRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.deploy.v1.CloudDeploy/AdvanceRollout', + $argument, + ['\Google\Cloud\Deploy\V1\AdvanceRolloutResponse', 'decode'], + $metadata, $options); + } + + /** + * Cancels a Rollout in a given project and location. + * @param \Google\Cloud\Deploy\V1\CancelRolloutRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function CancelRollout(\Google\Cloud\Deploy\V1\CancelRolloutRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.deploy.v1.CloudDeploy/CancelRollout', + $argument, + ['\Google\Cloud\Deploy\V1\CancelRolloutResponse', 'decode'], + $metadata, $options); + } + + /** + * Lists Rollouts in a given project and location. + * @param \Google\Cloud\Deploy\V1\ListRolloutsRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function ListRollouts(\Google\Cloud\Deploy\V1\ListRolloutsRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.deploy.v1.CloudDeploy/ListRollouts', + $argument, + ['\Google\Cloud\Deploy\V1\ListRolloutsResponse', 'decode'], + $metadata, $options); + } + + /** + * Gets details of a single Rollout. + * @param \Google\Cloud\Deploy\V1\GetRolloutRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function GetRollout(\Google\Cloud\Deploy\V1\GetRolloutRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.deploy.v1.CloudDeploy/GetRollout', + $argument, + ['\Google\Cloud\Deploy\V1\Rollout', 'decode'], + $metadata, $options); + } + + /** + * Creates a new Rollout in a given project and location. + * @param \Google\Cloud\Deploy\V1\CreateRolloutRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function CreateRollout(\Google\Cloud\Deploy\V1\CreateRolloutRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.deploy.v1.CloudDeploy/CreateRollout', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Ignores the specified Job in a Rollout. + * @param \Google\Cloud\Deploy\V1\IgnoreJobRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function IgnoreJob(\Google\Cloud\Deploy\V1\IgnoreJobRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.deploy.v1.CloudDeploy/IgnoreJob', + $argument, + ['\Google\Cloud\Deploy\V1\IgnoreJobResponse', 'decode'], + $metadata, $options); + } + + /** + * Retries the specified Job in a Rollout. + * @param \Google\Cloud\Deploy\V1\RetryJobRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function RetryJob(\Google\Cloud\Deploy\V1\RetryJobRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.deploy.v1.CloudDeploy/RetryJob', + $argument, + ['\Google\Cloud\Deploy\V1\RetryJobResponse', 'decode'], + $metadata, $options); + } + + /** + * Lists JobRuns in a given project and location. + * @param \Google\Cloud\Deploy\V1\ListJobRunsRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function ListJobRuns(\Google\Cloud\Deploy\V1\ListJobRunsRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.deploy.v1.CloudDeploy/ListJobRuns', + $argument, + ['\Google\Cloud\Deploy\V1\ListJobRunsResponse', 'decode'], + $metadata, $options); + } + + /** + * Gets details of a single JobRun. + * @param \Google\Cloud\Deploy\V1\GetJobRunRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function GetJobRun(\Google\Cloud\Deploy\V1\GetJobRunRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.deploy.v1.CloudDeploy/GetJobRun', + $argument, + ['\Google\Cloud\Deploy\V1\JobRun', 'decode'], + $metadata, $options); + } + + /** + * Terminates a Job Run in a given project and location. + * @param \Google\Cloud\Deploy\V1\TerminateJobRunRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function TerminateJobRun(\Google\Cloud\Deploy\V1\TerminateJobRunRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.deploy.v1.CloudDeploy/TerminateJobRun', + $argument, + ['\Google\Cloud\Deploy\V1\TerminateJobRunResponse', 'decode'], + $metadata, $options); + } + + /** + * Gets the configuration for a location. + * @param \Google\Cloud\Deploy\V1\GetConfigRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function GetConfig(\Google\Cloud\Deploy\V1\GetConfigRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.deploy.v1.CloudDeploy/GetConfig', + $argument, + ['\Google\Cloud\Deploy\V1\Config', 'decode'], + $metadata, $options); + } + +} diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/CloudRunConfig.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/CloudRunConfig.php new file mode 100644 index 000000000000..358ed08114b4 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/CloudRunConfig.php @@ -0,0 +1,79 @@ +google.cloud.deploy.v1.CloudRunConfig + */ +class CloudRunConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Whether Cloud Deploy should update the traffic stanza in a Cloud Run + * Service on the user's behalf to facilitate traffic splitting. This is + * required to be true for CanaryDeployments, but optional for + * CustomCanaryDeployments. + * + * Generated from protobuf field bool automatic_traffic_control = 1; + */ + protected $automatic_traffic_control = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $automatic_traffic_control + * Whether Cloud Deploy should update the traffic stanza in a Cloud Run + * Service on the user's behalf to facilitate traffic splitting. This is + * required to be true for CanaryDeployments, but optional for + * CustomCanaryDeployments. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * Whether Cloud Deploy should update the traffic stanza in a Cloud Run + * Service on the user's behalf to facilitate traffic splitting. This is + * required to be true for CanaryDeployments, but optional for + * CustomCanaryDeployments. + * + * Generated from protobuf field bool automatic_traffic_control = 1; + * @return bool + */ + public function getAutomaticTrafficControl() + { + return $this->automatic_traffic_control; + } + + /** + * Whether Cloud Deploy should update the traffic stanza in a Cloud Run + * Service on the user's behalf to facilitate traffic splitting. This is + * required to be true for CanaryDeployments, but optional for + * CustomCanaryDeployments. + * + * Generated from protobuf field bool automatic_traffic_control = 1; + * @param bool $var + * @return $this + */ + public function setAutomaticTrafficControl($var) + { + GPBUtil::checkBool($var); + $this->automatic_traffic_control = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/CloudRunLocation.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/CloudRunLocation.php new file mode 100644 index 000000000000..ff0ebad3a710 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/CloudRunLocation.php @@ -0,0 +1,71 @@ +google.cloud.deploy.v1.CloudRunLocation + */ +class CloudRunLocation extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The location for the Cloud Run Service. Format must be + * `projects/{project}/locations/{location}`. + * + * Generated from protobuf field string location = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $location = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $location + * Required. The location for the Cloud Run Service. Format must be + * `projects/{project}/locations/{location}`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * Required. The location for the Cloud Run Service. Format must be + * `projects/{project}/locations/{location}`. + * + * Generated from protobuf field string location = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getLocation() + { + return $this->location; + } + + /** + * Required. The location for the Cloud Run Service. Format must be + * `projects/{project}/locations/{location}`. + * + * Generated from protobuf field string location = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setLocation($var) + { + GPBUtil::checkString($var, True); + $this->location = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/CloudRunMetadata.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/CloudRunMetadata.php new file mode 100644 index 000000000000..1df01c3367f8 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/CloudRunMetadata.php @@ -0,0 +1,147 @@ +google.cloud.deploy.v1.CloudRunMetadata + */ +class CloudRunMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The name of the Cloud Run Service that is associated with a + * `Rollout`. Format is + * projects/{project}/locations/{location}/services/{service}. + * + * Generated from protobuf field string service = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + */ + protected $service = ''; + /** + * Output only. The Cloud Run Service urls that are associated with a + * `Rollout`. + * + * Generated from protobuf field repeated string service_urls = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $service_urls; + /** + * Output only. The Cloud Run Revision id associated with a `Rollout`. + * + * Generated from protobuf field string revision = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $revision = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $service + * Output only. The name of the Cloud Run Service that is associated with a + * `Rollout`. Format is + * projects/{project}/locations/{location}/services/{service}. + * @type array|\Google\Protobuf\Internal\RepeatedField $service_urls + * Output only. The Cloud Run Service urls that are associated with a + * `Rollout`. + * @type string $revision + * Output only. The Cloud Run Revision id associated with a `Rollout`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The name of the Cloud Run Service that is associated with a + * `Rollout`. Format is + * projects/{project}/locations/{location}/services/{service}. + * + * Generated from protobuf field string service = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + * @return string + */ + public function getService() + { + return $this->service; + } + + /** + * Output only. The name of the Cloud Run Service that is associated with a + * `Rollout`. Format is + * projects/{project}/locations/{location}/services/{service}. + * + * Generated from protobuf field string service = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setService($var) + { + GPBUtil::checkString($var, True); + $this->service = $var; + + return $this; + } + + /** + * Output only. The Cloud Run Service urls that are associated with a + * `Rollout`. + * + * Generated from protobuf field repeated string service_urls = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getServiceUrls() + { + return $this->service_urls; + } + + /** + * Output only. The Cloud Run Service urls that are associated with a + * `Rollout`. + * + * Generated from protobuf field repeated string service_urls = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setServiceUrls($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->service_urls = $arr; + + return $this; + } + + /** + * Output only. The Cloud Run Revision id associated with a `Rollout`. + * + * Generated from protobuf field string revision = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getRevision() + { + return $this->revision; + } + + /** + * Output only. The Cloud Run Revision id associated with a `Rollout`. + * + * Generated from protobuf field string revision = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setRevision($var) + { + GPBUtil::checkString($var, True); + $this->revision = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/CloudRunRenderMetadata.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/CloudRunRenderMetadata.php new file mode 100644 index 000000000000..f04aa55ae9dc --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/CloudRunRenderMetadata.php @@ -0,0 +1,72 @@ +google.cloud.deploy.v1.CloudRunRenderMetadata + */ +class CloudRunRenderMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The name of the Cloud Run Service in the rendered manifest. + * Format is projects/{project}/locations/{location}/services/{service}. + * + * Generated from protobuf field string service = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + */ + protected $service = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $service + * Output only. The name of the Cloud Run Service in the rendered manifest. + * Format is projects/{project}/locations/{location}/services/{service}. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The name of the Cloud Run Service in the rendered manifest. + * Format is projects/{project}/locations/{location}/services/{service}. + * + * Generated from protobuf field string service = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + * @return string + */ + public function getService() + { + return $this->service; + } + + /** + * Output only. The name of the Cloud Run Service in the rendered manifest. + * Format is projects/{project}/locations/{location}/services/{service}. + * + * Generated from protobuf field string service = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setService($var) + { + GPBUtil::checkString($var, True); + $this->service = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Config.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Config.php new file mode 100644 index 000000000000..d3401ecb99a3 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Config.php @@ -0,0 +1,139 @@ +google.cloud.deploy.v1.Config + */ +class Config extends \Google\Protobuf\Internal\Message +{ + /** + * Name of the configuration. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * All supported versions of Skaffold. + * + * Generated from protobuf field repeated .google.cloud.deploy.v1.SkaffoldVersion supported_versions = 2; + */ + private $supported_versions; + /** + * Default Skaffold version that is assigned when a Release is created without + * specifying a Skaffold version. + * + * Generated from protobuf field string default_skaffold_version = 3; + */ + protected $default_skaffold_version = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Name of the configuration. + * @type array<\Google\Cloud\Deploy\V1\SkaffoldVersion>|\Google\Protobuf\Internal\RepeatedField $supported_versions + * All supported versions of Skaffold. + * @type string $default_skaffold_version + * Default Skaffold version that is assigned when a Release is created without + * specifying a Skaffold version. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * Name of the configuration. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Name of the configuration. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * All supported versions of Skaffold. + * + * Generated from protobuf field repeated .google.cloud.deploy.v1.SkaffoldVersion supported_versions = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSupportedVersions() + { + return $this->supported_versions; + } + + /** + * All supported versions of Skaffold. + * + * Generated from protobuf field repeated .google.cloud.deploy.v1.SkaffoldVersion supported_versions = 2; + * @param array<\Google\Cloud\Deploy\V1\SkaffoldVersion>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSupportedVersions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Deploy\V1\SkaffoldVersion::class); + $this->supported_versions = $arr; + + return $this; + } + + /** + * Default Skaffold version that is assigned when a Release is created without + * specifying a Skaffold version. + * + * Generated from protobuf field string default_skaffold_version = 3; + * @return string + */ + public function getDefaultSkaffoldVersion() + { + return $this->default_skaffold_version; + } + + /** + * Default Skaffold version that is assigned when a Release is created without + * specifying a Skaffold version. + * + * Generated from protobuf field string default_skaffold_version = 3; + * @param string $var + * @return $this + */ + public function setDefaultSkaffoldVersion($var) + { + GPBUtil::checkString($var, True); + $this->default_skaffold_version = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/CreateChildRolloutJob.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/CreateChildRolloutJob.php new file mode 100644 index 000000000000..ba7b1ce944b0 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/CreateChildRolloutJob.php @@ -0,0 +1,33 @@ +google.cloud.deploy.v1.CreateChildRolloutJob + */ +class CreateChildRolloutJob extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/CreateChildRolloutJobRun.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/CreateChildRolloutJobRun.php new file mode 100644 index 000000000000..2b60a5efeec1 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/CreateChildRolloutJobRun.php @@ -0,0 +1,110 @@ +google.cloud.deploy.v1.CreateChildRolloutJobRun + */ +class CreateChildRolloutJobRun extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. Name of the `ChildRollout`. Format is projects/{project}/ + * locations/{location}/deliveryPipelines/{deliveryPipeline}/ + * releases/{release}/rollouts/[a-z][a-z0-9\-]{0,62}. + * + * Generated from protobuf field string rollout = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $rollout = ''; + /** + * Output only. The ID of the childRollout Phase initiated by this JobRun. + * + * Generated from protobuf field string rollout_phase_id = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $rollout_phase_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $rollout + * Output only. Name of the `ChildRollout`. Format is projects/{project}/ + * locations/{location}/deliveryPipelines/{deliveryPipeline}/ + * releases/{release}/rollouts/[a-z][a-z0-9\-]{0,62}. + * @type string $rollout_phase_id + * Output only. The ID of the childRollout Phase initiated by this JobRun. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * Output only. Name of the `ChildRollout`. Format is projects/{project}/ + * locations/{location}/deliveryPipelines/{deliveryPipeline}/ + * releases/{release}/rollouts/[a-z][a-z0-9\-]{0,62}. + * + * Generated from protobuf field string rollout = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getRollout() + { + return $this->rollout; + } + + /** + * Output only. Name of the `ChildRollout`. Format is projects/{project}/ + * locations/{location}/deliveryPipelines/{deliveryPipeline}/ + * releases/{release}/rollouts/[a-z][a-z0-9\-]{0,62}. + * + * Generated from protobuf field string rollout = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setRollout($var) + { + GPBUtil::checkString($var, True); + $this->rollout = $var; + + return $this; + } + + /** + * Output only. The ID of the childRollout Phase initiated by this JobRun. + * + * Generated from protobuf field string rollout_phase_id = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getRolloutPhaseId() + { + return $this->rollout_phase_id; + } + + /** + * Output only. The ID of the childRollout Phase initiated by this JobRun. + * + * Generated from protobuf field string rollout_phase_id = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setRolloutPhaseId($var) + { + GPBUtil::checkString($var, True); + $this->rollout_phase_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/CreateDeliveryPipelineRequest.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/CreateDeliveryPipelineRequest.php new file mode 100644 index 000000000000..28b28989092f --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/CreateDeliveryPipelineRequest.php @@ -0,0 +1,280 @@ +google.cloud.deploy.v1.CreateDeliveryPipelineRequest + */ +class CreateDeliveryPipelineRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent collection in which the `DeliveryPipeline` should be + * created. Format should be projects/{project_id}/locations/{location_name}. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. ID of the `DeliveryPipeline`. + * + * Generated from protobuf field string delivery_pipeline_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $delivery_pipeline_id = ''; + /** + * Required. The `DeliveryPipeline` to create. + * + * Generated from protobuf field .google.cloud.deploy.v1.DeliveryPipeline delivery_pipeline = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $delivery_pipeline = null; + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + /** + * Optional. If set to true, the request is validated and the user is provided + * with an expected result, but no actual change is made. + * + * Generated from protobuf field bool validate_only = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $validate_only = false; + + /** + * @param string $parent Required. The parent collection in which the `DeliveryPipeline` should be + * created. Format should be projects/{project_id}/locations/{location_name}. Please see + * {@see CloudDeployClient::locationName()} for help formatting this field. + * @param \Google\Cloud\Deploy\V1\DeliveryPipeline $deliveryPipeline Required. The `DeliveryPipeline` to create. + * @param string $deliveryPipelineId Required. ID of the `DeliveryPipeline`. + * + * @return \Google\Cloud\Deploy\V1\CreateDeliveryPipelineRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\Deploy\V1\DeliveryPipeline $deliveryPipeline, string $deliveryPipelineId): self + { + return (new self()) + ->setParent($parent) + ->setDeliveryPipeline($deliveryPipeline) + ->setDeliveryPipelineId($deliveryPipelineId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The parent collection in which the `DeliveryPipeline` should be + * created. Format should be projects/{project_id}/locations/{location_name}. + * @type string $delivery_pipeline_id + * Required. ID of the `DeliveryPipeline`. + * @type \Google\Cloud\Deploy\V1\DeliveryPipeline $delivery_pipeline + * Required. The `DeliveryPipeline` to create. + * @type string $request_id + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validate_only + * Optional. If set to true, the request is validated and the user is provided + * with an expected result, but no actual change is made. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent collection in which the `DeliveryPipeline` should be + * created. Format should be projects/{project_id}/locations/{location_name}. + * + * 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. The parent collection in which the `DeliveryPipeline` should be + * created. Format should be projects/{project_id}/locations/{location_name}. + * + * 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. ID of the `DeliveryPipeline`. + * + * Generated from protobuf field string delivery_pipeline_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getDeliveryPipelineId() + { + return $this->delivery_pipeline_id; + } + + /** + * Required. ID of the `DeliveryPipeline`. + * + * Generated from protobuf field string delivery_pipeline_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setDeliveryPipelineId($var) + { + GPBUtil::checkString($var, True); + $this->delivery_pipeline_id = $var; + + return $this; + } + + /** + * Required. The `DeliveryPipeline` to create. + * + * Generated from protobuf field .google.cloud.deploy.v1.DeliveryPipeline delivery_pipeline = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Deploy\V1\DeliveryPipeline|null + */ + public function getDeliveryPipeline() + { + return $this->delivery_pipeline; + } + + public function hasDeliveryPipeline() + { + return isset($this->delivery_pipeline); + } + + public function clearDeliveryPipeline() + { + unset($this->delivery_pipeline); + } + + /** + * Required. The `DeliveryPipeline` to create. + * + * Generated from protobuf field .google.cloud.deploy.v1.DeliveryPipeline delivery_pipeline = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Deploy\V1\DeliveryPipeline $var + * @return $this + */ + public function setDeliveryPipeline($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Deploy\V1\DeliveryPipeline::class); + $this->delivery_pipeline = $var; + + return $this; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + + /** + * Optional. If set to true, the request is validated and the user is provided + * with an expected result, but no actual change is made. + * + * Generated from protobuf field bool validate_only = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * Optional. If set to true, the request is validated and the user is provided + * with an expected result, but no actual change is made. + * + * Generated from protobuf field bool validate_only = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/CreateReleaseRequest.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/CreateReleaseRequest.php new file mode 100644 index 000000000000..2124674d8675 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/CreateReleaseRequest.php @@ -0,0 +1,285 @@ +google.cloud.deploy.v1.CreateReleaseRequest + */ +class CreateReleaseRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent collection in which the `Release` should be created. + * Format should be + * projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. ID of the `Release`. + * + * Generated from protobuf field string release_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $release_id = ''; + /** + * Required. The `Release` to create. + * + * Generated from protobuf field .google.cloud.deploy.v1.Release release = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $release = null; + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + /** + * Optional. If set to true, the request is validated and the user is provided + * with an expected result, but no actual change is made. + * + * Generated from protobuf field bool validate_only = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $validate_only = false; + + /** + * @param string $parent Required. The parent collection in which the `Release` should be created. + * Format should be + * projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}. Please see + * {@see CloudDeployClient::deliveryPipelineName()} for help formatting this field. + * @param \Google\Cloud\Deploy\V1\Release $release Required. The `Release` to create. + * @param string $releaseId Required. ID of the `Release`. + * + * @return \Google\Cloud\Deploy\V1\CreateReleaseRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\Deploy\V1\Release $release, string $releaseId): self + { + return (new self()) + ->setParent($parent) + ->setRelease($release) + ->setReleaseId($releaseId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The parent collection in which the `Release` should be created. + * Format should be + * projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}. + * @type string $release_id + * Required. ID of the `Release`. + * @type \Google\Cloud\Deploy\V1\Release $release + * Required. The `Release` to create. + * @type string $request_id + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validate_only + * Optional. If set to true, the request is validated and the user is provided + * with an expected result, but no actual change is made. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent collection in which the `Release` should be created. + * Format should be + * projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}. + * + * 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. The parent collection in which the `Release` should be created. + * Format should be + * projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}. + * + * 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. ID of the `Release`. + * + * Generated from protobuf field string release_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getReleaseId() + { + return $this->release_id; + } + + /** + * Required. ID of the `Release`. + * + * Generated from protobuf field string release_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setReleaseId($var) + { + GPBUtil::checkString($var, True); + $this->release_id = $var; + + return $this; + } + + /** + * Required. The `Release` to create. + * + * Generated from protobuf field .google.cloud.deploy.v1.Release release = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Deploy\V1\Release|null + */ + public function getRelease() + { + return $this->release; + } + + public function hasRelease() + { + return isset($this->release); + } + + public function clearRelease() + { + unset($this->release); + } + + /** + * Required. The `Release` to create. + * + * Generated from protobuf field .google.cloud.deploy.v1.Release release = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Deploy\V1\Release $var + * @return $this + */ + public function setRelease($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Deploy\V1\Release::class); + $this->release = $var; + + return $this; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + + /** + * Optional. If set to true, the request is validated and the user is provided + * with an expected result, but no actual change is made. + * + * Generated from protobuf field bool validate_only = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * Optional. If set to true, the request is validated and the user is provided + * with an expected result, but no actual change is made. + * + * Generated from protobuf field bool validate_only = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/CreateRolloutRequest.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/CreateRolloutRequest.php new file mode 100644 index 000000000000..4266e82919c9 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/CreateRolloutRequest.php @@ -0,0 +1,323 @@ +google.cloud.deploy.v1.CreateRolloutRequest + */ +class CreateRolloutRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent collection in which the `Rollout` should be created. + * Format should be + * projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}/releases/{release_name}. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. ID of the `Rollout`. + * + * Generated from protobuf field string rollout_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $rollout_id = ''; + /** + * Required. The `Rollout` to create. + * + * Generated from protobuf field .google.cloud.deploy.v1.Rollout rollout = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $rollout = null; + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + /** + * Optional. If set to true, the request is validated and the user is provided + * with an expected result, but no actual change is made. + * + * Generated from protobuf field bool validate_only = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $validate_only = false; + /** + * Optional. The starting phase ID for the `Rollout`. If empty the `Rollout` + * will start at the first phase. + * + * Generated from protobuf field string starting_phase_id = 7 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $starting_phase_id = ''; + + /** + * @param string $parent Required. The parent collection in which the `Rollout` should be created. + * Format should be + * projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}/releases/{release_name}. Please see + * {@see CloudDeployClient::releaseName()} for help formatting this field. + * @param \Google\Cloud\Deploy\V1\Rollout $rollout Required. The `Rollout` to create. + * @param string $rolloutId Required. ID of the `Rollout`. + * + * @return \Google\Cloud\Deploy\V1\CreateRolloutRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\Deploy\V1\Rollout $rollout, string $rolloutId): self + { + return (new self()) + ->setParent($parent) + ->setRollout($rollout) + ->setRolloutId($rolloutId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The parent collection in which the `Rollout` should be created. + * Format should be + * projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}/releases/{release_name}. + * @type string $rollout_id + * Required. ID of the `Rollout`. + * @type \Google\Cloud\Deploy\V1\Rollout $rollout + * Required. The `Rollout` to create. + * @type string $request_id + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validate_only + * Optional. If set to true, the request is validated and the user is provided + * with an expected result, but no actual change is made. + * @type string $starting_phase_id + * Optional. The starting phase ID for the `Rollout`. If empty the `Rollout` + * will start at the first phase. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent collection in which the `Rollout` should be created. + * Format should be + * projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}/releases/{release_name}. + * + * 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. The parent collection in which the `Rollout` should be created. + * Format should be + * projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}/releases/{release_name}. + * + * 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. ID of the `Rollout`. + * + * Generated from protobuf field string rollout_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getRolloutId() + { + return $this->rollout_id; + } + + /** + * Required. ID of the `Rollout`. + * + * Generated from protobuf field string rollout_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setRolloutId($var) + { + GPBUtil::checkString($var, True); + $this->rollout_id = $var; + + return $this; + } + + /** + * Required. The `Rollout` to create. + * + * Generated from protobuf field .google.cloud.deploy.v1.Rollout rollout = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Deploy\V1\Rollout|null + */ + public function getRollout() + { + return $this->rollout; + } + + public function hasRollout() + { + return isset($this->rollout); + } + + public function clearRollout() + { + unset($this->rollout); + } + + /** + * Required. The `Rollout` to create. + * + * Generated from protobuf field .google.cloud.deploy.v1.Rollout rollout = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Deploy\V1\Rollout $var + * @return $this + */ + public function setRollout($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Deploy\V1\Rollout::class); + $this->rollout = $var; + + return $this; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + + /** + * Optional. If set to true, the request is validated and the user is provided + * with an expected result, but no actual change is made. + * + * Generated from protobuf field bool validate_only = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * Optional. If set to true, the request is validated and the user is provided + * with an expected result, but no actual change is made. + * + * Generated from protobuf field bool validate_only = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + + /** + * Optional. The starting phase ID for the `Rollout`. If empty the `Rollout` + * will start at the first phase. + * + * Generated from protobuf field string starting_phase_id = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getStartingPhaseId() + { + return $this->starting_phase_id; + } + + /** + * Optional. The starting phase ID for the `Rollout`. If empty the `Rollout` + * will start at the first phase. + * + * Generated from protobuf field string starting_phase_id = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setStartingPhaseId($var) + { + GPBUtil::checkString($var, True); + $this->starting_phase_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/CreateTargetRequest.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/CreateTargetRequest.php new file mode 100644 index 000000000000..f6afb0100473 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/CreateTargetRequest.php @@ -0,0 +1,285 @@ +google.cloud.deploy.v1.CreateTargetRequest + */ +class CreateTargetRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent collection in which the `Target` should be created. + * Format should be + * projects/{project_id}/locations/{location_name}. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. ID of the `Target`. + * + * Generated from protobuf field string target_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $target_id = ''; + /** + * Required. The `Target` to create. + * + * Generated from protobuf field .google.cloud.deploy.v1.Target target = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $target = null; + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + /** + * Optional. If set to true, the request is validated and the user is provided + * with an expected result, but no actual change is made. + * + * Generated from protobuf field bool validate_only = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $validate_only = false; + + /** + * @param string $parent Required. The parent collection in which the `Target` should be created. + * Format should be + * projects/{project_id}/locations/{location_name}. Please see + * {@see CloudDeployClient::locationName()} for help formatting this field. + * @param \Google\Cloud\Deploy\V1\Target $target Required. The `Target` to create. + * @param string $targetId Required. ID of the `Target`. + * + * @return \Google\Cloud\Deploy\V1\CreateTargetRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\Deploy\V1\Target $target, string $targetId): self + { + return (new self()) + ->setParent($parent) + ->setTarget($target) + ->setTargetId($targetId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The parent collection in which the `Target` should be created. + * Format should be + * projects/{project_id}/locations/{location_name}. + * @type string $target_id + * Required. ID of the `Target`. + * @type \Google\Cloud\Deploy\V1\Target $target + * Required. The `Target` to create. + * @type string $request_id + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validate_only + * Optional. If set to true, the request is validated and the user is provided + * with an expected result, but no actual change is made. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent collection in which the `Target` should be created. + * Format should be + * projects/{project_id}/locations/{location_name}. + * + * 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. The parent collection in which the `Target` should be created. + * Format should be + * projects/{project_id}/locations/{location_name}. + * + * 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. ID of the `Target`. + * + * Generated from protobuf field string target_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getTargetId() + { + return $this->target_id; + } + + /** + * Required. ID of the `Target`. + * + * Generated from protobuf field string target_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setTargetId($var) + { + GPBUtil::checkString($var, True); + $this->target_id = $var; + + return $this; + } + + /** + * Required. The `Target` to create. + * + * Generated from protobuf field .google.cloud.deploy.v1.Target target = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Deploy\V1\Target|null + */ + public function getTarget() + { + return $this->target; + } + + public function hasTarget() + { + return isset($this->target); + } + + public function clearTarget() + { + unset($this->target); + } + + /** + * Required. The `Target` to create. + * + * Generated from protobuf field .google.cloud.deploy.v1.Target target = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Deploy\V1\Target $var + * @return $this + */ + public function setTarget($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Deploy\V1\Target::class); + $this->target = $var; + + return $this; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + + /** + * Optional. If set to true, the request is validated and the user is provided + * with an expected result, but no actual change is made. + * + * Generated from protobuf field bool validate_only = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * Optional. If set to true, the request is validated and the user is provided + * with an expected result, but no actual change is made. + * + * Generated from protobuf field bool validate_only = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/CustomCanaryDeployment.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/CustomCanaryDeployment.php new file mode 100644 index 000000000000..7564e1c85ac6 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/CustomCanaryDeployment.php @@ -0,0 +1,72 @@ +google.cloud.deploy.v1.CustomCanaryDeployment + */ +class CustomCanaryDeployment extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Configuration for each phase in the canary deployment in the + * order executed. + * + * Generated from protobuf field repeated .google.cloud.deploy.v1.CustomCanaryDeployment.PhaseConfig phase_configs = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private $phase_configs; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Deploy\V1\CustomCanaryDeployment\PhaseConfig>|\Google\Protobuf\Internal\RepeatedField $phase_configs + * Required. Configuration for each phase in the canary deployment in the + * order executed. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * Required. Configuration for each phase in the canary deployment in the + * order executed. + * + * Generated from protobuf field repeated .google.cloud.deploy.v1.CustomCanaryDeployment.PhaseConfig phase_configs = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getPhaseConfigs() + { + return $this->phase_configs; + } + + /** + * Required. Configuration for each phase in the canary deployment in the + * order executed. + * + * Generated from protobuf field repeated .google.cloud.deploy.v1.CustomCanaryDeployment.PhaseConfig phase_configs = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param array<\Google\Cloud\Deploy\V1\CustomCanaryDeployment\PhaseConfig>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setPhaseConfigs($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Deploy\V1\CustomCanaryDeployment\PhaseConfig::class); + $this->phase_configs = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/CustomCanaryDeployment/PhaseConfig.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/CustomCanaryDeployment/PhaseConfig.php new file mode 100644 index 000000000000..8afad9cc2e68 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/CustomCanaryDeployment/PhaseConfig.php @@ -0,0 +1,197 @@ +google.cloud.deploy.v1.CustomCanaryDeployment.PhaseConfig + */ +class PhaseConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The ID to assign to the `Rollout` phase. + * This value must consist of lower-case letters, numbers, and hyphens, + * start with a letter and end with a letter or a number, and have a max + * length of 63 characters. In other words, it must match the following + * regex: `^[a-z]([a-z0-9-]{0,61}[a-z0-9])?$`. + * + * Generated from protobuf field string phase_id = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $phase_id = ''; + /** + * Required. Percentage deployment for the phase. + * + * Generated from protobuf field int32 percentage = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $percentage = 0; + /** + * Skaffold profiles to use when rendering the manifest for this phase. + * These are in addition to the profiles list specified in the + * `DeliveryPipeline` stage. + * + * Generated from protobuf field repeated string profiles = 3; + */ + private $profiles; + /** + * Whether to run verify tests after the deployment. + * + * Generated from protobuf field bool verify = 4; + */ + protected $verify = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $phase_id + * Required. The ID to assign to the `Rollout` phase. + * This value must consist of lower-case letters, numbers, and hyphens, + * start with a letter and end with a letter or a number, and have a max + * length of 63 characters. In other words, it must match the following + * regex: `^[a-z]([a-z0-9-]{0,61}[a-z0-9])?$`. + * @type int $percentage + * Required. Percentage deployment for the phase. + * @type array|\Google\Protobuf\Internal\RepeatedField $profiles + * Skaffold profiles to use when rendering the manifest for this phase. + * These are in addition to the profiles list specified in the + * `DeliveryPipeline` stage. + * @type bool $verify + * Whether to run verify tests after the deployment. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * Required. The ID to assign to the `Rollout` phase. + * This value must consist of lower-case letters, numbers, and hyphens, + * start with a letter and end with a letter or a number, and have a max + * length of 63 characters. In other words, it must match the following + * regex: `^[a-z]([a-z0-9-]{0,61}[a-z0-9])?$`. + * + * Generated from protobuf field string phase_id = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getPhaseId() + { + return $this->phase_id; + } + + /** + * Required. The ID to assign to the `Rollout` phase. + * This value must consist of lower-case letters, numbers, and hyphens, + * start with a letter and end with a letter or a number, and have a max + * length of 63 characters. In other words, it must match the following + * regex: `^[a-z]([a-z0-9-]{0,61}[a-z0-9])?$`. + * + * Generated from protobuf field string phase_id = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setPhaseId($var) + { + GPBUtil::checkString($var, True); + $this->phase_id = $var; + + return $this; + } + + /** + * Required. Percentage deployment for the phase. + * + * Generated from protobuf field int32 percentage = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getPercentage() + { + return $this->percentage; + } + + /** + * Required. Percentage deployment for the phase. + * + * Generated from protobuf field int32 percentage = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setPercentage($var) + { + GPBUtil::checkInt32($var); + $this->percentage = $var; + + return $this; + } + + /** + * Skaffold profiles to use when rendering the manifest for this phase. + * These are in addition to the profiles list specified in the + * `DeliveryPipeline` stage. + * + * Generated from protobuf field repeated string profiles = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getProfiles() + { + return $this->profiles; + } + + /** + * Skaffold profiles to use when rendering the manifest for this phase. + * These are in addition to the profiles list specified in the + * `DeliveryPipeline` stage. + * + * Generated from protobuf field repeated string profiles = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setProfiles($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->profiles = $arr; + + return $this; + } + + /** + * Whether to run verify tests after the deployment. + * + * Generated from protobuf field bool verify = 4; + * @return bool + */ + public function getVerify() + { + return $this->verify; + } + + /** + * Whether to run verify tests after the deployment. + * + * Generated from protobuf field bool verify = 4; + * @param bool $var + * @return $this + */ + public function setVerify($var) + { + GPBUtil::checkBool($var); + $this->verify = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(PhaseConfig::class, \Google\Cloud\Deploy\V1\CustomCanaryDeployment_PhaseConfig::class); + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/CustomCanaryDeployment_PhaseConfig.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/CustomCanaryDeployment_PhaseConfig.php new file mode 100644 index 000000000000..e72a76ca738a --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/CustomCanaryDeployment_PhaseConfig.php @@ -0,0 +1,16 @@ +google.cloud.deploy.v1.DefaultPool + */ +class DefaultPool extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. Google service account to use for execution. If unspecified, + * the project execution service account + * (-compute@developer.gserviceaccount.com) will be used. + * + * Generated from protobuf field string service_account = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $service_account = ''; + /** + * Optional. Cloud Storage location where execution outputs should be stored. + * This can either be a bucket ("gs://my-bucket") or a path within a bucket + * ("gs://my-bucket/my-dir"). + * If unspecified, a default bucket located in the same region will be used. + * + * Generated from protobuf field string artifact_storage = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $artifact_storage = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $service_account + * Optional. Google service account to use for execution. If unspecified, + * the project execution service account + * (-compute@developer.gserviceaccount.com) will be used. + * @type string $artifact_storage + * Optional. Cloud Storage location where execution outputs should be stored. + * This can either be a bucket ("gs://my-bucket") or a path within a bucket + * ("gs://my-bucket/my-dir"). + * If unspecified, a default bucket located in the same region will be used. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * Optional. Google service account to use for execution. If unspecified, + * the project execution service account + * (-compute@developer.gserviceaccount.com) will be used. + * + * Generated from protobuf field string service_account = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getServiceAccount() + { + return $this->service_account; + } + + /** + * Optional. Google service account to use for execution. If unspecified, + * the project execution service account + * (-compute@developer.gserviceaccount.com) will be used. + * + * Generated from protobuf field string service_account = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setServiceAccount($var) + { + GPBUtil::checkString($var, True); + $this->service_account = $var; + + return $this; + } + + /** + * Optional. Cloud Storage location where execution outputs should be stored. + * This can either be a bucket ("gs://my-bucket") or a path within a bucket + * ("gs://my-bucket/my-dir"). + * If unspecified, a default bucket located in the same region will be used. + * + * Generated from protobuf field string artifact_storage = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getArtifactStorage() + { + return $this->artifact_storage; + } + + /** + * Optional. Cloud Storage location where execution outputs should be stored. + * This can either be a bucket ("gs://my-bucket") or a path within a bucket + * ("gs://my-bucket/my-dir"). + * If unspecified, a default bucket located in the same region will be used. + * + * Generated from protobuf field string artifact_storage = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setArtifactStorage($var) + { + GPBUtil::checkString($var, True); + $this->artifact_storage = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/DeleteDeliveryPipelineRequest.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/DeleteDeliveryPipelineRequest.php new file mode 100644 index 000000000000..afd763c6bf47 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/DeleteDeliveryPipelineRequest.php @@ -0,0 +1,320 @@ +google.cloud.deploy.v1.DeleteDeliveryPipelineRequest + */ +class DeleteDeliveryPipelineRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the `DeliveryPipeline` to delete. Format should be + * projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + /** + * Optional. If set to true, then deleting an already deleted or non-existing + * `DeliveryPipeline` will succeed. + * + * Generated from protobuf field bool allow_missing = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $allow_missing = false; + /** + * Optional. If set, validate the request and preview the review, but do not + * actually post it. + * + * Generated from protobuf field bool validate_only = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $validate_only = false; + /** + * Optional. If set to true, all child resources under this pipeline will also + * be deleted. Otherwise, the request will only work if the pipeline has no + * child resources. + * + * Generated from protobuf field bool force = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $force = false; + /** + * Optional. This checksum is computed by the server based on the value of + * other fields, and may be sent on update and delete requests to ensure the + * client has an up-to-date value before proceeding. + * + * Generated from protobuf field string etag = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $etag = ''; + + /** + * @param string $name Required. The name of the `DeliveryPipeline` to delete. Format should be + * projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}. Please see + * {@see CloudDeployClient::deliveryPipelineName()} for help formatting this field. + * + * @return \Google\Cloud\Deploy\V1\DeleteDeliveryPipelineRequest + * + * @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 `DeliveryPipeline` to delete. Format should be + * projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}. + * @type string $request_id + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $allow_missing + * Optional. If set to true, then deleting an already deleted or non-existing + * `DeliveryPipeline` will succeed. + * @type bool $validate_only + * Optional. If set, validate the request and preview the review, but do not + * actually post it. + * @type bool $force + * Optional. If set to true, all child resources under this pipeline will also + * be deleted. Otherwise, the request will only work if the pipeline has no + * child resources. + * @type string $etag + * Optional. This checksum is computed by the server based on the value of + * other fields, and may be sent on update and delete requests to ensure the + * client has an up-to-date value before proceeding. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the `DeliveryPipeline` to delete. Format should be + * projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}. + * + * 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 `DeliveryPipeline` to delete. Format should be + * projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}. + * + * 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; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + + /** + * Optional. If set to true, then deleting an already deleted or non-existing + * `DeliveryPipeline` will succeed. + * + * Generated from protobuf field bool allow_missing = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getAllowMissing() + { + return $this->allow_missing; + } + + /** + * Optional. If set to true, then deleting an already deleted or non-existing + * `DeliveryPipeline` will succeed. + * + * Generated from protobuf field bool allow_missing = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setAllowMissing($var) + { + GPBUtil::checkBool($var); + $this->allow_missing = $var; + + return $this; + } + + /** + * Optional. If set, validate the request and preview the review, but do not + * actually post it. + * + * Generated from protobuf field bool validate_only = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * Optional. If set, validate the request and preview the review, but do not + * actually post it. + * + * Generated from protobuf field bool validate_only = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + + /** + * Optional. If set to true, all child resources under this pipeline will also + * be deleted. Otherwise, the request will only work if the pipeline has no + * child resources. + * + * Generated from protobuf field bool force = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getForce() + { + return $this->force; + } + + /** + * Optional. If set to true, all child resources under this pipeline will also + * be deleted. Otherwise, the request will only work if the pipeline has no + * child resources. + * + * Generated from protobuf field bool force = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setForce($var) + { + GPBUtil::checkBool($var); + $this->force = $var; + + return $this; + } + + /** + * Optional. This checksum is computed by the server based on the value of + * other fields, and may be sent on update and delete requests to ensure the + * client has an up-to-date value before proceeding. + * + * Generated from protobuf field string etag = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * Optional. This checksum is computed by the server based on the value of + * other fields, and may be sent on update and delete requests to ensure the + * client has an up-to-date value before proceeding. + * + * Generated from protobuf field string etag = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, True); + $this->etag = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/DeleteTargetRequest.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/DeleteTargetRequest.php new file mode 100644 index 000000000000..7050293ae903 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/DeleteTargetRequest.php @@ -0,0 +1,278 @@ +google.cloud.deploy.v1.DeleteTargetRequest + */ +class DeleteTargetRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the `Target` to delete. Format should be + * projects/{project_id}/locations/{location_name}/targets/{target_name}. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + /** + * Optional. If set to true, then deleting an already deleted or non-existing + * DeliveryPipeline will succeed. + * + * Generated from protobuf field bool allow_missing = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $allow_missing = false; + /** + * Optional. If set, validate the request and preview the review, but do not + * actually post it. + * + * Generated from protobuf field bool validate_only = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $validate_only = false; + /** + * Optional. This checksum is computed by the server based on the value of + * other fields, and may be sent on update and delete requests to ensure the + * client has an up-to-date value before proceeding. + * + * Generated from protobuf field string etag = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $etag = ''; + + /** + * @param string $name Required. The name of the `Target` to delete. Format should be + * projects/{project_id}/locations/{location_name}/targets/{target_name}. Please see + * {@see CloudDeployClient::targetName()} for help formatting this field. + * + * @return \Google\Cloud\Deploy\V1\DeleteTargetRequest + * + * @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 `Target` to delete. Format should be + * projects/{project_id}/locations/{location_name}/targets/{target_name}. + * @type string $request_id + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $allow_missing + * Optional. If set to true, then deleting an already deleted or non-existing + * DeliveryPipeline will succeed. + * @type bool $validate_only + * Optional. If set, validate the request and preview the review, but do not + * actually post it. + * @type string $etag + * Optional. This checksum is computed by the server based on the value of + * other fields, and may be sent on update and delete requests to ensure the + * client has an up-to-date value before proceeding. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the `Target` to delete. Format should be + * projects/{project_id}/locations/{location_name}/targets/{target_name}. + * + * 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 `Target` to delete. Format should be + * projects/{project_id}/locations/{location_name}/targets/{target_name}. + * + * 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; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + + /** + * Optional. If set to true, then deleting an already deleted or non-existing + * DeliveryPipeline will succeed. + * + * Generated from protobuf field bool allow_missing = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getAllowMissing() + { + return $this->allow_missing; + } + + /** + * Optional. If set to true, then deleting an already deleted or non-existing + * DeliveryPipeline will succeed. + * + * Generated from protobuf field bool allow_missing = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setAllowMissing($var) + { + GPBUtil::checkBool($var); + $this->allow_missing = $var; + + return $this; + } + + /** + * Optional. If set, validate the request and preview the review, but do not + * actually post it. + * + * Generated from protobuf field bool validate_only = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * Optional. If set, validate the request and preview the review, but do not + * actually post it. + * + * Generated from protobuf field bool validate_only = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + + /** + * Optional. This checksum is computed by the server based on the value of + * other fields, and may be sent on update and delete requests to ensure the + * client has an up-to-date value before proceeding. + * + * Generated from protobuf field string etag = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * Optional. This checksum is computed by the server based on the value of + * other fields, and may be sent on update and delete requests to ensure the + * client has an up-to-date value before proceeding. + * + * Generated from protobuf field string etag = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, True); + $this->etag = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/DeliveryPipeline.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/DeliveryPipeline.php new file mode 100644 index 000000000000..51e39d70bbfa --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/DeliveryPipeline.php @@ -0,0 +1,506 @@ +google.cloud.deploy.v1.DeliveryPipeline + */ +class DeliveryPipeline extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. Name of the `DeliveryPipeline`. Format is projects/{project}/ + * locations/{location}/deliveryPipelines/[a-z][a-z0-9\-]{0,62}. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $name = ''; + /** + * Output only. Unique identifier of the `DeliveryPipeline`. + * + * Generated from protobuf field string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $uid = ''; + /** + * Description of the `DeliveryPipeline`. Max length is 255 characters. + * + * Generated from protobuf field string description = 3; + */ + protected $description = ''; + /** + * User annotations. These attributes can only be set and used by the + * user, and not by Google Cloud Deploy. + * + * Generated from protobuf field map annotations = 4; + */ + private $annotations; + /** + * Labels are attributes that can be set and used by both the + * user and by Google Cloud Deploy. Labels must meet the following + * constraints: + * * Keys and values can contain only lowercase letters, numeric characters, + * underscores, and dashes. + * * All characters must use UTF-8 encoding, and international characters are + * allowed. + * * Keys must start with a lowercase letter or international character. + * * Each resource is limited to a maximum of 64 labels. + * Both keys and values are additionally constrained to be <= 128 bytes. + * + * Generated from protobuf field map labels = 5; + */ + private $labels; + /** + * Output only. Time at which the pipeline was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. Most recent time at which the pipeline was updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * Output only. Information around the state of the Delivery Pipeline. + * + * Generated from protobuf field .google.cloud.deploy.v1.PipelineCondition condition = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $condition = null; + /** + * This checksum is computed by the server based on the value of other + * fields, and may be sent on update and delete requests to ensure the + * client has an up-to-date value before proceeding. + * + * Generated from protobuf field string etag = 10; + */ + protected $etag = ''; + /** + * When suspended, no new releases or rollouts can be created, + * but in-progress ones will complete. + * + * Generated from protobuf field bool suspended = 12; + */ + protected $suspended = false; + protected $pipeline; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Optional. Name of the `DeliveryPipeline`. Format is projects/{project}/ + * locations/{location}/deliveryPipelines/[a-z][a-z0-9\-]{0,62}. + * @type string $uid + * Output only. Unique identifier of the `DeliveryPipeline`. + * @type string $description + * Description of the `DeliveryPipeline`. Max length is 255 characters. + * @type array|\Google\Protobuf\Internal\MapField $annotations + * User annotations. These attributes can only be set and used by the + * user, and not by Google Cloud Deploy. + * @type array|\Google\Protobuf\Internal\MapField $labels + * Labels are attributes that can be set and used by both the + * user and by Google Cloud Deploy. Labels must meet the following + * constraints: + * * Keys and values can contain only lowercase letters, numeric characters, + * underscores, and dashes. + * * All characters must use UTF-8 encoding, and international characters are + * allowed. + * * Keys must start with a lowercase letter or international character. + * * Each resource is limited to a maximum of 64 labels. + * Both keys and values are additionally constrained to be <= 128 bytes. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. Time at which the pipeline was created. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. Most recent time at which the pipeline was updated. + * @type \Google\Cloud\Deploy\V1\SerialPipeline $serial_pipeline + * SerialPipeline defines a sequential set of stages for a + * `DeliveryPipeline`. + * @type \Google\Cloud\Deploy\V1\PipelineCondition $condition + * Output only. Information around the state of the Delivery Pipeline. + * @type string $etag + * This checksum is computed by the server based on the value of other + * fields, and may be sent on update and delete requests to ensure the + * client has an up-to-date value before proceeding. + * @type bool $suspended + * When suspended, no new releases or rollouts can be created, + * but in-progress ones will complete. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * Optional. Name of the `DeliveryPipeline`. Format is projects/{project}/ + * locations/{location}/deliveryPipelines/[a-z][a-z0-9\-]{0,62}. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Optional. Name of the `DeliveryPipeline`. Format is projects/{project}/ + * locations/{location}/deliveryPipelines/[a-z][a-z0-9\-]{0,62}. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. Unique identifier of the `DeliveryPipeline`. + * + * Generated from protobuf field string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getUid() + { + return $this->uid; + } + + /** + * Output only. Unique identifier of the `DeliveryPipeline`. + * + * Generated from protobuf field string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setUid($var) + { + GPBUtil::checkString($var, True); + $this->uid = $var; + + return $this; + } + + /** + * Description of the `DeliveryPipeline`. Max length is 255 characters. + * + * Generated from protobuf field string description = 3; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Description of the `DeliveryPipeline`. Max length is 255 characters. + * + * Generated from protobuf field string description = 3; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * User annotations. These attributes can only be set and used by the + * user, and not by Google Cloud Deploy. + * + * Generated from protobuf field map annotations = 4; + * @return \Google\Protobuf\Internal\MapField + */ + public function getAnnotations() + { + return $this->annotations; + } + + /** + * User annotations. These attributes can only be set and used by the + * user, and not by Google Cloud Deploy. + * + * Generated from protobuf field map annotations = 4; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setAnnotations($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->annotations = $arr; + + return $this; + } + + /** + * Labels are attributes that can be set and used by both the + * user and by Google Cloud Deploy. Labels must meet the following + * constraints: + * * Keys and values can contain only lowercase letters, numeric characters, + * underscores, and dashes. + * * All characters must use UTF-8 encoding, and international characters are + * allowed. + * * Keys must start with a lowercase letter or international character. + * * Each resource is limited to a maximum of 64 labels. + * Both keys and values are additionally constrained to be <= 128 bytes. + * + * Generated from protobuf field map labels = 5; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * Labels are attributes that can be set and used by both the + * user and by Google Cloud Deploy. Labels must meet the following + * constraints: + * * Keys and values can contain only lowercase letters, numeric characters, + * underscores, and dashes. + * * All characters must use UTF-8 encoding, and international characters are + * allowed. + * * Keys must start with a lowercase letter or international character. + * * Each resource is limited to a maximum of 64 labels. + * Both keys and values are additionally constrained to be <= 128 bytes. + * + * Generated from protobuf field map labels = 5; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + + /** + * Output only. Time at which the pipeline was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 6 [(.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. Time at which the pipeline was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 6 [(.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. Most recent time at which the pipeline was updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 7 [(.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. Most recent time at which the pipeline was updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 7 [(.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; + } + + /** + * SerialPipeline defines a sequential set of stages for a + * `DeliveryPipeline`. + * + * Generated from protobuf field .google.cloud.deploy.v1.SerialPipeline serial_pipeline = 8; + * @return \Google\Cloud\Deploy\V1\SerialPipeline|null + */ + public function getSerialPipeline() + { + return $this->readOneof(8); + } + + public function hasSerialPipeline() + { + return $this->hasOneof(8); + } + + /** + * SerialPipeline defines a sequential set of stages for a + * `DeliveryPipeline`. + * + * Generated from protobuf field .google.cloud.deploy.v1.SerialPipeline serial_pipeline = 8; + * @param \Google\Cloud\Deploy\V1\SerialPipeline $var + * @return $this + */ + public function setSerialPipeline($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Deploy\V1\SerialPipeline::class); + $this->writeOneof(8, $var); + + return $this; + } + + /** + * Output only. Information around the state of the Delivery Pipeline. + * + * Generated from protobuf field .google.cloud.deploy.v1.PipelineCondition condition = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\Deploy\V1\PipelineCondition|null + */ + public function getCondition() + { + return $this->condition; + } + + public function hasCondition() + { + return isset($this->condition); + } + + public function clearCondition() + { + unset($this->condition); + } + + /** + * Output only. Information around the state of the Delivery Pipeline. + * + * Generated from protobuf field .google.cloud.deploy.v1.PipelineCondition condition = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\Deploy\V1\PipelineCondition $var + * @return $this + */ + public function setCondition($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Deploy\V1\PipelineCondition::class); + $this->condition = $var; + + return $this; + } + + /** + * This checksum is computed by the server based on the value of other + * fields, and may be sent on update and delete requests to ensure the + * client has an up-to-date value before proceeding. + * + * Generated from protobuf field string etag = 10; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * This checksum is computed by the server based on the value of other + * fields, and may be sent on update and delete requests to ensure the + * client has an up-to-date value before proceeding. + * + * Generated from protobuf field string etag = 10; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, True); + $this->etag = $var; + + return $this; + } + + /** + * When suspended, no new releases or rollouts can be created, + * but in-progress ones will complete. + * + * Generated from protobuf field bool suspended = 12; + * @return bool + */ + public function getSuspended() + { + return $this->suspended; + } + + /** + * When suspended, no new releases or rollouts can be created, + * but in-progress ones will complete. + * + * Generated from protobuf field bool suspended = 12; + * @param bool $var + * @return $this + */ + public function setSuspended($var) + { + GPBUtil::checkBool($var); + $this->suspended = $var; + + return $this; + } + + /** + * @return string + */ + public function getPipeline() + { + return $this->whichOneof("pipeline"); + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/DeliveryPipelineNotificationEvent.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/DeliveryPipelineNotificationEvent.php new file mode 100644 index 000000000000..7700e0417232 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/DeliveryPipelineNotificationEvent.php @@ -0,0 +1,137 @@ +google.cloud.deploy.v1.DeliveryPipelineNotificationEvent + */ +class DeliveryPipelineNotificationEvent extends \Google\Protobuf\Internal\Message +{ + /** + * Debug message for when a notification fails to send. + * + * Generated from protobuf field string message = 1; + */ + protected $message = ''; + /** + * The name of the `Delivery Pipeline`. + * + * Generated from protobuf field string delivery_pipeline = 2; + */ + protected $delivery_pipeline = ''; + /** + * Type of this notification, e.g. for a Pub/Sub failure. + * + * Generated from protobuf field .google.cloud.deploy.v1.Type type = 3; + */ + protected $type = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $message + * Debug message for when a notification fails to send. + * @type string $delivery_pipeline + * The name of the `Delivery Pipeline`. + * @type int $type + * Type of this notification, e.g. for a Pub/Sub failure. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\DeliverypipelineNotificationPayload::initOnce(); + parent::__construct($data); + } + + /** + * Debug message for when a notification fails to send. + * + * Generated from protobuf field string message = 1; + * @return string + */ + public function getMessage() + { + return $this->message; + } + + /** + * Debug message for when a notification fails to send. + * + * Generated from protobuf field string message = 1; + * @param string $var + * @return $this + */ + public function setMessage($var) + { + GPBUtil::checkString($var, True); + $this->message = $var; + + return $this; + } + + /** + * The name of the `Delivery Pipeline`. + * + * Generated from protobuf field string delivery_pipeline = 2; + * @return string + */ + public function getDeliveryPipeline() + { + return $this->delivery_pipeline; + } + + /** + * The name of the `Delivery Pipeline`. + * + * Generated from protobuf field string delivery_pipeline = 2; + * @param string $var + * @return $this + */ + public function setDeliveryPipeline($var) + { + GPBUtil::checkString($var, True); + $this->delivery_pipeline = $var; + + return $this; + } + + /** + * Type of this notification, e.g. for a Pub/Sub failure. + * + * Generated from protobuf field .google.cloud.deploy.v1.Type type = 3; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * Type of this notification, e.g. for a Pub/Sub failure. + * + * Generated from protobuf field .google.cloud.deploy.v1.Type type = 3; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Deploy\V1\Type::class); + $this->type = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/DeployArtifact.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/DeployArtifact.php new file mode 100644 index 000000000000..f7b78f40dd51 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/DeployArtifact.php @@ -0,0 +1,109 @@ +google.cloud.deploy.v1.DeployArtifact + */ +class DeployArtifact extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. URI of a directory containing the artifacts. All paths are + * relative to this location. + * + * Generated from protobuf field string artifact_uri = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $artifact_uri = ''; + /** + * Output only. File paths of the manifests applied during the deploy + * operation relative to the URI. + * + * Generated from protobuf field repeated string manifest_paths = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $manifest_paths; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $artifact_uri + * Output only. URI of a directory containing the artifacts. All paths are + * relative to this location. + * @type array|\Google\Protobuf\Internal\RepeatedField $manifest_paths + * Output only. File paths of the manifests applied during the deploy + * operation relative to the URI. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * Output only. URI of a directory containing the artifacts. All paths are + * relative to this location. + * + * Generated from protobuf field string artifact_uri = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getArtifactUri() + { + return $this->artifact_uri; + } + + /** + * Output only. URI of a directory containing the artifacts. All paths are + * relative to this location. + * + * Generated from protobuf field string artifact_uri = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setArtifactUri($var) + { + GPBUtil::checkString($var, True); + $this->artifact_uri = $var; + + return $this; + } + + /** + * Output only. File paths of the manifests applied during the deploy + * operation relative to the URI. + * + * Generated from protobuf field repeated string manifest_paths = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getManifestPaths() + { + return $this->manifest_paths; + } + + /** + * Output only. File paths of the manifests applied during the deploy + * operation relative to the URI. + * + * Generated from protobuf field repeated string manifest_paths = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setManifestPaths($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->manifest_paths = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/DeployJob.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/DeployJob.php new file mode 100644 index 000000000000..10225c0936ea --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/DeployJob.php @@ -0,0 +1,33 @@ +google.cloud.deploy.v1.DeployJob + */ +class DeployJob extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/DeployJobRun.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/DeployJobRun.php new file mode 100644 index 000000000000..70be401fceef --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/DeployJobRun.php @@ -0,0 +1,235 @@ +google.cloud.deploy.v1.DeployJobRun + */ +class DeployJobRun extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The resource name of the Cloud Build `Build` object that is + * used to deploy. Format is + * projects/{project}/locations/{location}/builds/{build}. + * + * Generated from protobuf field string build = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + */ + protected $build = ''; + /** + * Output only. The reason the deploy failed. This will always be unspecified + * while the deploy is in progress or if it succeeded. + * + * Generated from protobuf field .google.cloud.deploy.v1.DeployJobRun.FailureCause failure_cause = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $failure_cause = 0; + /** + * Output only. Additional information about the deploy failure, if available. + * + * Generated from protobuf field string failure_message = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $failure_message = ''; + /** + * Output only. Metadata containing information about the deploy job run. + * + * Generated from protobuf field .google.cloud.deploy.v1.DeployJobRunMetadata metadata = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $metadata = null; + /** + * Output only. The artifact of a deploy job run, if available. + * + * Generated from protobuf field .google.cloud.deploy.v1.DeployArtifact artifact = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $artifact = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $build + * Output only. The resource name of the Cloud Build `Build` object that is + * used to deploy. Format is + * projects/{project}/locations/{location}/builds/{build}. + * @type int $failure_cause + * Output only. The reason the deploy failed. This will always be unspecified + * while the deploy is in progress or if it succeeded. + * @type string $failure_message + * Output only. Additional information about the deploy failure, if available. + * @type \Google\Cloud\Deploy\V1\DeployJobRunMetadata $metadata + * Output only. Metadata containing information about the deploy job run. + * @type \Google\Cloud\Deploy\V1\DeployArtifact $artifact + * Output only. The artifact of a deploy job run, if available. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The resource name of the Cloud Build `Build` object that is + * used to deploy. Format is + * projects/{project}/locations/{location}/builds/{build}. + * + * Generated from protobuf field string build = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + * @return string + */ + public function getBuild() + { + return $this->build; + } + + /** + * Output only. The resource name of the Cloud Build `Build` object that is + * used to deploy. Format is + * projects/{project}/locations/{location}/builds/{build}. + * + * Generated from protobuf field string build = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setBuild($var) + { + GPBUtil::checkString($var, True); + $this->build = $var; + + return $this; + } + + /** + * Output only. The reason the deploy failed. This will always be unspecified + * while the deploy is in progress or if it succeeded. + * + * Generated from protobuf field .google.cloud.deploy.v1.DeployJobRun.FailureCause failure_cause = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getFailureCause() + { + return $this->failure_cause; + } + + /** + * Output only. The reason the deploy failed. This will always be unspecified + * while the deploy is in progress or if it succeeded. + * + * Generated from protobuf field .google.cloud.deploy.v1.DeployJobRun.FailureCause failure_cause = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setFailureCause($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Deploy\V1\DeployJobRun\FailureCause::class); + $this->failure_cause = $var; + + return $this; + } + + /** + * Output only. Additional information about the deploy failure, if available. + * + * Generated from protobuf field string failure_message = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getFailureMessage() + { + return $this->failure_message; + } + + /** + * Output only. Additional information about the deploy failure, if available. + * + * Generated from protobuf field string failure_message = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setFailureMessage($var) + { + GPBUtil::checkString($var, True); + $this->failure_message = $var; + + return $this; + } + + /** + * Output only. Metadata containing information about the deploy job run. + * + * Generated from protobuf field .google.cloud.deploy.v1.DeployJobRunMetadata metadata = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\Deploy\V1\DeployJobRunMetadata|null + */ + public function getMetadata() + { + return $this->metadata; + } + + public function hasMetadata() + { + return isset($this->metadata); + } + + public function clearMetadata() + { + unset($this->metadata); + } + + /** + * Output only. Metadata containing information about the deploy job run. + * + * Generated from protobuf field .google.cloud.deploy.v1.DeployJobRunMetadata metadata = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\Deploy\V1\DeployJobRunMetadata $var + * @return $this + */ + public function setMetadata($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Deploy\V1\DeployJobRunMetadata::class); + $this->metadata = $var; + + return $this; + } + + /** + * Output only. The artifact of a deploy job run, if available. + * + * Generated from protobuf field .google.cloud.deploy.v1.DeployArtifact artifact = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\Deploy\V1\DeployArtifact|null + */ + public function getArtifact() + { + return $this->artifact; + } + + public function hasArtifact() + { + return isset($this->artifact); + } + + public function clearArtifact() + { + unset($this->artifact); + } + + /** + * Output only. The artifact of a deploy job run, if available. + * + * Generated from protobuf field .google.cloud.deploy.v1.DeployArtifact artifact = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\Deploy\V1\DeployArtifact $var + * @return $this + */ + public function setArtifact($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Deploy\V1\DeployArtifact::class); + $this->artifact = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/DeployJobRun/FailureCause.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/DeployJobRun/FailureCause.php new file mode 100644 index 000000000000..c1e664cd030b --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/DeployJobRun/FailureCause.php @@ -0,0 +1,90 @@ +google.cloud.deploy.v1.DeployJobRun.FailureCause + */ +class FailureCause +{ + /** + * No reason for failure is specified. + * + * Generated from protobuf enum FAILURE_CAUSE_UNSPECIFIED = 0; + */ + const FAILURE_CAUSE_UNSPECIFIED = 0; + /** + * Cloud Build is not available, either because it is not enabled or because + * Google Cloud Deploy has insufficient permissions. See [Required + * permission](/deploy/docs/cloud-deploy-service-account#required_permissions). + * + * Generated from protobuf enum CLOUD_BUILD_UNAVAILABLE = 1; + */ + const CLOUD_BUILD_UNAVAILABLE = 1; + /** + * The deploy operation did not complete successfully; check Cloud Build + * logs. + * + * Generated from protobuf enum EXECUTION_FAILED = 2; + */ + const EXECUTION_FAILED = 2; + /** + * The deploy build did not complete within the alloted time. + * + * Generated from protobuf enum DEADLINE_EXCEEDED = 3; + */ + const DEADLINE_EXCEEDED = 3; + /** + * There were missing resources in the runtime environment required for a + * canary deployment. Check the Cloud Build logs for more information. + * + * Generated from protobuf enum MISSING_RESOURCES_FOR_CANARY = 4; + */ + const MISSING_RESOURCES_FOR_CANARY = 4; + /** + * Cloud Build failed to fulfill Google Cloud Deploy's request. See + * failure_message for additional details. + * + * Generated from protobuf enum CLOUD_BUILD_REQUEST_FAILED = 5; + */ + const CLOUD_BUILD_REQUEST_FAILED = 5; + + private static $valueToName = [ + self::FAILURE_CAUSE_UNSPECIFIED => 'FAILURE_CAUSE_UNSPECIFIED', + self::CLOUD_BUILD_UNAVAILABLE => 'CLOUD_BUILD_UNAVAILABLE', + self::EXECUTION_FAILED => 'EXECUTION_FAILED', + self::DEADLINE_EXCEEDED => 'DEADLINE_EXCEEDED', + self::MISSING_RESOURCES_FOR_CANARY => 'MISSING_RESOURCES_FOR_CANARY', + self::CLOUD_BUILD_REQUEST_FAILED => 'CLOUD_BUILD_REQUEST_FAILED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(FailureCause::class, \Google\Cloud\Deploy\V1\DeployJobRun_FailureCause::class); + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/DeployJobRunMetadata.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/DeployJobRunMetadata.php new file mode 100644 index 000000000000..56cd0f4fb22c --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/DeployJobRunMetadata.php @@ -0,0 +1,82 @@ +google.cloud.deploy.v1.DeployJobRunMetadata + */ +class DeployJobRunMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The name of the Cloud Run Service that is associated with a + * `DeployJobRun`. + * + * Generated from protobuf field .google.cloud.deploy.v1.CloudRunMetadata cloud_run = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $cloud_run = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Deploy\V1\CloudRunMetadata $cloud_run + * Output only. The name of the Cloud Run Service that is associated with a + * `DeployJobRun`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The name of the Cloud Run Service that is associated with a + * `DeployJobRun`. + * + * Generated from protobuf field .google.cloud.deploy.v1.CloudRunMetadata cloud_run = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\Deploy\V1\CloudRunMetadata|null + */ + public function getCloudRun() + { + return $this->cloud_run; + } + + public function hasCloudRun() + { + return isset($this->cloud_run); + } + + public function clearCloudRun() + { + unset($this->cloud_run); + } + + /** + * Output only. The name of the Cloud Run Service that is associated with a + * `DeployJobRun`. + * + * Generated from protobuf field .google.cloud.deploy.v1.CloudRunMetadata cloud_run = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\Deploy\V1\CloudRunMetadata $var + * @return $this + */ + public function setCloudRun($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Deploy\V1\CloudRunMetadata::class); + $this->cloud_run = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/DeployJobRun_FailureCause.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/DeployJobRun_FailureCause.php new file mode 100644 index 000000000000..621c5c708fcb --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/DeployJobRun_FailureCause.php @@ -0,0 +1,16 @@ +google.cloud.deploy.v1.DeploymentJobs + */ +class DeploymentJobs extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The deploy Job. This is the deploy job in the phase. + * + * Generated from protobuf field .google.cloud.deploy.v1.Job deploy_job = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $deploy_job = null; + /** + * Output only. The verify Job. Runs after a deploy if the deploy succeeds. + * + * Generated from protobuf field .google.cloud.deploy.v1.Job verify_job = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $verify_job = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Deploy\V1\Job $deploy_job + * Output only. The deploy Job. This is the deploy job in the phase. + * @type \Google\Cloud\Deploy\V1\Job $verify_job + * Output only. The verify Job. Runs after a deploy if the deploy succeeds. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The deploy Job. This is the deploy job in the phase. + * + * Generated from protobuf field .google.cloud.deploy.v1.Job deploy_job = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\Deploy\V1\Job|null + */ + public function getDeployJob() + { + return $this->deploy_job; + } + + public function hasDeployJob() + { + return isset($this->deploy_job); + } + + public function clearDeployJob() + { + unset($this->deploy_job); + } + + /** + * Output only. The deploy Job. This is the deploy job in the phase. + * + * Generated from protobuf field .google.cloud.deploy.v1.Job deploy_job = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\Deploy\V1\Job $var + * @return $this + */ + public function setDeployJob($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Deploy\V1\Job::class); + $this->deploy_job = $var; + + return $this; + } + + /** + * Output only. The verify Job. Runs after a deploy if the deploy succeeds. + * + * Generated from protobuf field .google.cloud.deploy.v1.Job verify_job = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\Deploy\V1\Job|null + */ + public function getVerifyJob() + { + return $this->verify_job; + } + + public function hasVerifyJob() + { + return isset($this->verify_job); + } + + public function clearVerifyJob() + { + unset($this->verify_job); + } + + /** + * Output only. The verify Job. Runs after a deploy if the deploy succeeds. + * + * Generated from protobuf field .google.cloud.deploy.v1.Job verify_job = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\Deploy\V1\Job $var + * @return $this + */ + public function setVerifyJob($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Deploy\V1\Job::class); + $this->verify_job = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/ExecutionConfig.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/ExecutionConfig.php new file mode 100644 index 000000000000..17f5e8d0c0d3 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/ExecutionConfig.php @@ -0,0 +1,328 @@ +google.cloud.deploy.v1.ExecutionConfig + */ +class ExecutionConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Usages when this configuration should be applied. + * + * Generated from protobuf field repeated .google.cloud.deploy.v1.ExecutionConfig.ExecutionEnvironmentUsage usages = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private $usages; + /** + * Optional. The resource name of the `WorkerPool`, with the format + * `projects/{project}/locations/{location}/workerPools/{worker_pool}`. + * If this optional field is unspecified, the default Cloud Build pool will be + * used. + * + * Generated from protobuf field string worker_pool = 4 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + */ + protected $worker_pool = ''; + /** + * Optional. Google service account to use for execution. If unspecified, + * the project execution service account + * (-compute@developer.gserviceaccount.com) is used. + * + * Generated from protobuf field string service_account = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $service_account = ''; + /** + * Optional. Cloud Storage location in which to store execution outputs. This + * can either be a bucket ("gs://my-bucket") or a path within a bucket + * ("gs://my-bucket/my-dir"). + * If unspecified, a default bucket located in the same region will be used. + * + * Generated from protobuf field string artifact_storage = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $artifact_storage = ''; + /** + * Optional. Execution timeout for a Cloud Build Execution. This must be + * between 10m and 24h in seconds format. If unspecified, a default timeout of + * 1h is used. + * + * Generated from protobuf field .google.protobuf.Duration execution_timeout = 7 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $execution_timeout = null; + protected $execution_environment; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $usages + * Required. Usages when this configuration should be applied. + * @type \Google\Cloud\Deploy\V1\DefaultPool $default_pool + * Optional. Use default Cloud Build pool. + * @type \Google\Cloud\Deploy\V1\PrivatePool $private_pool + * Optional. Use private Cloud Build pool. + * @type string $worker_pool + * Optional. The resource name of the `WorkerPool`, with the format + * `projects/{project}/locations/{location}/workerPools/{worker_pool}`. + * If this optional field is unspecified, the default Cloud Build pool will be + * used. + * @type string $service_account + * Optional. Google service account to use for execution. If unspecified, + * the project execution service account + * (-compute@developer.gserviceaccount.com) is used. + * @type string $artifact_storage + * Optional. Cloud Storage location in which to store execution outputs. This + * can either be a bucket ("gs://my-bucket") or a path within a bucket + * ("gs://my-bucket/my-dir"). + * If unspecified, a default bucket located in the same region will be used. + * @type \Google\Protobuf\Duration $execution_timeout + * Optional. Execution timeout for a Cloud Build Execution. This must be + * between 10m and 24h in seconds format. If unspecified, a default timeout of + * 1h is used. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * Required. Usages when this configuration should be applied. + * + * Generated from protobuf field repeated .google.cloud.deploy.v1.ExecutionConfig.ExecutionEnvironmentUsage usages = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUsages() + { + return $this->usages; + } + + /** + * Required. Usages when this configuration should be applied. + * + * Generated from protobuf field repeated .google.cloud.deploy.v1.ExecutionConfig.ExecutionEnvironmentUsage usages = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUsages($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM, \Google\Cloud\Deploy\V1\ExecutionConfig\ExecutionEnvironmentUsage::class); + $this->usages = $arr; + + return $this; + } + + /** + * Optional. Use default Cloud Build pool. + * + * Generated from protobuf field .google.cloud.deploy.v1.DefaultPool default_pool = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\Deploy\V1\DefaultPool|null + */ + public function getDefaultPool() + { + return $this->readOneof(2); + } + + public function hasDefaultPool() + { + return $this->hasOneof(2); + } + + /** + * Optional. Use default Cloud Build pool. + * + * Generated from protobuf field .google.cloud.deploy.v1.DefaultPool default_pool = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\Deploy\V1\DefaultPool $var + * @return $this + */ + public function setDefaultPool($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Deploy\V1\DefaultPool::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * Optional. Use private Cloud Build pool. + * + * Generated from protobuf field .google.cloud.deploy.v1.PrivatePool private_pool = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\Deploy\V1\PrivatePool|null + */ + public function getPrivatePool() + { + return $this->readOneof(3); + } + + public function hasPrivatePool() + { + return $this->hasOneof(3); + } + + /** + * Optional. Use private Cloud Build pool. + * + * Generated from protobuf field .google.cloud.deploy.v1.PrivatePool private_pool = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\Deploy\V1\PrivatePool $var + * @return $this + */ + public function setPrivatePool($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Deploy\V1\PrivatePool::class); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * Optional. The resource name of the `WorkerPool`, with the format + * `projects/{project}/locations/{location}/workerPools/{worker_pool}`. + * If this optional field is unspecified, the default Cloud Build pool will be + * used. + * + * Generated from protobuf field string worker_pool = 4 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @return string + */ + public function getWorkerPool() + { + return $this->worker_pool; + } + + /** + * Optional. The resource name of the `WorkerPool`, with the format + * `projects/{project}/locations/{location}/workerPools/{worker_pool}`. + * If this optional field is unspecified, the default Cloud Build pool will be + * used. + * + * Generated from protobuf field string worker_pool = 4 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setWorkerPool($var) + { + GPBUtil::checkString($var, True); + $this->worker_pool = $var; + + return $this; + } + + /** + * Optional. Google service account to use for execution. If unspecified, + * the project execution service account + * (-compute@developer.gserviceaccount.com) is used. + * + * Generated from protobuf field string service_account = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getServiceAccount() + { + return $this->service_account; + } + + /** + * Optional. Google service account to use for execution. If unspecified, + * the project execution service account + * (-compute@developer.gserviceaccount.com) is used. + * + * Generated from protobuf field string service_account = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setServiceAccount($var) + { + GPBUtil::checkString($var, True); + $this->service_account = $var; + + return $this; + } + + /** + * Optional. Cloud Storage location in which to store execution outputs. This + * can either be a bucket ("gs://my-bucket") or a path within a bucket + * ("gs://my-bucket/my-dir"). + * If unspecified, a default bucket located in the same region will be used. + * + * Generated from protobuf field string artifact_storage = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getArtifactStorage() + { + return $this->artifact_storage; + } + + /** + * Optional. Cloud Storage location in which to store execution outputs. This + * can either be a bucket ("gs://my-bucket") or a path within a bucket + * ("gs://my-bucket/my-dir"). + * If unspecified, a default bucket located in the same region will be used. + * + * Generated from protobuf field string artifact_storage = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setArtifactStorage($var) + { + GPBUtil::checkString($var, True); + $this->artifact_storage = $var; + + return $this; + } + + /** + * Optional. Execution timeout for a Cloud Build Execution. This must be + * between 10m and 24h in seconds format. If unspecified, a default timeout of + * 1h is used. + * + * Generated from protobuf field .google.protobuf.Duration execution_timeout = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Duration|null + */ + public function getExecutionTimeout() + { + return $this->execution_timeout; + } + + public function hasExecutionTimeout() + { + return isset($this->execution_timeout); + } + + public function clearExecutionTimeout() + { + unset($this->execution_timeout); + } + + /** + * Optional. Execution timeout for a Cloud Build Execution. This must be + * between 10m and 24h in seconds format. If unspecified, a default timeout of + * 1h is used. + * + * Generated from protobuf field .google.protobuf.Duration execution_timeout = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setExecutionTimeout($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->execution_timeout = $var; + + return $this; + } + + /** + * @return string + */ + public function getExecutionEnvironment() + { + return $this->whichOneof("execution_environment"); + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/ExecutionConfig/ExecutionEnvironmentUsage.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/ExecutionConfig/ExecutionEnvironmentUsage.php new file mode 100644 index 000000000000..abeb70c1b042 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/ExecutionConfig/ExecutionEnvironmentUsage.php @@ -0,0 +1,71 @@ +google.cloud.deploy.v1.ExecutionConfig.ExecutionEnvironmentUsage + */ +class ExecutionEnvironmentUsage +{ + /** + * Default value. This value is unused. + * + * Generated from protobuf enum EXECUTION_ENVIRONMENT_USAGE_UNSPECIFIED = 0; + */ + const EXECUTION_ENVIRONMENT_USAGE_UNSPECIFIED = 0; + /** + * Use for rendering. + * + * Generated from protobuf enum RENDER = 1; + */ + const RENDER = 1; + /** + * Use for deploying and deployment hooks. + * + * Generated from protobuf enum DEPLOY = 2; + */ + const DEPLOY = 2; + /** + * Use for deployment verification. + * + * Generated from protobuf enum VERIFY = 3; + */ + const VERIFY = 3; + + private static $valueToName = [ + self::EXECUTION_ENVIRONMENT_USAGE_UNSPECIFIED => 'EXECUTION_ENVIRONMENT_USAGE_UNSPECIFIED', + self::RENDER => 'RENDER', + self::DEPLOY => 'DEPLOY', + self::VERIFY => 'VERIFY', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ExecutionEnvironmentUsage::class, \Google\Cloud\Deploy\V1\ExecutionConfig_ExecutionEnvironmentUsage::class); + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/ExecutionConfig_ExecutionEnvironmentUsage.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/ExecutionConfig_ExecutionEnvironmentUsage.php new file mode 100644 index 000000000000..ecd15e041df3 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/ExecutionConfig_ExecutionEnvironmentUsage.php @@ -0,0 +1,16 @@ +google.cloud.deploy.v1.GetConfigRequest + */ +class GetConfigRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of requested configuration. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. Name of requested configuration. Please see + * {@see CloudDeployClient::configName()} for help formatting this field. + * + * @return \Google\Cloud\Deploy\V1\GetConfigRequest + * + * @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 requested configuration. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of requested configuration. + * + * 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. Name of requested configuration. + * + * 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; + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/GetDeliveryPipelineRequest.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/GetDeliveryPipelineRequest.php new file mode 100644 index 000000000000..9123cbf6332b --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/GetDeliveryPipelineRequest.php @@ -0,0 +1,86 @@ +google.cloud.deploy.v1.GetDeliveryPipelineRequest + */ +class GetDeliveryPipelineRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the `DeliveryPipeline`. Format must be + * projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. Name of the `DeliveryPipeline`. Format must be + * projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}. Please see + * {@see CloudDeployClient::deliveryPipelineName()} for help formatting this field. + * + * @return \Google\Cloud\Deploy\V1\GetDeliveryPipelineRequest + * + * @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 `DeliveryPipeline`. Format must be + * projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the `DeliveryPipeline`. Format must be + * projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}. + * + * 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. Name of the `DeliveryPipeline`. Format must be + * projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}. + * + * 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; + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/GetJobRunRequest.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/GetJobRunRequest.php new file mode 100644 index 000000000000..d7f17bb7bfc8 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/GetJobRunRequest.php @@ -0,0 +1,86 @@ +google.cloud.deploy.v1.GetJobRunRequest + */ +class GetJobRunRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the `JobRun`. Format must be + * projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}/releases/{release_name}/rollouts/{rollout_name}/jobRuns/{job_run_name}. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. Name of the `JobRun`. Format must be + * projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}/releases/{release_name}/rollouts/{rollout_name}/jobRuns/{job_run_name}. Please see + * {@see CloudDeployClient::jobRunName()} for help formatting this field. + * + * @return \Google\Cloud\Deploy\V1\GetJobRunRequest + * + * @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 `JobRun`. Format must be + * projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}/releases/{release_name}/rollouts/{rollout_name}/jobRuns/{job_run_name}. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the `JobRun`. Format must be + * projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}/releases/{release_name}/rollouts/{rollout_name}/jobRuns/{job_run_name}. + * + * 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. Name of the `JobRun`. Format must be + * projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}/releases/{release_name}/rollouts/{rollout_name}/jobRuns/{job_run_name}. + * + * 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; + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/GetReleaseRequest.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/GetReleaseRequest.php new file mode 100644 index 000000000000..3fc7b78c0778 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/GetReleaseRequest.php @@ -0,0 +1,86 @@ +google.cloud.deploy.v1.GetReleaseRequest + */ +class GetReleaseRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the `Release`. Format must be + * projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}/releases/{release_name}. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. Name of the `Release`. Format must be + * projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}/releases/{release_name}. Please see + * {@see CloudDeployClient::releaseName()} for help formatting this field. + * + * @return \Google\Cloud\Deploy\V1\GetReleaseRequest + * + * @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 `Release`. Format must be + * projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}/releases/{release_name}. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the `Release`. Format must be + * projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}/releases/{release_name}. + * + * 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. Name of the `Release`. Format must be + * projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}/releases/{release_name}. + * + * 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; + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/GetRolloutRequest.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/GetRolloutRequest.php new file mode 100644 index 000000000000..94799282c551 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/GetRolloutRequest.php @@ -0,0 +1,86 @@ +google.cloud.deploy.v1.GetRolloutRequest + */ +class GetRolloutRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the `Rollout`. Format must be + * projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}/releases/{release_name}/rollouts/{rollout_name}. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. Name of the `Rollout`. Format must be + * projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}/releases/{release_name}/rollouts/{rollout_name}. Please see + * {@see CloudDeployClient::rolloutName()} for help formatting this field. + * + * @return \Google\Cloud\Deploy\V1\GetRolloutRequest + * + * @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 `Rollout`. Format must be + * projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}/releases/{release_name}/rollouts/{rollout_name}. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the `Rollout`. Format must be + * projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}/releases/{release_name}/rollouts/{rollout_name}. + * + * 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. Name of the `Rollout`. Format must be + * projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}/releases/{release_name}/rollouts/{rollout_name}. + * + * 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; + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/GetTargetRequest.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/GetTargetRequest.php new file mode 100644 index 000000000000..7bacdb4bc35f --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/GetTargetRequest.php @@ -0,0 +1,86 @@ +google.cloud.deploy.v1.GetTargetRequest + */ +class GetTargetRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the `Target`. Format must be + * projects/{project_id}/locations/{location_name}/targets/{target_name}. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. Name of the `Target`. Format must be + * projects/{project_id}/locations/{location_name}/targets/{target_name}. Please see + * {@see CloudDeployClient::targetName()} for help formatting this field. + * + * @return \Google\Cloud\Deploy\V1\GetTargetRequest + * + * @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 `Target`. Format must be + * projects/{project_id}/locations/{location_name}/targets/{target_name}. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the `Target`. Format must be + * projects/{project_id}/locations/{location_name}/targets/{target_name}. + * + * 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. Name of the `Target`. Format must be + * projects/{project_id}/locations/{location_name}/targets/{target_name}. + * + * 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; + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/GkeCluster.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/GkeCluster.php new file mode 100644 index 000000000000..4a6b80ddecde --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/GkeCluster.php @@ -0,0 +1,129 @@ +google.cloud.deploy.v1.GkeCluster + */ +class GkeCluster extends \Google\Protobuf\Internal\Message +{ + /** + * Information specifying a GKE Cluster. Format is + * `projects/{project_id}/locations/{location_id}/clusters/{cluster_id}. + * + * Generated from protobuf field string cluster = 1 [(.google.api.resource_reference) = { + */ + protected $cluster = ''; + /** + * Optional. If true, `cluster` is accessed using the private IP address of + * the control plane endpoint. Otherwise, the default IP address of the + * control plane endpoint is used. The default IP address is the private IP + * address for clusters with private control-plane endpoints and the public IP + * address otherwise. + * Only specify this option when `cluster` is a [private GKE + * cluster](https://cloud.google.com/kubernetes-engine/docs/concepts/private-cluster-concept). + * + * Generated from protobuf field bool internal_ip = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $internal_ip = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $cluster + * Information specifying a GKE Cluster. Format is + * `projects/{project_id}/locations/{location_id}/clusters/{cluster_id}. + * @type bool $internal_ip + * Optional. If true, `cluster` is accessed using the private IP address of + * the control plane endpoint. Otherwise, the default IP address of the + * control plane endpoint is used. The default IP address is the private IP + * address for clusters with private control-plane endpoints and the public IP + * address otherwise. + * Only specify this option when `cluster` is a [private GKE + * cluster](https://cloud.google.com/kubernetes-engine/docs/concepts/private-cluster-concept). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * Information specifying a GKE Cluster. Format is + * `projects/{project_id}/locations/{location_id}/clusters/{cluster_id}. + * + * Generated from protobuf field string cluster = 1 [(.google.api.resource_reference) = { + * @return string + */ + public function getCluster() + { + return $this->cluster; + } + + /** + * Information specifying a GKE Cluster. Format is + * `projects/{project_id}/locations/{location_id}/clusters/{cluster_id}. + * + * Generated from protobuf field string cluster = 1 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setCluster($var) + { + GPBUtil::checkString($var, True); + $this->cluster = $var; + + return $this; + } + + /** + * Optional. If true, `cluster` is accessed using the private IP address of + * the control plane endpoint. Otherwise, the default IP address of the + * control plane endpoint is used. The default IP address is the private IP + * address for clusters with private control-plane endpoints and the public IP + * address otherwise. + * Only specify this option when `cluster` is a [private GKE + * cluster](https://cloud.google.com/kubernetes-engine/docs/concepts/private-cluster-concept). + * + * Generated from protobuf field bool internal_ip = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getInternalIp() + { + return $this->internal_ip; + } + + /** + * Optional. If true, `cluster` is accessed using the private IP address of + * the control plane endpoint. Otherwise, the default IP address of the + * control plane endpoint is used. The default IP address is the private IP + * address for clusters with private control-plane endpoints and the public IP + * address otherwise. + * Only specify this option when `cluster` is a [private GKE + * cluster](https://cloud.google.com/kubernetes-engine/docs/concepts/private-cluster-concept). + * + * Generated from protobuf field bool internal_ip = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setInternalIp($var) + { + GPBUtil::checkBool($var); + $this->internal_ip = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/IgnoreJobRequest.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/IgnoreJobRequest.php new file mode 100644 index 000000000000..cd56c4a28233 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/IgnoreJobRequest.php @@ -0,0 +1,163 @@ +google.cloud.deploy.v1.IgnoreJobRequest + */ +class IgnoreJobRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the Rollout. Format is + * projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/ + * releases/{release}/rollouts/{rollout}. + * + * Generated from protobuf field string rollout = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $rollout = ''; + /** + * Required. The phase ID the Job to ignore belongs to. + * + * Generated from protobuf field string phase_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $phase_id = ''; + /** + * Required. The job ID for the Job to ignore. + * + * Generated from protobuf field string job_id = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $job_id = ''; + + /** + * @param string $rollout Required. Name of the Rollout. Format is + * projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/ + * releases/{release}/rollouts/{rollout}. Please see + * {@see CloudDeployClient::rolloutName()} for help formatting this field. + * @param string $phaseId Required. The phase ID the Job to ignore belongs to. + * @param string $jobId Required. The job ID for the Job to ignore. + * + * @return \Google\Cloud\Deploy\V1\IgnoreJobRequest + * + * @experimental + */ + public static function build(string $rollout, string $phaseId, string $jobId): self + { + return (new self()) + ->setRollout($rollout) + ->setPhaseId($phaseId) + ->setJobId($jobId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $rollout + * Required. Name of the Rollout. Format is + * projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/ + * releases/{release}/rollouts/{rollout}. + * @type string $phase_id + * Required. The phase ID the Job to ignore belongs to. + * @type string $job_id + * Required. The job ID for the Job to ignore. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the Rollout. Format is + * projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/ + * releases/{release}/rollouts/{rollout}. + * + * Generated from protobuf field string rollout = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getRollout() + { + return $this->rollout; + } + + /** + * Required. Name of the Rollout. Format is + * projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/ + * releases/{release}/rollouts/{rollout}. + * + * Generated from protobuf field string rollout = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setRollout($var) + { + GPBUtil::checkString($var, True); + $this->rollout = $var; + + return $this; + } + + /** + * Required. The phase ID the Job to ignore belongs to. + * + * Generated from protobuf field string phase_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getPhaseId() + { + return $this->phase_id; + } + + /** + * Required. The phase ID the Job to ignore belongs to. + * + * Generated from protobuf field string phase_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setPhaseId($var) + { + GPBUtil::checkString($var, True); + $this->phase_id = $var; + + return $this; + } + + /** + * Required. The job ID for the Job to ignore. + * + * Generated from protobuf field string job_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getJobId() + { + return $this->job_id; + } + + /** + * Required. The job ID for the Job to ignore. + * + * Generated from protobuf field string job_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setJobId($var) + { + GPBUtil::checkString($var, True); + $this->job_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/IgnoreJobResponse.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/IgnoreJobResponse.php new file mode 100644 index 000000000000..a48bda5ffdf9 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/IgnoreJobResponse.php @@ -0,0 +1,33 @@ +google.cloud.deploy.v1.IgnoreJobResponse + */ +class IgnoreJobResponse extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Job.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Job.php new file mode 100644 index 000000000000..75dd8b791ae8 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Job.php @@ -0,0 +1,318 @@ +google.cloud.deploy.v1.Job + */ +class Job extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The ID of the Job. + * + * Generated from protobuf field string id = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $id = ''; + /** + * Output only. The current state of the Job. + * + * Generated from protobuf field .google.cloud.deploy.v1.Job.State state = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Output only. Additional information on why the Job was skipped, if + * available. + * + * Generated from protobuf field string skip_message = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $skip_message = ''; + /** + * Output only. The name of the `JobRun` responsible for the most recent + * invocation of this Job. + * + * Generated from protobuf field string job_run = 3 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + */ + protected $job_run = ''; + protected $job_type; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $id + * Output only. The ID of the Job. + * @type int $state + * Output only. The current state of the Job. + * @type string $skip_message + * Output only. Additional information on why the Job was skipped, if + * available. + * @type string $job_run + * Output only. The name of the `JobRun` responsible for the most recent + * invocation of this Job. + * @type \Google\Cloud\Deploy\V1\DeployJob $deploy_job + * Output only. A deploy Job. + * @type \Google\Cloud\Deploy\V1\VerifyJob $verify_job + * Output only. A verify Job. + * @type \Google\Cloud\Deploy\V1\CreateChildRolloutJob $create_child_rollout_job + * Output only. A createChildRollout Job. + * @type \Google\Cloud\Deploy\V1\AdvanceChildRolloutJob $advance_child_rollout_job + * Output only. An advanceChildRollout Job. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The ID of the Job. + * + * Generated from protobuf field string id = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getId() + { + return $this->id; + } + + /** + * Output only. The ID of the Job. + * + * Generated from protobuf field string id = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setId($var) + { + GPBUtil::checkString($var, True); + $this->id = $var; + + return $this; + } + + /** + * Output only. The current state of the Job. + * + * Generated from protobuf field .google.cloud.deploy.v1.Job.State state = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. The current state of the Job. + * + * Generated from protobuf field .google.cloud.deploy.v1.Job.State state = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Deploy\V1\Job\State::class); + $this->state = $var; + + return $this; + } + + /** + * Output only. Additional information on why the Job was skipped, if + * available. + * + * Generated from protobuf field string skip_message = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getSkipMessage() + { + return $this->skip_message; + } + + /** + * Output only. Additional information on why the Job was skipped, if + * available. + * + * Generated from protobuf field string skip_message = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setSkipMessage($var) + { + GPBUtil::checkString($var, True); + $this->skip_message = $var; + + return $this; + } + + /** + * Output only. The name of the `JobRun` responsible for the most recent + * invocation of this Job. + * + * Generated from protobuf field string job_run = 3 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + * @return string + */ + public function getJobRun() + { + return $this->job_run; + } + + /** + * Output only. The name of the `JobRun` responsible for the most recent + * invocation of this Job. + * + * Generated from protobuf field string job_run = 3 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setJobRun($var) + { + GPBUtil::checkString($var, True); + $this->job_run = $var; + + return $this; + } + + /** + * Output only. A deploy Job. + * + * Generated from protobuf field .google.cloud.deploy.v1.DeployJob deploy_job = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\Deploy\V1\DeployJob|null + */ + public function getDeployJob() + { + return $this->readOneof(4); + } + + public function hasDeployJob() + { + return $this->hasOneof(4); + } + + /** + * Output only. A deploy Job. + * + * Generated from protobuf field .google.cloud.deploy.v1.DeployJob deploy_job = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\Deploy\V1\DeployJob $var + * @return $this + */ + public function setDeployJob($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Deploy\V1\DeployJob::class); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * Output only. A verify Job. + * + * Generated from protobuf field .google.cloud.deploy.v1.VerifyJob verify_job = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\Deploy\V1\VerifyJob|null + */ + public function getVerifyJob() + { + return $this->readOneof(5); + } + + public function hasVerifyJob() + { + return $this->hasOneof(5); + } + + /** + * Output only. A verify Job. + * + * Generated from protobuf field .google.cloud.deploy.v1.VerifyJob verify_job = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\Deploy\V1\VerifyJob $var + * @return $this + */ + public function setVerifyJob($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Deploy\V1\VerifyJob::class); + $this->writeOneof(5, $var); + + return $this; + } + + /** + * Output only. A createChildRollout Job. + * + * Generated from protobuf field .google.cloud.deploy.v1.CreateChildRolloutJob create_child_rollout_job = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\Deploy\V1\CreateChildRolloutJob|null + */ + public function getCreateChildRolloutJob() + { + return $this->readOneof(6); + } + + public function hasCreateChildRolloutJob() + { + return $this->hasOneof(6); + } + + /** + * Output only. A createChildRollout Job. + * + * Generated from protobuf field .google.cloud.deploy.v1.CreateChildRolloutJob create_child_rollout_job = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\Deploy\V1\CreateChildRolloutJob $var + * @return $this + */ + public function setCreateChildRolloutJob($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Deploy\V1\CreateChildRolloutJob::class); + $this->writeOneof(6, $var); + + return $this; + } + + /** + * Output only. An advanceChildRollout Job. + * + * Generated from protobuf field .google.cloud.deploy.v1.AdvanceChildRolloutJob advance_child_rollout_job = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\Deploy\V1\AdvanceChildRolloutJob|null + */ + public function getAdvanceChildRolloutJob() + { + return $this->readOneof(7); + } + + public function hasAdvanceChildRolloutJob() + { + return $this->hasOneof(7); + } + + /** + * Output only. An advanceChildRollout Job. + * + * Generated from protobuf field .google.cloud.deploy.v1.AdvanceChildRolloutJob advance_child_rollout_job = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\Deploy\V1\AdvanceChildRolloutJob $var + * @return $this + */ + public function setAdvanceChildRolloutJob($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Deploy\V1\AdvanceChildRolloutJob::class); + $this->writeOneof(7, $var); + + return $this; + } + + /** + * @return string + */ + public function getJobType() + { + return $this->whichOneof("job_type"); + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Job/State.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Job/State.php new file mode 100644 index 000000000000..de523dfefaa6 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Job/State.php @@ -0,0 +1,106 @@ +google.cloud.deploy.v1.Job.State + */ +class State +{ + /** + * The Job has an unspecified state. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The Job is waiting for an earlier Phase(s) or Job(s) to complete. + * + * Generated from protobuf enum PENDING = 1; + */ + const PENDING = 1; + /** + * The Job is disabled. + * + * Generated from protobuf enum DISABLED = 2; + */ + const DISABLED = 2; + /** + * The Job is in progress. + * + * Generated from protobuf enum IN_PROGRESS = 3; + */ + const IN_PROGRESS = 3; + /** + * The Job succeeded. + * + * Generated from protobuf enum SUCCEEDED = 4; + */ + const SUCCEEDED = 4; + /** + * The Job failed. + * + * Generated from protobuf enum FAILED = 5; + */ + const FAILED = 5; + /** + * The Job was aborted. + * + * Generated from protobuf enum ABORTED = 6; + */ + const ABORTED = 6; + /** + * The Job was skipped. + * + * Generated from protobuf enum SKIPPED = 7; + */ + const SKIPPED = 7; + /** + * The Job was ignored. + * + * Generated from protobuf enum IGNORED = 8; + */ + const IGNORED = 8; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::PENDING => 'PENDING', + self::DISABLED => 'DISABLED', + self::IN_PROGRESS => 'IN_PROGRESS', + self::SUCCEEDED => 'SUCCEEDED', + self::FAILED => 'FAILED', + self::ABORTED => 'ABORTED', + self::SKIPPED => 'SKIPPED', + self::IGNORED => 'IGNORED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\Deploy\V1\Job_State::class); + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/JobRun.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/JobRun.php new file mode 100644 index 000000000000..ed375e513fd0 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/JobRun.php @@ -0,0 +1,531 @@ +google.cloud.deploy.v1.JobRun + */ +class JobRun extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. Name of the `JobRun`. Format is + * projects/{project}/locations/{location}/ + * deliveryPipelines/{deliveryPipeline}/releases/{releases}/rollouts/ + * {rollouts}/jobRuns/{uuid}. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $name = ''; + /** + * Output only. Unique identifier of the `JobRun`. + * + * Generated from protobuf field string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $uid = ''; + /** + * Output only. ID of the `Rollout` phase this `JobRun` belongs in. + * + * Generated from protobuf field string phase_id = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $phase_id = ''; + /** + * Output only. ID of the `Rollout` job this `JobRun` corresponds to. + * + * Generated from protobuf field string job_id = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $job_id = ''; + /** + * Output only. Time at which the `JobRun` was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. Time at which the `JobRun` was started. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $start_time = null; + /** + * Output only. Time at which the `JobRun` ended. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $end_time = null; + /** + * Output only. The current state of the `JobRun`. + * + * Generated from protobuf field .google.cloud.deploy.v1.JobRun.State state = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Output only. This checksum is computed by the server based on the value of + * other fields, and may be sent on update and delete requests to ensure the + * client has an up-to-date value before proceeding. + * + * Generated from protobuf field string etag = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $etag = ''; + protected $job_run; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Optional. Name of the `JobRun`. Format is + * projects/{project}/locations/{location}/ + * deliveryPipelines/{deliveryPipeline}/releases/{releases}/rollouts/ + * {rollouts}/jobRuns/{uuid}. + * @type string $uid + * Output only. Unique identifier of the `JobRun`. + * @type string $phase_id + * Output only. ID of the `Rollout` phase this `JobRun` belongs in. + * @type string $job_id + * Output only. ID of the `Rollout` job this `JobRun` corresponds to. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. Time at which the `JobRun` was created. + * @type \Google\Protobuf\Timestamp $start_time + * Output only. Time at which the `JobRun` was started. + * @type \Google\Protobuf\Timestamp $end_time + * Output only. Time at which the `JobRun` ended. + * @type int $state + * Output only. The current state of the `JobRun`. + * @type \Google\Cloud\Deploy\V1\DeployJobRun $deploy_job_run + * Output only. Information specific to a deploy `JobRun`. + * @type \Google\Cloud\Deploy\V1\VerifyJobRun $verify_job_run + * Output only. Information specific to a verify `JobRun`. + * @type \Google\Cloud\Deploy\V1\CreateChildRolloutJobRun $create_child_rollout_job_run + * Output only. Information specific to a createChildRollout `JobRun`. + * @type \Google\Cloud\Deploy\V1\AdvanceChildRolloutJobRun $advance_child_rollout_job_run + * Output only. Information specific to an advanceChildRollout `JobRun` + * @type string $etag + * Output only. This checksum is computed by the server based on the value of + * other fields, and may be sent on update and delete requests to ensure the + * client has an up-to-date value before proceeding. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * Optional. Name of the `JobRun`. Format is + * projects/{project}/locations/{location}/ + * deliveryPipelines/{deliveryPipeline}/releases/{releases}/rollouts/ + * {rollouts}/jobRuns/{uuid}. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Optional. Name of the `JobRun`. Format is + * projects/{project}/locations/{location}/ + * deliveryPipelines/{deliveryPipeline}/releases/{releases}/rollouts/ + * {rollouts}/jobRuns/{uuid}. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. Unique identifier of the `JobRun`. + * + * Generated from protobuf field string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getUid() + { + return $this->uid; + } + + /** + * Output only. Unique identifier of the `JobRun`. + * + * Generated from protobuf field string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setUid($var) + { + GPBUtil::checkString($var, True); + $this->uid = $var; + + return $this; + } + + /** + * Output only. ID of the `Rollout` phase this `JobRun` belongs in. + * + * Generated from protobuf field string phase_id = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getPhaseId() + { + return $this->phase_id; + } + + /** + * Output only. ID of the `Rollout` phase this `JobRun` belongs in. + * + * Generated from protobuf field string phase_id = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setPhaseId($var) + { + GPBUtil::checkString($var, True); + $this->phase_id = $var; + + return $this; + } + + /** + * Output only. ID of the `Rollout` job this `JobRun` corresponds to. + * + * Generated from protobuf field string job_id = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getJobId() + { + return $this->job_id; + } + + /** + * Output only. ID of the `Rollout` job this `JobRun` corresponds to. + * + * Generated from protobuf field string job_id = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setJobId($var) + { + GPBUtil::checkString($var, True); + $this->job_id = $var; + + return $this; + } + + /** + * Output only. Time at which the `JobRun` was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 5 [(.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. Time at which the `JobRun` was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 5 [(.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. Time at which the `JobRun` was started. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getStartTime() + { + return $this->start_time; + } + + public function hasStartTime() + { + return isset($this->start_time); + } + + public function clearStartTime() + { + unset($this->start_time); + } + + /** + * Output only. Time at which the `JobRun` was started. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setStartTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->start_time = $var; + + return $this; + } + + /** + * Output only. Time at which the `JobRun` ended. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 7 [(.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. Time at which the `JobRun` ended. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 7 [(.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 current state of the `JobRun`. + * + * Generated from protobuf field .google.cloud.deploy.v1.JobRun.State state = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. The current state of the `JobRun`. + * + * Generated from protobuf field .google.cloud.deploy.v1.JobRun.State state = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Deploy\V1\JobRun\State::class); + $this->state = $var; + + return $this; + } + + /** + * Output only. Information specific to a deploy `JobRun`. + * + * Generated from protobuf field .google.cloud.deploy.v1.DeployJobRun deploy_job_run = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\Deploy\V1\DeployJobRun|null + */ + public function getDeployJobRun() + { + return $this->readOneof(9); + } + + public function hasDeployJobRun() + { + return $this->hasOneof(9); + } + + /** + * Output only. Information specific to a deploy `JobRun`. + * + * Generated from protobuf field .google.cloud.deploy.v1.DeployJobRun deploy_job_run = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\Deploy\V1\DeployJobRun $var + * @return $this + */ + public function setDeployJobRun($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Deploy\V1\DeployJobRun::class); + $this->writeOneof(9, $var); + + return $this; + } + + /** + * Output only. Information specific to a verify `JobRun`. + * + * Generated from protobuf field .google.cloud.deploy.v1.VerifyJobRun verify_job_run = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\Deploy\V1\VerifyJobRun|null + */ + public function getVerifyJobRun() + { + return $this->readOneof(10); + } + + public function hasVerifyJobRun() + { + return $this->hasOneof(10); + } + + /** + * Output only. Information specific to a verify `JobRun`. + * + * Generated from protobuf field .google.cloud.deploy.v1.VerifyJobRun verify_job_run = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\Deploy\V1\VerifyJobRun $var + * @return $this + */ + public function setVerifyJobRun($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Deploy\V1\VerifyJobRun::class); + $this->writeOneof(10, $var); + + return $this; + } + + /** + * Output only. Information specific to a createChildRollout `JobRun`. + * + * Generated from protobuf field .google.cloud.deploy.v1.CreateChildRolloutJobRun create_child_rollout_job_run = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\Deploy\V1\CreateChildRolloutJobRun|null + */ + public function getCreateChildRolloutJobRun() + { + return $this->readOneof(12); + } + + public function hasCreateChildRolloutJobRun() + { + return $this->hasOneof(12); + } + + /** + * Output only. Information specific to a createChildRollout `JobRun`. + * + * Generated from protobuf field .google.cloud.deploy.v1.CreateChildRolloutJobRun create_child_rollout_job_run = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\Deploy\V1\CreateChildRolloutJobRun $var + * @return $this + */ + public function setCreateChildRolloutJobRun($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Deploy\V1\CreateChildRolloutJobRun::class); + $this->writeOneof(12, $var); + + return $this; + } + + /** + * Output only. Information specific to an advanceChildRollout `JobRun` + * + * Generated from protobuf field .google.cloud.deploy.v1.AdvanceChildRolloutJobRun advance_child_rollout_job_run = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\Deploy\V1\AdvanceChildRolloutJobRun|null + */ + public function getAdvanceChildRolloutJobRun() + { + return $this->readOneof(13); + } + + public function hasAdvanceChildRolloutJobRun() + { + return $this->hasOneof(13); + } + + /** + * Output only. Information specific to an advanceChildRollout `JobRun` + * + * Generated from protobuf field .google.cloud.deploy.v1.AdvanceChildRolloutJobRun advance_child_rollout_job_run = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\Deploy\V1\AdvanceChildRolloutJobRun $var + * @return $this + */ + public function setAdvanceChildRolloutJobRun($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Deploy\V1\AdvanceChildRolloutJobRun::class); + $this->writeOneof(13, $var); + + return $this; + } + + /** + * Output only. This checksum is computed by the server based on the value of + * other fields, and may be sent on update and delete requests to ensure the + * client has an up-to-date value before proceeding. + * + * Generated from protobuf field string etag = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * Output only. This checksum is computed by the server based on the value of + * other fields, and may be sent on update and delete requests to ensure the + * client has an up-to-date value before proceeding. + * + * Generated from protobuf field string etag = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, True); + $this->etag = $var; + + return $this; + } + + /** + * @return string + */ + public function getJobRun() + { + return $this->whichOneof("job_run"); + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/JobRun/State.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/JobRun/State.php new file mode 100644 index 000000000000..df8b7b7d61cf --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/JobRun/State.php @@ -0,0 +1,85 @@ +google.cloud.deploy.v1.JobRun.State + */ +class State +{ + /** + * The `JobRun` has an unspecified state. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The `JobRun` is in progress. + * + * Generated from protobuf enum IN_PROGRESS = 1; + */ + const IN_PROGRESS = 1; + /** + * The `JobRun` has succeeded. + * + * Generated from protobuf enum SUCCEEDED = 2; + */ + const SUCCEEDED = 2; + /** + * The `JobRun` has failed. + * + * Generated from protobuf enum FAILED = 3; + */ + const FAILED = 3; + /** + * The `JobRun` is terminating. + * + * Generated from protobuf enum TERMINATING = 4; + */ + const TERMINATING = 4; + /** + * The `JobRun` was terminated. + * + * Generated from protobuf enum TERMINATED = 5; + */ + const TERMINATED = 5; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::IN_PROGRESS => 'IN_PROGRESS', + self::SUCCEEDED => 'SUCCEEDED', + self::FAILED => 'FAILED', + self::TERMINATING => 'TERMINATING', + self::TERMINATED => 'TERMINATED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\Deploy\V1\JobRun_State::class); + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/JobRunNotificationEvent.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/JobRunNotificationEvent.php new file mode 100644 index 000000000000..fc8518e97851 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/JobRunNotificationEvent.php @@ -0,0 +1,273 @@ +google.cloud.deploy.v1.JobRunNotificationEvent + */ +class JobRunNotificationEvent extends \Google\Protobuf\Internal\Message +{ + /** + * Debug message for when a notification fails to send. + * + * Generated from protobuf field string message = 1; + */ + protected $message = ''; + /** + * The name of the `JobRun`. + * + * Generated from protobuf field string job_run = 2; + */ + protected $job_run = ''; + /** + * Unique identifier of the `DeliveryPipeline`. + * + * Generated from protobuf field string pipeline_uid = 3; + */ + protected $pipeline_uid = ''; + /** + * Unique identifier of the `Release`. + * + * Generated from protobuf field string release_uid = 4; + */ + protected $release_uid = ''; + /** + * Unique identifier of the `Rollout`. + * + * Generated from protobuf field string rollout_uid = 5; + */ + protected $rollout_uid = ''; + /** + * ID of the `Target`. + * + * Generated from protobuf field string target_id = 6; + */ + protected $target_id = ''; + /** + * Type of this notification, e.g. for a Pub/Sub failure. + * + * Generated from protobuf field .google.cloud.deploy.v1.Type type = 7; + */ + protected $type = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $message + * Debug message for when a notification fails to send. + * @type string $job_run + * The name of the `JobRun`. + * @type string $pipeline_uid + * Unique identifier of the `DeliveryPipeline`. + * @type string $release_uid + * Unique identifier of the `Release`. + * @type string $rollout_uid + * Unique identifier of the `Rollout`. + * @type string $target_id + * ID of the `Target`. + * @type int $type + * Type of this notification, e.g. for a Pub/Sub failure. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\JobrunNotificationPayload::initOnce(); + parent::__construct($data); + } + + /** + * Debug message for when a notification fails to send. + * + * Generated from protobuf field string message = 1; + * @return string + */ + public function getMessage() + { + return $this->message; + } + + /** + * Debug message for when a notification fails to send. + * + * Generated from protobuf field string message = 1; + * @param string $var + * @return $this + */ + public function setMessage($var) + { + GPBUtil::checkString($var, True); + $this->message = $var; + + return $this; + } + + /** + * The name of the `JobRun`. + * + * Generated from protobuf field string job_run = 2; + * @return string + */ + public function getJobRun() + { + return $this->job_run; + } + + /** + * The name of the `JobRun`. + * + * Generated from protobuf field string job_run = 2; + * @param string $var + * @return $this + */ + public function setJobRun($var) + { + GPBUtil::checkString($var, True); + $this->job_run = $var; + + return $this; + } + + /** + * Unique identifier of the `DeliveryPipeline`. + * + * Generated from protobuf field string pipeline_uid = 3; + * @return string + */ + public function getPipelineUid() + { + return $this->pipeline_uid; + } + + /** + * Unique identifier of the `DeliveryPipeline`. + * + * Generated from protobuf field string pipeline_uid = 3; + * @param string $var + * @return $this + */ + public function setPipelineUid($var) + { + GPBUtil::checkString($var, True); + $this->pipeline_uid = $var; + + return $this; + } + + /** + * Unique identifier of the `Release`. + * + * Generated from protobuf field string release_uid = 4; + * @return string + */ + public function getReleaseUid() + { + return $this->release_uid; + } + + /** + * Unique identifier of the `Release`. + * + * Generated from protobuf field string release_uid = 4; + * @param string $var + * @return $this + */ + public function setReleaseUid($var) + { + GPBUtil::checkString($var, True); + $this->release_uid = $var; + + return $this; + } + + /** + * Unique identifier of the `Rollout`. + * + * Generated from protobuf field string rollout_uid = 5; + * @return string + */ + public function getRolloutUid() + { + return $this->rollout_uid; + } + + /** + * Unique identifier of the `Rollout`. + * + * Generated from protobuf field string rollout_uid = 5; + * @param string $var + * @return $this + */ + public function setRolloutUid($var) + { + GPBUtil::checkString($var, True); + $this->rollout_uid = $var; + + return $this; + } + + /** + * ID of the `Target`. + * + * Generated from protobuf field string target_id = 6; + * @return string + */ + public function getTargetId() + { + return $this->target_id; + } + + /** + * ID of the `Target`. + * + * Generated from protobuf field string target_id = 6; + * @param string $var + * @return $this + */ + public function setTargetId($var) + { + GPBUtil::checkString($var, True); + $this->target_id = $var; + + return $this; + } + + /** + * Type of this notification, e.g. for a Pub/Sub failure. + * + * Generated from protobuf field .google.cloud.deploy.v1.Type type = 7; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * Type of this notification, e.g. for a Pub/Sub failure. + * + * Generated from protobuf field .google.cloud.deploy.v1.Type type = 7; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Deploy\V1\Type::class); + $this->type = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/JobRun_State.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/JobRun_State.php new file mode 100644 index 000000000000..5a15b6a6bddb --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/JobRun_State.php @@ -0,0 +1,16 @@ +google.cloud.deploy.v1.KubernetesConfig + */ +class KubernetesConfig extends \Google\Protobuf\Internal\Message +{ + protected $service_definition; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Deploy\V1\KubernetesConfig\GatewayServiceMesh $gateway_service_mesh + * Kubernetes Gateway API service mesh configuration. + * @type \Google\Cloud\Deploy\V1\KubernetesConfig\ServiceNetworking $service_networking + * Kubernetes Service networking configuration. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * Kubernetes Gateway API service mesh configuration. + * + * Generated from protobuf field .google.cloud.deploy.v1.KubernetesConfig.GatewayServiceMesh gateway_service_mesh = 1; + * @return \Google\Cloud\Deploy\V1\KubernetesConfig\GatewayServiceMesh|null + */ + public function getGatewayServiceMesh() + { + return $this->readOneof(1); + } + + public function hasGatewayServiceMesh() + { + return $this->hasOneof(1); + } + + /** + * Kubernetes Gateway API service mesh configuration. + * + * Generated from protobuf field .google.cloud.deploy.v1.KubernetesConfig.GatewayServiceMesh gateway_service_mesh = 1; + * @param \Google\Cloud\Deploy\V1\KubernetesConfig\GatewayServiceMesh $var + * @return $this + */ + public function setGatewayServiceMesh($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Deploy\V1\KubernetesConfig\GatewayServiceMesh::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * Kubernetes Service networking configuration. + * + * Generated from protobuf field .google.cloud.deploy.v1.KubernetesConfig.ServiceNetworking service_networking = 2; + * @return \Google\Cloud\Deploy\V1\KubernetesConfig\ServiceNetworking|null + */ + public function getServiceNetworking() + { + return $this->readOneof(2); + } + + public function hasServiceNetworking() + { + return $this->hasOneof(2); + } + + /** + * Kubernetes Service networking configuration. + * + * Generated from protobuf field .google.cloud.deploy.v1.KubernetesConfig.ServiceNetworking service_networking = 2; + * @param \Google\Cloud\Deploy\V1\KubernetesConfig\ServiceNetworking $var + * @return $this + */ + public function setServiceNetworking($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Deploy\V1\KubernetesConfig\ServiceNetworking::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * @return string + */ + public function getServiceDefinition() + { + return $this->whichOneof("service_definition"); + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/KubernetesConfig/GatewayServiceMesh.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/KubernetesConfig/GatewayServiceMesh.php new file mode 100644 index 000000000000..81ca9f2bc291 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/KubernetesConfig/GatewayServiceMesh.php @@ -0,0 +1,142 @@ +google.cloud.deploy.v1.KubernetesConfig.GatewayServiceMesh + */ +class GatewayServiceMesh extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the Gateway API HTTPRoute. + * + * Generated from protobuf field string http_route = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $http_route = ''; + /** + * Required. Name of the Kubernetes Service. + * + * Generated from protobuf field string service = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $service = ''; + /** + * Required. Name of the Kubernetes Deployment whose traffic is managed by + * the specified HTTPRoute and Service. + * + * Generated from protobuf field string deployment = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $deployment = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $http_route + * Required. Name of the Gateway API HTTPRoute. + * @type string $service + * Required. Name of the Kubernetes Service. + * @type string $deployment + * Required. Name of the Kubernetes Deployment whose traffic is managed by + * the specified HTTPRoute and Service. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the Gateway API HTTPRoute. + * + * Generated from protobuf field string http_route = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getHttpRoute() + { + return $this->http_route; + } + + /** + * Required. Name of the Gateway API HTTPRoute. + * + * Generated from protobuf field string http_route = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setHttpRoute($var) + { + GPBUtil::checkString($var, True); + $this->http_route = $var; + + return $this; + } + + /** + * Required. Name of the Kubernetes Service. + * + * Generated from protobuf field string service = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getService() + { + return $this->service; + } + + /** + * Required. Name of the Kubernetes Service. + * + * Generated from protobuf field string service = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setService($var) + { + GPBUtil::checkString($var, True); + $this->service = $var; + + return $this; + } + + /** + * Required. Name of the Kubernetes Deployment whose traffic is managed by + * the specified HTTPRoute and Service. + * + * Generated from protobuf field string deployment = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getDeployment() + { + return $this->deployment; + } + + /** + * Required. Name of the Kubernetes Deployment whose traffic is managed by + * the specified HTTPRoute and Service. + * + * Generated from protobuf field string deployment = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setDeployment($var) + { + GPBUtil::checkString($var, True); + $this->deployment = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(GatewayServiceMesh::class, \Google\Cloud\Deploy\V1\KubernetesConfig_GatewayServiceMesh::class); + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/KubernetesConfig/ServiceNetworking.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/KubernetesConfig/ServiceNetworking.php new file mode 100644 index 000000000000..fb34262a2562 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/KubernetesConfig/ServiceNetworking.php @@ -0,0 +1,108 @@ +google.cloud.deploy.v1.KubernetesConfig.ServiceNetworking + */ +class ServiceNetworking extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the Kubernetes Service. + * + * Generated from protobuf field string service = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $service = ''; + /** + * Required. Name of the Kubernetes Deployment whose traffic is managed by + * the specified Service. + * + * Generated from protobuf field string deployment = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $deployment = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $service + * Required. Name of the Kubernetes Service. + * @type string $deployment + * Required. Name of the Kubernetes Deployment whose traffic is managed by + * the specified Service. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the Kubernetes Service. + * + * Generated from protobuf field string service = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getService() + { + return $this->service; + } + + /** + * Required. Name of the Kubernetes Service. + * + * Generated from protobuf field string service = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setService($var) + { + GPBUtil::checkString($var, True); + $this->service = $var; + + return $this; + } + + /** + * Required. Name of the Kubernetes Deployment whose traffic is managed by + * the specified Service. + * + * Generated from protobuf field string deployment = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getDeployment() + { + return $this->deployment; + } + + /** + * Required. Name of the Kubernetes Deployment whose traffic is managed by + * the specified Service. + * + * Generated from protobuf field string deployment = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setDeployment($var) + { + GPBUtil::checkString($var, True); + $this->deployment = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ServiceNetworking::class, \Google\Cloud\Deploy\V1\KubernetesConfig_ServiceNetworking::class); + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/KubernetesConfig_GatewayServiceMesh.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/KubernetesConfig_GatewayServiceMesh.php new file mode 100644 index 000000000000..ae3a9bc9ef9d --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/KubernetesConfig_GatewayServiceMesh.php @@ -0,0 +1,16 @@ +google.cloud.deploy.v1.ListDeliveryPipelinesRequest + */ +class ListDeliveryPipelinesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent, which owns this collection of pipelines. Format must + * be projects/{project_id}/locations/{location_name}. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The maximum number of pipelines to return. The service may return + * fewer than this value. If unspecified, at most 50 pipelines will + * be returned. The maximum value is 1000; values above 1000 will be set + * to 1000. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * A page token, received from a previous `ListDeliveryPipelines` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other provided parameters match + * the call that provided the page token. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + /** + * Filter pipelines to be returned. See https://google.aip.dev/160 for more + * details. + * + * Generated from protobuf field string filter = 4; + */ + protected $filter = ''; + /** + * Field to sort by. See https://google.aip.dev/132#ordering for more details. + * + * Generated from protobuf field string order_by = 5; + */ + protected $order_by = ''; + + /** + * @param string $parent Required. The parent, which owns this collection of pipelines. Format must + * be projects/{project_id}/locations/{location_name}. Please see + * {@see CloudDeployClient::locationName()} for help formatting this field. + * + * @return \Google\Cloud\Deploy\V1\ListDeliveryPipelinesRequest + * + * @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. The parent, which owns this collection of pipelines. Format must + * be projects/{project_id}/locations/{location_name}. + * @type int $page_size + * The maximum number of pipelines to return. The service may return + * fewer than this value. If unspecified, at most 50 pipelines will + * be returned. The maximum value is 1000; values above 1000 will be set + * to 1000. + * @type string $page_token + * A page token, received from a previous `ListDeliveryPipelines` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other provided parameters match + * the call that provided the page token. + * @type string $filter + * Filter pipelines to be returned. See https://google.aip.dev/160 for more + * details. + * @type string $order_by + * Field to sort by. See https://google.aip.dev/132#ordering for more details. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent, which owns this collection of pipelines. Format must + * be projects/{project_id}/locations/{location_name}. + * + * 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. The parent, which owns this collection of pipelines. Format must + * be projects/{project_id}/locations/{location_name}. + * + * 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; + } + + /** + * The maximum number of pipelines to return. The service may return + * fewer than this value. If unspecified, at most 50 pipelines will + * be returned. The maximum value is 1000; values above 1000 will be set + * to 1000. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of pipelines to return. The service may return + * fewer than this value. If unspecified, at most 50 pipelines will + * be returned. The maximum value is 1000; values above 1000 will be set + * to 1000. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * A page token, received from a previous `ListDeliveryPipelines` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other provided parameters match + * the call that provided the page token. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * A page token, received from a previous `ListDeliveryPipelines` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other provided parameters match + * the call that provided the page token. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * Filter pipelines to be returned. See https://google.aip.dev/160 for more + * details. + * + * Generated from protobuf field string filter = 4; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Filter pipelines to be returned. See https://google.aip.dev/160 for more + * details. + * + * Generated from protobuf field string filter = 4; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Field to sort by. See https://google.aip.dev/132#ordering for more details. + * + * Generated from protobuf field string order_by = 5; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Field to sort by. See https://google.aip.dev/132#ordering for more details. + * + * Generated from protobuf field string order_by = 5; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/ListDeliveryPipelinesResponse.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/ListDeliveryPipelinesResponse.php new file mode 100644 index 000000000000..aade7781c825 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/ListDeliveryPipelinesResponse.php @@ -0,0 +1,139 @@ +google.cloud.deploy.v1.ListDeliveryPipelinesResponse + */ +class ListDeliveryPipelinesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The `DeliveryPipeline` objects. + * + * Generated from protobuf field repeated .google.cloud.deploy.v1.DeliveryPipeline delivery_pipelines = 1; + */ + private $delivery_pipelines; + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + */ + private $unreachable; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Deploy\V1\DeliveryPipeline>|\Google\Protobuf\Internal\RepeatedField $delivery_pipelines + * The `DeliveryPipeline` objects. + * @type string $next_page_token + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Locations that could not be reached. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * The `DeliveryPipeline` objects. + * + * Generated from protobuf field repeated .google.cloud.deploy.v1.DeliveryPipeline delivery_pipelines = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDeliveryPipelines() + { + return $this->delivery_pipelines; + } + + /** + * The `DeliveryPipeline` objects. + * + * Generated from protobuf field repeated .google.cloud.deploy.v1.DeliveryPipeline delivery_pipelines = 1; + * @param array<\Google\Cloud\Deploy\V1\DeliveryPipeline>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDeliveryPipelines($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Deploy\V1\DeliveryPipeline::class); + $this->delivery_pipelines = $arr; + + return $this; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * 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; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUnreachable($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->unreachable = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/ListJobRunsRequest.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/ListJobRunsRequest.php new file mode 100644 index 000000000000..de678b046e48 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/ListJobRunsRequest.php @@ -0,0 +1,249 @@ +google.cloud.deploy.v1.ListJobRunsRequest + */ +class ListJobRunsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The `Rollout` which owns this collection of `JobRun` objects. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. The maximum number of `JobRun` objects to return. The service may + * return fewer than this value. If unspecified, at most 50 `JobRun` objects + * will be returned. The maximum value is 1000; values above 1000 will be set + * to 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Optional. A page token, received from a previous `ListJobRuns` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other provided parameters match the call that provided + * the page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = ''; + /** + * Optional. Filter results to be returned. See https://google.aip.dev/160 for + * more details. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $filter = ''; + /** + * Optional. Field to sort by. See https://google.aip.dev/132#ordering for + * more details. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $order_by = ''; + + /** + * @param string $parent Required. The `Rollout` which owns this collection of `JobRun` objects. Please see + * {@see CloudDeployClient::rolloutName()} for help formatting this field. + * + * @return \Google\Cloud\Deploy\V1\ListJobRunsRequest + * + * @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. The `Rollout` which owns this collection of `JobRun` objects. + * @type int $page_size + * Optional. The maximum number of `JobRun` objects to return. The service may + * return fewer than this value. If unspecified, at most 50 `JobRun` objects + * will be returned. The maximum value is 1000; values above 1000 will be set + * to 1000. + * @type string $page_token + * Optional. A page token, received from a previous `ListJobRuns` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other provided parameters match the call that provided + * the page token. + * @type string $filter + * Optional. Filter results to be returned. See https://google.aip.dev/160 for + * more details. + * @type string $order_by + * Optional. Field to sort by. See https://google.aip.dev/132#ordering for + * more details. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * Required. The `Rollout` which owns this collection of `JobRun` objects. + * + * 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. The `Rollout` which owns this collection of `JobRun` objects. + * + * 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. The maximum number of `JobRun` objects to return. The service may + * return fewer than this value. If unspecified, at most 50 `JobRun` objects + * will be returned. The maximum value is 1000; values above 1000 will be set + * to 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. The maximum number of `JobRun` objects to return. The service may + * return fewer than this value. If unspecified, at most 50 `JobRun` objects + * will be returned. The maximum value is 1000; values above 1000 will be set + * to 1000. + * + * 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 page token, received from a previous `ListJobRuns` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other provided parameters match the call that provided + * the page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. A page token, received from a previous `ListJobRuns` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other provided parameters match the call that provided + * the page token. + * + * 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 be returned. See https://google.aip.dev/160 for + * more details. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Optional. Filter results to be returned. See https://google.aip.dev/160 for + * more details. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Optional. Field to sort by. See https://google.aip.dev/132#ordering for + * more details. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Optional. Field to sort by. See https://google.aip.dev/132#ordering for + * more details. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/ListJobRunsResponse.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/ListJobRunsResponse.php new file mode 100644 index 000000000000..c62986ce2dbe --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/ListJobRunsResponse.php @@ -0,0 +1,139 @@ +google.cloud.deploy.v1.ListJobRunsResponse + */ +class ListJobRunsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The `JobRun` objects. + * + * Generated from protobuf field repeated .google.cloud.deploy.v1.JobRun job_runs = 1; + */ + private $job_runs; + /** + * A token, which can be sent as `page_token` to retrieve the next page. If + * this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * Locations that could not be reached + * + * Generated from protobuf field repeated string unreachable = 3; + */ + private $unreachable; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Deploy\V1\JobRun>|\Google\Protobuf\Internal\RepeatedField $job_runs + * The `JobRun` objects. + * @type string $next_page_token + * A token, which can be sent as `page_token` to retrieve the next page. If + * this field is omitted, there are no subsequent pages. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Locations that could not be reached + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * The `JobRun` objects. + * + * Generated from protobuf field repeated .google.cloud.deploy.v1.JobRun job_runs = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getJobRuns() + { + return $this->job_runs; + } + + /** + * The `JobRun` objects. + * + * Generated from protobuf field repeated .google.cloud.deploy.v1.JobRun job_runs = 1; + * @param array<\Google\Cloud\Deploy\V1\JobRun>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setJobRuns($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Deploy\V1\JobRun::class); + $this->job_runs = $arr; + + return $this; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. If + * this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. If + * this field is omitted, there are no subsequent pages. + * + * 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; + } + + /** + * Locations that could not be reached + * + * Generated from protobuf field repeated string unreachable = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Locations that could not be reached + * + * Generated from protobuf field repeated string unreachable = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUnreachable($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->unreachable = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/ListReleasesRequest.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/ListReleasesRequest.php new file mode 100644 index 000000000000..a133cfc5e498 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/ListReleasesRequest.php @@ -0,0 +1,254 @@ +google.cloud.deploy.v1.ListReleasesRequest + */ +class ListReleasesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The `DeliveryPipeline` which owns this collection of `Release` + * objects. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. The maximum number of `Release` objects to return. The service + * may return fewer than this value. If unspecified, at most 50 `Release` + * objects will be returned. The maximum value is 1000; values above 1000 will + * be set to 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Optional. A page token, received from a previous `ListReleases` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other provided parameters match + * the call that provided the page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = ''; + /** + * Optional. Filter releases to be returned. See https://google.aip.dev/160 + * for more details. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $filter = ''; + /** + * Optional. Field to sort by. See https://google.aip.dev/132#ordering for + * more details. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $order_by = ''; + + /** + * @param string $parent Required. The `DeliveryPipeline` which owns this collection of `Release` + * objects. Please see + * {@see CloudDeployClient::deliveryPipelineName()} for help formatting this field. + * + * @return \Google\Cloud\Deploy\V1\ListReleasesRequest + * + * @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. The `DeliveryPipeline` which owns this collection of `Release` + * objects. + * @type int $page_size + * Optional. The maximum number of `Release` objects to return. The service + * may return fewer than this value. If unspecified, at most 50 `Release` + * objects will be returned. The maximum value is 1000; values above 1000 will + * be set to 1000. + * @type string $page_token + * Optional. A page token, received from a previous `ListReleases` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other provided parameters match + * the call that provided the page token. + * @type string $filter + * Optional. Filter releases to be returned. See https://google.aip.dev/160 + * for more details. + * @type string $order_by + * Optional. Field to sort by. See https://google.aip.dev/132#ordering for + * more details. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * Required. The `DeliveryPipeline` which owns this collection of `Release` + * objects. + * + * 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. The `DeliveryPipeline` which owns this collection of `Release` + * objects. + * + * 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. The maximum number of `Release` objects to return. The service + * may return fewer than this value. If unspecified, at most 50 `Release` + * objects will be returned. The maximum value is 1000; values above 1000 will + * be set to 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. The maximum number of `Release` objects to return. The service + * may return fewer than this value. If unspecified, at most 50 `Release` + * objects will be returned. The maximum value is 1000; values above 1000 will + * be set to 1000. + * + * 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 page token, received from a previous `ListReleases` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other provided parameters match + * the call that provided the page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. A page token, received from a previous `ListReleases` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other provided parameters match + * the call that provided the page token. + * + * 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 releases to be returned. See https://google.aip.dev/160 + * for more details. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Optional. Filter releases to be returned. See https://google.aip.dev/160 + * for more details. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Optional. Field to sort by. See https://google.aip.dev/132#ordering for + * more details. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Optional. Field to sort by. See https://google.aip.dev/132#ordering for + * more details. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/ListReleasesResponse.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/ListReleasesResponse.php new file mode 100644 index 000000000000..72798b69fe4c --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/ListReleasesResponse.php @@ -0,0 +1,139 @@ +google.cloud.deploy.v1.ListReleasesResponse + */ +class ListReleasesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The `Release` objects. + * + * Generated from protobuf field repeated .google.cloud.deploy.v1.Release releases = 1; + */ + private $releases; + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + */ + private $unreachable; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Deploy\V1\Release>|\Google\Protobuf\Internal\RepeatedField $releases + * The `Release` objects. + * @type string $next_page_token + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Locations that could not be reached. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * The `Release` objects. + * + * Generated from protobuf field repeated .google.cloud.deploy.v1.Release releases = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getReleases() + { + return $this->releases; + } + + /** + * The `Release` objects. + * + * Generated from protobuf field repeated .google.cloud.deploy.v1.Release releases = 1; + * @param array<\Google\Cloud\Deploy\V1\Release>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setReleases($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Deploy\V1\Release::class); + $this->releases = $arr; + + return $this; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * 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; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUnreachable($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->unreachable = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/ListRolloutsRequest.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/ListRolloutsRequest.php new file mode 100644 index 000000000000..6209b04be8b5 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/ListRolloutsRequest.php @@ -0,0 +1,249 @@ +google.cloud.deploy.v1.ListRolloutsRequest + */ +class ListRolloutsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The `Release` which owns this collection of `Rollout` objects. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. The maximum number of `Rollout` objects to return. The service + * may return fewer than this value. If unspecified, at most 50 `Rollout` + * objects will be returned. The maximum value is 1000; values above 1000 will + * be set to 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Optional. A page token, received from a previous `ListRollouts` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other provided parameters match + * the call that provided the page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = ''; + /** + * Optional. Filter rollouts to be returned. See https://google.aip.dev/160 + * for more details. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $filter = ''; + /** + * Optional. Field to sort by. See https://google.aip.dev/132#ordering for + * more details. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $order_by = ''; + + /** + * @param string $parent Required. The `Release` which owns this collection of `Rollout` objects. Please see + * {@see CloudDeployClient::releaseName()} for help formatting this field. + * + * @return \Google\Cloud\Deploy\V1\ListRolloutsRequest + * + * @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. The `Release` which owns this collection of `Rollout` objects. + * @type int $page_size + * Optional. The maximum number of `Rollout` objects to return. The service + * may return fewer than this value. If unspecified, at most 50 `Rollout` + * objects will be returned. The maximum value is 1000; values above 1000 will + * be set to 1000. + * @type string $page_token + * Optional. A page token, received from a previous `ListRollouts` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other provided parameters match + * the call that provided the page token. + * @type string $filter + * Optional. Filter rollouts to be returned. See https://google.aip.dev/160 + * for more details. + * @type string $order_by + * Optional. Field to sort by. See https://google.aip.dev/132#ordering for + * more details. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * Required. The `Release` which owns this collection of `Rollout` objects. + * + * 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. The `Release` which owns this collection of `Rollout` objects. + * + * 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. The maximum number of `Rollout` objects to return. The service + * may return fewer than this value. If unspecified, at most 50 `Rollout` + * objects will be returned. The maximum value is 1000; values above 1000 will + * be set to 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. The maximum number of `Rollout` objects to return. The service + * may return fewer than this value. If unspecified, at most 50 `Rollout` + * objects will be returned. The maximum value is 1000; values above 1000 will + * be set to 1000. + * + * 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 page token, received from a previous `ListRollouts` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other provided parameters match + * the call that provided the page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. A page token, received from a previous `ListRollouts` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other provided parameters match + * the call that provided the page token. + * + * 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 rollouts to be returned. See https://google.aip.dev/160 + * for more details. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Optional. Filter rollouts to be returned. See https://google.aip.dev/160 + * for more details. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Optional. Field to sort by. See https://google.aip.dev/132#ordering for + * more details. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Optional. Field to sort by. See https://google.aip.dev/132#ordering for + * more details. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/ListRolloutsResponse.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/ListRolloutsResponse.php new file mode 100644 index 000000000000..fc25e3092666 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/ListRolloutsResponse.php @@ -0,0 +1,139 @@ +google.cloud.deploy.v1.ListRolloutsResponse + */ +class ListRolloutsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The `Rollout` objects. + * + * Generated from protobuf field repeated .google.cloud.deploy.v1.Rollout rollouts = 1; + */ + private $rollouts; + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + */ + private $unreachable; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Deploy\V1\Rollout>|\Google\Protobuf\Internal\RepeatedField $rollouts + * The `Rollout` objects. + * @type string $next_page_token + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Locations that could not be reached. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * The `Rollout` objects. + * + * Generated from protobuf field repeated .google.cloud.deploy.v1.Rollout rollouts = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRollouts() + { + return $this->rollouts; + } + + /** + * The `Rollout` objects. + * + * Generated from protobuf field repeated .google.cloud.deploy.v1.Rollout rollouts = 1; + * @param array<\Google\Cloud\Deploy\V1\Rollout>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRollouts($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Deploy\V1\Rollout::class); + $this->rollouts = $arr; + + return $this; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * 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; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUnreachable($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->unreachable = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/ListTargetsRequest.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/ListTargetsRequest.php new file mode 100644 index 000000000000..1f2724d162a1 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/ListTargetsRequest.php @@ -0,0 +1,254 @@ +google.cloud.deploy.v1.ListTargetsRequest + */ +class ListTargetsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent, which owns this collection of targets. Format must be + * projects/{project_id}/locations/{location_name}. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. The maximum number of `Target` objects to return. The service may + * return fewer than this value. If unspecified, at most 50 `Target` objects + * will be returned. The maximum value is 1000; values above 1000 will be set + * to 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Optional. A page token, received from a previous `ListTargets` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other provided parameters match + * the call that provided the page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = ''; + /** + * Optional. Filter targets to be returned. See https://google.aip.dev/160 for + * more details. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $filter = ''; + /** + * Optional. Field to sort by. See https://google.aip.dev/132#ordering for + * more details. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $order_by = ''; + + /** + * @param string $parent Required. The parent, which owns this collection of targets. Format must be + * projects/{project_id}/locations/{location_name}. Please see + * {@see CloudDeployClient::locationName()} for help formatting this field. + * + * @return \Google\Cloud\Deploy\V1\ListTargetsRequest + * + * @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. The parent, which owns this collection of targets. Format must be + * projects/{project_id}/locations/{location_name}. + * @type int $page_size + * Optional. The maximum number of `Target` objects to return. The service may + * return fewer than this value. If unspecified, at most 50 `Target` objects + * will be returned. The maximum value is 1000; values above 1000 will be set + * to 1000. + * @type string $page_token + * Optional. A page token, received from a previous `ListTargets` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other provided parameters match + * the call that provided the page token. + * @type string $filter + * Optional. Filter targets to be returned. See https://google.aip.dev/160 for + * more details. + * @type string $order_by + * Optional. Field to sort by. See https://google.aip.dev/132#ordering for + * more details. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent, which owns this collection of targets. Format must be + * projects/{project_id}/locations/{location_name}. + * + * 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. The parent, which owns this collection of targets. Format must be + * projects/{project_id}/locations/{location_name}. + * + * 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. The maximum number of `Target` objects to return. The service may + * return fewer than this value. If unspecified, at most 50 `Target` objects + * will be returned. The maximum value is 1000; values above 1000 will be set + * to 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. The maximum number of `Target` objects to return. The service may + * return fewer than this value. If unspecified, at most 50 `Target` objects + * will be returned. The maximum value is 1000; values above 1000 will be set + * to 1000. + * + * 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 page token, received from a previous `ListTargets` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other provided parameters match + * the call that provided the page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. A page token, received from a previous `ListTargets` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other provided parameters match + * the call that provided the page token. + * + * 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 targets to be returned. See https://google.aip.dev/160 for + * more details. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Optional. Filter targets to be returned. See https://google.aip.dev/160 for + * more details. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Optional. Field to sort by. See https://google.aip.dev/132#ordering for + * more details. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Optional. Field to sort by. See https://google.aip.dev/132#ordering for + * more details. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/ListTargetsResponse.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/ListTargetsResponse.php new file mode 100644 index 000000000000..4c648ae25fd5 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/ListTargetsResponse.php @@ -0,0 +1,139 @@ +google.cloud.deploy.v1.ListTargetsResponse + */ +class ListTargetsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The `Target` objects. + * + * Generated from protobuf field repeated .google.cloud.deploy.v1.Target targets = 1; + */ + private $targets; + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + */ + private $unreachable; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Deploy\V1\Target>|\Google\Protobuf\Internal\RepeatedField $targets + * The `Target` objects. + * @type string $next_page_token + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Locations that could not be reached. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * The `Target` objects. + * + * Generated from protobuf field repeated .google.cloud.deploy.v1.Target targets = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTargets() + { + return $this->targets; + } + + /** + * The `Target` objects. + * + * Generated from protobuf field repeated .google.cloud.deploy.v1.Target targets = 1; + * @param array<\Google\Cloud\Deploy\V1\Target>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTargets($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Deploy\V1\Target::class); + $this->targets = $arr; + + return $this; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * 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; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUnreachable($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->unreachable = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Metadata.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Metadata.php new file mode 100644 index 000000000000..e396c0225e35 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Metadata.php @@ -0,0 +1,81 @@ +google.cloud.deploy.v1.Metadata + */ +class Metadata extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The name of the Cloud Run Service that is associated with a + * `Rollout`. + * + * Generated from protobuf field .google.cloud.deploy.v1.CloudRunMetadata cloud_run = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $cloud_run = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Deploy\V1\CloudRunMetadata $cloud_run + * Output only. The name of the Cloud Run Service that is associated with a + * `Rollout`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The name of the Cloud Run Service that is associated with a + * `Rollout`. + * + * Generated from protobuf field .google.cloud.deploy.v1.CloudRunMetadata cloud_run = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\Deploy\V1\CloudRunMetadata|null + */ + public function getCloudRun() + { + return $this->cloud_run; + } + + public function hasCloudRun() + { + return isset($this->cloud_run); + } + + public function clearCloudRun() + { + unset($this->cloud_run); + } + + /** + * Output only. The name of the Cloud Run Service that is associated with a + * `Rollout`. + * + * Generated from protobuf field .google.cloud.deploy.v1.CloudRunMetadata cloud_run = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\Deploy\V1\CloudRunMetadata $var + * @return $this + */ + public function setCloudRun($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Deploy\V1\CloudRunMetadata::class); + $this->cloud_run = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/MultiTarget.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/MultiTarget.php new file mode 100644 index 000000000000..339eb1798208 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/MultiTarget.php @@ -0,0 +1,67 @@ +google.cloud.deploy.v1.MultiTarget + */ +class MultiTarget extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The target_ids of this multiTarget. + * + * Generated from protobuf field repeated string target_ids = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private $target_ids; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $target_ids + * Required. The target_ids of this multiTarget. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * Required. The target_ids of this multiTarget. + * + * Generated from protobuf field repeated string target_ids = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTargetIds() + { + return $this->target_ids; + } + + /** + * Required. The target_ids of this multiTarget. + * + * Generated from protobuf field repeated string target_ids = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTargetIds($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->target_ids = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/OperationMetadata.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/OperationMetadata.php new file mode 100644 index 000000000000..2565328b1fe3 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/OperationMetadata.php @@ -0,0 +1,307 @@ +google.cloud.deploy.v1.OperationMetadata + */ +class OperationMetadata 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. Server-defined resource path for the target of the operation. + * + * Generated from protobuf field string target = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $target = ''; + /** + * Output only. Name of the verb executed by the operation. + * + * Generated from protobuf field string verb = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $verb = ''; + /** + * Output only. Human-readable status of the operation, if any. + * + * Generated from protobuf field string status_message = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $status_message = ''; + /** + * Output only. Identifies whether the user has requested cancellation + * of the operation. Operations that have successfully been cancelled + * have [Operation.error][] value with a + * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + * `Code.CANCELLED`. + * + * Generated from protobuf field bool requested_cancellation = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $requested_cancellation = false; + /** + * Output only. API version used to start the operation. + * + * Generated from protobuf field string api_version = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $api_version = ''; + + /** + * 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 string $target + * Output only. Server-defined resource path for the target of the operation. + * @type string $verb + * Output only. Name of the verb executed by the operation. + * @type string $status_message + * Output only. Human-readable status of the operation, if any. + * @type bool $requested_cancellation + * Output only. Identifies whether the user has requested cancellation + * of the operation. Operations that have successfully been cancelled + * have [Operation.error][] value with a + * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + * `Code.CANCELLED`. + * @type string $api_version + * Output only. API version used to start the operation. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::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. Server-defined resource path for the target of the operation. + * + * Generated from protobuf field string target = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getTarget() + { + return $this->target; + } + + /** + * Output only. Server-defined resource path for the target of the operation. + * + * Generated from protobuf field string target = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setTarget($var) + { + GPBUtil::checkString($var, True); + $this->target = $var; + + return $this; + } + + /** + * Output only. Name of the verb executed by the operation. + * + * Generated from protobuf field string verb = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getVerb() + { + return $this->verb; + } + + /** + * Output only. Name of the verb executed by the operation. + * + * Generated from protobuf field string verb = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setVerb($var) + { + GPBUtil::checkString($var, True); + $this->verb = $var; + + return $this; + } + + /** + * Output only. Human-readable status of the operation, if any. + * + * Generated from protobuf field string status_message = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getStatusMessage() + { + return $this->status_message; + } + + /** + * Output only. Human-readable status of the operation, if any. + * + * Generated from protobuf field string status_message = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setStatusMessage($var) + { + GPBUtil::checkString($var, True); + $this->status_message = $var; + + return $this; + } + + /** + * Output only. Identifies whether the user has requested cancellation + * of the operation. Operations that have successfully been cancelled + * have [Operation.error][] value with a + * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + * `Code.CANCELLED`. + * + * Generated from protobuf field bool requested_cancellation = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return bool + */ + public function getRequestedCancellation() + { + return $this->requested_cancellation; + } + + /** + * Output only. Identifies whether the user has requested cancellation + * of the operation. Operations that have successfully been cancelled + * have [Operation.error][] value with a + * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + * `Code.CANCELLED`. + * + * Generated from protobuf field bool requested_cancellation = 6 [(.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. API version used to start the operation. + * + * Generated from protobuf field string api_version = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getApiVersion() + { + return $this->api_version; + } + + /** + * Output only. API version used to start the operation. + * + * Generated from protobuf field string api_version = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setApiVersion($var) + { + GPBUtil::checkString($var, True); + $this->api_version = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Phase.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Phase.php new file mode 100644 index 000000000000..d4eb8041827c --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Phase.php @@ -0,0 +1,215 @@ +google.cloud.deploy.v1.Phase + */ +class Phase extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The ID of the Phase. + * + * Generated from protobuf field string id = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $id = ''; + /** + * Output only. Current state of the Phase. + * + * Generated from protobuf field .google.cloud.deploy.v1.Phase.State state = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Output only. Additional information on why the Phase was skipped, if + * available. + * + * Generated from protobuf field string skip_message = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $skip_message = ''; + protected $jobs; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $id + * Output only. The ID of the Phase. + * @type int $state + * Output only. Current state of the Phase. + * @type string $skip_message + * Output only. Additional information on why the Phase was skipped, if + * available. + * @type \Google\Cloud\Deploy\V1\DeploymentJobs $deployment_jobs + * Output only. Deployment job composition. + * @type \Google\Cloud\Deploy\V1\ChildRolloutJobs $child_rollout_jobs + * Output only. ChildRollout job composition. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The ID of the Phase. + * + * Generated from protobuf field string id = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getId() + { + return $this->id; + } + + /** + * Output only. The ID of the Phase. + * + * Generated from protobuf field string id = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setId($var) + { + GPBUtil::checkString($var, True); + $this->id = $var; + + return $this; + } + + /** + * Output only. Current state of the Phase. + * + * Generated from protobuf field .google.cloud.deploy.v1.Phase.State state = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. Current state of the Phase. + * + * Generated from protobuf field .google.cloud.deploy.v1.Phase.State state = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Deploy\V1\Phase\State::class); + $this->state = $var; + + return $this; + } + + /** + * Output only. Additional information on why the Phase was skipped, if + * available. + * + * Generated from protobuf field string skip_message = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getSkipMessage() + { + return $this->skip_message; + } + + /** + * Output only. Additional information on why the Phase was skipped, if + * available. + * + * Generated from protobuf field string skip_message = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setSkipMessage($var) + { + GPBUtil::checkString($var, True); + $this->skip_message = $var; + + return $this; + } + + /** + * Output only. Deployment job composition. + * + * Generated from protobuf field .google.cloud.deploy.v1.DeploymentJobs deployment_jobs = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\Deploy\V1\DeploymentJobs|null + */ + public function getDeploymentJobs() + { + return $this->readOneof(4); + } + + public function hasDeploymentJobs() + { + return $this->hasOneof(4); + } + + /** + * Output only. Deployment job composition. + * + * Generated from protobuf field .google.cloud.deploy.v1.DeploymentJobs deployment_jobs = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\Deploy\V1\DeploymentJobs $var + * @return $this + */ + public function setDeploymentJobs($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Deploy\V1\DeploymentJobs::class); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * Output only. ChildRollout job composition. + * + * Generated from protobuf field .google.cloud.deploy.v1.ChildRolloutJobs child_rollout_jobs = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\Deploy\V1\ChildRolloutJobs|null + */ + public function getChildRolloutJobs() + { + return $this->readOneof(5); + } + + public function hasChildRolloutJobs() + { + return $this->hasOneof(5); + } + + /** + * Output only. ChildRollout job composition. + * + * Generated from protobuf field .google.cloud.deploy.v1.ChildRolloutJobs child_rollout_jobs = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\Deploy\V1\ChildRolloutJobs $var + * @return $this + */ + public function setChildRolloutJobs($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Deploy\V1\ChildRolloutJobs::class); + $this->writeOneof(5, $var); + + return $this; + } + + /** + * @return string + */ + public function getJobs() + { + return $this->whichOneof("jobs"); + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Phase/State.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Phase/State.php new file mode 100644 index 000000000000..0685882739b8 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Phase/State.php @@ -0,0 +1,92 @@ +google.cloud.deploy.v1.Phase.State + */ +class State +{ + /** + * The Phase has an unspecified state. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The Phase is waiting for an earlier Phase(s) to complete. + * + * Generated from protobuf enum PENDING = 1; + */ + const PENDING = 1; + /** + * The Phase is in progress. + * + * Generated from protobuf enum IN_PROGRESS = 2; + */ + const IN_PROGRESS = 2; + /** + * The Phase has succeeded. + * + * Generated from protobuf enum SUCCEEDED = 3; + */ + const SUCCEEDED = 3; + /** + * The Phase has failed. + * + * Generated from protobuf enum FAILED = 4; + */ + const FAILED = 4; + /** + * The Phase was aborted. + * + * Generated from protobuf enum ABORTED = 5; + */ + const ABORTED = 5; + /** + * The Phase was skipped. + * + * Generated from protobuf enum SKIPPED = 6; + */ + const SKIPPED = 6; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::PENDING => 'PENDING', + self::IN_PROGRESS => 'IN_PROGRESS', + self::SUCCEEDED => 'SUCCEEDED', + self::FAILED => 'FAILED', + self::ABORTED => 'ABORTED', + self::SKIPPED => 'SKIPPED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\Deploy\V1\Phase_State::class); + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Phase_State.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Phase_State.php new file mode 100644 index 000000000000..3eb783441d76 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Phase_State.php @@ -0,0 +1,16 @@ +google.cloud.deploy.v1.PipelineCondition + */ +class PipelineCondition extends \Google\Protobuf\Internal\Message +{ + /** + * Details around the Pipeline's overall status. + * + * Generated from protobuf field .google.cloud.deploy.v1.PipelineReadyCondition pipeline_ready_condition = 1; + */ + protected $pipeline_ready_condition = null; + /** + * Details around targets enumerated in the pipeline. + * + * Generated from protobuf field .google.cloud.deploy.v1.TargetsPresentCondition targets_present_condition = 3; + */ + protected $targets_present_condition = null; + /** + * Details on the whether the targets enumerated in the pipeline are of the + * same type. + * + * Generated from protobuf field .google.cloud.deploy.v1.TargetsTypeCondition targets_type_condition = 4; + */ + protected $targets_type_condition = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Deploy\V1\PipelineReadyCondition $pipeline_ready_condition + * Details around the Pipeline's overall status. + * @type \Google\Cloud\Deploy\V1\TargetsPresentCondition $targets_present_condition + * Details around targets enumerated in the pipeline. + * @type \Google\Cloud\Deploy\V1\TargetsTypeCondition $targets_type_condition + * Details on the whether the targets enumerated in the pipeline are of the + * same type. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * Details around the Pipeline's overall status. + * + * Generated from protobuf field .google.cloud.deploy.v1.PipelineReadyCondition pipeline_ready_condition = 1; + * @return \Google\Cloud\Deploy\V1\PipelineReadyCondition|null + */ + public function getPipelineReadyCondition() + { + return $this->pipeline_ready_condition; + } + + public function hasPipelineReadyCondition() + { + return isset($this->pipeline_ready_condition); + } + + public function clearPipelineReadyCondition() + { + unset($this->pipeline_ready_condition); + } + + /** + * Details around the Pipeline's overall status. + * + * Generated from protobuf field .google.cloud.deploy.v1.PipelineReadyCondition pipeline_ready_condition = 1; + * @param \Google\Cloud\Deploy\V1\PipelineReadyCondition $var + * @return $this + */ + public function setPipelineReadyCondition($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Deploy\V1\PipelineReadyCondition::class); + $this->pipeline_ready_condition = $var; + + return $this; + } + + /** + * Details around targets enumerated in the pipeline. + * + * Generated from protobuf field .google.cloud.deploy.v1.TargetsPresentCondition targets_present_condition = 3; + * @return \Google\Cloud\Deploy\V1\TargetsPresentCondition|null + */ + public function getTargetsPresentCondition() + { + return $this->targets_present_condition; + } + + public function hasTargetsPresentCondition() + { + return isset($this->targets_present_condition); + } + + public function clearTargetsPresentCondition() + { + unset($this->targets_present_condition); + } + + /** + * Details around targets enumerated in the pipeline. + * + * Generated from protobuf field .google.cloud.deploy.v1.TargetsPresentCondition targets_present_condition = 3; + * @param \Google\Cloud\Deploy\V1\TargetsPresentCondition $var + * @return $this + */ + public function setTargetsPresentCondition($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Deploy\V1\TargetsPresentCondition::class); + $this->targets_present_condition = $var; + + return $this; + } + + /** + * Details on the whether the targets enumerated in the pipeline are of the + * same type. + * + * Generated from protobuf field .google.cloud.deploy.v1.TargetsTypeCondition targets_type_condition = 4; + * @return \Google\Cloud\Deploy\V1\TargetsTypeCondition|null + */ + public function getTargetsTypeCondition() + { + return $this->targets_type_condition; + } + + public function hasTargetsTypeCondition() + { + return isset($this->targets_type_condition); + } + + public function clearTargetsTypeCondition() + { + unset($this->targets_type_condition); + } + + /** + * Details on the whether the targets enumerated in the pipeline are of the + * same type. + * + * Generated from protobuf field .google.cloud.deploy.v1.TargetsTypeCondition targets_type_condition = 4; + * @param \Google\Cloud\Deploy\V1\TargetsTypeCondition $var + * @return $this + */ + public function setTargetsTypeCondition($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Deploy\V1\TargetsTypeCondition::class); + $this->targets_type_condition = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/PipelineReadyCondition.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/PipelineReadyCondition.php new file mode 100644 index 000000000000..5ed4775bcce0 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/PipelineReadyCondition.php @@ -0,0 +1,124 @@ +google.cloud.deploy.v1.PipelineReadyCondition + */ +class PipelineReadyCondition extends \Google\Protobuf\Internal\Message +{ + /** + * True if the Pipeline is in a valid state. Otherwise at least one condition + * in `PipelineCondition` is in an invalid state. Iterate over those + * conditions and see which condition(s) has status = false to find out what + * is wrong with the Pipeline. + * + * Generated from protobuf field bool status = 3; + */ + protected $status = false; + /** + * Last time the condition was updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 4; + */ + protected $update_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $status + * True if the Pipeline is in a valid state. Otherwise at least one condition + * in `PipelineCondition` is in an invalid state. Iterate over those + * conditions and see which condition(s) has status = false to find out what + * is wrong with the Pipeline. + * @type \Google\Protobuf\Timestamp $update_time + * Last time the condition was updated. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * True if the Pipeline is in a valid state. Otherwise at least one condition + * in `PipelineCondition` is in an invalid state. Iterate over those + * conditions and see which condition(s) has status = false to find out what + * is wrong with the Pipeline. + * + * Generated from protobuf field bool status = 3; + * @return bool + */ + public function getStatus() + { + return $this->status; + } + + /** + * True if the Pipeline is in a valid state. Otherwise at least one condition + * in `PipelineCondition` is in an invalid state. Iterate over those + * conditions and see which condition(s) has status = false to find out what + * is wrong with the Pipeline. + * + * Generated from protobuf field bool status = 3; + * @param bool $var + * @return $this + */ + public function setStatus($var) + { + GPBUtil::checkBool($var); + $this->status = $var; + + return $this; + } + + /** + * Last time the condition was updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 4; + * @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); + } + + /** + * Last time the condition was updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 4; + * @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/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/PrivatePool.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/PrivatePool.php new file mode 100644 index 000000000000..b7a8ae63ba44 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/PrivatePool.php @@ -0,0 +1,159 @@ +google.cloud.deploy.v1.PrivatePool + */ +class PrivatePool extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Resource name of the Cloud Build worker pool to use. The format + * is `projects/{project}/locations/{location}/workerPools/{pool}`. + * + * Generated from protobuf field string worker_pool = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $worker_pool = ''; + /** + * Optional. Google service account to use for execution. If unspecified, + * the project execution service account + * (-compute@developer.gserviceaccount.com) will be used. + * + * Generated from protobuf field string service_account = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $service_account = ''; + /** + * Optional. Cloud Storage location where execution outputs should be stored. + * This can either be a bucket ("gs://my-bucket") or a path within a bucket + * ("gs://my-bucket/my-dir"). + * If unspecified, a default bucket located in the same region will be used. + * + * Generated from protobuf field string artifact_storage = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $artifact_storage = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $worker_pool + * Required. Resource name of the Cloud Build worker pool to use. The format + * is `projects/{project}/locations/{location}/workerPools/{pool}`. + * @type string $service_account + * Optional. Google service account to use for execution. If unspecified, + * the project execution service account + * (-compute@developer.gserviceaccount.com) will be used. + * @type string $artifact_storage + * Optional. Cloud Storage location where execution outputs should be stored. + * This can either be a bucket ("gs://my-bucket") or a path within a bucket + * ("gs://my-bucket/my-dir"). + * If unspecified, a default bucket located in the same region will be used. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * Required. Resource name of the Cloud Build worker pool to use. The format + * is `projects/{project}/locations/{location}/workerPools/{pool}`. + * + * Generated from protobuf field string worker_pool = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getWorkerPool() + { + return $this->worker_pool; + } + + /** + * Required. Resource name of the Cloud Build worker pool to use. The format + * is `projects/{project}/locations/{location}/workerPools/{pool}`. + * + * Generated from protobuf field string worker_pool = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setWorkerPool($var) + { + GPBUtil::checkString($var, True); + $this->worker_pool = $var; + + return $this; + } + + /** + * Optional. Google service account to use for execution. If unspecified, + * the project execution service account + * (-compute@developer.gserviceaccount.com) will be used. + * + * Generated from protobuf field string service_account = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getServiceAccount() + { + return $this->service_account; + } + + /** + * Optional. Google service account to use for execution. If unspecified, + * the project execution service account + * (-compute@developer.gserviceaccount.com) will be used. + * + * Generated from protobuf field string service_account = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setServiceAccount($var) + { + GPBUtil::checkString($var, True); + $this->service_account = $var; + + return $this; + } + + /** + * Optional. Cloud Storage location where execution outputs should be stored. + * This can either be a bucket ("gs://my-bucket") or a path within a bucket + * ("gs://my-bucket/my-dir"). + * If unspecified, a default bucket located in the same region will be used. + * + * Generated from protobuf field string artifact_storage = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getArtifactStorage() + { + return $this->artifact_storage; + } + + /** + * Optional. Cloud Storage location where execution outputs should be stored. + * This can either be a bucket ("gs://my-bucket") or a path within a bucket + * ("gs://my-bucket/my-dir"). + * If unspecified, a default bucket located in the same region will be used. + * + * Generated from protobuf field string artifact_storage = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setArtifactStorage($var) + { + GPBUtil::checkString($var, True); + $this->artifact_storage = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Release.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Release.php new file mode 100644 index 000000000000..dee979a9229d --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Release.php @@ -0,0 +1,853 @@ +google.cloud.deploy.v1.Release + */ +class Release extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. Name of the `Release`. Format is projects/{project}/ + * locations/{location}/deliveryPipelines/{deliveryPipeline}/ + * releases/[a-z][a-z0-9\-]{0,62}. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $name = ''; + /** + * Output only. Unique identifier of the `Release`. + * + * Generated from protobuf field string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $uid = ''; + /** + * Description of the `Release`. Max length is 255 characters. + * + * Generated from protobuf field string description = 3; + */ + protected $description = ''; + /** + * User annotations. These attributes can only be set and used by the + * user, and not by Google Cloud Deploy. See + * https://google.aip.dev/128#annotations for more details such as format and + * size limitations. + * + * Generated from protobuf field map annotations = 4; + */ + private $annotations; + /** + * Labels are attributes that can be set and used by both the + * user and by Google Cloud Deploy. Labels must meet the following + * constraints: + * * Keys and values can contain only lowercase letters, numeric characters, + * underscores, and dashes. + * * All characters must use UTF-8 encoding, and international characters are + * allowed. + * * Keys must start with a lowercase letter or international character. + * * Each resource is limited to a maximum of 64 labels. + * Both keys and values are additionally constrained to be <= 128 bytes. + * + * Generated from protobuf field map labels = 5; + */ + private $labels; + /** + * Output only. Indicates whether this is an abandoned release. + * + * Generated from protobuf field bool abandoned = 23 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $abandoned = false; + /** + * Output only. Time at which the `Release` was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. Time at which the render began. + * + * Generated from protobuf field .google.protobuf.Timestamp render_start_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $render_start_time = null; + /** + * Output only. Time at which the render completed. + * + * Generated from protobuf field .google.protobuf.Timestamp render_end_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $render_end_time = null; + /** + * Cloud Storage URI of tar.gz archive containing Skaffold configuration. + * + * Generated from protobuf field string skaffold_config_uri = 17; + */ + protected $skaffold_config_uri = ''; + /** + * Filepath of the Skaffold config inside of the config URI. + * + * Generated from protobuf field string skaffold_config_path = 9; + */ + protected $skaffold_config_path = ''; + /** + * List of artifacts to pass through to Skaffold command. + * + * Generated from protobuf field repeated .google.cloud.deploy.v1.BuildArtifact build_artifacts = 10; + */ + private $build_artifacts; + /** + * Output only. Snapshot of the parent pipeline taken at release creation + * time. + * + * Generated from protobuf field .google.cloud.deploy.v1.DeliveryPipeline delivery_pipeline_snapshot = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $delivery_pipeline_snapshot = null; + /** + * Output only. Snapshot of the targets taken at release creation time. + * + * Generated from protobuf field repeated .google.cloud.deploy.v1.Target target_snapshots = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $target_snapshots; + /** + * Output only. Current state of the render operation. + * + * Generated from protobuf field .google.cloud.deploy.v1.Release.RenderState render_state = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $render_state = 0; + /** + * This checksum is computed by the server based on the value of other + * fields, and may be sent on update and delete requests to ensure the + * client has an up-to-date value before proceeding. + * + * Generated from protobuf field string etag = 16; + */ + protected $etag = ''; + /** + * The Skaffold version to use when operating on this release, such as + * "1.20.0". Not all versions are valid; Google Cloud Deploy supports a + * specific set of versions. + * If unset, the most recent supported Skaffold version will be used. + * + * Generated from protobuf field string skaffold_version = 19; + */ + protected $skaffold_version = ''; + /** + * Output only. Map from target ID to the target artifacts created + * during the render operation. + * + * Generated from protobuf field map target_artifacts = 20 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $target_artifacts; + /** + * Output only. Map from target ID to details of the render operation for that + * target. + * + * Generated from protobuf field map target_renders = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $target_renders; + /** + * Output only. Information around the state of the Release. + * + * Generated from protobuf field .google.cloud.deploy.v1.Release.ReleaseCondition condition = 24 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $condition = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Optional. Name of the `Release`. Format is projects/{project}/ + * locations/{location}/deliveryPipelines/{deliveryPipeline}/ + * releases/[a-z][a-z0-9\-]{0,62}. + * @type string $uid + * Output only. Unique identifier of the `Release`. + * @type string $description + * Description of the `Release`. Max length is 255 characters. + * @type array|\Google\Protobuf\Internal\MapField $annotations + * User annotations. These attributes can only be set and used by the + * user, and not by Google Cloud Deploy. See + * https://google.aip.dev/128#annotations for more details such as format and + * size limitations. + * @type array|\Google\Protobuf\Internal\MapField $labels + * Labels are attributes that can be set and used by both the + * user and by Google Cloud Deploy. Labels must meet the following + * constraints: + * * Keys and values can contain only lowercase letters, numeric characters, + * underscores, and dashes. + * * All characters must use UTF-8 encoding, and international characters are + * allowed. + * * Keys must start with a lowercase letter or international character. + * * Each resource is limited to a maximum of 64 labels. + * Both keys and values are additionally constrained to be <= 128 bytes. + * @type bool $abandoned + * Output only. Indicates whether this is an abandoned release. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. Time at which the `Release` was created. + * @type \Google\Protobuf\Timestamp $render_start_time + * Output only. Time at which the render began. + * @type \Google\Protobuf\Timestamp $render_end_time + * Output only. Time at which the render completed. + * @type string $skaffold_config_uri + * Cloud Storage URI of tar.gz archive containing Skaffold configuration. + * @type string $skaffold_config_path + * Filepath of the Skaffold config inside of the config URI. + * @type array<\Google\Cloud\Deploy\V1\BuildArtifact>|\Google\Protobuf\Internal\RepeatedField $build_artifacts + * List of artifacts to pass through to Skaffold command. + * @type \Google\Cloud\Deploy\V1\DeliveryPipeline $delivery_pipeline_snapshot + * Output only. Snapshot of the parent pipeline taken at release creation + * time. + * @type array<\Google\Cloud\Deploy\V1\Target>|\Google\Protobuf\Internal\RepeatedField $target_snapshots + * Output only. Snapshot of the targets taken at release creation time. + * @type int $render_state + * Output only. Current state of the render operation. + * @type string $etag + * This checksum is computed by the server based on the value of other + * fields, and may be sent on update and delete requests to ensure the + * client has an up-to-date value before proceeding. + * @type string $skaffold_version + * The Skaffold version to use when operating on this release, such as + * "1.20.0". Not all versions are valid; Google Cloud Deploy supports a + * specific set of versions. + * If unset, the most recent supported Skaffold version will be used. + * @type array|\Google\Protobuf\Internal\MapField $target_artifacts + * Output only. Map from target ID to the target artifacts created + * during the render operation. + * @type array|\Google\Protobuf\Internal\MapField $target_renders + * Output only. Map from target ID to details of the render operation for that + * target. + * @type \Google\Cloud\Deploy\V1\Release\ReleaseCondition $condition + * Output only. Information around the state of the Release. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * Optional. Name of the `Release`. Format is projects/{project}/ + * locations/{location}/deliveryPipelines/{deliveryPipeline}/ + * releases/[a-z][a-z0-9\-]{0,62}. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Optional. Name of the `Release`. Format is projects/{project}/ + * locations/{location}/deliveryPipelines/{deliveryPipeline}/ + * releases/[a-z][a-z0-9\-]{0,62}. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. Unique identifier of the `Release`. + * + * Generated from protobuf field string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getUid() + { + return $this->uid; + } + + /** + * Output only. Unique identifier of the `Release`. + * + * Generated from protobuf field string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setUid($var) + { + GPBUtil::checkString($var, True); + $this->uid = $var; + + return $this; + } + + /** + * Description of the `Release`. Max length is 255 characters. + * + * Generated from protobuf field string description = 3; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Description of the `Release`. Max length is 255 characters. + * + * Generated from protobuf field string description = 3; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * User annotations. These attributes can only be set and used by the + * user, and not by Google Cloud Deploy. See + * https://google.aip.dev/128#annotations for more details such as format and + * size limitations. + * + * Generated from protobuf field map annotations = 4; + * @return \Google\Protobuf\Internal\MapField + */ + public function getAnnotations() + { + return $this->annotations; + } + + /** + * User annotations. These attributes can only be set and used by the + * user, and not by Google Cloud Deploy. See + * https://google.aip.dev/128#annotations for more details such as format and + * size limitations. + * + * Generated from protobuf field map annotations = 4; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setAnnotations($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->annotations = $arr; + + return $this; + } + + /** + * Labels are attributes that can be set and used by both the + * user and by Google Cloud Deploy. Labels must meet the following + * constraints: + * * Keys and values can contain only lowercase letters, numeric characters, + * underscores, and dashes. + * * All characters must use UTF-8 encoding, and international characters are + * allowed. + * * Keys must start with a lowercase letter or international character. + * * Each resource is limited to a maximum of 64 labels. + * Both keys and values are additionally constrained to be <= 128 bytes. + * + * Generated from protobuf field map labels = 5; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * Labels are attributes that can be set and used by both the + * user and by Google Cloud Deploy. Labels must meet the following + * constraints: + * * Keys and values can contain only lowercase letters, numeric characters, + * underscores, and dashes. + * * All characters must use UTF-8 encoding, and international characters are + * allowed. + * * Keys must start with a lowercase letter or international character. + * * Each resource is limited to a maximum of 64 labels. + * Both keys and values are additionally constrained to be <= 128 bytes. + * + * Generated from protobuf field map labels = 5; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + + /** + * Output only. Indicates whether this is an abandoned release. + * + * Generated from protobuf field bool abandoned = 23 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return bool + */ + public function getAbandoned() + { + return $this->abandoned; + } + + /** + * Output only. Indicates whether this is an abandoned release. + * + * Generated from protobuf field bool abandoned = 23 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param bool $var + * @return $this + */ + public function setAbandoned($var) + { + GPBUtil::checkBool($var); + $this->abandoned = $var; + + return $this; + } + + /** + * Output only. Time at which the `Release` was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 6 [(.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. Time at which the `Release` was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 6 [(.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. Time at which the render began. + * + * Generated from protobuf field .google.protobuf.Timestamp render_start_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getRenderStartTime() + { + return $this->render_start_time; + } + + public function hasRenderStartTime() + { + return isset($this->render_start_time); + } + + public function clearRenderStartTime() + { + unset($this->render_start_time); + } + + /** + * Output only. Time at which the render began. + * + * Generated from protobuf field .google.protobuf.Timestamp render_start_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setRenderStartTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->render_start_time = $var; + + return $this; + } + + /** + * Output only. Time at which the render completed. + * + * Generated from protobuf field .google.protobuf.Timestamp render_end_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getRenderEndTime() + { + return $this->render_end_time; + } + + public function hasRenderEndTime() + { + return isset($this->render_end_time); + } + + public function clearRenderEndTime() + { + unset($this->render_end_time); + } + + /** + * Output only. Time at which the render completed. + * + * Generated from protobuf field .google.protobuf.Timestamp render_end_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setRenderEndTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->render_end_time = $var; + + return $this; + } + + /** + * Cloud Storage URI of tar.gz archive containing Skaffold configuration. + * + * Generated from protobuf field string skaffold_config_uri = 17; + * @return string + */ + public function getSkaffoldConfigUri() + { + return $this->skaffold_config_uri; + } + + /** + * Cloud Storage URI of tar.gz archive containing Skaffold configuration. + * + * Generated from protobuf field string skaffold_config_uri = 17; + * @param string $var + * @return $this + */ + public function setSkaffoldConfigUri($var) + { + GPBUtil::checkString($var, True); + $this->skaffold_config_uri = $var; + + return $this; + } + + /** + * Filepath of the Skaffold config inside of the config URI. + * + * Generated from protobuf field string skaffold_config_path = 9; + * @return string + */ + public function getSkaffoldConfigPath() + { + return $this->skaffold_config_path; + } + + /** + * Filepath of the Skaffold config inside of the config URI. + * + * Generated from protobuf field string skaffold_config_path = 9; + * @param string $var + * @return $this + */ + public function setSkaffoldConfigPath($var) + { + GPBUtil::checkString($var, True); + $this->skaffold_config_path = $var; + + return $this; + } + + /** + * List of artifacts to pass through to Skaffold command. + * + * Generated from protobuf field repeated .google.cloud.deploy.v1.BuildArtifact build_artifacts = 10; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getBuildArtifacts() + { + return $this->build_artifacts; + } + + /** + * List of artifacts to pass through to Skaffold command. + * + * Generated from protobuf field repeated .google.cloud.deploy.v1.BuildArtifact build_artifacts = 10; + * @param array<\Google\Cloud\Deploy\V1\BuildArtifact>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setBuildArtifacts($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Deploy\V1\BuildArtifact::class); + $this->build_artifacts = $arr; + + return $this; + } + + /** + * Output only. Snapshot of the parent pipeline taken at release creation + * time. + * + * Generated from protobuf field .google.cloud.deploy.v1.DeliveryPipeline delivery_pipeline_snapshot = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\Deploy\V1\DeliveryPipeline|null + */ + public function getDeliveryPipelineSnapshot() + { + return $this->delivery_pipeline_snapshot; + } + + public function hasDeliveryPipelineSnapshot() + { + return isset($this->delivery_pipeline_snapshot); + } + + public function clearDeliveryPipelineSnapshot() + { + unset($this->delivery_pipeline_snapshot); + } + + /** + * Output only. Snapshot of the parent pipeline taken at release creation + * time. + * + * Generated from protobuf field .google.cloud.deploy.v1.DeliveryPipeline delivery_pipeline_snapshot = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\Deploy\V1\DeliveryPipeline $var + * @return $this + */ + public function setDeliveryPipelineSnapshot($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Deploy\V1\DeliveryPipeline::class); + $this->delivery_pipeline_snapshot = $var; + + return $this; + } + + /** + * Output only. Snapshot of the targets taken at release creation time. + * + * Generated from protobuf field repeated .google.cloud.deploy.v1.Target target_snapshots = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTargetSnapshots() + { + return $this->target_snapshots; + } + + /** + * Output only. Snapshot of the targets taken at release creation time. + * + * Generated from protobuf field repeated .google.cloud.deploy.v1.Target target_snapshots = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array<\Google\Cloud\Deploy\V1\Target>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTargetSnapshots($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Deploy\V1\Target::class); + $this->target_snapshots = $arr; + + return $this; + } + + /** + * Output only. Current state of the render operation. + * + * Generated from protobuf field .google.cloud.deploy.v1.Release.RenderState render_state = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getRenderState() + { + return $this->render_state; + } + + /** + * Output only. Current state of the render operation. + * + * Generated from protobuf field .google.cloud.deploy.v1.Release.RenderState render_state = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setRenderState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Deploy\V1\Release\RenderState::class); + $this->render_state = $var; + + return $this; + } + + /** + * This checksum is computed by the server based on the value of other + * fields, and may be sent on update and delete requests to ensure the + * client has an up-to-date value before proceeding. + * + * Generated from protobuf field string etag = 16; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * This checksum is computed by the server based on the value of other + * fields, and may be sent on update and delete requests to ensure the + * client has an up-to-date value before proceeding. + * + * Generated from protobuf field string etag = 16; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, True); + $this->etag = $var; + + return $this; + } + + /** + * The Skaffold version to use when operating on this release, such as + * "1.20.0". Not all versions are valid; Google Cloud Deploy supports a + * specific set of versions. + * If unset, the most recent supported Skaffold version will be used. + * + * Generated from protobuf field string skaffold_version = 19; + * @return string + */ + public function getSkaffoldVersion() + { + return $this->skaffold_version; + } + + /** + * The Skaffold version to use when operating on this release, such as + * "1.20.0". Not all versions are valid; Google Cloud Deploy supports a + * specific set of versions. + * If unset, the most recent supported Skaffold version will be used. + * + * Generated from protobuf field string skaffold_version = 19; + * @param string $var + * @return $this + */ + public function setSkaffoldVersion($var) + { + GPBUtil::checkString($var, True); + $this->skaffold_version = $var; + + return $this; + } + + /** + * Output only. Map from target ID to the target artifacts created + * during the render operation. + * + * Generated from protobuf field map target_artifacts = 20 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\MapField + */ + public function getTargetArtifacts() + { + return $this->target_artifacts; + } + + /** + * Output only. Map from target ID to the target artifacts created + * during the render operation. + * + * Generated from protobuf field map target_artifacts = 20 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setTargetArtifacts($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Deploy\V1\TargetArtifact::class); + $this->target_artifacts = $arr; + + return $this; + } + + /** + * Output only. Map from target ID to details of the render operation for that + * target. + * + * Generated from protobuf field map target_renders = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\MapField + */ + public function getTargetRenders() + { + return $this->target_renders; + } + + /** + * Output only. Map from target ID to details of the render operation for that + * target. + * + * Generated from protobuf field map target_renders = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setTargetRenders($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Deploy\V1\Release\TargetRender::class); + $this->target_renders = $arr; + + return $this; + } + + /** + * Output only. Information around the state of the Release. + * + * Generated from protobuf field .google.cloud.deploy.v1.Release.ReleaseCondition condition = 24 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\Deploy\V1\Release\ReleaseCondition|null + */ + public function getCondition() + { + return $this->condition; + } + + public function hasCondition() + { + return isset($this->condition); + } + + public function clearCondition() + { + unset($this->condition); + } + + /** + * Output only. Information around the state of the Release. + * + * Generated from protobuf field .google.cloud.deploy.v1.Release.ReleaseCondition condition = 24 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\Deploy\V1\Release\ReleaseCondition $var + * @return $this + */ + public function setCondition($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Deploy\V1\Release\ReleaseCondition::class); + $this->condition = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Release/ReleaseCondition.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Release/ReleaseCondition.php new file mode 100644 index 000000000000..3a52391afa45 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Release/ReleaseCondition.php @@ -0,0 +1,128 @@ +google.cloud.deploy.v1.Release.ReleaseCondition + */ +class ReleaseCondition extends \Google\Protobuf\Internal\Message +{ + /** + * Details around the Releases's overall status. + * + * Generated from protobuf field .google.cloud.deploy.v1.Release.ReleaseReadyCondition release_ready_condition = 1; + */ + protected $release_ready_condition = null; + /** + * Details around the support state of the release's skaffold + * version. + * + * Generated from protobuf field .google.cloud.deploy.v1.Release.SkaffoldSupportedCondition skaffold_supported_condition = 2; + */ + protected $skaffold_supported_condition = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Deploy\V1\Release\ReleaseReadyCondition $release_ready_condition + * Details around the Releases's overall status. + * @type \Google\Cloud\Deploy\V1\Release\SkaffoldSupportedCondition $skaffold_supported_condition + * Details around the support state of the release's skaffold + * version. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * Details around the Releases's overall status. + * + * Generated from protobuf field .google.cloud.deploy.v1.Release.ReleaseReadyCondition release_ready_condition = 1; + * @return \Google\Cloud\Deploy\V1\Release\ReleaseReadyCondition|null + */ + public function getReleaseReadyCondition() + { + return $this->release_ready_condition; + } + + public function hasReleaseReadyCondition() + { + return isset($this->release_ready_condition); + } + + public function clearReleaseReadyCondition() + { + unset($this->release_ready_condition); + } + + /** + * Details around the Releases's overall status. + * + * Generated from protobuf field .google.cloud.deploy.v1.Release.ReleaseReadyCondition release_ready_condition = 1; + * @param \Google\Cloud\Deploy\V1\Release\ReleaseReadyCondition $var + * @return $this + */ + public function setReleaseReadyCondition($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Deploy\V1\Release\ReleaseReadyCondition::class); + $this->release_ready_condition = $var; + + return $this; + } + + /** + * Details around the support state of the release's skaffold + * version. + * + * Generated from protobuf field .google.cloud.deploy.v1.Release.SkaffoldSupportedCondition skaffold_supported_condition = 2; + * @return \Google\Cloud\Deploy\V1\Release\SkaffoldSupportedCondition|null + */ + public function getSkaffoldSupportedCondition() + { + return $this->skaffold_supported_condition; + } + + public function hasSkaffoldSupportedCondition() + { + return isset($this->skaffold_supported_condition); + } + + public function clearSkaffoldSupportedCondition() + { + unset($this->skaffold_supported_condition); + } + + /** + * Details around the support state of the release's skaffold + * version. + * + * Generated from protobuf field .google.cloud.deploy.v1.Release.SkaffoldSupportedCondition skaffold_supported_condition = 2; + * @param \Google\Cloud\Deploy\V1\Release\SkaffoldSupportedCondition $var + * @return $this + */ + public function setSkaffoldSupportedCondition($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Deploy\V1\Release\SkaffoldSupportedCondition::class); + $this->skaffold_supported_condition = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ReleaseCondition::class, \Google\Cloud\Deploy\V1\Release_ReleaseCondition::class); + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Release/ReleaseReadyCondition.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Release/ReleaseReadyCondition.php new file mode 100644 index 000000000000..067f272f1658 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Release/ReleaseReadyCondition.php @@ -0,0 +1,84 @@ +google.cloud.deploy.v1.Release.ReleaseReadyCondition + */ +class ReleaseReadyCondition extends \Google\Protobuf\Internal\Message +{ + /** + * True if the Release is in a valid state. Otherwise at least one condition + * in `ReleaseCondition` is in an invalid state. Iterate over those + * conditions and see which condition(s) has status = false to find out what + * is wrong with the Release. + * + * Generated from protobuf field bool status = 1; + */ + protected $status = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $status + * True if the Release is in a valid state. Otherwise at least one condition + * in `ReleaseCondition` is in an invalid state. Iterate over those + * conditions and see which condition(s) has status = false to find out what + * is wrong with the Release. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * True if the Release is in a valid state. Otherwise at least one condition + * in `ReleaseCondition` is in an invalid state. Iterate over those + * conditions and see which condition(s) has status = false to find out what + * is wrong with the Release. + * + * Generated from protobuf field bool status = 1; + * @return bool + */ + public function getStatus() + { + return $this->status; + } + + /** + * True if the Release is in a valid state. Otherwise at least one condition + * in `ReleaseCondition` is in an invalid state. Iterate over those + * conditions and see which condition(s) has status = false to find out what + * is wrong with the Release. + * + * Generated from protobuf field bool status = 1; + * @param bool $var + * @return $this + */ + public function setStatus($var) + { + GPBUtil::checkBool($var); + $this->status = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ReleaseReadyCondition::class, \Google\Cloud\Deploy\V1\Release_ReleaseReadyCondition::class); + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Release/RenderState.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Release/RenderState.php new file mode 100644 index 000000000000..37282c517e76 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Release/RenderState.php @@ -0,0 +1,71 @@ +google.cloud.deploy.v1.Release.RenderState + */ +class RenderState +{ + /** + * The render state is unspecified. + * + * Generated from protobuf enum RENDER_STATE_UNSPECIFIED = 0; + */ + const RENDER_STATE_UNSPECIFIED = 0; + /** + * All rendering operations have completed successfully. + * + * Generated from protobuf enum SUCCEEDED = 1; + */ + const SUCCEEDED = 1; + /** + * All rendering operations have completed, and one or more have failed. + * + * Generated from protobuf enum FAILED = 2; + */ + const FAILED = 2; + /** + * Rendering has started and is not complete. + * + * Generated from protobuf enum IN_PROGRESS = 3; + */ + const IN_PROGRESS = 3; + + private static $valueToName = [ + self::RENDER_STATE_UNSPECIFIED => 'RENDER_STATE_UNSPECIFIED', + self::SUCCEEDED => 'SUCCEEDED', + self::FAILED => 'FAILED', + self::IN_PROGRESS => 'IN_PROGRESS', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(RenderState::class, \Google\Cloud\Deploy\V1\Release_RenderState::class); + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Release/SkaffoldSupportedCondition.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Release/SkaffoldSupportedCondition.php new file mode 100644 index 000000000000..bd1a0c9bdaf7 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Release/SkaffoldSupportedCondition.php @@ -0,0 +1,201 @@ +google.cloud.deploy.v1.Release.SkaffoldSupportedCondition + */ +class SkaffoldSupportedCondition extends \Google\Protobuf\Internal\Message +{ + /** + * True if the version of skaffold used by this release is supported. + * + * Generated from protobuf field bool status = 1; + */ + protected $status = false; + /** + * The skaffold support state for this release's version of skaffold. + * + * Generated from protobuf field .google.cloud.deploy.v1.SkaffoldSupportState skaffold_support_state = 2; + */ + protected $skaffold_support_state = 0; + /** + * The time at which this release's version of skaffold will enter + * maintenance mode. + * + * Generated from protobuf field .google.protobuf.Timestamp maintenance_mode_time = 3; + */ + protected $maintenance_mode_time = null; + /** + * The time at which this release's version of skaffold will no longer be + * supported. + * + * Generated from protobuf field .google.protobuf.Timestamp support_expiration_time = 4; + */ + protected $support_expiration_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $status + * True if the version of skaffold used by this release is supported. + * @type int $skaffold_support_state + * The skaffold support state for this release's version of skaffold. + * @type \Google\Protobuf\Timestamp $maintenance_mode_time + * The time at which this release's version of skaffold will enter + * maintenance mode. + * @type \Google\Protobuf\Timestamp $support_expiration_time + * The time at which this release's version of skaffold will no longer be + * supported. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * True if the version of skaffold used by this release is supported. + * + * Generated from protobuf field bool status = 1; + * @return bool + */ + public function getStatus() + { + return $this->status; + } + + /** + * True if the version of skaffold used by this release is supported. + * + * Generated from protobuf field bool status = 1; + * @param bool $var + * @return $this + */ + public function setStatus($var) + { + GPBUtil::checkBool($var); + $this->status = $var; + + return $this; + } + + /** + * The skaffold support state for this release's version of skaffold. + * + * Generated from protobuf field .google.cloud.deploy.v1.SkaffoldSupportState skaffold_support_state = 2; + * @return int + */ + public function getSkaffoldSupportState() + { + return $this->skaffold_support_state; + } + + /** + * The skaffold support state for this release's version of skaffold. + * + * Generated from protobuf field .google.cloud.deploy.v1.SkaffoldSupportState skaffold_support_state = 2; + * @param int $var + * @return $this + */ + public function setSkaffoldSupportState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Deploy\V1\SkaffoldSupportState::class); + $this->skaffold_support_state = $var; + + return $this; + } + + /** + * The time at which this release's version of skaffold will enter + * maintenance mode. + * + * Generated from protobuf field .google.protobuf.Timestamp maintenance_mode_time = 3; + * @return \Google\Protobuf\Timestamp|null + */ + public function getMaintenanceModeTime() + { + return $this->maintenance_mode_time; + } + + public function hasMaintenanceModeTime() + { + return isset($this->maintenance_mode_time); + } + + public function clearMaintenanceModeTime() + { + unset($this->maintenance_mode_time); + } + + /** + * The time at which this release's version of skaffold will enter + * maintenance mode. + * + * Generated from protobuf field .google.protobuf.Timestamp maintenance_mode_time = 3; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setMaintenanceModeTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->maintenance_mode_time = $var; + + return $this; + } + + /** + * The time at which this release's version of skaffold will no longer be + * supported. + * + * Generated from protobuf field .google.protobuf.Timestamp support_expiration_time = 4; + * @return \Google\Protobuf\Timestamp|null + */ + public function getSupportExpirationTime() + { + return $this->support_expiration_time; + } + + public function hasSupportExpirationTime() + { + return isset($this->support_expiration_time); + } + + public function clearSupportExpirationTime() + { + unset($this->support_expiration_time); + } + + /** + * The time at which this release's version of skaffold will no longer be + * supported. + * + * Generated from protobuf field .google.protobuf.Timestamp support_expiration_time = 4; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setSupportExpirationTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->support_expiration_time = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(SkaffoldSupportedCondition::class, \Google\Cloud\Deploy\V1\Release_SkaffoldSupportedCondition::class); + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Release/TargetRender.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Release/TargetRender.php new file mode 100644 index 000000000000..6042ed840749 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Release/TargetRender.php @@ -0,0 +1,232 @@ +google.cloud.deploy.v1.Release.TargetRender + */ +class TargetRender extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The resource name of the Cloud Build `Build` object that is + * used to render the manifest for this target. Format is + * `projects/{project}/locations/{location}/builds/{build}`. + * + * Generated from protobuf field string rendering_build = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + */ + protected $rendering_build = ''; + /** + * Output only. Current state of the render operation for this Target. + * + * Generated from protobuf field .google.cloud.deploy.v1.Release.TargetRender.TargetRenderState rendering_state = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $rendering_state = 0; + /** + * Output only. Metadata related to the `Release` render for this Target. + * + * Generated from protobuf field .google.cloud.deploy.v1.RenderMetadata metadata = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $metadata = null; + /** + * Output only. Reason this render failed. This will always be unspecified + * while the render in progress. + * + * Generated from protobuf field .google.cloud.deploy.v1.Release.TargetRender.FailureCause failure_cause = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $failure_cause = 0; + /** + * Output only. Additional information about the render failure, if + * available. + * + * Generated from protobuf field string failure_message = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $failure_message = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $rendering_build + * Output only. The resource name of the Cloud Build `Build` object that is + * used to render the manifest for this target. Format is + * `projects/{project}/locations/{location}/builds/{build}`. + * @type int $rendering_state + * Output only. Current state of the render operation for this Target. + * @type \Google\Cloud\Deploy\V1\RenderMetadata $metadata + * Output only. Metadata related to the `Release` render for this Target. + * @type int $failure_cause + * Output only. Reason this render failed. This will always be unspecified + * while the render in progress. + * @type string $failure_message + * Output only. Additional information about the render failure, if + * available. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The resource name of the Cloud Build `Build` object that is + * used to render the manifest for this target. Format is + * `projects/{project}/locations/{location}/builds/{build}`. + * + * Generated from protobuf field string rendering_build = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + * @return string + */ + public function getRenderingBuild() + { + return $this->rendering_build; + } + + /** + * Output only. The resource name of the Cloud Build `Build` object that is + * used to render the manifest for this target. Format is + * `projects/{project}/locations/{location}/builds/{build}`. + * + * Generated from protobuf field string rendering_build = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setRenderingBuild($var) + { + GPBUtil::checkString($var, True); + $this->rendering_build = $var; + + return $this; + } + + /** + * Output only. Current state of the render operation for this Target. + * + * Generated from protobuf field .google.cloud.deploy.v1.Release.TargetRender.TargetRenderState rendering_state = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getRenderingState() + { + return $this->rendering_state; + } + + /** + * Output only. Current state of the render operation for this Target. + * + * Generated from protobuf field .google.cloud.deploy.v1.Release.TargetRender.TargetRenderState rendering_state = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setRenderingState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Deploy\V1\Release\TargetRender\TargetRenderState::class); + $this->rendering_state = $var; + + return $this; + } + + /** + * Output only. Metadata related to the `Release` render for this Target. + * + * Generated from protobuf field .google.cloud.deploy.v1.RenderMetadata metadata = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\Deploy\V1\RenderMetadata|null + */ + public function getMetadata() + { + return $this->metadata; + } + + public function hasMetadata() + { + return isset($this->metadata); + } + + public function clearMetadata() + { + unset($this->metadata); + } + + /** + * Output only. Metadata related to the `Release` render for this Target. + * + * Generated from protobuf field .google.cloud.deploy.v1.RenderMetadata metadata = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\Deploy\V1\RenderMetadata $var + * @return $this + */ + public function setMetadata($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Deploy\V1\RenderMetadata::class); + $this->metadata = $var; + + return $this; + } + + /** + * Output only. Reason this render failed. This will always be unspecified + * while the render in progress. + * + * Generated from protobuf field .google.cloud.deploy.v1.Release.TargetRender.FailureCause failure_cause = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getFailureCause() + { + return $this->failure_cause; + } + + /** + * Output only. Reason this render failed. This will always be unspecified + * while the render in progress. + * + * Generated from protobuf field .google.cloud.deploy.v1.Release.TargetRender.FailureCause failure_cause = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setFailureCause($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Deploy\V1\Release\TargetRender\FailureCause::class); + $this->failure_cause = $var; + + return $this; + } + + /** + * Output only. Additional information about the render failure, if + * available. + * + * Generated from protobuf field string failure_message = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getFailureMessage() + { + return $this->failure_message; + } + + /** + * Output only. Additional information about the render failure, if + * available. + * + * Generated from protobuf field string failure_message = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setFailureMessage($var) + { + GPBUtil::checkString($var, True); + $this->failure_message = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(TargetRender::class, \Google\Cloud\Deploy\V1\Release_TargetRender::class); + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Release/TargetRender/FailureCause.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Release/TargetRender/FailureCause.php new file mode 100644 index 000000000000..704f445643cf --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Release/TargetRender/FailureCause.php @@ -0,0 +1,75 @@ +google.cloud.deploy.v1.Release.TargetRender.FailureCause + */ +class FailureCause +{ + /** + * No reason for failure is specified. + * + * Generated from protobuf enum FAILURE_CAUSE_UNSPECIFIED = 0; + */ + const FAILURE_CAUSE_UNSPECIFIED = 0; + /** + * Cloud Build is not available, either because it is not enabled or + * because Google Cloud Deploy has insufficient permissions. See [required + * permission](/deploy/docs/cloud-deploy-service-account#required_permissions). + * + * Generated from protobuf enum CLOUD_BUILD_UNAVAILABLE = 1; + */ + const CLOUD_BUILD_UNAVAILABLE = 1; + /** + * The render operation did not complete successfully; check Cloud Build + * logs. + * + * Generated from protobuf enum EXECUTION_FAILED = 2; + */ + const EXECUTION_FAILED = 2; + /** + * Cloud Build failed to fulfill Google Cloud Deploy's request. See + * failure_message for additional details. + * + * Generated from protobuf enum CLOUD_BUILD_REQUEST_FAILED = 3; + */ + const CLOUD_BUILD_REQUEST_FAILED = 3; + + private static $valueToName = [ + self::FAILURE_CAUSE_UNSPECIFIED => 'FAILURE_CAUSE_UNSPECIFIED', + self::CLOUD_BUILD_UNAVAILABLE => 'CLOUD_BUILD_UNAVAILABLE', + self::EXECUTION_FAILED => 'EXECUTION_FAILED', + self::CLOUD_BUILD_REQUEST_FAILED => 'CLOUD_BUILD_REQUEST_FAILED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(FailureCause::class, \Google\Cloud\Deploy\V1\Release_TargetRender_FailureCause::class); + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Release/TargetRender/TargetRenderState.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Release/TargetRender/TargetRenderState.php new file mode 100644 index 000000000000..3f4840b1272f --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Release/TargetRender/TargetRenderState.php @@ -0,0 +1,71 @@ +google.cloud.deploy.v1.Release.TargetRender.TargetRenderState + */ +class TargetRenderState +{ + /** + * The render operation state is unspecified. + * + * Generated from protobuf enum TARGET_RENDER_STATE_UNSPECIFIED = 0; + */ + const TARGET_RENDER_STATE_UNSPECIFIED = 0; + /** + * The render operation has completed successfully. + * + * Generated from protobuf enum SUCCEEDED = 1; + */ + const SUCCEEDED = 1; + /** + * The render operation has failed. + * + * Generated from protobuf enum FAILED = 2; + */ + const FAILED = 2; + /** + * The render operation is in progress. + * + * Generated from protobuf enum IN_PROGRESS = 3; + */ + const IN_PROGRESS = 3; + + private static $valueToName = [ + self::TARGET_RENDER_STATE_UNSPECIFIED => 'TARGET_RENDER_STATE_UNSPECIFIED', + self::SUCCEEDED => 'SUCCEEDED', + self::FAILED => 'FAILED', + self::IN_PROGRESS => 'IN_PROGRESS', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(TargetRenderState::class, \Google\Cloud\Deploy\V1\Release_TargetRender_TargetRenderState::class); + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/ReleaseNotificationEvent.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/ReleaseNotificationEvent.php new file mode 100644 index 000000000000..7a299e666d70 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/ReleaseNotificationEvent.php @@ -0,0 +1,137 @@ +google.cloud.deploy.v1.ReleaseNotificationEvent + */ +class ReleaseNotificationEvent extends \Google\Protobuf\Internal\Message +{ + /** + * Debug message for when a notification fails to send. + * + * Generated from protobuf field string message = 1; + */ + protected $message = ''; + /** + * The name of the `Release`. + * + * Generated from protobuf field string release = 2; + */ + protected $release = ''; + /** + * Type of this notification, e.g. for a Pub/Sub failure. + * + * Generated from protobuf field .google.cloud.deploy.v1.Type type = 3; + */ + protected $type = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $message + * Debug message for when a notification fails to send. + * @type string $release + * The name of the `Release`. + * @type int $type + * Type of this notification, e.g. for a Pub/Sub failure. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\ReleaseNotificationPayload::initOnce(); + parent::__construct($data); + } + + /** + * Debug message for when a notification fails to send. + * + * Generated from protobuf field string message = 1; + * @return string + */ + public function getMessage() + { + return $this->message; + } + + /** + * Debug message for when a notification fails to send. + * + * Generated from protobuf field string message = 1; + * @param string $var + * @return $this + */ + public function setMessage($var) + { + GPBUtil::checkString($var, True); + $this->message = $var; + + return $this; + } + + /** + * The name of the `Release`. + * + * Generated from protobuf field string release = 2; + * @return string + */ + public function getRelease() + { + return $this->release; + } + + /** + * The name of the `Release`. + * + * Generated from protobuf field string release = 2; + * @param string $var + * @return $this + */ + public function setRelease($var) + { + GPBUtil::checkString($var, True); + $this->release = $var; + + return $this; + } + + /** + * Type of this notification, e.g. for a Pub/Sub failure. + * + * Generated from protobuf field .google.cloud.deploy.v1.Type type = 3; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * Type of this notification, e.g. for a Pub/Sub failure. + * + * Generated from protobuf field .google.cloud.deploy.v1.Type type = 3; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Deploy\V1\Type::class); + $this->type = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/ReleaseRenderEvent.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/ReleaseRenderEvent.php new file mode 100644 index 000000000000..4add01825a29 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/ReleaseRenderEvent.php @@ -0,0 +1,106 @@ +google.cloud.deploy.v1.ReleaseRenderEvent + */ +class ReleaseRenderEvent extends \Google\Protobuf\Internal\Message +{ + /** + * Debug message for when a render transition occurs. Provides further + * details as rendering progresses through render states. + * + * Generated from protobuf field string message = 1; + */ + protected $message = ''; + /** + * The name of the `Release`. + * + * Generated from protobuf field string release = 2; + */ + protected $release = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $message + * Debug message for when a render transition occurs. Provides further + * details as rendering progresses through render states. + * @type string $release + * The name of the `Release`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\ReleaseRenderPayload::initOnce(); + parent::__construct($data); + } + + /** + * Debug message for when a render transition occurs. Provides further + * details as rendering progresses through render states. + * + * Generated from protobuf field string message = 1; + * @return string + */ + public function getMessage() + { + return $this->message; + } + + /** + * Debug message for when a render transition occurs. Provides further + * details as rendering progresses through render states. + * + * Generated from protobuf field string message = 1; + * @param string $var + * @return $this + */ + public function setMessage($var) + { + GPBUtil::checkString($var, True); + $this->message = $var; + + return $this; + } + + /** + * The name of the `Release`. + * + * Generated from protobuf field string release = 2; + * @return string + */ + public function getRelease() + { + return $this->release; + } + + /** + * The name of the `Release`. + * + * Generated from protobuf field string release = 2; + * @param string $var + * @return $this + */ + public function setRelease($var) + { + GPBUtil::checkString($var, True); + $this->release = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Release_ReleaseCondition.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Release_ReleaseCondition.php new file mode 100644 index 000000000000..0219b398cfe8 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Release_ReleaseCondition.php @@ -0,0 +1,16 @@ +google.cloud.deploy.v1.RenderMetadata + */ +class RenderMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. Metadata associated with rendering for Cloud Run. + * + * Generated from protobuf field .google.cloud.deploy.v1.CloudRunRenderMetadata cloud_run = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $cloud_run = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Deploy\V1\CloudRunRenderMetadata $cloud_run + * Output only. Metadata associated with rendering for Cloud Run. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * Output only. Metadata associated with rendering for Cloud Run. + * + * Generated from protobuf field .google.cloud.deploy.v1.CloudRunRenderMetadata cloud_run = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\Deploy\V1\CloudRunRenderMetadata|null + */ + public function getCloudRun() + { + return $this->cloud_run; + } + + public function hasCloudRun() + { + return isset($this->cloud_run); + } + + public function clearCloudRun() + { + unset($this->cloud_run); + } + + /** + * Output only. Metadata associated with rendering for Cloud Run. + * + * Generated from protobuf field .google.cloud.deploy.v1.CloudRunRenderMetadata cloud_run = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\Deploy\V1\CloudRunRenderMetadata $var + * @return $this + */ + public function setCloudRun($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Deploy\V1\CloudRunRenderMetadata::class); + $this->cloud_run = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/RetryJobRequest.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/RetryJobRequest.php new file mode 100644 index 000000000000..ee1db2272aab --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/RetryJobRequest.php @@ -0,0 +1,163 @@ +google.cloud.deploy.v1.RetryJobRequest + */ +class RetryJobRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the Rollout. Format is + * projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/ + * releases/{release}/rollouts/{rollout}. + * + * Generated from protobuf field string rollout = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $rollout = ''; + /** + * Required. The phase ID the Job to retry belongs to. + * + * Generated from protobuf field string phase_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $phase_id = ''; + /** + * Required. The job ID for the Job to retry. + * + * Generated from protobuf field string job_id = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $job_id = ''; + + /** + * @param string $rollout Required. Name of the Rollout. Format is + * projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/ + * releases/{release}/rollouts/{rollout}. Please see + * {@see CloudDeployClient::rolloutName()} for help formatting this field. + * @param string $phaseId Required. The phase ID the Job to retry belongs to. + * @param string $jobId Required. The job ID for the Job to retry. + * + * @return \Google\Cloud\Deploy\V1\RetryJobRequest + * + * @experimental + */ + public static function build(string $rollout, string $phaseId, string $jobId): self + { + return (new self()) + ->setRollout($rollout) + ->setPhaseId($phaseId) + ->setJobId($jobId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $rollout + * Required. Name of the Rollout. Format is + * projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/ + * releases/{release}/rollouts/{rollout}. + * @type string $phase_id + * Required. The phase ID the Job to retry belongs to. + * @type string $job_id + * Required. The job ID for the Job to retry. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the Rollout. Format is + * projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/ + * releases/{release}/rollouts/{rollout}. + * + * Generated from protobuf field string rollout = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getRollout() + { + return $this->rollout; + } + + /** + * Required. Name of the Rollout. Format is + * projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/ + * releases/{release}/rollouts/{rollout}. + * + * Generated from protobuf field string rollout = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setRollout($var) + { + GPBUtil::checkString($var, True); + $this->rollout = $var; + + return $this; + } + + /** + * Required. The phase ID the Job to retry belongs to. + * + * Generated from protobuf field string phase_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getPhaseId() + { + return $this->phase_id; + } + + /** + * Required. The phase ID the Job to retry belongs to. + * + * Generated from protobuf field string phase_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setPhaseId($var) + { + GPBUtil::checkString($var, True); + $this->phase_id = $var; + + return $this; + } + + /** + * Required. The job ID for the Job to retry. + * + * Generated from protobuf field string job_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getJobId() + { + return $this->job_id; + } + + /** + * Required. The job ID for the Job to retry. + * + * Generated from protobuf field string job_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setJobId($var) + { + GPBUtil::checkString($var, True); + $this->job_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/RetryJobResponse.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/RetryJobResponse.php new file mode 100644 index 000000000000..3058f4b1d9e7 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/RetryJobResponse.php @@ -0,0 +1,33 @@ +google.cloud.deploy.v1.RetryJobResponse + */ +class RetryJobResponse extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Rollout.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Rollout.php new file mode 100644 index 000000000000..a94a0f0e86b3 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Rollout.php @@ -0,0 +1,866 @@ +google.cloud.deploy.v1.Rollout + */ +class Rollout extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. Name of the `Rollout`. Format is projects/{project}/ + * locations/{location}/deliveryPipelines/{deliveryPipeline}/ + * releases/{release}/rollouts/[a-z][a-z0-9\-]{0,62}. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $name = ''; + /** + * Output only. Unique identifier of the `Rollout`. + * + * Generated from protobuf field string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $uid = ''; + /** + * Description of the `Rollout` for user purposes. Max length is 255 + * characters. + * + * Generated from protobuf field string description = 3; + */ + protected $description = ''; + /** + * User annotations. These attributes can only be set and used by the + * user, and not by Google Cloud Deploy. See + * https://google.aip.dev/128#annotations for more details such as format and + * size limitations. + * + * Generated from protobuf field map annotations = 4; + */ + private $annotations; + /** + * Labels are attributes that can be set and used by both the + * user and by Google Cloud Deploy. Labels must meet the following + * constraints: + * * Keys and values can contain only lowercase letters, numeric characters, + * underscores, and dashes. + * * All characters must use UTF-8 encoding, and international characters are + * allowed. + * * Keys must start with a lowercase letter or international character. + * * Each resource is limited to a maximum of 64 labels. + * Both keys and values are additionally constrained to be <= 128 bytes. + * + * Generated from protobuf field map labels = 5; + */ + private $labels; + /** + * Output only. Time at which the `Rollout` was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. Time at which the `Rollout` was approved. + * + * Generated from protobuf field .google.protobuf.Timestamp approve_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $approve_time = null; + /** + * Output only. Time at which the `Rollout` was enqueued. + * + * Generated from protobuf field .google.protobuf.Timestamp enqueue_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $enqueue_time = null; + /** + * Output only. Time at which the `Rollout` started deploying. + * + * Generated from protobuf field .google.protobuf.Timestamp deploy_start_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $deploy_start_time = null; + /** + * Output only. Time at which the `Rollout` finished deploying. + * + * Generated from protobuf field .google.protobuf.Timestamp deploy_end_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $deploy_end_time = null; + /** + * Required. The ID of Target to which this `Rollout` is deploying. + * + * Generated from protobuf field string target_id = 18 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $target_id = ''; + /** + * Output only. Approval state of the `Rollout`. + * + * Generated from protobuf field .google.cloud.deploy.v1.Rollout.ApprovalState approval_state = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $approval_state = 0; + /** + * Output only. Current state of the `Rollout`. + * + * Generated from protobuf field .google.cloud.deploy.v1.Rollout.State state = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Output only. Additional information about the rollout failure, if + * available. + * + * Generated from protobuf field string failure_reason = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $failure_reason = ''; + /** + * Output only. The resource name of the Cloud Build `Build` object that is + * used to deploy the Rollout. Format is + * `projects/{project}/locations/{location}/builds/{build}`. + * + * Generated from protobuf field string deploying_build = 17 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + */ + protected $deploying_build = ''; + /** + * This checksum is computed by the server based on the value of other + * fields, and may be sent on update and delete requests to ensure the + * client has an up-to-date value before proceeding. + * + * Generated from protobuf field string etag = 16; + */ + protected $etag = ''; + /** + * Output only. The reason this rollout failed. This will always be + * unspecified while the rollout is in progress. + * + * Generated from protobuf field .google.cloud.deploy.v1.Rollout.FailureCause deploy_failure_cause = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $deploy_failure_cause = 0; + /** + * Output only. The phases that represent the workflows of this `Rollout`. + * + * Generated from protobuf field repeated .google.cloud.deploy.v1.Phase phases = 23 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $phases; + /** + * Output only. Metadata contains information about the rollout. + * + * Generated from protobuf field .google.cloud.deploy.v1.Metadata metadata = 24 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $metadata = null; + /** + * Output only. Name of the `ControllerRollout`. Format is projects/{project}/ + * locations/{location}/deliveryPipelines/{deliveryPipeline}/ + * releases/{release}/rollouts/[a-z][a-z0-9\-]{0,62}. + * + * Generated from protobuf field string controller_rollout = 25 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $controller_rollout = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Optional. Name of the `Rollout`. Format is projects/{project}/ + * locations/{location}/deliveryPipelines/{deliveryPipeline}/ + * releases/{release}/rollouts/[a-z][a-z0-9\-]{0,62}. + * @type string $uid + * Output only. Unique identifier of the `Rollout`. + * @type string $description + * Description of the `Rollout` for user purposes. Max length is 255 + * characters. + * @type array|\Google\Protobuf\Internal\MapField $annotations + * User annotations. These attributes can only be set and used by the + * user, and not by Google Cloud Deploy. See + * https://google.aip.dev/128#annotations for more details such as format and + * size limitations. + * @type array|\Google\Protobuf\Internal\MapField $labels + * Labels are attributes that can be set and used by both the + * user and by Google Cloud Deploy. Labels must meet the following + * constraints: + * * Keys and values can contain only lowercase letters, numeric characters, + * underscores, and dashes. + * * All characters must use UTF-8 encoding, and international characters are + * allowed. + * * Keys must start with a lowercase letter or international character. + * * Each resource is limited to a maximum of 64 labels. + * Both keys and values are additionally constrained to be <= 128 bytes. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. Time at which the `Rollout` was created. + * @type \Google\Protobuf\Timestamp $approve_time + * Output only. Time at which the `Rollout` was approved. + * @type \Google\Protobuf\Timestamp $enqueue_time + * Output only. Time at which the `Rollout` was enqueued. + * @type \Google\Protobuf\Timestamp $deploy_start_time + * Output only. Time at which the `Rollout` started deploying. + * @type \Google\Protobuf\Timestamp $deploy_end_time + * Output only. Time at which the `Rollout` finished deploying. + * @type string $target_id + * Required. The ID of Target to which this `Rollout` is deploying. + * @type int $approval_state + * Output only. Approval state of the `Rollout`. + * @type int $state + * Output only. Current state of the `Rollout`. + * @type string $failure_reason + * Output only. Additional information about the rollout failure, if + * available. + * @type string $deploying_build + * Output only. The resource name of the Cloud Build `Build` object that is + * used to deploy the Rollout. Format is + * `projects/{project}/locations/{location}/builds/{build}`. + * @type string $etag + * This checksum is computed by the server based on the value of other + * fields, and may be sent on update and delete requests to ensure the + * client has an up-to-date value before proceeding. + * @type int $deploy_failure_cause + * Output only. The reason this rollout failed. This will always be + * unspecified while the rollout is in progress. + * @type array<\Google\Cloud\Deploy\V1\Phase>|\Google\Protobuf\Internal\RepeatedField $phases + * Output only. The phases that represent the workflows of this `Rollout`. + * @type \Google\Cloud\Deploy\V1\Metadata $metadata + * Output only. Metadata contains information about the rollout. + * @type string $controller_rollout + * Output only. Name of the `ControllerRollout`. Format is projects/{project}/ + * locations/{location}/deliveryPipelines/{deliveryPipeline}/ + * releases/{release}/rollouts/[a-z][a-z0-9\-]{0,62}. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * Optional. Name of the `Rollout`. Format is projects/{project}/ + * locations/{location}/deliveryPipelines/{deliveryPipeline}/ + * releases/{release}/rollouts/[a-z][a-z0-9\-]{0,62}. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Optional. Name of the `Rollout`. Format is projects/{project}/ + * locations/{location}/deliveryPipelines/{deliveryPipeline}/ + * releases/{release}/rollouts/[a-z][a-z0-9\-]{0,62}. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. Unique identifier of the `Rollout`. + * + * Generated from protobuf field string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getUid() + { + return $this->uid; + } + + /** + * Output only. Unique identifier of the `Rollout`. + * + * Generated from protobuf field string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setUid($var) + { + GPBUtil::checkString($var, True); + $this->uid = $var; + + return $this; + } + + /** + * Description of the `Rollout` for user purposes. Max length is 255 + * characters. + * + * Generated from protobuf field string description = 3; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Description of the `Rollout` for user purposes. Max length is 255 + * characters. + * + * Generated from protobuf field string description = 3; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * User annotations. These attributes can only be set and used by the + * user, and not by Google Cloud Deploy. See + * https://google.aip.dev/128#annotations for more details such as format and + * size limitations. + * + * Generated from protobuf field map annotations = 4; + * @return \Google\Protobuf\Internal\MapField + */ + public function getAnnotations() + { + return $this->annotations; + } + + /** + * User annotations. These attributes can only be set and used by the + * user, and not by Google Cloud Deploy. See + * https://google.aip.dev/128#annotations for more details such as format and + * size limitations. + * + * Generated from protobuf field map annotations = 4; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setAnnotations($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->annotations = $arr; + + return $this; + } + + /** + * Labels are attributes that can be set and used by both the + * user and by Google Cloud Deploy. Labels must meet the following + * constraints: + * * Keys and values can contain only lowercase letters, numeric characters, + * underscores, and dashes. + * * All characters must use UTF-8 encoding, and international characters are + * allowed. + * * Keys must start with a lowercase letter or international character. + * * Each resource is limited to a maximum of 64 labels. + * Both keys and values are additionally constrained to be <= 128 bytes. + * + * Generated from protobuf field map labels = 5; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * Labels are attributes that can be set and used by both the + * user and by Google Cloud Deploy. Labels must meet the following + * constraints: + * * Keys and values can contain only lowercase letters, numeric characters, + * underscores, and dashes. + * * All characters must use UTF-8 encoding, and international characters are + * allowed. + * * Keys must start with a lowercase letter or international character. + * * Each resource is limited to a maximum of 64 labels. + * Both keys and values are additionally constrained to be <= 128 bytes. + * + * Generated from protobuf field map labels = 5; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + + /** + * Output only. Time at which the `Rollout` was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 6 [(.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. Time at which the `Rollout` was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 6 [(.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. Time at which the `Rollout` was approved. + * + * Generated from protobuf field .google.protobuf.Timestamp approve_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getApproveTime() + { + return $this->approve_time; + } + + public function hasApproveTime() + { + return isset($this->approve_time); + } + + public function clearApproveTime() + { + unset($this->approve_time); + } + + /** + * Output only. Time at which the `Rollout` was approved. + * + * Generated from protobuf field .google.protobuf.Timestamp approve_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setApproveTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->approve_time = $var; + + return $this; + } + + /** + * Output only. Time at which the `Rollout` was enqueued. + * + * Generated from protobuf field .google.protobuf.Timestamp enqueue_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getEnqueueTime() + { + return $this->enqueue_time; + } + + public function hasEnqueueTime() + { + return isset($this->enqueue_time); + } + + public function clearEnqueueTime() + { + unset($this->enqueue_time); + } + + /** + * Output only. Time at which the `Rollout` was enqueued. + * + * Generated from protobuf field .google.protobuf.Timestamp enqueue_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setEnqueueTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->enqueue_time = $var; + + return $this; + } + + /** + * Output only. Time at which the `Rollout` started deploying. + * + * Generated from protobuf field .google.protobuf.Timestamp deploy_start_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getDeployStartTime() + { + return $this->deploy_start_time; + } + + public function hasDeployStartTime() + { + return isset($this->deploy_start_time); + } + + public function clearDeployStartTime() + { + unset($this->deploy_start_time); + } + + /** + * Output only. Time at which the `Rollout` started deploying. + * + * Generated from protobuf field .google.protobuf.Timestamp deploy_start_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setDeployStartTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->deploy_start_time = $var; + + return $this; + } + + /** + * Output only. Time at which the `Rollout` finished deploying. + * + * Generated from protobuf field .google.protobuf.Timestamp deploy_end_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getDeployEndTime() + { + return $this->deploy_end_time; + } + + public function hasDeployEndTime() + { + return isset($this->deploy_end_time); + } + + public function clearDeployEndTime() + { + unset($this->deploy_end_time); + } + + /** + * Output only. Time at which the `Rollout` finished deploying. + * + * Generated from protobuf field .google.protobuf.Timestamp deploy_end_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setDeployEndTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->deploy_end_time = $var; + + return $this; + } + + /** + * Required. The ID of Target to which this `Rollout` is deploying. + * + * Generated from protobuf field string target_id = 18 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getTargetId() + { + return $this->target_id; + } + + /** + * Required. The ID of Target to which this `Rollout` is deploying. + * + * Generated from protobuf field string target_id = 18 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setTargetId($var) + { + GPBUtil::checkString($var, True); + $this->target_id = $var; + + return $this; + } + + /** + * Output only. Approval state of the `Rollout`. + * + * Generated from protobuf field .google.cloud.deploy.v1.Rollout.ApprovalState approval_state = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getApprovalState() + { + return $this->approval_state; + } + + /** + * Output only. Approval state of the `Rollout`. + * + * Generated from protobuf field .google.cloud.deploy.v1.Rollout.ApprovalState approval_state = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setApprovalState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Deploy\V1\Rollout\ApprovalState::class); + $this->approval_state = $var; + + return $this; + } + + /** + * Output only. Current state of the `Rollout`. + * + * Generated from protobuf field .google.cloud.deploy.v1.Rollout.State state = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. Current state of the `Rollout`. + * + * Generated from protobuf field .google.cloud.deploy.v1.Rollout.State state = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Deploy\V1\Rollout\State::class); + $this->state = $var; + + return $this; + } + + /** + * Output only. Additional information about the rollout failure, if + * available. + * + * Generated from protobuf field string failure_reason = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getFailureReason() + { + return $this->failure_reason; + } + + /** + * Output only. Additional information about the rollout failure, if + * available. + * + * Generated from protobuf field string failure_reason = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setFailureReason($var) + { + GPBUtil::checkString($var, True); + $this->failure_reason = $var; + + return $this; + } + + /** + * Output only. The resource name of the Cloud Build `Build` object that is + * used to deploy the Rollout. Format is + * `projects/{project}/locations/{location}/builds/{build}`. + * + * Generated from protobuf field string deploying_build = 17 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + * @return string + */ + public function getDeployingBuild() + { + return $this->deploying_build; + } + + /** + * Output only. The resource name of the Cloud Build `Build` object that is + * used to deploy the Rollout. Format is + * `projects/{project}/locations/{location}/builds/{build}`. + * + * Generated from protobuf field string deploying_build = 17 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setDeployingBuild($var) + { + GPBUtil::checkString($var, True); + $this->deploying_build = $var; + + return $this; + } + + /** + * This checksum is computed by the server based on the value of other + * fields, and may be sent on update and delete requests to ensure the + * client has an up-to-date value before proceeding. + * + * Generated from protobuf field string etag = 16; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * This checksum is computed by the server based on the value of other + * fields, and may be sent on update and delete requests to ensure the + * client has an up-to-date value before proceeding. + * + * Generated from protobuf field string etag = 16; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, True); + $this->etag = $var; + + return $this; + } + + /** + * Output only. The reason this rollout failed. This will always be + * unspecified while the rollout is in progress. + * + * Generated from protobuf field .google.cloud.deploy.v1.Rollout.FailureCause deploy_failure_cause = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getDeployFailureCause() + { + return $this->deploy_failure_cause; + } + + /** + * Output only. The reason this rollout failed. This will always be + * unspecified while the rollout is in progress. + * + * Generated from protobuf field .google.cloud.deploy.v1.Rollout.FailureCause deploy_failure_cause = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setDeployFailureCause($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Deploy\V1\Rollout\FailureCause::class); + $this->deploy_failure_cause = $var; + + return $this; + } + + /** + * Output only. The phases that represent the workflows of this `Rollout`. + * + * Generated from protobuf field repeated .google.cloud.deploy.v1.Phase phases = 23 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getPhases() + { + return $this->phases; + } + + /** + * Output only. The phases that represent the workflows of this `Rollout`. + * + * Generated from protobuf field repeated .google.cloud.deploy.v1.Phase phases = 23 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array<\Google\Cloud\Deploy\V1\Phase>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setPhases($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Deploy\V1\Phase::class); + $this->phases = $arr; + + return $this; + } + + /** + * Output only. Metadata contains information about the rollout. + * + * Generated from protobuf field .google.cloud.deploy.v1.Metadata metadata = 24 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\Deploy\V1\Metadata|null + */ + public function getMetadata() + { + return $this->metadata; + } + + public function hasMetadata() + { + return isset($this->metadata); + } + + public function clearMetadata() + { + unset($this->metadata); + } + + /** + * Output only. Metadata contains information about the rollout. + * + * Generated from protobuf field .google.cloud.deploy.v1.Metadata metadata = 24 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\Deploy\V1\Metadata $var + * @return $this + */ + public function setMetadata($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Deploy\V1\Metadata::class); + $this->metadata = $var; + + return $this; + } + + /** + * Output only. Name of the `ControllerRollout`. Format is projects/{project}/ + * locations/{location}/deliveryPipelines/{deliveryPipeline}/ + * releases/{release}/rollouts/[a-z][a-z0-9\-]{0,62}. + * + * Generated from protobuf field string controller_rollout = 25 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getControllerRollout() + { + return $this->controller_rollout; + } + + /** + * Output only. Name of the `ControllerRollout`. Format is projects/{project}/ + * locations/{location}/deliveryPipelines/{deliveryPipeline}/ + * releases/{release}/rollouts/[a-z][a-z0-9\-]{0,62}. + * + * Generated from protobuf field string controller_rollout = 25 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setControllerRollout($var) + { + GPBUtil::checkString($var, True); + $this->controller_rollout = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Rollout/ApprovalState.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Rollout/ApprovalState.php new file mode 100644 index 000000000000..c0fb8336f4e8 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Rollout/ApprovalState.php @@ -0,0 +1,78 @@ +google.cloud.deploy.v1.Rollout.ApprovalState + */ +class ApprovalState +{ + /** + * The `Rollout` has an unspecified approval state. + * + * Generated from protobuf enum APPROVAL_STATE_UNSPECIFIED = 0; + */ + const APPROVAL_STATE_UNSPECIFIED = 0; + /** + * The `Rollout` requires approval. + * + * Generated from protobuf enum NEEDS_APPROVAL = 1; + */ + const NEEDS_APPROVAL = 1; + /** + * The `Rollout` does not require approval. + * + * Generated from protobuf enum DOES_NOT_NEED_APPROVAL = 2; + */ + const DOES_NOT_NEED_APPROVAL = 2; + /** + * The `Rollout` has been approved. + * + * Generated from protobuf enum APPROVED = 3; + */ + const APPROVED = 3; + /** + * The `Rollout` has been rejected. + * + * Generated from protobuf enum REJECTED = 4; + */ + const REJECTED = 4; + + private static $valueToName = [ + self::APPROVAL_STATE_UNSPECIFIED => 'APPROVAL_STATE_UNSPECIFIED', + self::NEEDS_APPROVAL => 'NEEDS_APPROVAL', + self::DOES_NOT_NEED_APPROVAL => 'DOES_NOT_NEED_APPROVAL', + self::APPROVED => 'APPROVED', + self::REJECTED => 'REJECTED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ApprovalState::class, \Google\Cloud\Deploy\V1\Rollout_ApprovalState::class); + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Rollout/FailureCause.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Rollout/FailureCause.php new file mode 100644 index 000000000000..77bd8fee0694 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Rollout/FailureCause.php @@ -0,0 +1,103 @@ +google.cloud.deploy.v1.Rollout.FailureCause + */ +class FailureCause +{ + /** + * No reason for failure is specified. + * + * Generated from protobuf enum FAILURE_CAUSE_UNSPECIFIED = 0; + */ + const FAILURE_CAUSE_UNSPECIFIED = 0; + /** + * Cloud Build is not available, either because it is not enabled or because + * Cloud Deploy has insufficient permissions. See [required + * permission](/deploy/docs/cloud-deploy-service-account#required_permissions). + * + * Generated from protobuf enum CLOUD_BUILD_UNAVAILABLE = 1; + */ + const CLOUD_BUILD_UNAVAILABLE = 1; + /** + * The deploy operation did not complete successfully; check Cloud Build + * logs. + * + * Generated from protobuf enum EXECUTION_FAILED = 2; + */ + const EXECUTION_FAILED = 2; + /** + * Deployment did not complete within the alloted time. + * + * Generated from protobuf enum DEADLINE_EXCEEDED = 3; + */ + const DEADLINE_EXCEEDED = 3; + /** + * Release is in a failed state. + * + * Generated from protobuf enum RELEASE_FAILED = 4; + */ + const RELEASE_FAILED = 4; + /** + * Release is abandoned. + * + * Generated from protobuf enum RELEASE_ABANDONED = 5; + */ + const RELEASE_ABANDONED = 5; + /** + * No skaffold verify configuration was found. + * + * Generated from protobuf enum VERIFICATION_CONFIG_NOT_FOUND = 6; + */ + const VERIFICATION_CONFIG_NOT_FOUND = 6; + /** + * Cloud Build failed to fulfill Google Cloud Deploy's request. See + * failure_message for additional details. + * + * Generated from protobuf enum CLOUD_BUILD_REQUEST_FAILED = 7; + */ + const CLOUD_BUILD_REQUEST_FAILED = 7; + + private static $valueToName = [ + self::FAILURE_CAUSE_UNSPECIFIED => 'FAILURE_CAUSE_UNSPECIFIED', + self::CLOUD_BUILD_UNAVAILABLE => 'CLOUD_BUILD_UNAVAILABLE', + self::EXECUTION_FAILED => 'EXECUTION_FAILED', + self::DEADLINE_EXCEEDED => 'DEADLINE_EXCEEDED', + self::RELEASE_FAILED => 'RELEASE_FAILED', + self::RELEASE_ABANDONED => 'RELEASE_ABANDONED', + self::VERIFICATION_CONFIG_NOT_FOUND => 'VERIFICATION_CONFIG_NOT_FOUND', + self::CLOUD_BUILD_REQUEST_FAILED => 'CLOUD_BUILD_REQUEST_FAILED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(FailureCause::class, \Google\Cloud\Deploy\V1\Rollout_FailureCause::class); + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Rollout/State.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Rollout/State.php new file mode 100644 index 000000000000..d92e91477504 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Rollout/State.php @@ -0,0 +1,121 @@ +google.cloud.deploy.v1.Rollout.State + */ +class State +{ + /** + * The `Rollout` has an unspecified state. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The `Rollout` has completed successfully. + * + * Generated from protobuf enum SUCCEEDED = 1; + */ + const SUCCEEDED = 1; + /** + * The `Rollout` has failed. + * + * Generated from protobuf enum FAILED = 2; + */ + const FAILED = 2; + /** + * The `Rollout` is being deployed. + * + * Generated from protobuf enum IN_PROGRESS = 3; + */ + const IN_PROGRESS = 3; + /** + * The `Rollout` needs approval. + * + * Generated from protobuf enum PENDING_APPROVAL = 4; + */ + const PENDING_APPROVAL = 4; + /** + * An approver rejected the `Rollout`. + * + * Generated from protobuf enum APPROVAL_REJECTED = 5; + */ + const APPROVAL_REJECTED = 5; + /** + * The `Rollout` is waiting for an earlier Rollout(s) to complete on this + * `Target`. + * + * Generated from protobuf enum PENDING = 6; + */ + const PENDING = 6; + /** + * The `Rollout` is waiting for the `Release` to be fully rendered. + * + * Generated from protobuf enum PENDING_RELEASE = 7; + */ + const PENDING_RELEASE = 7; + /** + * The `Rollout` is in the process of being cancelled. + * + * Generated from protobuf enum CANCELLING = 8; + */ + const CANCELLING = 8; + /** + * The `Rollout` has been cancelled. + * + * Generated from protobuf enum CANCELLED = 9; + */ + const CANCELLED = 9; + /** + * The `Rollout` is halted. + * + * Generated from protobuf enum HALTED = 10; + */ + const HALTED = 10; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::SUCCEEDED => 'SUCCEEDED', + self::FAILED => 'FAILED', + self::IN_PROGRESS => 'IN_PROGRESS', + self::PENDING_APPROVAL => 'PENDING_APPROVAL', + self::APPROVAL_REJECTED => 'APPROVAL_REJECTED', + self::PENDING => 'PENDING', + self::PENDING_RELEASE => 'PENDING_RELEASE', + self::CANCELLING => 'CANCELLING', + self::CANCELLED => 'CANCELLED', + self::HALTED => 'HALTED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\Deploy\V1\Rollout_State::class); + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/RolloutNotificationEvent.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/RolloutNotificationEvent.php new file mode 100644 index 000000000000..bea716943e4c --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/RolloutNotificationEvent.php @@ -0,0 +1,239 @@ +google.cloud.deploy.v1.RolloutNotificationEvent + */ +class RolloutNotificationEvent extends \Google\Protobuf\Internal\Message +{ + /** + * Debug message for when a notification fails to send. + * + * Generated from protobuf field string message = 1; + */ + protected $message = ''; + /** + * Unique identifier of the `DeliveryPipeline`. + * + * Generated from protobuf field string pipeline_uid = 2; + */ + protected $pipeline_uid = ''; + /** + * Unique identifier of the `Release`. + * + * Generated from protobuf field string release_uid = 3; + */ + protected $release_uid = ''; + /** + * The name of the `Rollout`. + * + * Generated from protobuf field string rollout = 4; + */ + protected $rollout = ''; + /** + * Type of this notification, e.g. for a Pub/Sub failure. + * + * Generated from protobuf field .google.cloud.deploy.v1.Type type = 5; + */ + protected $type = 0; + /** + * ID of the `Target` that the rollout is deployed to. + * + * Generated from protobuf field string target_id = 6; + */ + protected $target_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $message + * Debug message for when a notification fails to send. + * @type string $pipeline_uid + * Unique identifier of the `DeliveryPipeline`. + * @type string $release_uid + * Unique identifier of the `Release`. + * @type string $rollout + * The name of the `Rollout`. + * @type int $type + * Type of this notification, e.g. for a Pub/Sub failure. + * @type string $target_id + * ID of the `Target` that the rollout is deployed to. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\RolloutNotificationPayload::initOnce(); + parent::__construct($data); + } + + /** + * Debug message for when a notification fails to send. + * + * Generated from protobuf field string message = 1; + * @return string + */ + public function getMessage() + { + return $this->message; + } + + /** + * Debug message for when a notification fails to send. + * + * Generated from protobuf field string message = 1; + * @param string $var + * @return $this + */ + public function setMessage($var) + { + GPBUtil::checkString($var, True); + $this->message = $var; + + return $this; + } + + /** + * Unique identifier of the `DeliveryPipeline`. + * + * Generated from protobuf field string pipeline_uid = 2; + * @return string + */ + public function getPipelineUid() + { + return $this->pipeline_uid; + } + + /** + * Unique identifier of the `DeliveryPipeline`. + * + * Generated from protobuf field string pipeline_uid = 2; + * @param string $var + * @return $this + */ + public function setPipelineUid($var) + { + GPBUtil::checkString($var, True); + $this->pipeline_uid = $var; + + return $this; + } + + /** + * Unique identifier of the `Release`. + * + * Generated from protobuf field string release_uid = 3; + * @return string + */ + public function getReleaseUid() + { + return $this->release_uid; + } + + /** + * Unique identifier of the `Release`. + * + * Generated from protobuf field string release_uid = 3; + * @param string $var + * @return $this + */ + public function setReleaseUid($var) + { + GPBUtil::checkString($var, True); + $this->release_uid = $var; + + return $this; + } + + /** + * The name of the `Rollout`. + * + * Generated from protobuf field string rollout = 4; + * @return string + */ + public function getRollout() + { + return $this->rollout; + } + + /** + * The name of the `Rollout`. + * + * Generated from protobuf field string rollout = 4; + * @param string $var + * @return $this + */ + public function setRollout($var) + { + GPBUtil::checkString($var, True); + $this->rollout = $var; + + return $this; + } + + /** + * Type of this notification, e.g. for a Pub/Sub failure. + * + * Generated from protobuf field .google.cloud.deploy.v1.Type type = 5; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * Type of this notification, e.g. for a Pub/Sub failure. + * + * Generated from protobuf field .google.cloud.deploy.v1.Type type = 5; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Deploy\V1\Type::class); + $this->type = $var; + + return $this; + } + + /** + * ID of the `Target` that the rollout is deployed to. + * + * Generated from protobuf field string target_id = 6; + * @return string + */ + public function getTargetId() + { + return $this->target_id; + } + + /** + * ID of the `Target` that the rollout is deployed to. + * + * Generated from protobuf field string target_id = 6; + * @param string $var + * @return $this + */ + public function setTargetId($var) + { + GPBUtil::checkString($var, True); + $this->target_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Rollout_ApprovalState.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Rollout_ApprovalState.php new file mode 100644 index 000000000000..7d7474584780 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Rollout_ApprovalState.php @@ -0,0 +1,16 @@ +google.cloud.deploy.v1.RuntimeConfig + */ +class RuntimeConfig extends \Google\Protobuf\Internal\Message +{ + protected $runtime_config; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Deploy\V1\KubernetesConfig $kubernetes + * Kubernetes runtime configuration. + * @type \Google\Cloud\Deploy\V1\CloudRunConfig $cloud_run + * Cloud Run runtime configuration. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * Kubernetes runtime configuration. + * + * Generated from protobuf field .google.cloud.deploy.v1.KubernetesConfig kubernetes = 1; + * @return \Google\Cloud\Deploy\V1\KubernetesConfig|null + */ + public function getKubernetes() + { + return $this->readOneof(1); + } + + public function hasKubernetes() + { + return $this->hasOneof(1); + } + + /** + * Kubernetes runtime configuration. + * + * Generated from protobuf field .google.cloud.deploy.v1.KubernetesConfig kubernetes = 1; + * @param \Google\Cloud\Deploy\V1\KubernetesConfig $var + * @return $this + */ + public function setKubernetes($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Deploy\V1\KubernetesConfig::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * Cloud Run runtime configuration. + * + * Generated from protobuf field .google.cloud.deploy.v1.CloudRunConfig cloud_run = 2; + * @return \Google\Cloud\Deploy\V1\CloudRunConfig|null + */ + public function getCloudRun() + { + return $this->readOneof(2); + } + + public function hasCloudRun() + { + return $this->hasOneof(2); + } + + /** + * Cloud Run runtime configuration. + * + * Generated from protobuf field .google.cloud.deploy.v1.CloudRunConfig cloud_run = 2; + * @param \Google\Cloud\Deploy\V1\CloudRunConfig $var + * @return $this + */ + public function setCloudRun($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Deploy\V1\CloudRunConfig::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * @return string + */ + public function getRuntimeConfig() + { + return $this->whichOneof("runtime_config"); + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/SerialPipeline.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/SerialPipeline.php new file mode 100644 index 000000000000..df68b2ffa1d9 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/SerialPipeline.php @@ -0,0 +1,71 @@ +google.cloud.deploy.v1.SerialPipeline + */ +class SerialPipeline extends \Google\Protobuf\Internal\Message +{ + /** + * Each stage specifies configuration for a `Target`. The ordering + * of this list defines the promotion flow. + * + * Generated from protobuf field repeated .google.cloud.deploy.v1.Stage stages = 1; + */ + private $stages; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Deploy\V1\Stage>|\Google\Protobuf\Internal\RepeatedField $stages + * Each stage specifies configuration for a `Target`. The ordering + * of this list defines the promotion flow. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * Each stage specifies configuration for a `Target`. The ordering + * of this list defines the promotion flow. + * + * Generated from protobuf field repeated .google.cloud.deploy.v1.Stage stages = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getStages() + { + return $this->stages; + } + + /** + * Each stage specifies configuration for a `Target`. The ordering + * of this list defines the promotion flow. + * + * Generated from protobuf field repeated .google.cloud.deploy.v1.Stage stages = 1; + * @param array<\Google\Cloud\Deploy\V1\Stage>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setStages($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Deploy\V1\Stage::class); + $this->stages = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/SkaffoldSupportState.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/SkaffoldSupportState.php new file mode 100644 index 000000000000..dcc57086c6cd --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/SkaffoldSupportState.php @@ -0,0 +1,68 @@ +google.cloud.deploy.v1.SkaffoldSupportState + */ +class SkaffoldSupportState +{ + /** + * Default value. This value is unused. + * + * Generated from protobuf enum SKAFFOLD_SUPPORT_STATE_UNSPECIFIED = 0; + */ + const SKAFFOLD_SUPPORT_STATE_UNSPECIFIED = 0; + /** + * This skaffold version is currently supported. + * + * Generated from protobuf enum SKAFFOLD_SUPPORT_STATE_SUPPORTED = 1; + */ + const SKAFFOLD_SUPPORT_STATE_SUPPORTED = 1; + /** + * This skaffold version is in maintenance mode. + * + * Generated from protobuf enum SKAFFOLD_SUPPORT_STATE_MAINTENANCE_MODE = 2; + */ + const SKAFFOLD_SUPPORT_STATE_MAINTENANCE_MODE = 2; + /** + * This skaffold version is no longer supported. + * + * Generated from protobuf enum SKAFFOLD_SUPPORT_STATE_UNSUPPORTED = 3; + */ + const SKAFFOLD_SUPPORT_STATE_UNSUPPORTED = 3; + + private static $valueToName = [ + self::SKAFFOLD_SUPPORT_STATE_UNSPECIFIED => 'SKAFFOLD_SUPPORT_STATE_UNSPECIFIED', + self::SKAFFOLD_SUPPORT_STATE_SUPPORTED => 'SKAFFOLD_SUPPORT_STATE_SUPPORTED', + self::SKAFFOLD_SUPPORT_STATE_MAINTENANCE_MODE => 'SKAFFOLD_SUPPORT_STATE_MAINTENANCE_MODE', + self::SKAFFOLD_SUPPORT_STATE_UNSUPPORTED => 'SKAFFOLD_SUPPORT_STATE_UNSUPPORTED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/SkaffoldVersion.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/SkaffoldVersion.php new file mode 100644 index 000000000000..99cf896c1e45 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/SkaffoldVersion.php @@ -0,0 +1,199 @@ +google.cloud.deploy.v1.SkaffoldVersion + */ +class SkaffoldVersion extends \Google\Protobuf\Internal\Message +{ + /** + * Release version number. For example, "1.20.3". + * + * Generated from protobuf field string version = 1; + */ + protected $version = ''; + /** + * The time at which this version of skaffold will enter maintenance mode. + * + * Generated from protobuf field .google.protobuf.Timestamp maintenance_mode_time = 3; + */ + protected $maintenance_mode_time = null; + /** + * The time at which this version of skaffold will no longer be supported. + * + * Generated from protobuf field .google.protobuf.Timestamp support_expiration_time = 4; + */ + protected $support_expiration_time = null; + /** + * Date when this version is expected to no longer be supported. + * + * Generated from protobuf field .google.type.Date support_end_date = 2; + */ + protected $support_end_date = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $version + * Release version number. For example, "1.20.3". + * @type \Google\Protobuf\Timestamp $maintenance_mode_time + * The time at which this version of skaffold will enter maintenance mode. + * @type \Google\Protobuf\Timestamp $support_expiration_time + * The time at which this version of skaffold will no longer be supported. + * @type \Google\Type\Date $support_end_date + * Date when this version is expected to no longer be supported. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * Release version number. For example, "1.20.3". + * + * Generated from protobuf field string version = 1; + * @return string + */ + public function getVersion() + { + return $this->version; + } + + /** + * Release version number. For example, "1.20.3". + * + * Generated from protobuf field string version = 1; + * @param string $var + * @return $this + */ + public function setVersion($var) + { + GPBUtil::checkString($var, True); + $this->version = $var; + + return $this; + } + + /** + * The time at which this version of skaffold will enter maintenance mode. + * + * Generated from protobuf field .google.protobuf.Timestamp maintenance_mode_time = 3; + * @return \Google\Protobuf\Timestamp|null + */ + public function getMaintenanceModeTime() + { + return $this->maintenance_mode_time; + } + + public function hasMaintenanceModeTime() + { + return isset($this->maintenance_mode_time); + } + + public function clearMaintenanceModeTime() + { + unset($this->maintenance_mode_time); + } + + /** + * The time at which this version of skaffold will enter maintenance mode. + * + * Generated from protobuf field .google.protobuf.Timestamp maintenance_mode_time = 3; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setMaintenanceModeTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->maintenance_mode_time = $var; + + return $this; + } + + /** + * The time at which this version of skaffold will no longer be supported. + * + * Generated from protobuf field .google.protobuf.Timestamp support_expiration_time = 4; + * @return \Google\Protobuf\Timestamp|null + */ + public function getSupportExpirationTime() + { + return $this->support_expiration_time; + } + + public function hasSupportExpirationTime() + { + return isset($this->support_expiration_time); + } + + public function clearSupportExpirationTime() + { + unset($this->support_expiration_time); + } + + /** + * The time at which this version of skaffold will no longer be supported. + * + * Generated from protobuf field .google.protobuf.Timestamp support_expiration_time = 4; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setSupportExpirationTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->support_expiration_time = $var; + + return $this; + } + + /** + * Date when this version is expected to no longer be supported. + * + * Generated from protobuf field .google.type.Date support_end_date = 2; + * @return \Google\Type\Date|null + */ + public function getSupportEndDate() + { + return $this->support_end_date; + } + + public function hasSupportEndDate() + { + return isset($this->support_end_date); + } + + public function clearSupportEndDate() + { + unset($this->support_end_date); + } + + /** + * Date when this version is expected to no longer be supported. + * + * Generated from protobuf field .google.type.Date support_end_date = 2; + * @param \Google\Type\Date $var + * @return $this + */ + public function setSupportEndDate($var) + { + GPBUtil::checkMessage($var, \Google\Type\Date::class); + $this->support_end_date = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Stage.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Stage.php new file mode 100644 index 000000000000..debad7f632f9 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Stage.php @@ -0,0 +1,169 @@ +google.cloud.deploy.v1.Stage + */ +class Stage extends \Google\Protobuf\Internal\Message +{ + /** + * The target_id to which this stage points. This field refers exclusively to + * the last segment of a target name. For example, this field would just be + * `my-target` (rather than + * `projects/project/locations/location/targets/my-target`). The location of + * the `Target` is inferred to be the same as the location of the + * `DeliveryPipeline` that contains this `Stage`. + * + * Generated from protobuf field string target_id = 1; + */ + protected $target_id = ''; + /** + * Skaffold profiles to use when rendering the manifest for this stage's + * `Target`. + * + * Generated from protobuf field repeated string profiles = 2; + */ + private $profiles; + /** + * Optional. The strategy to use for a `Rollout` to this stage. + * + * Generated from protobuf field .google.cloud.deploy.v1.Strategy strategy = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $strategy = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $target_id + * The target_id to which this stage points. This field refers exclusively to + * the last segment of a target name. For example, this field would just be + * `my-target` (rather than + * `projects/project/locations/location/targets/my-target`). The location of + * the `Target` is inferred to be the same as the location of the + * `DeliveryPipeline` that contains this `Stage`. + * @type array|\Google\Protobuf\Internal\RepeatedField $profiles + * Skaffold profiles to use when rendering the manifest for this stage's + * `Target`. + * @type \Google\Cloud\Deploy\V1\Strategy $strategy + * Optional. The strategy to use for a `Rollout` to this stage. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * The target_id to which this stage points. This field refers exclusively to + * the last segment of a target name. For example, this field would just be + * `my-target` (rather than + * `projects/project/locations/location/targets/my-target`). The location of + * the `Target` is inferred to be the same as the location of the + * `DeliveryPipeline` that contains this `Stage`. + * + * Generated from protobuf field string target_id = 1; + * @return string + */ + public function getTargetId() + { + return $this->target_id; + } + + /** + * The target_id to which this stage points. This field refers exclusively to + * the last segment of a target name. For example, this field would just be + * `my-target` (rather than + * `projects/project/locations/location/targets/my-target`). The location of + * the `Target` is inferred to be the same as the location of the + * `DeliveryPipeline` that contains this `Stage`. + * + * Generated from protobuf field string target_id = 1; + * @param string $var + * @return $this + */ + public function setTargetId($var) + { + GPBUtil::checkString($var, True); + $this->target_id = $var; + + return $this; + } + + /** + * Skaffold profiles to use when rendering the manifest for this stage's + * `Target`. + * + * Generated from protobuf field repeated string profiles = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getProfiles() + { + return $this->profiles; + } + + /** + * Skaffold profiles to use when rendering the manifest for this stage's + * `Target`. + * + * Generated from protobuf field repeated string profiles = 2; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setProfiles($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->profiles = $arr; + + return $this; + } + + /** + * Optional. The strategy to use for a `Rollout` to this stage. + * + * Generated from protobuf field .google.cloud.deploy.v1.Strategy strategy = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\Deploy\V1\Strategy|null + */ + public function getStrategy() + { + return $this->strategy; + } + + public function hasStrategy() + { + return isset($this->strategy); + } + + public function clearStrategy() + { + unset($this->strategy); + } + + /** + * Optional. The strategy to use for a `Rollout` to this stage. + * + * Generated from protobuf field .google.cloud.deploy.v1.Strategy strategy = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\Deploy\V1\Strategy $var + * @return $this + */ + public function setStrategy($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Deploy\V1\Strategy::class); + $this->strategy = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Standard.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Standard.php new file mode 100644 index 000000000000..0ec4ae2a2adf --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Standard.php @@ -0,0 +1,67 @@ +google.cloud.deploy.v1.Standard + */ +class Standard extends \Google\Protobuf\Internal\Message +{ + /** + * Whether to verify a deployment. + * + * Generated from protobuf field bool verify = 1; + */ + protected $verify = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $verify + * Whether to verify a deployment. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * Whether to verify a deployment. + * + * Generated from protobuf field bool verify = 1; + * @return bool + */ + public function getVerify() + { + return $this->verify; + } + + /** + * Whether to verify a deployment. + * + * Generated from protobuf field bool verify = 1; + * @param bool $var + * @return $this + */ + public function setVerify($var) + { + GPBUtil::checkBool($var); + $this->verify = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Strategy.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Strategy.php new file mode 100644 index 000000000000..3d4f9641a71f --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Strategy.php @@ -0,0 +1,114 @@ +google.cloud.deploy.v1.Strategy + */ +class Strategy extends \Google\Protobuf\Internal\Message +{ + protected $deployment_strategy; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Deploy\V1\Standard $standard + * Standard deployment strategy executes a single deploy and allows + * verifying the deployment. + * @type \Google\Cloud\Deploy\V1\Canary $canary + * Canary deployment strategy provides progressive percentage based + * deployments to a Target. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * Standard deployment strategy executes a single deploy and allows + * verifying the deployment. + * + * Generated from protobuf field .google.cloud.deploy.v1.Standard standard = 1; + * @return \Google\Cloud\Deploy\V1\Standard|null + */ + public function getStandard() + { + return $this->readOneof(1); + } + + public function hasStandard() + { + return $this->hasOneof(1); + } + + /** + * Standard deployment strategy executes a single deploy and allows + * verifying the deployment. + * + * Generated from protobuf field .google.cloud.deploy.v1.Standard standard = 1; + * @param \Google\Cloud\Deploy\V1\Standard $var + * @return $this + */ + public function setStandard($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Deploy\V1\Standard::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * Canary deployment strategy provides progressive percentage based + * deployments to a Target. + * + * Generated from protobuf field .google.cloud.deploy.v1.Canary canary = 2; + * @return \Google\Cloud\Deploy\V1\Canary|null + */ + public function getCanary() + { + return $this->readOneof(2); + } + + public function hasCanary() + { + return $this->hasOneof(2); + } + + /** + * Canary deployment strategy provides progressive percentage based + * deployments to a Target. + * + * Generated from protobuf field .google.cloud.deploy.v1.Canary canary = 2; + * @param \Google\Cloud\Deploy\V1\Canary $var + * @return $this + */ + public function setCanary($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Deploy\V1\Canary::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * @return string + */ + public function getDeploymentStrategy() + { + return $this->whichOneof("deployment_strategy"); + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Target.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Target.php new file mode 100644 index 000000000000..aef262730a78 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Target.php @@ -0,0 +1,654 @@ +google.cloud.deploy.v1.Target + */ +class Target extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. Name of the `Target`. Format is + * projects/{project}/locations/{location}/targets/[a-z][a-z0-9\-]{0,62}. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $name = ''; + /** + * Output only. Resource id of the `Target`. + * + * Generated from protobuf field string target_id = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $target_id = ''; + /** + * Output only. Unique identifier of the `Target`. + * + * Generated from protobuf field string uid = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $uid = ''; + /** + * Optional. Description of the `Target`. Max length is 255 characters. + * + * Generated from protobuf field string description = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $description = ''; + /** + * Optional. User annotations. These attributes can only be set and used by + * the user, and not by Google Cloud Deploy. See + * https://google.aip.dev/128#annotations for more details such as format and + * size limitations. + * + * Generated from protobuf field map annotations = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $annotations; + /** + * Optional. Labels are attributes that can be set and used by both the + * user and by Google Cloud Deploy. Labels must meet the following + * constraints: + * * Keys and values can contain only lowercase letters, numeric characters, + * underscores, and dashes. + * * All characters must use UTF-8 encoding, and international characters are + * allowed. + * * Keys must start with a lowercase letter or international character. + * * Each resource is limited to a maximum of 64 labels. + * Both keys and values are additionally constrained to be <= 128 bytes. + * + * Generated from protobuf field map labels = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $labels; + /** + * Optional. Whether or not the `Target` requires approval. + * + * Generated from protobuf field bool require_approval = 13 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $require_approval = false; + /** + * Output only. Time at which the `Target` was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. Most recent time at which the `Target` was updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * Optional. This checksum is computed by the server based on the value of + * other fields, and may be sent on update and delete requests to ensure the + * client has an up-to-date value before proceeding. + * + * Generated from protobuf field string etag = 12 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $etag = ''; + /** + * Configurations for all execution that relates to this `Target`. + * Each `ExecutionEnvironmentUsage` value may only be used in a single + * configuration; using the same value multiple times is an error. + * When one or more configurations are specified, they must include the + * `RENDER` and `DEPLOY` `ExecutionEnvironmentUsage` values. + * When no configurations are specified, execution will use the default + * specified in `DefaultPool`. + * + * Generated from protobuf field repeated .google.cloud.deploy.v1.ExecutionConfig execution_configs = 16; + */ + private $execution_configs; + protected $deployment_target; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Optional. Name of the `Target`. Format is + * projects/{project}/locations/{location}/targets/[a-z][a-z0-9\-]{0,62}. + * @type string $target_id + * Output only. Resource id of the `Target`. + * @type string $uid + * Output only. Unique identifier of the `Target`. + * @type string $description + * Optional. Description of the `Target`. Max length is 255 characters. + * @type array|\Google\Protobuf\Internal\MapField $annotations + * Optional. User annotations. These attributes can only be set and used by + * the user, and not by Google Cloud Deploy. See + * https://google.aip.dev/128#annotations for more details such as format and + * size limitations. + * @type array|\Google\Protobuf\Internal\MapField $labels + * Optional. Labels are attributes that can be set and used by both the + * user and by Google Cloud Deploy. Labels must meet the following + * constraints: + * * Keys and values can contain only lowercase letters, numeric characters, + * underscores, and dashes. + * * All characters must use UTF-8 encoding, and international characters are + * allowed. + * * Keys must start with a lowercase letter or international character. + * * Each resource is limited to a maximum of 64 labels. + * Both keys and values are additionally constrained to be <= 128 bytes. + * @type bool $require_approval + * Optional. Whether or not the `Target` requires approval. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. Time at which the `Target` was created. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. Most recent time at which the `Target` was updated. + * @type \Google\Cloud\Deploy\V1\GkeCluster $gke + * Information specifying a GKE Cluster. + * @type \Google\Cloud\Deploy\V1\AnthosCluster $anthos_cluster + * Information specifying an Anthos Cluster. + * @type \Google\Cloud\Deploy\V1\CloudRunLocation $run + * Information specifying a Cloud Run deployment target. + * @type \Google\Cloud\Deploy\V1\MultiTarget $multi_target + * Information specifying a multiTarget. + * @type string $etag + * Optional. This checksum is computed by the server based on the value of + * other fields, and may be sent on update and delete requests to ensure the + * client has an up-to-date value before proceeding. + * @type array<\Google\Cloud\Deploy\V1\ExecutionConfig>|\Google\Protobuf\Internal\RepeatedField $execution_configs + * Configurations for all execution that relates to this `Target`. + * Each `ExecutionEnvironmentUsage` value may only be used in a single + * configuration; using the same value multiple times is an error. + * When one or more configurations are specified, they must include the + * `RENDER` and `DEPLOY` `ExecutionEnvironmentUsage` values. + * When no configurations are specified, execution will use the default + * specified in `DefaultPool`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * Optional. Name of the `Target`. Format is + * projects/{project}/locations/{location}/targets/[a-z][a-z0-9\-]{0,62}. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Optional. Name of the `Target`. Format is + * projects/{project}/locations/{location}/targets/[a-z][a-z0-9\-]{0,62}. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. Resource id of the `Target`. + * + * Generated from protobuf field string target_id = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getTargetId() + { + return $this->target_id; + } + + /** + * Output only. Resource id of the `Target`. + * + * Generated from protobuf field string target_id = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setTargetId($var) + { + GPBUtil::checkString($var, True); + $this->target_id = $var; + + return $this; + } + + /** + * Output only. Unique identifier of the `Target`. + * + * Generated from protobuf field string uid = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getUid() + { + return $this->uid; + } + + /** + * Output only. Unique identifier of the `Target`. + * + * Generated from protobuf field string uid = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setUid($var) + { + GPBUtil::checkString($var, True); + $this->uid = $var; + + return $this; + } + + /** + * Optional. Description of the `Target`. Max length is 255 characters. + * + * Generated from protobuf field string description = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Optional. Description of the `Target`. Max length is 255 characters. + * + * Generated from protobuf field string description = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * Optional. User annotations. These attributes can only be set and used by + * the user, and not by Google Cloud Deploy. See + * https://google.aip.dev/128#annotations for more details such as format and + * size limitations. + * + * Generated from protobuf field map annotations = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\MapField + */ + public function getAnnotations() + { + return $this->annotations; + } + + /** + * Optional. User annotations. These attributes can only be set and used by + * the user, and not by Google Cloud Deploy. See + * https://google.aip.dev/128#annotations for more details such as format and + * size limitations. + * + * Generated from protobuf field map annotations = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setAnnotations($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->annotations = $arr; + + return $this; + } + + /** + * Optional. Labels are attributes that can be set and used by both the + * user and by Google Cloud Deploy. Labels must meet the following + * constraints: + * * Keys and values can contain only lowercase letters, numeric characters, + * underscores, and dashes. + * * All characters must use UTF-8 encoding, and international characters are + * allowed. + * * Keys must start with a lowercase letter or international character. + * * Each resource is limited to a maximum of 64 labels. + * Both keys and values are additionally constrained to be <= 128 bytes. + * + * Generated from protobuf field map labels = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * Optional. Labels are attributes that can be set and used by both the + * user and by Google Cloud Deploy. Labels must meet the following + * constraints: + * * Keys and values can contain only lowercase letters, numeric characters, + * underscores, and dashes. + * * All characters must use UTF-8 encoding, and international characters are + * allowed. + * * Keys must start with a lowercase letter or international character. + * * Each resource is limited to a maximum of 64 labels. + * Both keys and values are additionally constrained to be <= 128 bytes. + * + * Generated from protobuf field map labels = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + + /** + * Optional. Whether or not the `Target` requires approval. + * + * Generated from protobuf field bool require_approval = 13 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getRequireApproval() + { + return $this->require_approval; + } + + /** + * Optional. Whether or not the `Target` requires approval. + * + * Generated from protobuf field bool require_approval = 13 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setRequireApproval($var) + { + GPBUtil::checkBool($var); + $this->require_approval = $var; + + return $this; + } + + /** + * Output only. Time at which the `Target` was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 8 [(.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. Time at which the `Target` was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 8 [(.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. Most recent time at which the `Target` was updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 9 [(.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. Most recent time at which the `Target` was updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 9 [(.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; + } + + /** + * Information specifying a GKE Cluster. + * + * Generated from protobuf field .google.cloud.deploy.v1.GkeCluster gke = 15; + * @return \Google\Cloud\Deploy\V1\GkeCluster|null + */ + public function getGke() + { + return $this->readOneof(15); + } + + public function hasGke() + { + return $this->hasOneof(15); + } + + /** + * Information specifying a GKE Cluster. + * + * Generated from protobuf field .google.cloud.deploy.v1.GkeCluster gke = 15; + * @param \Google\Cloud\Deploy\V1\GkeCluster $var + * @return $this + */ + public function setGke($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Deploy\V1\GkeCluster::class); + $this->writeOneof(15, $var); + + return $this; + } + + /** + * Information specifying an Anthos Cluster. + * + * Generated from protobuf field .google.cloud.deploy.v1.AnthosCluster anthos_cluster = 17; + * @return \Google\Cloud\Deploy\V1\AnthosCluster|null + */ + public function getAnthosCluster() + { + return $this->readOneof(17); + } + + public function hasAnthosCluster() + { + return $this->hasOneof(17); + } + + /** + * Information specifying an Anthos Cluster. + * + * Generated from protobuf field .google.cloud.deploy.v1.AnthosCluster anthos_cluster = 17; + * @param \Google\Cloud\Deploy\V1\AnthosCluster $var + * @return $this + */ + public function setAnthosCluster($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Deploy\V1\AnthosCluster::class); + $this->writeOneof(17, $var); + + return $this; + } + + /** + * Information specifying a Cloud Run deployment target. + * + * Generated from protobuf field .google.cloud.deploy.v1.CloudRunLocation run = 18; + * @return \Google\Cloud\Deploy\V1\CloudRunLocation|null + */ + public function getRun() + { + return $this->readOneof(18); + } + + public function hasRun() + { + return $this->hasOneof(18); + } + + /** + * Information specifying a Cloud Run deployment target. + * + * Generated from protobuf field .google.cloud.deploy.v1.CloudRunLocation run = 18; + * @param \Google\Cloud\Deploy\V1\CloudRunLocation $var + * @return $this + */ + public function setRun($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Deploy\V1\CloudRunLocation::class); + $this->writeOneof(18, $var); + + return $this; + } + + /** + * Information specifying a multiTarget. + * + * Generated from protobuf field .google.cloud.deploy.v1.MultiTarget multi_target = 19; + * @return \Google\Cloud\Deploy\V1\MultiTarget|null + */ + public function getMultiTarget() + { + return $this->readOneof(19); + } + + public function hasMultiTarget() + { + return $this->hasOneof(19); + } + + /** + * Information specifying a multiTarget. + * + * Generated from protobuf field .google.cloud.deploy.v1.MultiTarget multi_target = 19; + * @param \Google\Cloud\Deploy\V1\MultiTarget $var + * @return $this + */ + public function setMultiTarget($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Deploy\V1\MultiTarget::class); + $this->writeOneof(19, $var); + + return $this; + } + + /** + * Optional. This checksum is computed by the server based on the value of + * other fields, and may be sent on update and delete requests to ensure the + * client has an up-to-date value before proceeding. + * + * Generated from protobuf field string etag = 12 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * Optional. This checksum is computed by the server based on the value of + * other fields, and may be sent on update and delete requests to ensure the + * client has an up-to-date value before proceeding. + * + * Generated from protobuf field string etag = 12 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, True); + $this->etag = $var; + + return $this; + } + + /** + * Configurations for all execution that relates to this `Target`. + * Each `ExecutionEnvironmentUsage` value may only be used in a single + * configuration; using the same value multiple times is an error. + * When one or more configurations are specified, they must include the + * `RENDER` and `DEPLOY` `ExecutionEnvironmentUsage` values. + * When no configurations are specified, execution will use the default + * specified in `DefaultPool`. + * + * Generated from protobuf field repeated .google.cloud.deploy.v1.ExecutionConfig execution_configs = 16; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getExecutionConfigs() + { + return $this->execution_configs; + } + + /** + * Configurations for all execution that relates to this `Target`. + * Each `ExecutionEnvironmentUsage` value may only be used in a single + * configuration; using the same value multiple times is an error. + * When one or more configurations are specified, they must include the + * `RENDER` and `DEPLOY` `ExecutionEnvironmentUsage` values. + * When no configurations are specified, execution will use the default + * specified in `DefaultPool`. + * + * Generated from protobuf field repeated .google.cloud.deploy.v1.ExecutionConfig execution_configs = 16; + * @param array<\Google\Cloud\Deploy\V1\ExecutionConfig>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setExecutionConfigs($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Deploy\V1\ExecutionConfig::class); + $this->execution_configs = $arr; + + return $this; + } + + /** + * @return string + */ + public function getDeploymentTarget() + { + return $this->whichOneof("deployment_target"); + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/TargetArtifact.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/TargetArtifact.php new file mode 100644 index 000000000000..dcca9ff5bfa5 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/TargetArtifact.php @@ -0,0 +1,187 @@ +google.cloud.deploy.v1.TargetArtifact + */ +class TargetArtifact extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. File path of the resolved Skaffold configuration relative to + * the URI. + * + * Generated from protobuf field string skaffold_config_path = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $skaffold_config_path = ''; + /** + * Output only. File path of the rendered manifest relative to the URI. + * + * Generated from protobuf field string manifest_path = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $manifest_path = ''; + /** + * Output only. Map from the phase ID to the phase artifacts for the `Target`. + * + * Generated from protobuf field map phase_artifacts = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $phase_artifacts; + protected $uri; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $artifact_uri + * Output only. URI of a directory containing the artifacts. This contains + * deployment configuration used by Skaffold during a rollout, and all + * paths are relative to this location. + * @type string $skaffold_config_path + * Output only. File path of the resolved Skaffold configuration relative to + * the URI. + * @type string $manifest_path + * Output only. File path of the rendered manifest relative to the URI. + * @type array|\Google\Protobuf\Internal\MapField $phase_artifacts + * Output only. Map from the phase ID to the phase artifacts for the `Target`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * Output only. URI of a directory containing the artifacts. This contains + * deployment configuration used by Skaffold during a rollout, and all + * paths are relative to this location. + * + * Generated from protobuf field string artifact_uri = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getArtifactUri() + { + return $this->readOneof(4); + } + + public function hasArtifactUri() + { + return $this->hasOneof(4); + } + + /** + * Output only. URI of a directory containing the artifacts. This contains + * deployment configuration used by Skaffold during a rollout, and all + * paths are relative to this location. + * + * Generated from protobuf field string artifact_uri = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setArtifactUri($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * Output only. File path of the resolved Skaffold configuration relative to + * the URI. + * + * Generated from protobuf field string skaffold_config_path = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getSkaffoldConfigPath() + { + return $this->skaffold_config_path; + } + + /** + * Output only. File path of the resolved Skaffold configuration relative to + * the URI. + * + * Generated from protobuf field string skaffold_config_path = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setSkaffoldConfigPath($var) + { + GPBUtil::checkString($var, True); + $this->skaffold_config_path = $var; + + return $this; + } + + /** + * Output only. File path of the rendered manifest relative to the URI. + * + * Generated from protobuf field string manifest_path = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getManifestPath() + { + return $this->manifest_path; + } + + /** + * Output only. File path of the rendered manifest relative to the URI. + * + * Generated from protobuf field string manifest_path = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setManifestPath($var) + { + GPBUtil::checkString($var, True); + $this->manifest_path = $var; + + return $this; + } + + /** + * Output only. Map from the phase ID to the phase artifacts for the `Target`. + * + * Generated from protobuf field map phase_artifacts = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\MapField + */ + public function getPhaseArtifacts() + { + return $this->phase_artifacts; + } + + /** + * Output only. Map from the phase ID to the phase artifacts for the `Target`. + * + * Generated from protobuf field map phase_artifacts = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setPhaseArtifacts($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Deploy\V1\TargetArtifact\PhaseArtifact::class); + $this->phase_artifacts = $arr; + + return $this; + } + + /** + * @return string + */ + public function getUri() + { + return $this->whichOneof("uri"); + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/TargetArtifact/PhaseArtifact.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/TargetArtifact/PhaseArtifact.php new file mode 100644 index 000000000000..27736c6008e0 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/TargetArtifact/PhaseArtifact.php @@ -0,0 +1,146 @@ +google.cloud.deploy.v1.TargetArtifact.PhaseArtifact + */ +class PhaseArtifact extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. File path of the resolved Skaffold configuration relative to + * the URI. + * + * Generated from protobuf field string skaffold_config_path = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $skaffold_config_path = ''; + /** + * Output only. File path of the rendered manifest relative to the URI. + * + * Generated from protobuf field string manifest_path = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $manifest_path = ''; + /** + * Output only. File path of the directory of rendered job manifests + * relative to the URI. This is only set if it is applicable. + * + * Generated from protobuf field string job_manifests_path = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $job_manifests_path = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $skaffold_config_path + * Output only. File path of the resolved Skaffold configuration relative to + * the URI. + * @type string $manifest_path + * Output only. File path of the rendered manifest relative to the URI. + * @type string $job_manifests_path + * Output only. File path of the directory of rendered job manifests + * relative to the URI. This is only set if it is applicable. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * Output only. File path of the resolved Skaffold configuration relative to + * the URI. + * + * Generated from protobuf field string skaffold_config_path = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getSkaffoldConfigPath() + { + return $this->skaffold_config_path; + } + + /** + * Output only. File path of the resolved Skaffold configuration relative to + * the URI. + * + * Generated from protobuf field string skaffold_config_path = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setSkaffoldConfigPath($var) + { + GPBUtil::checkString($var, True); + $this->skaffold_config_path = $var; + + return $this; + } + + /** + * Output only. File path of the rendered manifest relative to the URI. + * + * Generated from protobuf field string manifest_path = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getManifestPath() + { + return $this->manifest_path; + } + + /** + * Output only. File path of the rendered manifest relative to the URI. + * + * Generated from protobuf field string manifest_path = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setManifestPath($var) + { + GPBUtil::checkString($var, True); + $this->manifest_path = $var; + + return $this; + } + + /** + * Output only. File path of the directory of rendered job manifests + * relative to the URI. This is only set if it is applicable. + * + * Generated from protobuf field string job_manifests_path = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getJobManifestsPath() + { + return $this->job_manifests_path; + } + + /** + * Output only. File path of the directory of rendered job manifests + * relative to the URI. This is only set if it is applicable. + * + * Generated from protobuf field string job_manifests_path = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setJobManifestsPath($var) + { + GPBUtil::checkString($var, True); + $this->job_manifests_path = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(PhaseArtifact::class, \Google\Cloud\Deploy\V1\TargetArtifact_PhaseArtifact::class); + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/TargetArtifact_PhaseArtifact.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/TargetArtifact_PhaseArtifact.php new file mode 100644 index 000000000000..738c557eaa50 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/TargetArtifact_PhaseArtifact.php @@ -0,0 +1,16 @@ +google.cloud.deploy.v1.TargetNotificationEvent + */ +class TargetNotificationEvent extends \Google\Protobuf\Internal\Message +{ + /** + * Debug message for when a notification fails to send. + * + * Generated from protobuf field string message = 1; + */ + protected $message = ''; + /** + * The name of the `Target`. + * + * Generated from protobuf field string target = 2; + */ + protected $target = ''; + /** + * Type of this notification, e.g. for a Pub/Sub failure. + * + * Generated from protobuf field .google.cloud.deploy.v1.Type type = 3; + */ + protected $type = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $message + * Debug message for when a notification fails to send. + * @type string $target + * The name of the `Target`. + * @type int $type + * Type of this notification, e.g. for a Pub/Sub failure. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\TargetNotificationPayload::initOnce(); + parent::__construct($data); + } + + /** + * Debug message for when a notification fails to send. + * + * Generated from protobuf field string message = 1; + * @return string + */ + public function getMessage() + { + return $this->message; + } + + /** + * Debug message for when a notification fails to send. + * + * Generated from protobuf field string message = 1; + * @param string $var + * @return $this + */ + public function setMessage($var) + { + GPBUtil::checkString($var, True); + $this->message = $var; + + return $this; + } + + /** + * The name of the `Target`. + * + * Generated from protobuf field string target = 2; + * @return string + */ + public function getTarget() + { + return $this->target; + } + + /** + * The name of the `Target`. + * + * Generated from protobuf field string target = 2; + * @param string $var + * @return $this + */ + public function setTarget($var) + { + GPBUtil::checkString($var, True); + $this->target = $var; + + return $this; + } + + /** + * Type of this notification, e.g. for a Pub/Sub failure. + * + * Generated from protobuf field .google.cloud.deploy.v1.Type type = 3; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * Type of this notification, e.g. for a Pub/Sub failure. + * + * Generated from protobuf field .google.cloud.deploy.v1.Type type = 3; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Deploy\V1\Type::class); + $this->type = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/TargetsPresentCondition.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/TargetsPresentCondition.php new file mode 100644 index 000000000000..42d2afcce4d4 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/TargetsPresentCondition.php @@ -0,0 +1,150 @@ +google.cloud.deploy.v1.TargetsPresentCondition + */ +class TargetsPresentCondition extends \Google\Protobuf\Internal\Message +{ + /** + * True if there aren't any missing Targets. + * + * Generated from protobuf field bool status = 1; + */ + protected $status = false; + /** + * The list of Target names that do not exist. For example, + * projects/{project_id}/locations/{location_name}/targets/{target_name}. + * + * Generated from protobuf field repeated string missing_targets = 2 [(.google.api.resource_reference) = { + */ + private $missing_targets; + /** + * Last time the condition was updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 4; + */ + protected $update_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $status + * True if there aren't any missing Targets. + * @type array|\Google\Protobuf\Internal\RepeatedField $missing_targets + * The list of Target names that do not exist. For example, + * projects/{project_id}/locations/{location_name}/targets/{target_name}. + * @type \Google\Protobuf\Timestamp $update_time + * Last time the condition was updated. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * True if there aren't any missing Targets. + * + * Generated from protobuf field bool status = 1; + * @return bool + */ + public function getStatus() + { + return $this->status; + } + + /** + * True if there aren't any missing Targets. + * + * Generated from protobuf field bool status = 1; + * @param bool $var + * @return $this + */ + public function setStatus($var) + { + GPBUtil::checkBool($var); + $this->status = $var; + + return $this; + } + + /** + * The list of Target names that do not exist. For example, + * projects/{project_id}/locations/{location_name}/targets/{target_name}. + * + * Generated from protobuf field repeated string missing_targets = 2 [(.google.api.resource_reference) = { + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getMissingTargets() + { + return $this->missing_targets; + } + + /** + * The list of Target names that do not exist. For example, + * projects/{project_id}/locations/{location_name}/targets/{target_name}. + * + * Generated from protobuf field repeated string missing_targets = 2 [(.google.api.resource_reference) = { + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setMissingTargets($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->missing_targets = $arr; + + return $this; + } + + /** + * Last time the condition was updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 4; + * @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); + } + + /** + * Last time the condition was updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 4; + * @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/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/TargetsTypeCondition.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/TargetsTypeCondition.php new file mode 100644 index 000000000000..34705dbf6df7 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/TargetsTypeCondition.php @@ -0,0 +1,110 @@ +google.cloud.deploy.v1.TargetsTypeCondition + */ +class TargetsTypeCondition extends \Google\Protobuf\Internal\Message +{ + /** + * True if the targets are all a comparable type. For example this is true if + * all targets are GKE clusters. This is false if some targets are Cloud Run + * targets and others are GKE clusters. + * + * Generated from protobuf field bool status = 1; + */ + protected $status = false; + /** + * Human readable error message. + * + * Generated from protobuf field string error_details = 2; + */ + protected $error_details = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $status + * True if the targets are all a comparable type. For example this is true if + * all targets are GKE clusters. This is false if some targets are Cloud Run + * targets and others are GKE clusters. + * @type string $error_details + * Human readable error message. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * True if the targets are all a comparable type. For example this is true if + * all targets are GKE clusters. This is false if some targets are Cloud Run + * targets and others are GKE clusters. + * + * Generated from protobuf field bool status = 1; + * @return bool + */ + public function getStatus() + { + return $this->status; + } + + /** + * True if the targets are all a comparable type. For example this is true if + * all targets are GKE clusters. This is false if some targets are Cloud Run + * targets and others are GKE clusters. + * + * Generated from protobuf field bool status = 1; + * @param bool $var + * @return $this + */ + public function setStatus($var) + { + GPBUtil::checkBool($var); + $this->status = $var; + + return $this; + } + + /** + * Human readable error message. + * + * Generated from protobuf field string error_details = 2; + * @return string + */ + public function getErrorDetails() + { + return $this->error_details; + } + + /** + * Human readable error message. + * + * Generated from protobuf field string error_details = 2; + * @param string $var + * @return $this + */ + public function setErrorDetails($var) + { + GPBUtil::checkString($var, True); + $this->error_details = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/TerminateJobRunRequest.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/TerminateJobRunRequest.php new file mode 100644 index 000000000000..b62abe4c5205 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/TerminateJobRunRequest.php @@ -0,0 +1,91 @@ +google.cloud.deploy.v1.TerminateJobRunRequest + */ +class TerminateJobRunRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the `JobRun`. Format must be + * projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/ + * releases/{release}/rollouts/{rollout}/jobRuns/{jobRun}. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. Name of the `JobRun`. Format must be + * projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/ + * releases/{release}/rollouts/{rollout}/jobRuns/{jobRun}. Please see + * {@see CloudDeployClient::jobRunName()} for help formatting this field. + * + * @return \Google\Cloud\Deploy\V1\TerminateJobRunRequest + * + * @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 `JobRun`. Format must be + * projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/ + * releases/{release}/rollouts/{rollout}/jobRuns/{jobRun}. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the `JobRun`. Format must be + * projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/ + * releases/{release}/rollouts/{rollout}/jobRuns/{jobRun}. + * + * 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. Name of the `JobRun`. Format must be + * projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/ + * releases/{release}/rollouts/{rollout}/jobRuns/{jobRun}. + * + * 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; + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/TerminateJobRunResponse.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/TerminateJobRunResponse.php new file mode 100644 index 000000000000..7053edb3af40 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/TerminateJobRunResponse.php @@ -0,0 +1,33 @@ +google.cloud.deploy.v1.TerminateJobRunResponse + */ +class TerminateJobRunResponse extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Type.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Type.php new file mode 100644 index 000000000000..c9a88c026ee3 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/Type.php @@ -0,0 +1,61 @@ +google.cloud.deploy.v1.Type + */ +class Type +{ + /** + * Type is unspecified. + * + * Generated from protobuf enum TYPE_UNSPECIFIED = 0; + */ + const TYPE_UNSPECIFIED = 0; + /** + * A Pub/Sub notification failed to be sent. + * + * Generated from protobuf enum TYPE_PUBSUB_NOTIFICATION_FAILURE = 1; + */ + const TYPE_PUBSUB_NOTIFICATION_FAILURE = 1; + /** + * Deprecated: This field is never used. Use release_render log type instead. + * + * Generated from protobuf enum TYPE_RENDER_STATUES_CHANGE = 2 [deprecated = true]; + */ + const TYPE_RENDER_STATUES_CHANGE = 2; + + private static $valueToName = [ + self::TYPE_UNSPECIFIED => 'TYPE_UNSPECIFIED', + self::TYPE_PUBSUB_NOTIFICATION_FAILURE => 'TYPE_PUBSUB_NOTIFICATION_FAILURE', + self::TYPE_RENDER_STATUES_CHANGE => 'TYPE_RENDER_STATUES_CHANGE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/UpdateDeliveryPipelineRequest.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/UpdateDeliveryPipelineRequest.php new file mode 100644 index 000000000000..aeb37ae971d4 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/UpdateDeliveryPipelineRequest.php @@ -0,0 +1,306 @@ +google.cloud.deploy.v1.UpdateDeliveryPipelineRequest + */ +class UpdateDeliveryPipelineRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Field mask is used to specify the fields to be overwritten in the + * `DeliveryPipeline` resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $update_mask = null; + /** + * Required. The `DeliveryPipeline` to update. + * + * Generated from protobuf field .google.cloud.deploy.v1.DeliveryPipeline delivery_pipeline = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $delivery_pipeline = null; + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + /** + * Optional. If set to true, updating a `DeliveryPipeline` that does not exist + * will result in the creation of a new `DeliveryPipeline`. + * + * Generated from protobuf field bool allow_missing = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $allow_missing = false; + /** + * Optional. If set to true, the request is validated and the user is provided + * with an expected result, but no actual change is made. + * + * Generated from protobuf field bool validate_only = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $validate_only = false; + + /** + * @param \Google\Cloud\Deploy\V1\DeliveryPipeline $deliveryPipeline Required. The `DeliveryPipeline` to update. + * @param \Google\Protobuf\FieldMask $updateMask Required. Field mask is used to specify the fields to be overwritten in the + * `DeliveryPipeline` resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * @return \Google\Cloud\Deploy\V1\UpdateDeliveryPipelineRequest + * + * @experimental + */ + public static function build(\Google\Cloud\Deploy\V1\DeliveryPipeline $deliveryPipeline, \Google\Protobuf\FieldMask $updateMask): self + { + return (new self()) + ->setDeliveryPipeline($deliveryPipeline) + ->setUpdateMask($updateMask); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\FieldMask $update_mask + * Required. Field mask is used to specify the fields to be overwritten in the + * `DeliveryPipeline` resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @type \Google\Cloud\Deploy\V1\DeliveryPipeline $delivery_pipeline + * Required. The `DeliveryPipeline` to update. + * @type string $request_id + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $allow_missing + * Optional. If set to true, updating a `DeliveryPipeline` that does not exist + * will result in the creation of a new `DeliveryPipeline`. + * @type bool $validate_only + * Optional. If set to true, the request is validated and the user is provided + * with an expected result, but no actual change is made. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * Required. Field mask is used to specify the fields to be overwritten in the + * `DeliveryPipeline` resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Required. Field mask is used to specify the fields to be overwritten in the + * `DeliveryPipeline` resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + + /** + * Required. The `DeliveryPipeline` to update. + * + * Generated from protobuf field .google.cloud.deploy.v1.DeliveryPipeline delivery_pipeline = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Deploy\V1\DeliveryPipeline|null + */ + public function getDeliveryPipeline() + { + return $this->delivery_pipeline; + } + + public function hasDeliveryPipeline() + { + return isset($this->delivery_pipeline); + } + + public function clearDeliveryPipeline() + { + unset($this->delivery_pipeline); + } + + /** + * Required. The `DeliveryPipeline` to update. + * + * Generated from protobuf field .google.cloud.deploy.v1.DeliveryPipeline delivery_pipeline = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Deploy\V1\DeliveryPipeline $var + * @return $this + */ + public function setDeliveryPipeline($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Deploy\V1\DeliveryPipeline::class); + $this->delivery_pipeline = $var; + + return $this; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + + /** + * Optional. If set to true, updating a `DeliveryPipeline` that does not exist + * will result in the creation of a new `DeliveryPipeline`. + * + * Generated from protobuf field bool allow_missing = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getAllowMissing() + { + return $this->allow_missing; + } + + /** + * Optional. If set to true, updating a `DeliveryPipeline` that does not exist + * will result in the creation of a new `DeliveryPipeline`. + * + * Generated from protobuf field bool allow_missing = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setAllowMissing($var) + { + GPBUtil::checkBool($var); + $this->allow_missing = $var; + + return $this; + } + + /** + * Optional. If set to true, the request is validated and the user is provided + * with an expected result, but no actual change is made. + * + * Generated from protobuf field bool validate_only = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * Optional. If set to true, the request is validated and the user is provided + * with an expected result, but no actual change is made. + * + * Generated from protobuf field bool validate_only = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/UpdateTargetRequest.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/UpdateTargetRequest.php new file mode 100644 index 000000000000..4c89a30a7366 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/UpdateTargetRequest.php @@ -0,0 +1,306 @@ +google.cloud.deploy.v1.UpdateTargetRequest + */ +class UpdateTargetRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Field mask is used to specify the fields to be overwritten in the + * Target resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $update_mask = null; + /** + * Required. The `Target` to update. + * + * Generated from protobuf field .google.cloud.deploy.v1.Target target = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $target = null; + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + /** + * Optional. If set to true, updating a `Target` that does not exist will + * result in the creation of a new `Target`. + * + * Generated from protobuf field bool allow_missing = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $allow_missing = false; + /** + * Optional. If set to true, the request is validated and the user is provided + * with an expected result, but no actual change is made. + * + * Generated from protobuf field bool validate_only = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $validate_only = false; + + /** + * @param \Google\Cloud\Deploy\V1\Target $target Required. The `Target` to update. + * @param \Google\Protobuf\FieldMask $updateMask Required. Field mask is used to specify the fields to be overwritten in the + * Target resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * @return \Google\Cloud\Deploy\V1\UpdateTargetRequest + * + * @experimental + */ + public static function build(\Google\Cloud\Deploy\V1\Target $target, \Google\Protobuf\FieldMask $updateMask): self + { + return (new self()) + ->setTarget($target) + ->setUpdateMask($updateMask); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\FieldMask $update_mask + * Required. Field mask is used to specify the fields to be overwritten in the + * Target resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @type \Google\Cloud\Deploy\V1\Target $target + * Required. The `Target` to update. + * @type string $request_id + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $allow_missing + * Optional. If set to true, updating a `Target` that does not exist will + * result in the creation of a new `Target`. + * @type bool $validate_only + * Optional. If set to true, the request is validated and the user is provided + * with an expected result, but no actual change is made. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * Required. Field mask is used to specify the fields to be overwritten in the + * Target resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Required. Field mask is used to specify the fields to be overwritten in the + * Target resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + + /** + * Required. The `Target` to update. + * + * Generated from protobuf field .google.cloud.deploy.v1.Target target = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Deploy\V1\Target|null + */ + public function getTarget() + { + return $this->target; + } + + public function hasTarget() + { + return isset($this->target); + } + + public function clearTarget() + { + unset($this->target); + } + + /** + * Required. The `Target` to update. + * + * Generated from protobuf field .google.cloud.deploy.v1.Target target = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Deploy\V1\Target $var + * @return $this + */ + public function setTarget($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Deploy\V1\Target::class); + $this->target = $var; + + return $this; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + + /** + * Optional. If set to true, updating a `Target` that does not exist will + * result in the creation of a new `Target`. + * + * Generated from protobuf field bool allow_missing = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getAllowMissing() + { + return $this->allow_missing; + } + + /** + * Optional. If set to true, updating a `Target` that does not exist will + * result in the creation of a new `Target`. + * + * Generated from protobuf field bool allow_missing = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setAllowMissing($var) + { + GPBUtil::checkBool($var); + $this->allow_missing = $var; + + return $this; + } + + /** + * Optional. If set to true, the request is validated and the user is provided + * with an expected result, but no actual change is made. + * + * Generated from protobuf field bool validate_only = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * Optional. If set to true, the request is validated and the user is provided + * with an expected result, but no actual change is made. + * + * Generated from protobuf field bool validate_only = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/VerifyJob.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/VerifyJob.php new file mode 100644 index 000000000000..acbf1fc38199 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/VerifyJob.php @@ -0,0 +1,33 @@ +google.cloud.deploy.v1.VerifyJob + */ +class VerifyJob extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/VerifyJobRun.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/VerifyJobRun.php new file mode 100644 index 000000000000..437fc9ef6c97 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/VerifyJobRun.php @@ -0,0 +1,223 @@ +google.cloud.deploy.v1.VerifyJobRun + */ +class VerifyJobRun extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The resource name of the Cloud Build `Build` object that is + * used to verify. Format is + * projects/{project}/locations/{location}/builds/{build}. + * + * Generated from protobuf field string build = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + */ + protected $build = ''; + /** + * Output only. URI of a directory containing the verify artifacts. This + * contains the Skaffold event log. + * + * Generated from protobuf field string artifact_uri = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $artifact_uri = ''; + /** + * Output only. File path of the Skaffold event log relative to the artifact + * URI. + * + * Generated from protobuf field string event_log_path = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $event_log_path = ''; + /** + * Output only. The reason the verify failed. This will always be unspecified + * while the verify is in progress or if it succeeded. + * + * Generated from protobuf field .google.cloud.deploy.v1.VerifyJobRun.FailureCause failure_cause = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $failure_cause = 0; + /** + * Output only. Additional information about the verify failure, if available. + * + * Generated from protobuf field string failure_message = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $failure_message = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $build + * Output only. The resource name of the Cloud Build `Build` object that is + * used to verify. Format is + * projects/{project}/locations/{location}/builds/{build}. + * @type string $artifact_uri + * Output only. URI of a directory containing the verify artifacts. This + * contains the Skaffold event log. + * @type string $event_log_path + * Output only. File path of the Skaffold event log relative to the artifact + * URI. + * @type int $failure_cause + * Output only. The reason the verify failed. This will always be unspecified + * while the verify is in progress or if it succeeded. + * @type string $failure_message + * Output only. Additional information about the verify failure, if available. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The resource name of the Cloud Build `Build` object that is + * used to verify. Format is + * projects/{project}/locations/{location}/builds/{build}. + * + * Generated from protobuf field string build = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + * @return string + */ + public function getBuild() + { + return $this->build; + } + + /** + * Output only. The resource name of the Cloud Build `Build` object that is + * used to verify. Format is + * projects/{project}/locations/{location}/builds/{build}. + * + * Generated from protobuf field string build = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setBuild($var) + { + GPBUtil::checkString($var, True); + $this->build = $var; + + return $this; + } + + /** + * Output only. URI of a directory containing the verify artifacts. This + * contains the Skaffold event log. + * + * Generated from protobuf field string artifact_uri = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getArtifactUri() + { + return $this->artifact_uri; + } + + /** + * Output only. URI of a directory containing the verify artifacts. This + * contains the Skaffold event log. + * + * Generated from protobuf field string artifact_uri = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setArtifactUri($var) + { + GPBUtil::checkString($var, True); + $this->artifact_uri = $var; + + return $this; + } + + /** + * Output only. File path of the Skaffold event log relative to the artifact + * URI. + * + * Generated from protobuf field string event_log_path = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getEventLogPath() + { + return $this->event_log_path; + } + + /** + * Output only. File path of the Skaffold event log relative to the artifact + * URI. + * + * Generated from protobuf field string event_log_path = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setEventLogPath($var) + { + GPBUtil::checkString($var, True); + $this->event_log_path = $var; + + return $this; + } + + /** + * Output only. The reason the verify failed. This will always be unspecified + * while the verify is in progress or if it succeeded. + * + * Generated from protobuf field .google.cloud.deploy.v1.VerifyJobRun.FailureCause failure_cause = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getFailureCause() + { + return $this->failure_cause; + } + + /** + * Output only. The reason the verify failed. This will always be unspecified + * while the verify is in progress or if it succeeded. + * + * Generated from protobuf field .google.cloud.deploy.v1.VerifyJobRun.FailureCause failure_cause = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setFailureCause($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Deploy\V1\VerifyJobRun\FailureCause::class); + $this->failure_cause = $var; + + return $this; + } + + /** + * Output only. Additional information about the verify failure, if available. + * + * Generated from protobuf field string failure_message = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getFailureMessage() + { + return $this->failure_message; + } + + /** + * Output only. Additional information about the verify failure, if available. + * + * Generated from protobuf field string failure_message = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setFailureMessage($var) + { + GPBUtil::checkString($var, True); + $this->failure_message = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/VerifyJobRun/FailureCause.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/VerifyJobRun/FailureCause.php new file mode 100644 index 000000000000..69a935479c00 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/VerifyJobRun/FailureCause.php @@ -0,0 +1,89 @@ +google.cloud.deploy.v1.VerifyJobRun.FailureCause + */ +class FailureCause +{ + /** + * No reason for failure is specified. + * + * Generated from protobuf enum FAILURE_CAUSE_UNSPECIFIED = 0; + */ + const FAILURE_CAUSE_UNSPECIFIED = 0; + /** + * Cloud Build is not available, either because it is not enabled or because + * Google Cloud Deploy has insufficient permissions. See [required + * permission](/deploy/docs/cloud-deploy-service-account#required_permissions). + * + * Generated from protobuf enum CLOUD_BUILD_UNAVAILABLE = 1; + */ + const CLOUD_BUILD_UNAVAILABLE = 1; + /** + * The verify operation did not complete successfully; check Cloud Build + * logs. + * + * Generated from protobuf enum EXECUTION_FAILED = 2; + */ + const EXECUTION_FAILED = 2; + /** + * The verify build did not complete within the alloted time. + * + * Generated from protobuf enum DEADLINE_EXCEEDED = 3; + */ + const DEADLINE_EXCEEDED = 3; + /** + * No Skaffold verify configuration was found. + * + * Generated from protobuf enum VERIFICATION_CONFIG_NOT_FOUND = 4; + */ + const VERIFICATION_CONFIG_NOT_FOUND = 4; + /** + * Cloud Build failed to fulfill Google Cloud Deploy's request. See + * failure_message for additional details. + * + * Generated from protobuf enum CLOUD_BUILD_REQUEST_FAILED = 5; + */ + const CLOUD_BUILD_REQUEST_FAILED = 5; + + private static $valueToName = [ + self::FAILURE_CAUSE_UNSPECIFIED => 'FAILURE_CAUSE_UNSPECIFIED', + self::CLOUD_BUILD_UNAVAILABLE => 'CLOUD_BUILD_UNAVAILABLE', + self::EXECUTION_FAILED => 'EXECUTION_FAILED', + self::DEADLINE_EXCEEDED => 'DEADLINE_EXCEEDED', + self::VERIFICATION_CONFIG_NOT_FOUND => 'VERIFICATION_CONFIG_NOT_FOUND', + self::CLOUD_BUILD_REQUEST_FAILED => 'CLOUD_BUILD_REQUEST_FAILED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(FailureCause::class, \Google\Cloud\Deploy\V1\VerifyJobRun_FailureCause::class); + diff --git a/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/VerifyJobRun_FailureCause.php b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/VerifyJobRun_FailureCause.php new file mode 100644 index 000000000000..f8318b188409 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/proto/src/Google/Cloud/Deploy/V1/VerifyJobRun_FailureCause.php @@ -0,0 +1,16 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var AbandonReleaseResponse $response */ + $response = $cloudDeployClient->abandonRelease($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 = CloudDeployClient::releaseName( + '[PROJECT]', + '[LOCATION]', + '[DELIVERY_PIPELINE]', + '[RELEASE]' + ); + + abandon_release_sample($formattedName); +} +// [END clouddeploy_v1_generated_CloudDeploy_AbandonRelease_sync] diff --git a/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/advance_rollout.php b/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/advance_rollout.php new file mode 100644 index 000000000000..a4e29ebaa7fb --- /dev/null +++ b/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/advance_rollout.php @@ -0,0 +1,82 @@ +setName($formattedName) + ->setPhaseId($phaseId); + + // Call the API and handle any network failures. + try { + /** @var AdvanceRolloutResponse $response */ + $response = $cloudDeployClient->advanceRollout($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 = CloudDeployClient::rolloutName( + '[PROJECT]', + '[LOCATION]', + '[DELIVERY_PIPELINE]', + '[RELEASE]', + '[ROLLOUT]' + ); + $phaseId = '[PHASE_ID]'; + + advance_rollout_sample($formattedName, $phaseId); +} +// [END clouddeploy_v1_generated_CloudDeploy_AdvanceRollout_sync] diff --git a/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/approve_rollout.php b/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/approve_rollout.php new file mode 100644 index 000000000000..5ae0a873eac5 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/approve_rollout.php @@ -0,0 +1,82 @@ +setName($formattedName) + ->setApproved($approved); + + // Call the API and handle any network failures. + try { + /** @var ApproveRolloutResponse $response */ + $response = $cloudDeployClient->approveRollout($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 = CloudDeployClient::rolloutName( + '[PROJECT]', + '[LOCATION]', + '[DELIVERY_PIPELINE]', + '[RELEASE]', + '[ROLLOUT]' + ); + $approved = false; + + approve_rollout_sample($formattedName, $approved); +} +// [END clouddeploy_v1_generated_CloudDeploy_ApproveRollout_sync] diff --git a/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/cancel_rollout.php b/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/cancel_rollout.php new file mode 100644 index 000000000000..2f06b27d86a9 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/cancel_rollout.php @@ -0,0 +1,79 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var CancelRolloutResponse $response */ + $response = $cloudDeployClient->cancelRollout($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 = CloudDeployClient::rolloutName( + '[PROJECT]', + '[LOCATION]', + '[DELIVERY_PIPELINE]', + '[RELEASE]', + '[ROLLOUT]' + ); + + cancel_rollout_sample($formattedName); +} +// [END clouddeploy_v1_generated_CloudDeploy_CancelRollout_sync] diff --git a/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/create_delivery_pipeline.php b/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/create_delivery_pipeline.php new file mode 100644 index 000000000000..a26bec51e083 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/create_delivery_pipeline.php @@ -0,0 +1,91 @@ +setParent($formattedParent) + ->setDeliveryPipelineId($deliveryPipelineId) + ->setDeliveryPipeline($deliveryPipeline); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $cloudDeployClient->createDeliveryPipeline($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var DeliveryPipeline $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 +{ + $formattedParent = CloudDeployClient::locationName('[PROJECT]', '[LOCATION]'); + $deliveryPipelineId = '[DELIVERY_PIPELINE_ID]'; + + create_delivery_pipeline_sample($formattedParent, $deliveryPipelineId); +} +// [END clouddeploy_v1_generated_CloudDeploy_CreateDeliveryPipeline_sync] diff --git a/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/create_release.php b/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/create_release.php new file mode 100644 index 000000000000..563be0fbcd84 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/create_release.php @@ -0,0 +1,94 @@ +setParent($formattedParent) + ->setReleaseId($releaseId) + ->setRelease($release); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $cloudDeployClient->createRelease($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Release $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 +{ + $formattedParent = CloudDeployClient::deliveryPipelineName( + '[PROJECT]', + '[LOCATION]', + '[DELIVERY_PIPELINE]' + ); + $releaseId = '[RELEASE_ID]'; + + create_release_sample($formattedParent, $releaseId); +} +// [END clouddeploy_v1_generated_CloudDeploy_CreateRelease_sync] diff --git a/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/create_rollout.php b/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/create_rollout.php new file mode 100644 index 000000000000..ae484462fffe --- /dev/null +++ b/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/create_rollout.php @@ -0,0 +1,101 @@ +setTargetId($rolloutTargetId); + $request = (new CreateRolloutRequest()) + ->setParent($formattedParent) + ->setRolloutId($rolloutId) + ->setRollout($rollout); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $cloudDeployClient->createRollout($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Rollout $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 +{ + $formattedParent = CloudDeployClient::releaseName( + '[PROJECT]', + '[LOCATION]', + '[DELIVERY_PIPELINE]', + '[RELEASE]' + ); + $rolloutId = '[ROLLOUT_ID]'; + $rolloutTargetId = '[TARGET_ID]'; + + create_rollout_sample($formattedParent, $rolloutId, $rolloutTargetId); +} +// [END clouddeploy_v1_generated_CloudDeploy_CreateRollout_sync] diff --git a/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/create_target.php b/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/create_target.php new file mode 100644 index 000000000000..d03d1b7bb13f --- /dev/null +++ b/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/create_target.php @@ -0,0 +1,90 @@ +setParent($formattedParent) + ->setTargetId($targetId) + ->setTarget($target); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $cloudDeployClient->createTarget($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Target $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 +{ + $formattedParent = CloudDeployClient::locationName('[PROJECT]', '[LOCATION]'); + $targetId = '[TARGET_ID]'; + + create_target_sample($formattedParent, $targetId); +} +// [END clouddeploy_v1_generated_CloudDeploy_CreateTarget_sync] diff --git a/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/delete_delivery_pipeline.php b/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/delete_delivery_pipeline.php new file mode 100644 index 000000000000..d79c0138ee87 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/delete_delivery_pipeline.php @@ -0,0 +1,85 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $cloudDeployClient->deleteDeliveryPipeline($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + printf('Operation completed successfully.' . PHP_EOL); + } 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 = CloudDeployClient::deliveryPipelineName( + '[PROJECT]', + '[LOCATION]', + '[DELIVERY_PIPELINE]' + ); + + delete_delivery_pipeline_sample($formattedName); +} +// [END clouddeploy_v1_generated_CloudDeploy_DeleteDeliveryPipeline_sync] diff --git a/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/delete_target.php b/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/delete_target.php new file mode 100644 index 000000000000..df9b66eef67d --- /dev/null +++ b/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/delete_target.php @@ -0,0 +1,81 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $cloudDeployClient->deleteTarget($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + printf('Operation completed successfully.' . PHP_EOL); + } 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 = CloudDeployClient::targetName('[PROJECT]', '[LOCATION]', '[TARGET]'); + + delete_target_sample($formattedName); +} +// [END clouddeploy_v1_generated_CloudDeploy_DeleteTarget_sync] diff --git a/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/get_config.php b/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/get_config.php new file mode 100644 index 000000000000..a269e5595f58 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/get_config.php @@ -0,0 +1,71 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var Config $response */ + $response = $cloudDeployClient->getConfig($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 = CloudDeployClient::configName('[PROJECT]', '[LOCATION]'); + + get_config_sample($formattedName); +} +// [END clouddeploy_v1_generated_CloudDeploy_GetConfig_sync] diff --git a/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/get_delivery_pipeline.php b/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/get_delivery_pipeline.php new file mode 100644 index 000000000000..5440e2bdc524 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/get_delivery_pipeline.php @@ -0,0 +1,76 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var DeliveryPipeline $response */ + $response = $cloudDeployClient->getDeliveryPipeline($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 = CloudDeployClient::deliveryPipelineName( + '[PROJECT]', + '[LOCATION]', + '[DELIVERY_PIPELINE]' + ); + + get_delivery_pipeline_sample($formattedName); +} +// [END clouddeploy_v1_generated_CloudDeploy_GetDeliveryPipeline_sync] diff --git a/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/get_iam_policy.php b/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/get_iam_policy.php new file mode 100644 index 000000000000..2940566b5141 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/get_iam_policy.php @@ -0,0 +1,72 @@ +setResource($resource); + + // Call the API and handle any network failures. + try { + /** @var Policy $response */ + $response = $cloudDeployClient->getIamPolicy($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 +{ + $resource = '[RESOURCE]'; + + get_iam_policy_sample($resource); +} +// [END clouddeploy_v1_generated_CloudDeploy_GetIamPolicy_sync] diff --git a/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/get_job_run.php b/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/get_job_run.php new file mode 100644 index 000000000000..7927e3aff505 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/get_job_run.php @@ -0,0 +1,79 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var JobRun $response */ + $response = $cloudDeployClient->getJobRun($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 = CloudDeployClient::jobRunName( + '[PROJECT]', + '[LOCATION]', + '[DELIVERY_PIPELINE]', + '[RELEASE]', + '[ROLLOUT]', + '[JOB_RUN]' + ); + + get_job_run_sample($formattedName); +} +// [END clouddeploy_v1_generated_CloudDeploy_GetJobRun_sync] diff --git a/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/get_location.php b/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/get_location.php new file mode 100644 index 000000000000..59b30bd9c437 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/get_location.php @@ -0,0 +1,57 @@ +getLocation($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END clouddeploy_v1_generated_CloudDeploy_GetLocation_sync] diff --git a/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/get_release.php b/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/get_release.php new file mode 100644 index 000000000000..f35d172fab87 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/get_release.php @@ -0,0 +1,77 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var Release $response */ + $response = $cloudDeployClient->getRelease($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 = CloudDeployClient::releaseName( + '[PROJECT]', + '[LOCATION]', + '[DELIVERY_PIPELINE]', + '[RELEASE]' + ); + + get_release_sample($formattedName); +} +// [END clouddeploy_v1_generated_CloudDeploy_GetRelease_sync] diff --git a/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/get_rollout.php b/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/get_rollout.php new file mode 100644 index 000000000000..ea3f1bc77495 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/get_rollout.php @@ -0,0 +1,78 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var Rollout $response */ + $response = $cloudDeployClient->getRollout($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 = CloudDeployClient::rolloutName( + '[PROJECT]', + '[LOCATION]', + '[DELIVERY_PIPELINE]', + '[RELEASE]', + '[ROLLOUT]' + ); + + get_rollout_sample($formattedName); +} +// [END clouddeploy_v1_generated_CloudDeploy_GetRollout_sync] diff --git a/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/get_target.php b/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/get_target.php new file mode 100644 index 000000000000..98a80dca2417 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/get_target.php @@ -0,0 +1,72 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var Target $response */ + $response = $cloudDeployClient->getTarget($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 = CloudDeployClient::targetName('[PROJECT]', '[LOCATION]', '[TARGET]'); + + get_target_sample($formattedName); +} +// [END clouddeploy_v1_generated_CloudDeploy_GetTarget_sync] diff --git a/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/ignore_job.php b/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/ignore_job.php new file mode 100644 index 000000000000..a6299b104e6e --- /dev/null +++ b/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/ignore_job.php @@ -0,0 +1,85 @@ +setRollout($formattedRollout) + ->setPhaseId($phaseId) + ->setJobId($jobId); + + // Call the API and handle any network failures. + try { + /** @var IgnoreJobResponse $response */ + $response = $cloudDeployClient->ignoreJob($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 +{ + $formattedRollout = CloudDeployClient::rolloutName( + '[PROJECT]', + '[LOCATION]', + '[DELIVERY_PIPELINE]', + '[RELEASE]', + '[ROLLOUT]' + ); + $phaseId = '[PHASE_ID]'; + $jobId = '[JOB_ID]'; + + ignore_job_sample($formattedRollout, $phaseId, $jobId); +} +// [END clouddeploy_v1_generated_CloudDeploy_IgnoreJob_sync] diff --git a/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/list_delivery_pipelines.php b/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/list_delivery_pipelines.php new file mode 100644 index 000000000000..f99c9bbfee1e --- /dev/null +++ b/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/list_delivery_pipelines.php @@ -0,0 +1,77 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $cloudDeployClient->listDeliveryPipelines($request); + + /** @var DeliveryPipeline $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 = CloudDeployClient::locationName('[PROJECT]', '[LOCATION]'); + + list_delivery_pipelines_sample($formattedParent); +} +// [END clouddeploy_v1_generated_CloudDeploy_ListDeliveryPipelines_sync] diff --git a/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/list_job_runs.php b/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/list_job_runs.php new file mode 100644 index 000000000000..65da0912cc2f --- /dev/null +++ b/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/list_job_runs.php @@ -0,0 +1,82 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $cloudDeployClient->listJobRuns($request); + + /** @var JobRun $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 = CloudDeployClient::rolloutName( + '[PROJECT]', + '[LOCATION]', + '[DELIVERY_PIPELINE]', + '[RELEASE]', + '[ROLLOUT]' + ); + + list_job_runs_sample($formattedParent); +} +// [END clouddeploy_v1_generated_CloudDeploy_ListJobRuns_sync] diff --git a/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/list_locations.php b/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/list_locations.php new file mode 100644 index 000000000000..a02df383f065 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/list_locations.php @@ -0,0 +1,62 @@ +listLocations($request); + + /** @var Location $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()); + } +} +// [END clouddeploy_v1_generated_CloudDeploy_ListLocations_sync] diff --git a/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/list_releases.php b/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/list_releases.php new file mode 100644 index 000000000000..36d8f75565b0 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/list_releases.php @@ -0,0 +1,81 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $cloudDeployClient->listReleases($request); + + /** @var Release $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 = CloudDeployClient::deliveryPipelineName( + '[PROJECT]', + '[LOCATION]', + '[DELIVERY_PIPELINE]' + ); + + list_releases_sample($formattedParent); +} +// [END clouddeploy_v1_generated_CloudDeploy_ListReleases_sync] diff --git a/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/list_rollouts.php b/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/list_rollouts.php new file mode 100644 index 000000000000..b61507443d85 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/list_rollouts.php @@ -0,0 +1,81 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $cloudDeployClient->listRollouts($request); + + /** @var Rollout $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 = CloudDeployClient::releaseName( + '[PROJECT]', + '[LOCATION]', + '[DELIVERY_PIPELINE]', + '[RELEASE]' + ); + + list_rollouts_sample($formattedParent); +} +// [END clouddeploy_v1_generated_CloudDeploy_ListRollouts_sync] diff --git a/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/list_targets.php b/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/list_targets.php new file mode 100644 index 000000000000..b3cb73a00b8f --- /dev/null +++ b/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/list_targets.php @@ -0,0 +1,77 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $cloudDeployClient->listTargets($request); + + /** @var Target $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 = CloudDeployClient::locationName('[PROJECT]', '[LOCATION]'); + + list_targets_sample($formattedParent); +} +// [END clouddeploy_v1_generated_CloudDeploy_ListTargets_sync] diff --git a/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/retry_job.php b/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/retry_job.php new file mode 100644 index 000000000000..35cf108e6fd1 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/retry_job.php @@ -0,0 +1,85 @@ +setRollout($formattedRollout) + ->setPhaseId($phaseId) + ->setJobId($jobId); + + // Call the API and handle any network failures. + try { + /** @var RetryJobResponse $response */ + $response = $cloudDeployClient->retryJob($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 +{ + $formattedRollout = CloudDeployClient::rolloutName( + '[PROJECT]', + '[LOCATION]', + '[DELIVERY_PIPELINE]', + '[RELEASE]', + '[ROLLOUT]' + ); + $phaseId = '[PHASE_ID]'; + $jobId = '[JOB_ID]'; + + retry_job_sample($formattedRollout, $phaseId, $jobId); +} +// [END clouddeploy_v1_generated_CloudDeploy_RetryJob_sync] diff --git a/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/set_iam_policy.php b/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/set_iam_policy.php new file mode 100644 index 000000000000..5387074d734f --- /dev/null +++ b/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/set_iam_policy.php @@ -0,0 +1,77 @@ +setResource($resource) + ->setPolicy($policy); + + // Call the API and handle any network failures. + try { + /** @var Policy $response */ + $response = $cloudDeployClient->setIamPolicy($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 +{ + $resource = '[RESOURCE]'; + + set_iam_policy_sample($resource); +} +// [END clouddeploy_v1_generated_CloudDeploy_SetIamPolicy_sync] diff --git a/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/terminate_job_run.php b/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/terminate_job_run.php new file mode 100644 index 000000000000..8be2add33f13 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/terminate_job_run.php @@ -0,0 +1,80 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var TerminateJobRunResponse $response */ + $response = $cloudDeployClient->terminateJobRun($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 = CloudDeployClient::jobRunName( + '[PROJECT]', + '[LOCATION]', + '[DELIVERY_PIPELINE]', + '[RELEASE]', + '[ROLLOUT]', + '[JOB_RUN]' + ); + + terminate_job_run_sample($formattedName); +} +// [END clouddeploy_v1_generated_CloudDeploy_TerminateJobRun_sync] diff --git a/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/test_iam_permissions.php b/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/test_iam_permissions.php new file mode 100644 index 000000000000..7681012d764e --- /dev/null +++ b/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/test_iam_permissions.php @@ -0,0 +1,84 @@ +setResource($resource) + ->setPermissions($permissions); + + // Call the API and handle any network failures. + try { + /** @var TestIamPermissionsResponse $response */ + $response = $cloudDeployClient->testIamPermissions($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 +{ + $resource = '[RESOURCE]'; + $permissionsElement = '[PERMISSIONS]'; + + test_iam_permissions_sample($resource, $permissionsElement); +} +// [END clouddeploy_v1_generated_CloudDeploy_TestIamPermissions_sync] diff --git a/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/update_delivery_pipeline.php b/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/update_delivery_pipeline.php new file mode 100644 index 000000000000..406f40ab7955 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/update_delivery_pipeline.php @@ -0,0 +1,74 @@ +setUpdateMask($updateMask) + ->setDeliveryPipeline($deliveryPipeline); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $cloudDeployClient->updateDeliveryPipeline($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var DeliveryPipeline $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()); + } +} +// [END clouddeploy_v1_generated_CloudDeploy_UpdateDeliveryPipeline_sync] diff --git a/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/update_target.php b/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/update_target.php new file mode 100644 index 000000000000..228f9d74d35e --- /dev/null +++ b/owl-bot-staging/Deploy/v1/samples/V1/CloudDeployClient/update_target.php @@ -0,0 +1,74 @@ +setUpdateMask($updateMask) + ->setTarget($target); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $cloudDeployClient->updateTarget($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Target $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()); + } +} +// [END clouddeploy_v1_generated_CloudDeploy_UpdateTarget_sync] diff --git a/owl-bot-staging/Deploy/v1/src/V1/Client/BaseClient/CloudDeployBaseClient.php b/owl-bot-staging/Deploy/v1/src/V1/Client/BaseClient/CloudDeployBaseClient.php new file mode 100644 index 000000000000..94001d9d0a8c --- /dev/null +++ b/owl-bot-staging/Deploy/v1/src/V1/Client/BaseClient/CloudDeployBaseClient.php @@ -0,0 +1,1307 @@ + self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../../resources/cloud_deploy_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../../resources/cloud_deploy_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../../resources/cloud_deploy_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../../resources/cloud_deploy_rest_client_config.php', + ], + ], + ]; + } + + /** + * 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 build + * resource. + * + * @param string $project + * @param string $location + * @param string $build + * + * @return string The formatted build resource. + */ + public static function buildName(string $project, string $location, string $build): string + { + return self::getPathTemplate('build')->render([ + 'project' => $project, + 'location' => $location, + 'build' => $build, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a cluster + * resource. + * + * @param string $project + * @param string $location + * @param string $cluster + * + * @return string The formatted cluster resource. + */ + public static function clusterName(string $project, string $location, string $cluster): string + { + return self::getPathTemplate('cluster')->render([ + 'project' => $project, + 'location' => $location, + 'cluster' => $cluster, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a config + * resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted config resource. + */ + public static function configName(string $project, string $location): string + { + return self::getPathTemplate('config')->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * delivery_pipeline resource. + * + * @param string $project + * @param string $location + * @param string $deliveryPipeline + * + * @return string The formatted delivery_pipeline resource. + */ + public static function deliveryPipelineName(string $project, string $location, string $deliveryPipeline): string + { + return self::getPathTemplate('deliveryPipeline')->render([ + 'project' => $project, + 'location' => $location, + 'delivery_pipeline' => $deliveryPipeline, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a job_run + * resource. + * + * @param string $project + * @param string $location + * @param string $deliveryPipeline + * @param string $release + * @param string $rollout + * @param string $jobRun + * + * @return string The formatted job_run resource. + */ + public static function jobRunName(string $project, string $location, string $deliveryPipeline, string $release, string $rollout, string $jobRun): string + { + return self::getPathTemplate('jobRun')->render([ + 'project' => $project, + 'location' => $location, + 'delivery_pipeline' => $deliveryPipeline, + 'release' => $release, + 'rollout' => $rollout, + 'job_run' => $jobRun, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a location + * resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted location resource. + */ + public static function locationName(string $project, string $location): string + { + return self::getPathTemplate('location')->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a membership + * resource. + * + * @param string $project + * @param string $location + * @param string $membership + * + * @return string The formatted membership resource. + */ + public static function membershipName(string $project, string $location, string $membership): string + { + return self::getPathTemplate('membership')->render([ + 'project' => $project, + 'location' => $location, + 'membership' => $membership, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a release + * resource. + * + * @param string $project + * @param string $location + * @param string $deliveryPipeline + * @param string $release + * + * @return string The formatted release resource. + */ + public static function releaseName(string $project, string $location, string $deliveryPipeline, string $release): string + { + return self::getPathTemplate('release')->render([ + 'project' => $project, + 'location' => $location, + 'delivery_pipeline' => $deliveryPipeline, + 'release' => $release, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a rollout + * resource. + * + * @param string $project + * @param string $location + * @param string $deliveryPipeline + * @param string $release + * @param string $rollout + * + * @return string The formatted rollout resource. + */ + public static function rolloutName(string $project, string $location, string $deliveryPipeline, string $release, string $rollout): string + { + return self::getPathTemplate('rollout')->render([ + 'project' => $project, + 'location' => $location, + 'delivery_pipeline' => $deliveryPipeline, + 'release' => $release, + 'rollout' => $rollout, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a service + * resource. + * + * @param string $project + * @param string $location + * @param string $service + * + * @return string The formatted service resource. + */ + public static function serviceName(string $project, string $location, string $service): string + { + return self::getPathTemplate('service')->render([ + 'project' => $project, + 'location' => $location, + 'service' => $service, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a target + * resource. + * + * @param string $project + * @param string $location + * @param string $target + * + * @return string The formatted target resource. + */ + public static function targetName(string $project, string $location, string $target): string + { + return self::getPathTemplate('target')->render([ + 'project' => $project, + 'location' => $location, + 'target' => $target, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a worker_pool + * resource. + * + * @param string $project + * @param string $location + * @param string $workerPool + * + * @return string The formatted worker_pool resource. + */ + public static function workerPoolName(string $project, string $location, string $workerPool): string + { + return self::getPathTemplate('workerPool')->render([ + 'project' => $project, + 'location' => $location, + 'worker_pool' => $workerPool, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - build: projects/{project}/locations/{location}/builds/{build} + * - cluster: projects/{project}/locations/{location}/clusters/{cluster} + * - config: projects/{project}/locations/{location}/config + * - deliveryPipeline: projects/{project}/locations/{location}/deliveryPipelines/{delivery_pipeline} + * - jobRun: projects/{project}/locations/{location}/deliveryPipelines/{delivery_pipeline}/releases/{release}/rollouts/{rollout}/jobRuns/{job_run} + * - location: projects/{project}/locations/{location} + * - membership: projects/{project}/locations/{location}/memberships/{membership} + * - release: projects/{project}/locations/{location}/deliveryPipelines/{delivery_pipeline}/releases/{release} + * - rollout: projects/{project}/locations/{location}/deliveryPipelines/{delivery_pipeline}/releases/{release}/rollouts/{rollout} + * - service: projects/{project}/locations/{location}/services/{service} + * - target: projects/{project}/locations/{location}/targets/{target} + * - workerPool: projects/{project}/locations/{location}/workerPools/{worker_pool} + * + * 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 'clouddeploy.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. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *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' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods 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); + } + + /** + * Abandons a Release in the Delivery Pipeline. + * + * The async variant is {@see self::abandonReleaseAsync()} . + * + * @param AbandonReleaseRequest $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 AbandonReleaseResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function abandonRelease(AbandonReleaseRequest $request, array $callOptions = []): AbandonReleaseResponse + { + return $this->startApiCall('AbandonRelease', $request, $callOptions)->wait(); + } + + /** + * Advances a Rollout in a given project and location. + * + * The async variant is {@see self::advanceRolloutAsync()} . + * + * @param AdvanceRolloutRequest $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 AdvanceRolloutResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function advanceRollout(AdvanceRolloutRequest $request, array $callOptions = []): AdvanceRolloutResponse + { + return $this->startApiCall('AdvanceRollout', $request, $callOptions)->wait(); + } + + /** + * Approves a Rollout. + * + * The async variant is {@see self::approveRolloutAsync()} . + * + * @param ApproveRolloutRequest $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 ApproveRolloutResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function approveRollout(ApproveRolloutRequest $request, array $callOptions = []): ApproveRolloutResponse + { + return $this->startApiCall('ApproveRollout', $request, $callOptions)->wait(); + } + + /** + * Cancels a Rollout in a given project and location. + * + * The async variant is {@see self::cancelRolloutAsync()} . + * + * @param CancelRolloutRequest $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 CancelRolloutResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function cancelRollout(CancelRolloutRequest $request, array $callOptions = []): CancelRolloutResponse + { + return $this->startApiCall('CancelRollout', $request, $callOptions)->wait(); + } + + /** + * Creates a new DeliveryPipeline in a given project and location. + * + * The async variant is {@see self::createDeliveryPipelineAsync()} . + * + * @param CreateDeliveryPipelineRequest $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 createDeliveryPipeline(CreateDeliveryPipelineRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('CreateDeliveryPipeline', $request, $callOptions)->wait(); + } + + /** + * Creates a new Release in a given project and location. + * + * The async variant is {@see self::createReleaseAsync()} . + * + * @param CreateReleaseRequest $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 createRelease(CreateReleaseRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('CreateRelease', $request, $callOptions)->wait(); + } + + /** + * Creates a new Rollout in a given project and location. + * + * The async variant is {@see self::createRolloutAsync()} . + * + * @param CreateRolloutRequest $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 createRollout(CreateRolloutRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('CreateRollout', $request, $callOptions)->wait(); + } + + /** + * Creates a new Target in a given project and location. + * + * The async variant is {@see self::createTargetAsync()} . + * + * @param CreateTargetRequest $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 createTarget(CreateTargetRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('CreateTarget', $request, $callOptions)->wait(); + } + + /** + * Deletes a single DeliveryPipeline. + * + * The async variant is {@see self::deleteDeliveryPipelineAsync()} . + * + * @param DeleteDeliveryPipelineRequest $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 deleteDeliveryPipeline(DeleteDeliveryPipelineRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('DeleteDeliveryPipeline', $request, $callOptions)->wait(); + } + + /** + * Deletes a single Target. + * + * The async variant is {@see self::deleteTargetAsync()} . + * + * @param DeleteTargetRequest $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 deleteTarget(DeleteTargetRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('DeleteTarget', $request, $callOptions)->wait(); + } + + /** + * Gets the configuration for a location. + * + * The async variant is {@see self::getConfigAsync()} . + * + * @param GetConfigRequest $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 Config + * + * @throws ApiException Thrown if the API call fails. + */ + public function getConfig(GetConfigRequest $request, array $callOptions = []): Config + { + return $this->startApiCall('GetConfig', $request, $callOptions)->wait(); + } + + /** + * Gets details of a single DeliveryPipeline. + * + * The async variant is {@see self::getDeliveryPipelineAsync()} . + * + * @param GetDeliveryPipelineRequest $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 DeliveryPipeline + * + * @throws ApiException Thrown if the API call fails. + */ + public function getDeliveryPipeline(GetDeliveryPipelineRequest $request, array $callOptions = []): DeliveryPipeline + { + return $this->startApiCall('GetDeliveryPipeline', $request, $callOptions)->wait(); + } + + /** + * Gets details of a single JobRun. + * + * The async variant is {@see self::getJobRunAsync()} . + * + * @param GetJobRunRequest $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 JobRun + * + * @throws ApiException Thrown if the API call fails. + */ + public function getJobRun(GetJobRunRequest $request, array $callOptions = []): JobRun + { + return $this->startApiCall('GetJobRun', $request, $callOptions)->wait(); + } + + /** + * Gets details of a single Release. + * + * The async variant is {@see self::getReleaseAsync()} . + * + * @param GetReleaseRequest $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 Release + * + * @throws ApiException Thrown if the API call fails. + */ + public function getRelease(GetReleaseRequest $request, array $callOptions = []): Release + { + return $this->startApiCall('GetRelease', $request, $callOptions)->wait(); + } + + /** + * Gets details of a single Rollout. + * + * The async variant is {@see self::getRolloutAsync()} . + * + * @param GetRolloutRequest $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 Rollout + * + * @throws ApiException Thrown if the API call fails. + */ + public function getRollout(GetRolloutRequest $request, array $callOptions = []): Rollout + { + return $this->startApiCall('GetRollout', $request, $callOptions)->wait(); + } + + /** + * Gets details of a single Target. + * + * The async variant is {@see self::getTargetAsync()} . + * + * @param GetTargetRequest $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 Target + * + * @throws ApiException Thrown if the API call fails. + */ + public function getTarget(GetTargetRequest $request, array $callOptions = []): Target + { + return $this->startApiCall('GetTarget', $request, $callOptions)->wait(); + } + + /** + * Ignores the specified Job in a Rollout. + * + * The async variant is {@see self::ignoreJobAsync()} . + * + * @param IgnoreJobRequest $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 IgnoreJobResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function ignoreJob(IgnoreJobRequest $request, array $callOptions = []): IgnoreJobResponse + { + return $this->startApiCall('IgnoreJob', $request, $callOptions)->wait(); + } + + /** + * Lists DeliveryPipelines in a given project and location. + * + * The async variant is {@see self::listDeliveryPipelinesAsync()} . + * + * @param ListDeliveryPipelinesRequest $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 listDeliveryPipelines(ListDeliveryPipelinesRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListDeliveryPipelines', $request, $callOptions); + } + + /** + * Lists JobRuns in a given project and location. + * + * The async variant is {@see self::listJobRunsAsync()} . + * + * @param ListJobRunsRequest $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 listJobRuns(ListJobRunsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListJobRuns', $request, $callOptions); + } + + /** + * Lists Releases in a given project and location. + * + * The async variant is {@see self::listReleasesAsync()} . + * + * @param ListReleasesRequest $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 listReleases(ListReleasesRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListReleases', $request, $callOptions); + } + + /** + * Lists Rollouts in a given project and location. + * + * The async variant is {@see self::listRolloutsAsync()} . + * + * @param ListRolloutsRequest $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 listRollouts(ListRolloutsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListRollouts', $request, $callOptions); + } + + /** + * Lists Targets in a given project and location. + * + * The async variant is {@see self::listTargetsAsync()} . + * + * @param ListTargetsRequest $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 listTargets(ListTargetsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListTargets', $request, $callOptions); + } + + /** + * Retries the specified Job in a Rollout. + * + * The async variant is {@see self::retryJobAsync()} . + * + * @param RetryJobRequest $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 RetryJobResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function retryJob(RetryJobRequest $request, array $callOptions = []): RetryJobResponse + { + return $this->startApiCall('RetryJob', $request, $callOptions)->wait(); + } + + /** + * Terminates a Job Run in a given project and location. + * + * The async variant is {@see self::terminateJobRunAsync()} . + * + * @param TerminateJobRunRequest $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 TerminateJobRunResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function terminateJobRun(TerminateJobRunRequest $request, array $callOptions = []): TerminateJobRunResponse + { + return $this->startApiCall('TerminateJobRun', $request, $callOptions)->wait(); + } + + /** + * Updates the parameters of a single DeliveryPipeline. + * + * The async variant is {@see self::updateDeliveryPipelineAsync()} . + * + * @param UpdateDeliveryPipelineRequest $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 updateDeliveryPipeline(UpdateDeliveryPipelineRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('UpdateDeliveryPipeline', $request, $callOptions)->wait(); + } + + /** + * Updates the parameters of a single Target. + * + * The async variant is {@see self::updateTargetAsync()} . + * + * @param UpdateTargetRequest $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 updateTarget(UpdateTargetRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('UpdateTarget', $request, $callOptions)->wait(); + } + + /** + * Gets information about a location. + * + * The async variant is {@see self::getLocationAsync()} . + * + * @param GetLocationRequest $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 Location + * + * @throws ApiException Thrown if the API call fails. + */ + public function getLocation(GetLocationRequest $request, array $callOptions = []): Location + { + return $this->startApiCall('GetLocation', $request, $callOptions)->wait(); + } + + /** + * Lists information about the supported locations for this service. + * + * The async variant is {@see self::listLocationsAsync()} . + * + * @param ListLocationsRequest $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 listLocations(ListLocationsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListLocations', $request, $callOptions); + } + + /** + * Gets the access control policy for a resource. Returns an empty policy + if the resource exists and does not have a policy set. + * + * The async variant is {@see self::getIamPolicyAsync()} . + * + * @param GetIamPolicyRequest $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 Policy + * + * @throws ApiException Thrown if the API call fails. + */ + public function getIamPolicy(GetIamPolicyRequest $request, array $callOptions = []): Policy + { + return $this->startApiCall('GetIamPolicy', $request, $callOptions)->wait(); + } + + /** + * Sets the access control policy on the specified resource. Replaces + any existing policy. + + Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` + errors. + * + * The async variant is {@see self::setIamPolicyAsync()} . + * + * @param SetIamPolicyRequest $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 Policy + * + * @throws ApiException Thrown if the API call fails. + */ + public function setIamPolicy(SetIamPolicyRequest $request, array $callOptions = []): Policy + { + return $this->startApiCall('SetIamPolicy', $request, $callOptions)->wait(); + } + + /** + * Returns permissions that a caller has on the specified resource. If the + resource does not exist, this will return an empty set of + permissions, not a `NOT_FOUND` error. + + Note: This operation is designed to be used for building + permission-aware UIs and command-line tools, not for authorization + checking. This operation may "fail open" without warning. + * + * The async variant is {@see self::testIamPermissionsAsync()} . + * + * @param TestIamPermissionsRequest $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 TestIamPermissionsResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function testIamPermissions(TestIamPermissionsRequest $request, array $callOptions = []): TestIamPermissionsResponse + { + return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); + } +} diff --git a/owl-bot-staging/Deploy/v1/src/V1/Client/CloudDeployClient.php b/owl-bot-staging/Deploy/v1/src/V1/Client/CloudDeployClient.php new file mode 100644 index 000000000000..56001b0b4c94 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/src/V1/Client/CloudDeployClient.php @@ -0,0 +1,40 @@ +releaseName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]', '[RELEASE]'); + * $response = $cloudDeployClient->abandonRelease($formattedName); + * } finally { + * $cloudDeployClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + */ +class CloudDeployGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.deploy.v1.CloudDeploy'; + + /** The default address of the service. */ + const SERVICE_ADDRESS = 'clouddeploy.googleapis.com'; + + /** The default port of the service. */ + const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + ]; + + private static $buildNameTemplate; + + private static $clusterNameTemplate; + + private static $configNameTemplate; + + private static $deliveryPipelineNameTemplate; + + private static $jobRunNameTemplate; + + private static $locationNameTemplate; + + private static $membershipNameTemplate; + + private static $releaseNameTemplate; + + private static $rolloutNameTemplate; + + private static $serviceNameTemplate; + + private static $targetNameTemplate; + + private static $workerPoolNameTemplate; + + private static $pathTemplateMap; + + private $operationsClient; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/cloud_deploy_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/cloud_deploy_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/cloud_deploy_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/cloud_deploy_rest_client_config.php', + ], + ], + ]; + } + + private static function getBuildNameTemplate() + { + if (self::$buildNameTemplate == null) { + self::$buildNameTemplate = new PathTemplate('projects/{project}/locations/{location}/builds/{build}'); + } + + return self::$buildNameTemplate; + } + + private static function getClusterNameTemplate() + { + if (self::$clusterNameTemplate == null) { + self::$clusterNameTemplate = new PathTemplate('projects/{project}/locations/{location}/clusters/{cluster}'); + } + + return self::$clusterNameTemplate; + } + + private static function getConfigNameTemplate() + { + if (self::$configNameTemplate == null) { + self::$configNameTemplate = new PathTemplate('projects/{project}/locations/{location}/config'); + } + + return self::$configNameTemplate; + } + + private static function getDeliveryPipelineNameTemplate() + { + if (self::$deliveryPipelineNameTemplate == null) { + self::$deliveryPipelineNameTemplate = new PathTemplate('projects/{project}/locations/{location}/deliveryPipelines/{delivery_pipeline}'); + } + + return self::$deliveryPipelineNameTemplate; + } + + private static function getJobRunNameTemplate() + { + if (self::$jobRunNameTemplate == null) { + self::$jobRunNameTemplate = new PathTemplate('projects/{project}/locations/{location}/deliveryPipelines/{delivery_pipeline}/releases/{release}/rollouts/{rollout}/jobRuns/{job_run}'); + } + + return self::$jobRunNameTemplate; + } + + private static function getLocationNameTemplate() + { + if (self::$locationNameTemplate == null) { + self::$locationNameTemplate = new PathTemplate('projects/{project}/locations/{location}'); + } + + return self::$locationNameTemplate; + } + + private static function getMembershipNameTemplate() + { + if (self::$membershipNameTemplate == null) { + self::$membershipNameTemplate = new PathTemplate('projects/{project}/locations/{location}/memberships/{membership}'); + } + + return self::$membershipNameTemplate; + } + + private static function getReleaseNameTemplate() + { + if (self::$releaseNameTemplate == null) { + self::$releaseNameTemplate = new PathTemplate('projects/{project}/locations/{location}/deliveryPipelines/{delivery_pipeline}/releases/{release}'); + } + + return self::$releaseNameTemplate; + } + + private static function getRolloutNameTemplate() + { + if (self::$rolloutNameTemplate == null) { + self::$rolloutNameTemplate = new PathTemplate('projects/{project}/locations/{location}/deliveryPipelines/{delivery_pipeline}/releases/{release}/rollouts/{rollout}'); + } + + return self::$rolloutNameTemplate; + } + + private static function getServiceNameTemplate() + { + if (self::$serviceNameTemplate == null) { + self::$serviceNameTemplate = new PathTemplate('projects/{project}/locations/{location}/services/{service}'); + } + + return self::$serviceNameTemplate; + } + + private static function getTargetNameTemplate() + { + if (self::$targetNameTemplate == null) { + self::$targetNameTemplate = new PathTemplate('projects/{project}/locations/{location}/targets/{target}'); + } + + return self::$targetNameTemplate; + } + + private static function getWorkerPoolNameTemplate() + { + if (self::$workerPoolNameTemplate == null) { + self::$workerPoolNameTemplate = new PathTemplate('projects/{project}/locations/{location}/workerPools/{worker_pool}'); + } + + return self::$workerPoolNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'build' => self::getBuildNameTemplate(), + 'cluster' => self::getClusterNameTemplate(), + 'config' => self::getConfigNameTemplate(), + 'deliveryPipeline' => self::getDeliveryPipelineNameTemplate(), + 'jobRun' => self::getJobRunNameTemplate(), + 'location' => self::getLocationNameTemplate(), + 'membership' => self::getMembershipNameTemplate(), + 'release' => self::getReleaseNameTemplate(), + 'rollout' => self::getRolloutNameTemplate(), + 'service' => self::getServiceNameTemplate(), + 'target' => self::getTargetNameTemplate(), + 'workerPool' => self::getWorkerPoolNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a build + * resource. + * + * @param string $project + * @param string $location + * @param string $build + * + * @return string The formatted build resource. + */ + public static function buildName($project, $location, $build) + { + return self::getBuildNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'build' => $build, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a cluster + * resource. + * + * @param string $project + * @param string $location + * @param string $cluster + * + * @return string The formatted cluster resource. + */ + public static function clusterName($project, $location, $cluster) + { + return self::getClusterNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'cluster' => $cluster, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a config + * resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted config resource. + */ + public static function configName($project, $location) + { + return self::getConfigNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * delivery_pipeline resource. + * + * @param string $project + * @param string $location + * @param string $deliveryPipeline + * + * @return string The formatted delivery_pipeline resource. + */ + public static function deliveryPipelineName($project, $location, $deliveryPipeline) + { + return self::getDeliveryPipelineNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'delivery_pipeline' => $deliveryPipeline, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a job_run + * resource. + * + * @param string $project + * @param string $location + * @param string $deliveryPipeline + * @param string $release + * @param string $rollout + * @param string $jobRun + * + * @return string The formatted job_run resource. + */ + public static function jobRunName($project, $location, $deliveryPipeline, $release, $rollout, $jobRun) + { + return self::getJobRunNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'delivery_pipeline' => $deliveryPipeline, + 'release' => $release, + 'rollout' => $rollout, + 'job_run' => $jobRun, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a location + * resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted location resource. + */ + public static function locationName($project, $location) + { + return self::getLocationNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a membership + * resource. + * + * @param string $project + * @param string $location + * @param string $membership + * + * @return string The formatted membership resource. + */ + public static function membershipName($project, $location, $membership) + { + return self::getMembershipNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'membership' => $membership, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a release + * resource. + * + * @param string $project + * @param string $location + * @param string $deliveryPipeline + * @param string $release + * + * @return string The formatted release resource. + */ + public static function releaseName($project, $location, $deliveryPipeline, $release) + { + return self::getReleaseNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'delivery_pipeline' => $deliveryPipeline, + 'release' => $release, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a rollout + * resource. + * + * @param string $project + * @param string $location + * @param string $deliveryPipeline + * @param string $release + * @param string $rollout + * + * @return string The formatted rollout resource. + */ + public static function rolloutName($project, $location, $deliveryPipeline, $release, $rollout) + { + return self::getRolloutNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'delivery_pipeline' => $deliveryPipeline, + 'release' => $release, + 'rollout' => $rollout, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a service + * resource. + * + * @param string $project + * @param string $location + * @param string $service + * + * @return string The formatted service resource. + */ + public static function serviceName($project, $location, $service) + { + return self::getServiceNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'service' => $service, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a target + * resource. + * + * @param string $project + * @param string $location + * @param string $target + * + * @return string The formatted target resource. + */ + public static function targetName($project, $location, $target) + { + return self::getTargetNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'target' => $target, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a worker_pool + * resource. + * + * @param string $project + * @param string $location + * @param string $workerPool + * + * @return string The formatted worker_pool resource. + */ + public static function workerPoolName($project, $location, $workerPool) + { + return self::getWorkerPoolNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'worker_pool' => $workerPool, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - build: projects/{project}/locations/{location}/builds/{build} + * - cluster: projects/{project}/locations/{location}/clusters/{cluster} + * - config: projects/{project}/locations/{location}/config + * - deliveryPipeline: projects/{project}/locations/{location}/deliveryPipelines/{delivery_pipeline} + * - jobRun: projects/{project}/locations/{location}/deliveryPipelines/{delivery_pipeline}/releases/{release}/rollouts/{rollout}/jobRuns/{job_run} + * - location: projects/{project}/locations/{location} + * - membership: projects/{project}/locations/{location}/memberships/{membership} + * - release: projects/{project}/locations/{location}/deliveryPipelines/{delivery_pipeline}/releases/{release} + * - rollout: projects/{project}/locations/{location}/deliveryPipelines/{delivery_pipeline}/releases/{release}/rollouts/{rollout} + * - service: projects/{project}/locations/{location}/services/{service} + * - target: projects/{project}/locations/{location}/targets/{target} + * - workerPool: projects/{project}/locations/{location}/workerPools/{worker_pool} + * + * 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($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * 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; + } + + /** + * 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 'clouddeploy.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. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *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' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods 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); + } + + /** + * Abandons a Release in the Delivery Pipeline. + * + * Sample code: + * ``` + * $cloudDeployClient = new CloudDeployClient(); + * try { + * $formattedName = $cloudDeployClient->releaseName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]', '[RELEASE]'); + * $response = $cloudDeployClient->abandonRelease($formattedName); + * } finally { + * $cloudDeployClient->close(); + * } + * ``` + * + * @param string $name Required. Name of the Release. Format is + * projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/ + * releases/{release}. + * @param array $optionalArgs { + * 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 \Google\Cloud\Deploy\V1\AbandonReleaseResponse + * + * @throws ApiException if the remote call fails + */ + public function abandonRelease($name, array $optionalArgs = []) + { + $request = new AbandonReleaseRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('AbandonRelease', AbandonReleaseResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Advances a Rollout in a given project and location. + * + * Sample code: + * ``` + * $cloudDeployClient = new CloudDeployClient(); + * try { + * $formattedName = $cloudDeployClient->rolloutName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]', '[RELEASE]', '[ROLLOUT]'); + * $phaseId = 'phase_id'; + * $response = $cloudDeployClient->advanceRollout($formattedName, $phaseId); + * } finally { + * $cloudDeployClient->close(); + * } + * ``` + * + * @param string $name Required. Name of the Rollout. Format is + * projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/ + * releases/{release}/rollouts/{rollout}. + * @param string $phaseId Required. The phase ID to advance the `Rollout` to. + * @param array $optionalArgs { + * 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 \Google\Cloud\Deploy\V1\AdvanceRolloutResponse + * + * @throws ApiException if the remote call fails + */ + public function advanceRollout($name, $phaseId, array $optionalArgs = []) + { + $request = new AdvanceRolloutRequest(); + $requestParamHeaders = []; + $request->setName($name); + $request->setPhaseId($phaseId); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('AdvanceRollout', AdvanceRolloutResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Approves a Rollout. + * + * Sample code: + * ``` + * $cloudDeployClient = new CloudDeployClient(); + * try { + * $formattedName = $cloudDeployClient->rolloutName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]', '[RELEASE]', '[ROLLOUT]'); + * $approved = false; + * $response = $cloudDeployClient->approveRollout($formattedName, $approved); + * } finally { + * $cloudDeployClient->close(); + * } + * ``` + * + * @param string $name Required. Name of the Rollout. Format is + * projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/ + * releases/{release}/rollouts/{rollout}. + * @param bool $approved Required. True = approve; false = reject + * @param array $optionalArgs { + * 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 \Google\Cloud\Deploy\V1\ApproveRolloutResponse + * + * @throws ApiException if the remote call fails + */ + public function approveRollout($name, $approved, array $optionalArgs = []) + { + $request = new ApproveRolloutRequest(); + $requestParamHeaders = []; + $request->setName($name); + $request->setApproved($approved); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('ApproveRollout', ApproveRolloutResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Cancels a Rollout in a given project and location. + * + * Sample code: + * ``` + * $cloudDeployClient = new CloudDeployClient(); + * try { + * $formattedName = $cloudDeployClient->rolloutName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]', '[RELEASE]', '[ROLLOUT]'); + * $response = $cloudDeployClient->cancelRollout($formattedName); + * } finally { + * $cloudDeployClient->close(); + * } + * ``` + * + * @param string $name Required. Name of the Rollout. Format is + * projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/ + * releases/{release}/rollouts/{rollout}. + * @param array $optionalArgs { + * 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 \Google\Cloud\Deploy\V1\CancelRolloutResponse + * + * @throws ApiException if the remote call fails + */ + public function cancelRollout($name, array $optionalArgs = []) + { + $request = new CancelRolloutRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('CancelRollout', CancelRolloutResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Creates a new DeliveryPipeline in a given project and location. + * + * Sample code: + * ``` + * $cloudDeployClient = new CloudDeployClient(); + * try { + * $formattedParent = $cloudDeployClient->locationName('[PROJECT]', '[LOCATION]'); + * $deliveryPipelineId = 'delivery_pipeline_id'; + * $deliveryPipeline = new DeliveryPipeline(); + * $operationResponse = $cloudDeployClient->createDeliveryPipeline($formattedParent, $deliveryPipelineId, $deliveryPipeline); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $cloudDeployClient->createDeliveryPipeline($formattedParent, $deliveryPipelineId, $deliveryPipeline); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $cloudDeployClient->resumeOperation($operationName, 'createDeliveryPipeline'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $cloudDeployClient->close(); + * } + * ``` + * + * @param string $parent Required. The parent collection in which the `DeliveryPipeline` should be + * created. Format should be projects/{project_id}/locations/{location_name}. + * @param string $deliveryPipelineId Required. ID of the `DeliveryPipeline`. + * @param DeliveryPipeline $deliveryPipeline Required. The `DeliveryPipeline` to create. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validateOnly + * Optional. If set to true, the request is validated and the user is provided + * with an expected result, but no actual change is made. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function createDeliveryPipeline($parent, $deliveryPipelineId, $deliveryPipeline, array $optionalArgs = []) + { + $request = new CreateDeliveryPipelineRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setDeliveryPipelineId($deliveryPipelineId); + $request->setDeliveryPipeline($deliveryPipeline); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + if (isset($optionalArgs['validateOnly'])) { + $request->setValidateOnly($optionalArgs['validateOnly']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateDeliveryPipeline', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Creates a new Release in a given project and location. + * + * Sample code: + * ``` + * $cloudDeployClient = new CloudDeployClient(); + * try { + * $formattedParent = $cloudDeployClient->deliveryPipelineName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]'); + * $releaseId = 'release_id'; + * $release = new Release(); + * $operationResponse = $cloudDeployClient->createRelease($formattedParent, $releaseId, $release); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $cloudDeployClient->createRelease($formattedParent, $releaseId, $release); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $cloudDeployClient->resumeOperation($operationName, 'createRelease'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $cloudDeployClient->close(); + * } + * ``` + * + * @param string $parent Required. The parent collection in which the `Release` should be created. + * Format should be + * projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}. + * @param string $releaseId Required. ID of the `Release`. + * @param Release $release Required. The `Release` to create. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validateOnly + * Optional. If set to true, the request is validated and the user is provided + * with an expected result, but no actual change is made. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function createRelease($parent, $releaseId, $release, array $optionalArgs = []) + { + $request = new CreateReleaseRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setReleaseId($releaseId); + $request->setRelease($release); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + if (isset($optionalArgs['validateOnly'])) { + $request->setValidateOnly($optionalArgs['validateOnly']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateRelease', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Creates a new Rollout in a given project and location. + * + * Sample code: + * ``` + * $cloudDeployClient = new CloudDeployClient(); + * try { + * $formattedParent = $cloudDeployClient->releaseName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]', '[RELEASE]'); + * $rolloutId = 'rollout_id'; + * $rollout = new Rollout(); + * $operationResponse = $cloudDeployClient->createRollout($formattedParent, $rolloutId, $rollout); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $cloudDeployClient->createRollout($formattedParent, $rolloutId, $rollout); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $cloudDeployClient->resumeOperation($operationName, 'createRollout'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $cloudDeployClient->close(); + * } + * ``` + * + * @param string $parent Required. The parent collection in which the `Rollout` should be created. + * Format should be + * projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}/releases/{release_name}. + * @param string $rolloutId Required. ID of the `Rollout`. + * @param Rollout $rollout Required. The `Rollout` to create. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validateOnly + * Optional. If set to true, the request is validated and the user is provided + * with an expected result, but no actual change is made. + * @type string $startingPhaseId + * Optional. The starting phase ID for the `Rollout`. If empty the `Rollout` + * will start at the first phase. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function createRollout($parent, $rolloutId, $rollout, array $optionalArgs = []) + { + $request = new CreateRolloutRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setRolloutId($rolloutId); + $request->setRollout($rollout); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + if (isset($optionalArgs['validateOnly'])) { + $request->setValidateOnly($optionalArgs['validateOnly']); + } + + if (isset($optionalArgs['startingPhaseId'])) { + $request->setStartingPhaseId($optionalArgs['startingPhaseId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateRollout', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Creates a new Target in a given project and location. + * + * Sample code: + * ``` + * $cloudDeployClient = new CloudDeployClient(); + * try { + * $formattedParent = $cloudDeployClient->locationName('[PROJECT]', '[LOCATION]'); + * $targetId = 'target_id'; + * $target = new Target(); + * $operationResponse = $cloudDeployClient->createTarget($formattedParent, $targetId, $target); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $cloudDeployClient->createTarget($formattedParent, $targetId, $target); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $cloudDeployClient->resumeOperation($operationName, 'createTarget'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $cloudDeployClient->close(); + * } + * ``` + * + * @param string $parent Required. The parent collection in which the `Target` should be created. + * Format should be + * projects/{project_id}/locations/{location_name}. + * @param string $targetId Required. ID of the `Target`. + * @param Target $target Required. The `Target` to create. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validateOnly + * Optional. If set to true, the request is validated and the user is provided + * with an expected result, but no actual change is made. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function createTarget($parent, $targetId, $target, array $optionalArgs = []) + { + $request = new CreateTargetRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setTargetId($targetId); + $request->setTarget($target); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + if (isset($optionalArgs['validateOnly'])) { + $request->setValidateOnly($optionalArgs['validateOnly']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateTarget', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Deletes a single DeliveryPipeline. + * + * Sample code: + * ``` + * $cloudDeployClient = new CloudDeployClient(); + * try { + * $formattedName = $cloudDeployClient->deliveryPipelineName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]'); + * $operationResponse = $cloudDeployClient->deleteDeliveryPipeline($formattedName); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $cloudDeployClient->deleteDeliveryPipeline($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $cloudDeployClient->resumeOperation($operationName, 'deleteDeliveryPipeline'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $cloudDeployClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the `DeliveryPipeline` to delete. Format should be + * projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $allowMissing + * Optional. If set to true, then deleting an already deleted or non-existing + * `DeliveryPipeline` will succeed. + * @type bool $validateOnly + * Optional. If set, validate the request and preview the review, but do not + * actually post it. + * @type bool $force + * Optional. If set to true, all child resources under this pipeline will also + * be deleted. Otherwise, the request will only work if the pipeline has no + * child resources. + * @type string $etag + * Optional. This checksum is computed by the server based on the value of + * other fields, and may be sent on update and delete requests to ensure the + * client has an up-to-date value before proceeding. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function deleteDeliveryPipeline($name, array $optionalArgs = []) + { + $request = new DeleteDeliveryPipelineRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + if (isset($optionalArgs['allowMissing'])) { + $request->setAllowMissing($optionalArgs['allowMissing']); + } + + if (isset($optionalArgs['validateOnly'])) { + $request->setValidateOnly($optionalArgs['validateOnly']); + } + + if (isset($optionalArgs['force'])) { + $request->setForce($optionalArgs['force']); + } + + if (isset($optionalArgs['etag'])) { + $request->setEtag($optionalArgs['etag']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('DeleteDeliveryPipeline', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Deletes a single Target. + * + * Sample code: + * ``` + * $cloudDeployClient = new CloudDeployClient(); + * try { + * $formattedName = $cloudDeployClient->targetName('[PROJECT]', '[LOCATION]', '[TARGET]'); + * $operationResponse = $cloudDeployClient->deleteTarget($formattedName); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $cloudDeployClient->deleteTarget($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $cloudDeployClient->resumeOperation($operationName, 'deleteTarget'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $cloudDeployClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the `Target` to delete. Format should be + * projects/{project_id}/locations/{location_name}/targets/{target_name}. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $allowMissing + * Optional. If set to true, then deleting an already deleted or non-existing + * DeliveryPipeline will succeed. + * @type bool $validateOnly + * Optional. If set, validate the request and preview the review, but do not + * actually post it. + * @type string $etag + * Optional. This checksum is computed by the server based on the value of + * other fields, and may be sent on update and delete requests to ensure the + * client has an up-to-date value before proceeding. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function deleteTarget($name, array $optionalArgs = []) + { + $request = new DeleteTargetRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + if (isset($optionalArgs['allowMissing'])) { + $request->setAllowMissing($optionalArgs['allowMissing']); + } + + if (isset($optionalArgs['validateOnly'])) { + $request->setValidateOnly($optionalArgs['validateOnly']); + } + + if (isset($optionalArgs['etag'])) { + $request->setEtag($optionalArgs['etag']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('DeleteTarget', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Gets the configuration for a location. + * + * Sample code: + * ``` + * $cloudDeployClient = new CloudDeployClient(); + * try { + * $formattedName = $cloudDeployClient->configName('[PROJECT]', '[LOCATION]'); + * $response = $cloudDeployClient->getConfig($formattedName); + * } finally { + * $cloudDeployClient->close(); + * } + * ``` + * + * @param string $name Required. Name of requested configuration. + * @param array $optionalArgs { + * 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 \Google\Cloud\Deploy\V1\Config + * + * @throws ApiException if the remote call fails + */ + public function getConfig($name, array $optionalArgs = []) + { + $request = new GetConfigRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetConfig', Config::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets details of a single DeliveryPipeline. + * + * Sample code: + * ``` + * $cloudDeployClient = new CloudDeployClient(); + * try { + * $formattedName = $cloudDeployClient->deliveryPipelineName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]'); + * $response = $cloudDeployClient->getDeliveryPipeline($formattedName); + * } finally { + * $cloudDeployClient->close(); + * } + * ``` + * + * @param string $name Required. Name of the `DeliveryPipeline`. Format must be + * projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}. + * @param array $optionalArgs { + * 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 \Google\Cloud\Deploy\V1\DeliveryPipeline + * + * @throws ApiException if the remote call fails + */ + public function getDeliveryPipeline($name, array $optionalArgs = []) + { + $request = new GetDeliveryPipelineRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetDeliveryPipeline', DeliveryPipeline::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets details of a single JobRun. + * + * Sample code: + * ``` + * $cloudDeployClient = new CloudDeployClient(); + * try { + * $formattedName = $cloudDeployClient->jobRunName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]', '[RELEASE]', '[ROLLOUT]', '[JOB_RUN]'); + * $response = $cloudDeployClient->getJobRun($formattedName); + * } finally { + * $cloudDeployClient->close(); + * } + * ``` + * + * @param string $name Required. Name of the `JobRun`. Format must be + * projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}/releases/{release_name}/rollouts/{rollout_name}/jobRuns/{job_run_name}. + * @param array $optionalArgs { + * 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 \Google\Cloud\Deploy\V1\JobRun + * + * @throws ApiException if the remote call fails + */ + public function getJobRun($name, array $optionalArgs = []) + { + $request = new GetJobRunRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetJobRun', JobRun::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets details of a single Release. + * + * Sample code: + * ``` + * $cloudDeployClient = new CloudDeployClient(); + * try { + * $formattedName = $cloudDeployClient->releaseName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]', '[RELEASE]'); + * $response = $cloudDeployClient->getRelease($formattedName); + * } finally { + * $cloudDeployClient->close(); + * } + * ``` + * + * @param string $name Required. Name of the `Release`. Format must be + * projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}/releases/{release_name}. + * @param array $optionalArgs { + * 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 \Google\Cloud\Deploy\V1\Release + * + * @throws ApiException if the remote call fails + */ + public function getRelease($name, array $optionalArgs = []) + { + $request = new GetReleaseRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetRelease', Release::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets details of a single Rollout. + * + * Sample code: + * ``` + * $cloudDeployClient = new CloudDeployClient(); + * try { + * $formattedName = $cloudDeployClient->rolloutName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]', '[RELEASE]', '[ROLLOUT]'); + * $response = $cloudDeployClient->getRollout($formattedName); + * } finally { + * $cloudDeployClient->close(); + * } + * ``` + * + * @param string $name Required. Name of the `Rollout`. Format must be + * projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}/releases/{release_name}/rollouts/{rollout_name}. + * @param array $optionalArgs { + * 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 \Google\Cloud\Deploy\V1\Rollout + * + * @throws ApiException if the remote call fails + */ + public function getRollout($name, array $optionalArgs = []) + { + $request = new GetRolloutRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetRollout', Rollout::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets details of a single Target. + * + * Sample code: + * ``` + * $cloudDeployClient = new CloudDeployClient(); + * try { + * $formattedName = $cloudDeployClient->targetName('[PROJECT]', '[LOCATION]', '[TARGET]'); + * $response = $cloudDeployClient->getTarget($formattedName); + * } finally { + * $cloudDeployClient->close(); + * } + * ``` + * + * @param string $name Required. Name of the `Target`. Format must be + * projects/{project_id}/locations/{location_name}/targets/{target_name}. + * @param array $optionalArgs { + * 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 \Google\Cloud\Deploy\V1\Target + * + * @throws ApiException if the remote call fails + */ + public function getTarget($name, array $optionalArgs = []) + { + $request = new GetTargetRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetTarget', Target::class, $optionalArgs, $request)->wait(); + } + + /** + * Ignores the specified Job in a Rollout. + * + * Sample code: + * ``` + * $cloudDeployClient = new CloudDeployClient(); + * try { + * $formattedRollout = $cloudDeployClient->rolloutName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]', '[RELEASE]', '[ROLLOUT]'); + * $phaseId = 'phase_id'; + * $jobId = 'job_id'; + * $response = $cloudDeployClient->ignoreJob($formattedRollout, $phaseId, $jobId); + * } finally { + * $cloudDeployClient->close(); + * } + * ``` + * + * @param string $rollout Required. Name of the Rollout. Format is + * projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/ + * releases/{release}/rollouts/{rollout}. + * @param string $phaseId Required. The phase ID the Job to ignore belongs to. + * @param string $jobId Required. The job ID for the Job to ignore. + * @param array $optionalArgs { + * 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 \Google\Cloud\Deploy\V1\IgnoreJobResponse + * + * @throws ApiException if the remote call fails + */ + public function ignoreJob($rollout, $phaseId, $jobId, array $optionalArgs = []) + { + $request = new IgnoreJobRequest(); + $requestParamHeaders = []; + $request->setRollout($rollout); + $request->setPhaseId($phaseId); + $request->setJobId($jobId); + $requestParamHeaders['rollout'] = $rollout; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('IgnoreJob', IgnoreJobResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Lists DeliveryPipelines in a given project and location. + * + * Sample code: + * ``` + * $cloudDeployClient = new CloudDeployClient(); + * try { + * $formattedParent = $cloudDeployClient->locationName('[PROJECT]', '[LOCATION]'); + * // Iterate over pages of elements + * $pagedResponse = $cloudDeployClient->listDeliveryPipelines($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $cloudDeployClient->listDeliveryPipelines($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $cloudDeployClient->close(); + * } + * ``` + * + * @param string $parent Required. The parent, which owns this collection of pipelines. Format must + * be projects/{project_id}/locations/{location_name}. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type string $filter + * Filter pipelines to be returned. See https://google.aip.dev/160 for more + * details. + * @type string $orderBy + * Field to sort by. See https://google.aip.dev/132#ordering for more details. + * @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 \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listDeliveryPipelines($parent, array $optionalArgs = []) + { + $request = new ListDeliveryPipelinesRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListDeliveryPipelines', $optionalArgs, ListDeliveryPipelinesResponse::class, $request); + } + + /** + * Lists JobRuns in a given project and location. + * + * Sample code: + * ``` + * $cloudDeployClient = new CloudDeployClient(); + * try { + * $formattedParent = $cloudDeployClient->rolloutName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]', '[RELEASE]', '[ROLLOUT]'); + * // Iterate over pages of elements + * $pagedResponse = $cloudDeployClient->listJobRuns($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $cloudDeployClient->listJobRuns($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $cloudDeployClient->close(); + * } + * ``` + * + * @param string $parent Required. The `Rollout` which owns this collection of `JobRun` objects. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type string $filter + * Optional. Filter results to be returned. See https://google.aip.dev/160 for + * more details. + * @type string $orderBy + * Optional. Field to sort by. See https://google.aip.dev/132#ordering for + * more details. + * @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 \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listJobRuns($parent, array $optionalArgs = []) + { + $request = new ListJobRunsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListJobRuns', $optionalArgs, ListJobRunsResponse::class, $request); + } + + /** + * Lists Releases in a given project and location. + * + * Sample code: + * ``` + * $cloudDeployClient = new CloudDeployClient(); + * try { + * $formattedParent = $cloudDeployClient->deliveryPipelineName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]'); + * // Iterate over pages of elements + * $pagedResponse = $cloudDeployClient->listReleases($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $cloudDeployClient->listReleases($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $cloudDeployClient->close(); + * } + * ``` + * + * @param string $parent Required. The `DeliveryPipeline` which owns this collection of `Release` + * objects. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type string $filter + * Optional. Filter releases to be returned. See https://google.aip.dev/160 + * for more details. + * @type string $orderBy + * Optional. Field to sort by. See https://google.aip.dev/132#ordering for + * more details. + * @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 \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listReleases($parent, array $optionalArgs = []) + { + $request = new ListReleasesRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListReleases', $optionalArgs, ListReleasesResponse::class, $request); + } + + /** + * Lists Rollouts in a given project and location. + * + * Sample code: + * ``` + * $cloudDeployClient = new CloudDeployClient(); + * try { + * $formattedParent = $cloudDeployClient->releaseName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]', '[RELEASE]'); + * // Iterate over pages of elements + * $pagedResponse = $cloudDeployClient->listRollouts($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $cloudDeployClient->listRollouts($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $cloudDeployClient->close(); + * } + * ``` + * + * @param string $parent Required. The `Release` which owns this collection of `Rollout` objects. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type string $filter + * Optional. Filter rollouts to be returned. See https://google.aip.dev/160 + * for more details. + * @type string $orderBy + * Optional. Field to sort by. See https://google.aip.dev/132#ordering for + * more details. + * @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 \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listRollouts($parent, array $optionalArgs = []) + { + $request = new ListRolloutsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListRollouts', $optionalArgs, ListRolloutsResponse::class, $request); + } + + /** + * Lists Targets in a given project and location. + * + * Sample code: + * ``` + * $cloudDeployClient = new CloudDeployClient(); + * try { + * $formattedParent = $cloudDeployClient->locationName('[PROJECT]', '[LOCATION]'); + * // Iterate over pages of elements + * $pagedResponse = $cloudDeployClient->listTargets($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $cloudDeployClient->listTargets($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $cloudDeployClient->close(); + * } + * ``` + * + * @param string $parent Required. The parent, which owns this collection of targets. Format must be + * projects/{project_id}/locations/{location_name}. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type string $filter + * Optional. Filter targets to be returned. See https://google.aip.dev/160 for + * more details. + * @type string $orderBy + * Optional. Field to sort by. See https://google.aip.dev/132#ordering for + * more details. + * @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 \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listTargets($parent, array $optionalArgs = []) + { + $request = new ListTargetsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListTargets', $optionalArgs, ListTargetsResponse::class, $request); + } + + /** + * Retries the specified Job in a Rollout. + * + * Sample code: + * ``` + * $cloudDeployClient = new CloudDeployClient(); + * try { + * $formattedRollout = $cloudDeployClient->rolloutName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]', '[RELEASE]', '[ROLLOUT]'); + * $phaseId = 'phase_id'; + * $jobId = 'job_id'; + * $response = $cloudDeployClient->retryJob($formattedRollout, $phaseId, $jobId); + * } finally { + * $cloudDeployClient->close(); + * } + * ``` + * + * @param string $rollout Required. Name of the Rollout. Format is + * projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/ + * releases/{release}/rollouts/{rollout}. + * @param string $phaseId Required. The phase ID the Job to retry belongs to. + * @param string $jobId Required. The job ID for the Job to retry. + * @param array $optionalArgs { + * 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 \Google\Cloud\Deploy\V1\RetryJobResponse + * + * @throws ApiException if the remote call fails + */ + public function retryJob($rollout, $phaseId, $jobId, array $optionalArgs = []) + { + $request = new RetryJobRequest(); + $requestParamHeaders = []; + $request->setRollout($rollout); + $request->setPhaseId($phaseId); + $request->setJobId($jobId); + $requestParamHeaders['rollout'] = $rollout; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('RetryJob', RetryJobResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Terminates a Job Run in a given project and location. + * + * Sample code: + * ``` + * $cloudDeployClient = new CloudDeployClient(); + * try { + * $formattedName = $cloudDeployClient->jobRunName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]', '[RELEASE]', '[ROLLOUT]', '[JOB_RUN]'); + * $response = $cloudDeployClient->terminateJobRun($formattedName); + * } finally { + * $cloudDeployClient->close(); + * } + * ``` + * + * @param string $name Required. Name of the `JobRun`. Format must be + * projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/ + * releases/{release}/rollouts/{rollout}/jobRuns/{jobRun}. + * @param array $optionalArgs { + * 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 \Google\Cloud\Deploy\V1\TerminateJobRunResponse + * + * @throws ApiException if the remote call fails + */ + public function terminateJobRun($name, array $optionalArgs = []) + { + $request = new TerminateJobRunRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('TerminateJobRun', TerminateJobRunResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Updates the parameters of a single DeliveryPipeline. + * + * Sample code: + * ``` + * $cloudDeployClient = new CloudDeployClient(); + * try { + * $updateMask = new FieldMask(); + * $deliveryPipeline = new DeliveryPipeline(); + * $operationResponse = $cloudDeployClient->updateDeliveryPipeline($updateMask, $deliveryPipeline); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $cloudDeployClient->updateDeliveryPipeline($updateMask, $deliveryPipeline); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $cloudDeployClient->resumeOperation($operationName, 'updateDeliveryPipeline'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $cloudDeployClient->close(); + * } + * ``` + * + * @param FieldMask $updateMask Required. Field mask is used to specify the fields to be overwritten in the + * `DeliveryPipeline` resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @param DeliveryPipeline $deliveryPipeline Required. The `DeliveryPipeline` to update. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $allowMissing + * Optional. If set to true, updating a `DeliveryPipeline` that does not exist + * will result in the creation of a new `DeliveryPipeline`. + * @type bool $validateOnly + * Optional. If set to true, the request is validated and the user is provided + * with an expected result, but no actual change is made. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function updateDeliveryPipeline($updateMask, $deliveryPipeline, array $optionalArgs = []) + { + $request = new UpdateDeliveryPipelineRequest(); + $requestParamHeaders = []; + $request->setUpdateMask($updateMask); + $request->setDeliveryPipeline($deliveryPipeline); + $requestParamHeaders['delivery_pipeline.name'] = $deliveryPipeline->getName(); + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + if (isset($optionalArgs['allowMissing'])) { + $request->setAllowMissing($optionalArgs['allowMissing']); + } + + if (isset($optionalArgs['validateOnly'])) { + $request->setValidateOnly($optionalArgs['validateOnly']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('UpdateDeliveryPipeline', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Updates the parameters of a single Target. + * + * Sample code: + * ``` + * $cloudDeployClient = new CloudDeployClient(); + * try { + * $updateMask = new FieldMask(); + * $target = new Target(); + * $operationResponse = $cloudDeployClient->updateTarget($updateMask, $target); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $cloudDeployClient->updateTarget($updateMask, $target); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $cloudDeployClient->resumeOperation($operationName, 'updateTarget'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $cloudDeployClient->close(); + * } + * ``` + * + * @param FieldMask $updateMask Required. Field mask is used to specify the fields to be overwritten in the + * Target resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @param Target $target Required. The `Target` to update. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $allowMissing + * Optional. If set to true, updating a `Target` that does not exist will + * result in the creation of a new `Target`. + * @type bool $validateOnly + * Optional. If set to true, the request is validated and the user is provided + * with an expected result, but no actual change is made. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function updateTarget($updateMask, $target, array $optionalArgs = []) + { + $request = new UpdateTargetRequest(); + $requestParamHeaders = []; + $request->setUpdateMask($updateMask); + $request->setTarget($target); + $requestParamHeaders['target.name'] = $target->getName(); + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + if (isset($optionalArgs['allowMissing'])) { + $request->setAllowMissing($optionalArgs['allowMissing']); + } + + if (isset($optionalArgs['validateOnly'])) { + $request->setValidateOnly($optionalArgs['validateOnly']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('UpdateTarget', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Gets information about a location. + * + * Sample code: + * ``` + * $cloudDeployClient = new CloudDeployClient(); + * try { + * $response = $cloudDeployClient->getLocation(); + * } finally { + * $cloudDeployClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * Resource name for the location. + * @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 \Google\Cloud\Location\Location + * + * @throws ApiException if the remote call fails + */ + public function getLocation(array $optionalArgs = []) + { + $request = new GetLocationRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetLocation', Location::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.cloud.location.Locations')->wait(); + } + + /** + * Lists information about the supported locations for this service. + * + * Sample code: + * ``` + * $cloudDeployClient = new CloudDeployClient(); + * try { + * // Iterate over pages of elements + * $pagedResponse = $cloudDeployClient->listLocations(); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $cloudDeployClient->listLocations(); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $cloudDeployClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * The resource that owns the locations collection, if applicable. + * @type string $filter + * The standard list filter. + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @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 \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listLocations(array $optionalArgs = []) + { + $request = new ListLocationsRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListLocations', $optionalArgs, ListLocationsResponse::class, $request, 'google.cloud.location.Locations'); + } + + /** + * Gets the access control policy for a resource. Returns an empty policy + if the resource exists and does not have a policy set. + * + * Sample code: + * ``` + * $cloudDeployClient = new CloudDeployClient(); + * try { + * $resource = 'resource'; + * $response = $cloudDeployClient->getIamPolicy($resource); + * } finally { + * $cloudDeployClient->close(); + * } + * ``` + * + * @param string $resource REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param array $optionalArgs { + * Optional. + * + * @type GetPolicyOptions $options + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. + * @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 \Google\Cloud\Iam\V1\Policy + * + * @throws ApiException if the remote call fails + */ + public function getIamPolicy($resource, array $optionalArgs = []) + { + $request = new GetIamPolicyRequest(); + $requestParamHeaders = []; + $request->setResource($resource); + $requestParamHeaders['resource'] = $resource; + if (isset($optionalArgs['options'])) { + $request->setOptions($optionalArgs['options']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetIamPolicy', Policy::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.iam.v1.IAMPolicy')->wait(); + } + + /** + * Sets the access control policy on the specified resource. Replaces + any existing policy. + + Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` + errors. + * + * Sample code: + * ``` + * $cloudDeployClient = new CloudDeployClient(); + * try { + * $resource = 'resource'; + * $policy = new Policy(); + * $response = $cloudDeployClient->setIamPolicy($resource, $policy); + * } finally { + * $cloudDeployClient->close(); + * } + * ``` + * + * @param string $resource REQUIRED: The resource for which the policy is being specified. + * See the operation documentation for the appropriate value for this field. + * @param Policy $policy REQUIRED: The complete policy to be applied to the `resource`. The size of + * the policy is limited to a few 10s of KB. An empty policy is a + * valid policy but certain Cloud Platform services (such as Projects) + * might reject them. + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only + * the fields in the mask will be modified. If no mask is provided, the + * following default mask is used: + * + * `paths: "bindings, etag"` + * @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 \Google\Cloud\Iam\V1\Policy + * + * @throws ApiException if the remote call fails + */ + public function setIamPolicy($resource, $policy, array $optionalArgs = []) + { + $request = new SetIamPolicyRequest(); + $requestParamHeaders = []; + $request->setResource($resource); + $request->setPolicy($policy); + $requestParamHeaders['resource'] = $resource; + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('SetIamPolicy', Policy::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.iam.v1.IAMPolicy')->wait(); + } + + /** + * Returns permissions that a caller has on the specified resource. If the + resource does not exist, this will return an empty set of + permissions, not a `NOT_FOUND` error. + + Note: This operation is designed to be used for building + permission-aware UIs and command-line tools, not for authorization + checking. This operation may "fail open" without warning. + * + * Sample code: + * ``` + * $cloudDeployClient = new CloudDeployClient(); + * try { + * $resource = 'resource'; + * $permissions = []; + * $response = $cloudDeployClient->testIamPermissions($resource, $permissions); + * } finally { + * $cloudDeployClient->close(); + * } + * ``` + * + * @param string $resource REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param string[] $permissions The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @param array $optionalArgs { + * 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 \Google\Cloud\Iam\V1\TestIamPermissionsResponse + * + * @throws ApiException if the remote call fails + */ + public function testIamPermissions($resource, $permissions, array $optionalArgs = []) + { + $request = new TestIamPermissionsRequest(); + $requestParamHeaders = []; + $request->setResource($resource); + $request->setPermissions($permissions); + $requestParamHeaders['resource'] = $resource; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('TestIamPermissions', TestIamPermissionsResponse::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.iam.v1.IAMPolicy')->wait(); + } +} diff --git a/owl-bot-staging/Deploy/v1/src/V1/gapic_metadata.json b/owl-bot-staging/Deploy/v1/src/V1/gapic_metadata.json new file mode 100644 index 000000000000..e1488c9b4b7c --- /dev/null +++ b/owl-bot-staging/Deploy/v1/src/V1/gapic_metadata.json @@ -0,0 +1,173 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services\/RPCs to the corresponding library clients\/methods", + "language": "php", + "protoPackage": "google.cloud.deploy.v1", + "libraryPackage": "Google\\Cloud\\Deploy\\V1", + "services": { + "CloudDeploy": { + "clients": { + "grpc": { + "libraryClient": "CloudDeployGapicClient", + "rpcs": { + "AbandonRelease": { + "methods": [ + "abandonRelease" + ] + }, + "AdvanceRollout": { + "methods": [ + "advanceRollout" + ] + }, + "ApproveRollout": { + "methods": [ + "approveRollout" + ] + }, + "CancelRollout": { + "methods": [ + "cancelRollout" + ] + }, + "CreateDeliveryPipeline": { + "methods": [ + "createDeliveryPipeline" + ] + }, + "CreateRelease": { + "methods": [ + "createRelease" + ] + }, + "CreateRollout": { + "methods": [ + "createRollout" + ] + }, + "CreateTarget": { + "methods": [ + "createTarget" + ] + }, + "DeleteDeliveryPipeline": { + "methods": [ + "deleteDeliveryPipeline" + ] + }, + "DeleteTarget": { + "methods": [ + "deleteTarget" + ] + }, + "GetConfig": { + "methods": [ + "getConfig" + ] + }, + "GetDeliveryPipeline": { + "methods": [ + "getDeliveryPipeline" + ] + }, + "GetJobRun": { + "methods": [ + "getJobRun" + ] + }, + "GetRelease": { + "methods": [ + "getRelease" + ] + }, + "GetRollout": { + "methods": [ + "getRollout" + ] + }, + "GetTarget": { + "methods": [ + "getTarget" + ] + }, + "IgnoreJob": { + "methods": [ + "ignoreJob" + ] + }, + "ListDeliveryPipelines": { + "methods": [ + "listDeliveryPipelines" + ] + }, + "ListJobRuns": { + "methods": [ + "listJobRuns" + ] + }, + "ListReleases": { + "methods": [ + "listReleases" + ] + }, + "ListRollouts": { + "methods": [ + "listRollouts" + ] + }, + "ListTargets": { + "methods": [ + "listTargets" + ] + }, + "RetryJob": { + "methods": [ + "retryJob" + ] + }, + "TerminateJobRun": { + "methods": [ + "terminateJobRun" + ] + }, + "UpdateDeliveryPipeline": { + "methods": [ + "updateDeliveryPipeline" + ] + }, + "UpdateTarget": { + "methods": [ + "updateTarget" + ] + }, + "GetLocation": { + "methods": [ + "getLocation" + ] + }, + "ListLocations": { + "methods": [ + "listLocations" + ] + }, + "GetIamPolicy": { + "methods": [ + "getIamPolicy" + ] + }, + "SetIamPolicy": { + "methods": [ + "setIamPolicy" + ] + }, + "TestIamPermissions": { + "methods": [ + "testIamPermissions" + ] + } + } + } + } + } + } +} \ No newline at end of file diff --git a/owl-bot-staging/Deploy/v1/src/V1/resources/cloud_deploy_client_config.json b/owl-bot-staging/Deploy/v1/src/V1/resources/cloud_deploy_client_config.json new file mode 100644 index 000000000000..271aff1addc5 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/src/V1/resources/cloud_deploy_client_config.json @@ -0,0 +1,199 @@ +{ + "interfaces": { + "google.cloud.deploy.v1.CloudDeploy": { + "retry_codes": { + "no_retry_codes": [], + "retry_policy_1_codes": [ + "UNAVAILABLE" + ], + "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": 1.3, + "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": { + "AbandonRelease": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "AdvanceRollout": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "ApproveRollout": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "CancelRollout": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "CreateDeliveryPipeline": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "CreateRelease": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "CreateRollout": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "CreateTarget": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "DeleteDeliveryPipeline": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "DeleteTarget": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "GetConfig": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetDeliveryPipeline": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetJobRun": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetRelease": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetRollout": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetTarget": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "IgnoreJob": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "ListDeliveryPipelines": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListJobRuns": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListReleases": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListRollouts": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListTargets": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "RetryJob": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "TerminateJobRun": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "UpdateDeliveryPipeline": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "UpdateTarget": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "GetLocation": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "ListLocations": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "GetIamPolicy": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "SetIamPolicy": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "TestIamPermissions": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + } + } + } + } +} diff --git a/owl-bot-staging/Deploy/v1/src/V1/resources/cloud_deploy_descriptor_config.php b/owl-bot-staging/Deploy/v1/src/V1/resources/cloud_deploy_descriptor_config.php new file mode 100644 index 000000000000..3cad10a76835 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/src/V1/resources/cloud_deploy_descriptor_config.php @@ -0,0 +1,505 @@ + [ + 'google.cloud.deploy.v1.CloudDeploy' => [ + 'CreateDeliveryPipeline' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Deploy\V1\DeliveryPipeline', + 'metadataReturnType' => '\Google\Cloud\Deploy\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'CreateRelease' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Deploy\V1\Release', + 'metadataReturnType' => '\Google\Cloud\Deploy\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'CreateRollout' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Deploy\V1\Rollout', + 'metadataReturnType' => '\Google\Cloud\Deploy\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'CreateTarget' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Deploy\V1\Target', + 'metadataReturnType' => '\Google\Cloud\Deploy\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'DeleteDeliveryPipeline' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\Deploy\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'DeleteTarget' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\Deploy\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'UpdateDeliveryPipeline' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Deploy\V1\DeliveryPipeline', + 'metadataReturnType' => '\Google\Cloud\Deploy\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'delivery_pipeline.name', + 'fieldAccessors' => [ + 'getDeliveryPipeline', + 'getName', + ], + ], + ], + ], + 'UpdateTarget' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Deploy\V1\Target', + 'metadataReturnType' => '\Google\Cloud\Deploy\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'target.name', + 'fieldAccessors' => [ + 'getTarget', + 'getName', + ], + ], + ], + ], + 'AbandonRelease' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Deploy\V1\AbandonReleaseResponse', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'AdvanceRollout' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Deploy\V1\AdvanceRolloutResponse', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'ApproveRollout' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Deploy\V1\ApproveRolloutResponse', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'CancelRollout' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Deploy\V1\CancelRolloutResponse', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetConfig' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Deploy\V1\Config', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetDeliveryPipeline' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Deploy\V1\DeliveryPipeline', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetJobRun' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Deploy\V1\JobRun', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetRelease' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Deploy\V1\Release', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetRollout' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Deploy\V1\Rollout', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetTarget' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Deploy\V1\Target', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'IgnoreJob' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Deploy\V1\IgnoreJobResponse', + 'headerParams' => [ + [ + 'keyName' => 'rollout', + 'fieldAccessors' => [ + 'getRollout', + ], + ], + ], + ], + 'ListDeliveryPipelines' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getDeliveryPipelines', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Deploy\V1\ListDeliveryPipelinesResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListJobRuns' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getJobRuns', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Deploy\V1\ListJobRunsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListReleases' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getReleases', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Deploy\V1\ListReleasesResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListRollouts' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getRollouts', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Deploy\V1\ListRolloutsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListTargets' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getTargets', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Deploy\V1\ListTargetsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'RetryJob' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Deploy\V1\RetryJobResponse', + 'headerParams' => [ + [ + 'keyName' => 'rollout', + 'fieldAccessors' => [ + 'getRollout', + ], + ], + ], + ], + 'TerminateJobRun' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Deploy\V1\TerminateJobRunResponse', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetLocation' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Location\Location', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + 'interfaceOverride' => 'google.cloud.location.Locations', + ], + 'ListLocations' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getLocations', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Location\ListLocationsResponse', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + 'interfaceOverride' => 'google.cloud.location.Locations', + ], + 'GetIamPolicy' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Iam\V1\Policy', + 'headerParams' => [ + [ + 'keyName' => 'resource', + 'fieldAccessors' => [ + 'getResource', + ], + ], + ], + 'interfaceOverride' => 'google.iam.v1.IAMPolicy', + ], + 'SetIamPolicy' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Iam\V1\Policy', + 'headerParams' => [ + [ + 'keyName' => 'resource', + 'fieldAccessors' => [ + 'getResource', + ], + ], + ], + 'interfaceOverride' => 'google.iam.v1.IAMPolicy', + ], + 'TestIamPermissions' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Iam\V1\TestIamPermissionsResponse', + 'headerParams' => [ + [ + 'keyName' => 'resource', + 'fieldAccessors' => [ + 'getResource', + ], + ], + ], + 'interfaceOverride' => 'google.iam.v1.IAMPolicy', + ], + 'templateMap' => [ + 'build' => 'projects/{project}/locations/{location}/builds/{build}', + 'cluster' => 'projects/{project}/locations/{location}/clusters/{cluster}', + 'config' => 'projects/{project}/locations/{location}/config', + 'deliveryPipeline' => 'projects/{project}/locations/{location}/deliveryPipelines/{delivery_pipeline}', + 'jobRun' => 'projects/{project}/locations/{location}/deliveryPipelines/{delivery_pipeline}/releases/{release}/rollouts/{rollout}/jobRuns/{job_run}', + 'location' => 'projects/{project}/locations/{location}', + 'membership' => 'projects/{project}/locations/{location}/memberships/{membership}', + 'release' => 'projects/{project}/locations/{location}/deliveryPipelines/{delivery_pipeline}/releases/{release}', + 'rollout' => 'projects/{project}/locations/{location}/deliveryPipelines/{delivery_pipeline}/releases/{release}/rollouts/{rollout}', + 'service' => 'projects/{project}/locations/{location}/services/{service}', + 'target' => 'projects/{project}/locations/{location}/targets/{target}', + 'workerPool' => 'projects/{project}/locations/{location}/workerPools/{worker_pool}', + ], + ], + ], +]; diff --git a/owl-bot-staging/Deploy/v1/src/V1/resources/cloud_deploy_rest_client_config.php b/owl-bot-staging/Deploy/v1/src/V1/resources/cloud_deploy_rest_client_config.php new file mode 100644 index 000000000000..2e27a1e28f5d --- /dev/null +++ b/owl-bot-staging/Deploy/v1/src/V1/resources/cloud_deploy_rest_client_config.php @@ -0,0 +1,456 @@ + [ + 'google.cloud.deploy.v1.CloudDeploy' => [ + 'AbandonRelease' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/deliveryPipelines/*/releases/*}:abandon', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'AdvanceRollout' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/deliveryPipelines/*/releases/*/rollouts/*}:advance', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ApproveRollout' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/deliveryPipelines/*/releases/*/rollouts/*}:approve', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'CancelRollout' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/deliveryPipelines/*/releases/*/rollouts/*}:cancel', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'CreateDeliveryPipeline' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/deliveryPipelines', + 'body' => 'delivery_pipeline', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'delivery_pipeline_id', + ], + ], + 'CreateRelease' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/deliveryPipelines/*}/releases', + 'body' => 'release', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'release_id', + ], + ], + 'CreateRollout' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/deliveryPipelines/*/releases/*}/rollouts', + 'body' => 'rollout', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'rollout_id', + ], + ], + 'CreateTarget' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/targets', + 'body' => 'target', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'target_id', + ], + ], + 'DeleteDeliveryPipeline' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/deliveryPipelines/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteTarget' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/targets/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetConfig' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/config}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetDeliveryPipeline' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/deliveryPipelines/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetJobRun' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/deliveryPipelines/*/releases/*/rollouts/*/jobRuns/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetRelease' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/deliveryPipelines/*/releases/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetRollout' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/deliveryPipelines/*/releases/*/rollouts/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetTarget' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/targets/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'IgnoreJob' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{rollout=projects/*/locations/*/deliveryPipelines/*/releases/*/rollouts/*}:ignoreJob', + 'body' => '*', + 'placeholders' => [ + 'rollout' => [ + 'getters' => [ + 'getRollout', + ], + ], + ], + ], + 'ListDeliveryPipelines' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/deliveryPipelines', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListJobRuns' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/deliveryPipelines/*/releases/*/rollouts/*}/jobRuns', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListReleases' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/deliveryPipelines/*}/releases', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListRollouts' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/deliveryPipelines/*/releases/*}/rollouts', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListTargets' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/targets', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'RetryJob' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{rollout=projects/*/locations/*/deliveryPipelines/*/releases/*/rollouts/*}:retryJob', + 'body' => '*', + 'placeholders' => [ + 'rollout' => [ + 'getters' => [ + 'getRollout', + ], + ], + ], + ], + 'TerminateJobRun' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/deliveryPipelines/*/releases/*/rollouts/*/jobRuns/*}:terminate', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'UpdateDeliveryPipeline' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{delivery_pipeline.name=projects/*/locations/*/deliveryPipelines/*}', + 'body' => 'delivery_pipeline', + 'placeholders' => [ + 'delivery_pipeline.name' => [ + 'getters' => [ + 'getDeliveryPipeline', + 'getName', + ], + ], + ], + 'queryParams' => [ + 'update_mask', + ], + ], + 'UpdateTarget' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{target.name=projects/*/locations/*/targets/*}', + 'body' => 'target', + 'placeholders' => [ + 'target.name' => [ + 'getters' => [ + 'getTarget', + 'getName', + ], + ], + ], + 'queryParams' => [ + 'update_mask', + ], + ], + ], + 'google.cloud.location.Locations' => [ + 'GetLocation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListLocations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*}/locations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + 'google.iam.v1.IAMPolicy' => [ + 'GetIamPolicy' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/deliveryPipelines/*}:getIamPolicy', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/targets/*}:getIamPolicy', + ], + ], + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + 'SetIamPolicy' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/deliveryPipelines/*}:setIamPolicy', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/targets/*}:setIamPolicy', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + 'TestIamPermissions' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/deliveryPipelines/*}:testIamPermissions', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/targets/*}:testIamPermissions', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + ], + 'google.longrunning.Operations' => [ + 'CancelOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}:cancel', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteOperation' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetOperation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListOperations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*}/operations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/Deploy/v1/tests/Unit/V1/Client/CloudDeployClientTest.php b/owl-bot-staging/Deploy/v1/tests/Unit/V1/Client/CloudDeployClientTest.php new file mode 100644 index 000000000000..5ac54ab9a28d --- /dev/null +++ b/owl-bot-staging/Deploy/v1/tests/Unit/V1/Client/CloudDeployClientTest.php @@ -0,0 +1,2854 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return CloudDeployClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new CloudDeployClient($options); + } + + /** @test */ + public function abandonReleaseTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new AbandonReleaseResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->releaseName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]', '[RELEASE]'); + $request = (new AbandonReleaseRequest()) + ->setName($formattedName); + $response = $gapicClient->abandonRelease($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.deploy.v1.CloudDeploy/AbandonRelease', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function abandonReleaseExceptionTest() + { + $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->releaseName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]', '[RELEASE]'); + $request = (new AbandonReleaseRequest()) + ->setName($formattedName); + try { + $gapicClient->abandonRelease($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 advanceRolloutTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new AdvanceRolloutResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->rolloutName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]', '[RELEASE]', '[ROLLOUT]'); + $phaseId = 'phaseId-1676299681'; + $request = (new AdvanceRolloutRequest()) + ->setName($formattedName) + ->setPhaseId($phaseId); + $response = $gapicClient->advanceRollout($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.deploy.v1.CloudDeploy/AdvanceRollout', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $actualValue = $actualRequestObject->getPhaseId(); + $this->assertProtobufEquals($phaseId, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function advanceRolloutExceptionTest() + { + $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->rolloutName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]', '[RELEASE]', '[ROLLOUT]'); + $phaseId = 'phaseId-1676299681'; + $request = (new AdvanceRolloutRequest()) + ->setName($formattedName) + ->setPhaseId($phaseId); + try { + $gapicClient->advanceRollout($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 approveRolloutTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new ApproveRolloutResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->rolloutName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]', '[RELEASE]', '[ROLLOUT]'); + $approved = false; + $request = (new ApproveRolloutRequest()) + ->setName($formattedName) + ->setApproved($approved); + $response = $gapicClient->approveRollout($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.deploy.v1.CloudDeploy/ApproveRollout', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $actualValue = $actualRequestObject->getApproved(); + $this->assertProtobufEquals($approved, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function approveRolloutExceptionTest() + { + $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->rolloutName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]', '[RELEASE]', '[ROLLOUT]'); + $approved = false; + $request = (new ApproveRolloutRequest()) + ->setName($formattedName) + ->setApproved($approved); + try { + $gapicClient->approveRollout($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 cancelRolloutTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new CancelRolloutResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->rolloutName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]', '[RELEASE]', '[ROLLOUT]'); + $request = (new CancelRolloutRequest()) + ->setName($formattedName); + $response = $gapicClient->cancelRollout($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.deploy.v1.CloudDeploy/CancelRollout', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function cancelRolloutExceptionTest() + { + $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->rolloutName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]', '[RELEASE]', '[ROLLOUT]'); + $request = (new CancelRolloutRequest()) + ->setName($formattedName); + try { + $gapicClient->cancelRollout($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 createDeliveryPipelineTest() + { + $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/createDeliveryPipelineTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $uid = 'uid115792'; + $description = 'description-1724546052'; + $etag = 'etag3123477'; + $suspended = false; + $expectedResponse = new DeliveryPipeline(); + $expectedResponse->setName($name); + $expectedResponse->setUid($uid); + $expectedResponse->setDescription($description); + $expectedResponse->setEtag($etag); + $expectedResponse->setSuspended($suspended); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createDeliveryPipelineTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $deliveryPipelineId = 'deliveryPipelineId1972590605'; + $deliveryPipeline = new DeliveryPipeline(); + $request = (new CreateDeliveryPipelineRequest()) + ->setParent($formattedParent) + ->setDeliveryPipelineId($deliveryPipelineId) + ->setDeliveryPipeline($deliveryPipeline); + $response = $gapicClient->createDeliveryPipeline($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.cloud.deploy.v1.CloudDeploy/CreateDeliveryPipeline', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getDeliveryPipelineId(); + $this->assertProtobufEquals($deliveryPipelineId, $actualValue); + $actualValue = $actualApiRequestObject->getDeliveryPipeline(); + $this->assertProtobufEquals($deliveryPipeline, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createDeliveryPipelineTest'); + $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 createDeliveryPipelineExceptionTest() + { + $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/createDeliveryPipelineTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $deliveryPipelineId = 'deliveryPipelineId1972590605'; + $deliveryPipeline = new DeliveryPipeline(); + $request = (new CreateDeliveryPipelineRequest()) + ->setParent($formattedParent) + ->setDeliveryPipelineId($deliveryPipelineId) + ->setDeliveryPipeline($deliveryPipeline); + $response = $gapicClient->createDeliveryPipeline($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createDeliveryPipelineTest'); + 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 createReleaseTest() + { + $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/createReleaseTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $uid = 'uid115792'; + $description = 'description-1724546052'; + $abandoned = true; + $skaffoldConfigUri = 'skaffoldConfigUri-860592176'; + $skaffoldConfigPath = 'skaffoldConfigPath-908718527'; + $etag = 'etag3123477'; + $skaffoldVersion = 'skaffoldVersion-1146663017'; + $expectedResponse = new Release(); + $expectedResponse->setName($name); + $expectedResponse->setUid($uid); + $expectedResponse->setDescription($description); + $expectedResponse->setAbandoned($abandoned); + $expectedResponse->setSkaffoldConfigUri($skaffoldConfigUri); + $expectedResponse->setSkaffoldConfigPath($skaffoldConfigPath); + $expectedResponse->setEtag($etag); + $expectedResponse->setSkaffoldVersion($skaffoldVersion); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createReleaseTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->deliveryPipelineName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]'); + $releaseId = 'releaseId-1517127597'; + $release = new Release(); + $request = (new CreateReleaseRequest()) + ->setParent($formattedParent) + ->setReleaseId($releaseId) + ->setRelease($release); + $response = $gapicClient->createRelease($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.cloud.deploy.v1.CloudDeploy/CreateRelease', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getReleaseId(); + $this->assertProtobufEquals($releaseId, $actualValue); + $actualValue = $actualApiRequestObject->getRelease(); + $this->assertProtobufEquals($release, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createReleaseTest'); + $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 createReleaseExceptionTest() + { + $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/createReleaseTest'); + $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 + $formattedParent = $gapicClient->deliveryPipelineName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]'); + $releaseId = 'releaseId-1517127597'; + $release = new Release(); + $request = (new CreateReleaseRequest()) + ->setParent($formattedParent) + ->setReleaseId($releaseId) + ->setRelease($release); + $response = $gapicClient->createRelease($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createReleaseTest'); + 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 createRolloutTest() + { + $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/createRolloutTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $uid = 'uid115792'; + $description = 'description-1724546052'; + $targetId = 'targetId-815576439'; + $failureReason = 'failureReason1743941273'; + $deployingBuild = 'deployingBuild931623626'; + $etag = 'etag3123477'; + $controllerRollout = 'controllerRollout-146558962'; + $expectedResponse = new Rollout(); + $expectedResponse->setName($name); + $expectedResponse->setUid($uid); + $expectedResponse->setDescription($description); + $expectedResponse->setTargetId($targetId); + $expectedResponse->setFailureReason($failureReason); + $expectedResponse->setDeployingBuild($deployingBuild); + $expectedResponse->setEtag($etag); + $expectedResponse->setControllerRollout($controllerRollout); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createRolloutTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->releaseName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]', '[RELEASE]'); + $rolloutId = 'rolloutId-91142551'; + $rollout = new Rollout(); + $rolloutTargetId = 'rolloutTargetId509050717'; + $rollout->setTargetId($rolloutTargetId); + $request = (new CreateRolloutRequest()) + ->setParent($formattedParent) + ->setRolloutId($rolloutId) + ->setRollout($rollout); + $response = $gapicClient->createRollout($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.cloud.deploy.v1.CloudDeploy/CreateRollout', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getRolloutId(); + $this->assertProtobufEquals($rolloutId, $actualValue); + $actualValue = $actualApiRequestObject->getRollout(); + $this->assertProtobufEquals($rollout, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createRolloutTest'); + $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 createRolloutExceptionTest() + { + $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/createRolloutTest'); + $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 + $formattedParent = $gapicClient->releaseName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]', '[RELEASE]'); + $rolloutId = 'rolloutId-91142551'; + $rollout = new Rollout(); + $rolloutTargetId = 'rolloutTargetId509050717'; + $rollout->setTargetId($rolloutTargetId); + $request = (new CreateRolloutRequest()) + ->setParent($formattedParent) + ->setRolloutId($rolloutId) + ->setRollout($rollout); + $response = $gapicClient->createRollout($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createRolloutTest'); + 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 createTargetTest() + { + $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/createTargetTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $targetId2 = 'targetId2-2084907012'; + $uid = 'uid115792'; + $description = 'description-1724546052'; + $requireApproval = false; + $etag = 'etag3123477'; + $expectedResponse = new Target(); + $expectedResponse->setName($name); + $expectedResponse->setTargetId($targetId2); + $expectedResponse->setUid($uid); + $expectedResponse->setDescription($description); + $expectedResponse->setRequireApproval($requireApproval); + $expectedResponse->setEtag($etag); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createTargetTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $targetId = 'targetId-815576439'; + $target = new Target(); + $request = (new CreateTargetRequest()) + ->setParent($formattedParent) + ->setTargetId($targetId) + ->setTarget($target); + $response = $gapicClient->createTarget($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.cloud.deploy.v1.CloudDeploy/CreateTarget', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getTargetId(); + $this->assertProtobufEquals($targetId, $actualValue); + $actualValue = $actualApiRequestObject->getTarget(); + $this->assertProtobufEquals($target, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createTargetTest'); + $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 createTargetExceptionTest() + { + $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/createTargetTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $targetId = 'targetId-815576439'; + $target = new Target(); + $request = (new CreateTargetRequest()) + ->setParent($formattedParent) + ->setTargetId($targetId) + ->setTarget($target); + $response = $gapicClient->createTarget($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createTargetTest'); + 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 deleteDeliveryPipelineTest() + { + $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/deleteDeliveryPipelineTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteDeliveryPipelineTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->deliveryPipelineName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]'); + $request = (new DeleteDeliveryPipelineRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteDeliveryPipeline($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.cloud.deploy.v1.CloudDeploy/DeleteDeliveryPipeline', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteDeliveryPipelineTest'); + $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 deleteDeliveryPipelineExceptionTest() + { + $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/deleteDeliveryPipelineTest'); + $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->deliveryPipelineName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]'); + $request = (new DeleteDeliveryPipelineRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteDeliveryPipeline($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteDeliveryPipelineTest'); + 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 deleteTargetTest() + { + $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/deleteTargetTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteTargetTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->targetName('[PROJECT]', '[LOCATION]', '[TARGET]'); + $request = (new DeleteTargetRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteTarget($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.cloud.deploy.v1.CloudDeploy/DeleteTarget', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteTargetTest'); + $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 deleteTargetExceptionTest() + { + $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/deleteTargetTest'); + $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->targetName('[PROJECT]', '[LOCATION]', '[TARGET]'); + $request = (new DeleteTargetRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteTarget($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteTargetTest'); + 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 getConfigTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $defaultSkaffoldVersion = 'defaultSkaffoldVersion1930298837'; + $expectedResponse = new Config(); + $expectedResponse->setName($name2); + $expectedResponse->setDefaultSkaffoldVersion($defaultSkaffoldVersion); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->configName('[PROJECT]', '[LOCATION]'); + $request = (new GetConfigRequest()) + ->setName($formattedName); + $response = $gapicClient->getConfig($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.deploy.v1.CloudDeploy/GetConfig', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getConfigExceptionTest() + { + $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->configName('[PROJECT]', '[LOCATION]'); + $request = (new GetConfigRequest()) + ->setName($formattedName); + try { + $gapicClient->getConfig($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 getDeliveryPipelineTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $uid = 'uid115792'; + $description = 'description-1724546052'; + $etag = 'etag3123477'; + $suspended = false; + $expectedResponse = new DeliveryPipeline(); + $expectedResponse->setName($name2); + $expectedResponse->setUid($uid); + $expectedResponse->setDescription($description); + $expectedResponse->setEtag($etag); + $expectedResponse->setSuspended($suspended); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->deliveryPipelineName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]'); + $request = (new GetDeliveryPipelineRequest()) + ->setName($formattedName); + $response = $gapicClient->getDeliveryPipeline($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.deploy.v1.CloudDeploy/GetDeliveryPipeline', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getDeliveryPipelineExceptionTest() + { + $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->deliveryPipelineName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]'); + $request = (new GetDeliveryPipelineRequest()) + ->setName($formattedName); + try { + $gapicClient->getDeliveryPipeline($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 getJobRunTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $uid = 'uid115792'; + $phaseId = 'phaseId-1676299681'; + $jobId = 'jobId-1154752291'; + $etag = 'etag3123477'; + $expectedResponse = new JobRun(); + $expectedResponse->setName($name2); + $expectedResponse->setUid($uid); + $expectedResponse->setPhaseId($phaseId); + $expectedResponse->setJobId($jobId); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->jobRunName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]', '[RELEASE]', '[ROLLOUT]', '[JOB_RUN]'); + $request = (new GetJobRunRequest()) + ->setName($formattedName); + $response = $gapicClient->getJobRun($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.deploy.v1.CloudDeploy/GetJobRun', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getJobRunExceptionTest() + { + $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->jobRunName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]', '[RELEASE]', '[ROLLOUT]', '[JOB_RUN]'); + $request = (new GetJobRunRequest()) + ->setName($formattedName); + try { + $gapicClient->getJobRun($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 getReleaseTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $uid = 'uid115792'; + $description = 'description-1724546052'; + $abandoned = true; + $skaffoldConfigUri = 'skaffoldConfigUri-860592176'; + $skaffoldConfigPath = 'skaffoldConfigPath-908718527'; + $etag = 'etag3123477'; + $skaffoldVersion = 'skaffoldVersion-1146663017'; + $expectedResponse = new Release(); + $expectedResponse->setName($name2); + $expectedResponse->setUid($uid); + $expectedResponse->setDescription($description); + $expectedResponse->setAbandoned($abandoned); + $expectedResponse->setSkaffoldConfigUri($skaffoldConfigUri); + $expectedResponse->setSkaffoldConfigPath($skaffoldConfigPath); + $expectedResponse->setEtag($etag); + $expectedResponse->setSkaffoldVersion($skaffoldVersion); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->releaseName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]', '[RELEASE]'); + $request = (new GetReleaseRequest()) + ->setName($formattedName); + $response = $gapicClient->getRelease($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.deploy.v1.CloudDeploy/GetRelease', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getReleaseExceptionTest() + { + $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->releaseName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]', '[RELEASE]'); + $request = (new GetReleaseRequest()) + ->setName($formattedName); + try { + $gapicClient->getRelease($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 getRolloutTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $uid = 'uid115792'; + $description = 'description-1724546052'; + $targetId = 'targetId-815576439'; + $failureReason = 'failureReason1743941273'; + $deployingBuild = 'deployingBuild931623626'; + $etag = 'etag3123477'; + $controllerRollout = 'controllerRollout-146558962'; + $expectedResponse = new Rollout(); + $expectedResponse->setName($name2); + $expectedResponse->setUid($uid); + $expectedResponse->setDescription($description); + $expectedResponse->setTargetId($targetId); + $expectedResponse->setFailureReason($failureReason); + $expectedResponse->setDeployingBuild($deployingBuild); + $expectedResponse->setEtag($etag); + $expectedResponse->setControllerRollout($controllerRollout); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->rolloutName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]', '[RELEASE]', '[ROLLOUT]'); + $request = (new GetRolloutRequest()) + ->setName($formattedName); + $response = $gapicClient->getRollout($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.deploy.v1.CloudDeploy/GetRollout', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getRolloutExceptionTest() + { + $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->rolloutName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]', '[RELEASE]', '[ROLLOUT]'); + $request = (new GetRolloutRequest()) + ->setName($formattedName); + try { + $gapicClient->getRollout($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 getTargetTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $targetId = 'targetId-815576439'; + $uid = 'uid115792'; + $description = 'description-1724546052'; + $requireApproval = false; + $etag = 'etag3123477'; + $expectedResponse = new Target(); + $expectedResponse->setName($name2); + $expectedResponse->setTargetId($targetId); + $expectedResponse->setUid($uid); + $expectedResponse->setDescription($description); + $expectedResponse->setRequireApproval($requireApproval); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->targetName('[PROJECT]', '[LOCATION]', '[TARGET]'); + $request = (new GetTargetRequest()) + ->setName($formattedName); + $response = $gapicClient->getTarget($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.deploy.v1.CloudDeploy/GetTarget', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getTargetExceptionTest() + { + $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->targetName('[PROJECT]', '[LOCATION]', '[TARGET]'); + $request = (new GetTargetRequest()) + ->setName($formattedName); + try { + $gapicClient->getTarget($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 ignoreJobTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new IgnoreJobResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedRollout = $gapicClient->rolloutName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]', '[RELEASE]', '[ROLLOUT]'); + $phaseId = 'phaseId-1676299681'; + $jobId = 'jobId-1154752291'; + $request = (new IgnoreJobRequest()) + ->setRollout($formattedRollout) + ->setPhaseId($phaseId) + ->setJobId($jobId); + $response = $gapicClient->ignoreJob($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.deploy.v1.CloudDeploy/IgnoreJob', $actualFuncCall); + $actualValue = $actualRequestObject->getRollout(); + $this->assertProtobufEquals($formattedRollout, $actualValue); + $actualValue = $actualRequestObject->getPhaseId(); + $this->assertProtobufEquals($phaseId, $actualValue); + $actualValue = $actualRequestObject->getJobId(); + $this->assertProtobufEquals($jobId, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function ignoreJobExceptionTest() + { + $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 + $formattedRollout = $gapicClient->rolloutName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]', '[RELEASE]', '[ROLLOUT]'); + $phaseId = 'phaseId-1676299681'; + $jobId = 'jobId-1154752291'; + $request = (new IgnoreJobRequest()) + ->setRollout($formattedRollout) + ->setPhaseId($phaseId) + ->setJobId($jobId); + try { + $gapicClient->ignoreJob($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 listDeliveryPipelinesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $deliveryPipelinesElement = new DeliveryPipeline(); + $deliveryPipelines = [ + $deliveryPipelinesElement, + ]; + $expectedResponse = new ListDeliveryPipelinesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setDeliveryPipelines($deliveryPipelines); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListDeliveryPipelinesRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listDeliveryPipelines($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getDeliveryPipelines()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.deploy.v1.CloudDeploy/ListDeliveryPipelines', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listDeliveryPipelinesExceptionTest() + { + $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->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListDeliveryPipelinesRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listDeliveryPipelines($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 listJobRunsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $jobRunsElement = new JobRun(); + $jobRuns = [ + $jobRunsElement, + ]; + $expectedResponse = new ListJobRunsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setJobRuns($jobRuns); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->rolloutName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]', '[RELEASE]', '[ROLLOUT]'); + $request = (new ListJobRunsRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listJobRuns($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getJobRuns()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.deploy.v1.CloudDeploy/ListJobRuns', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listJobRunsExceptionTest() + { + $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->rolloutName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]', '[RELEASE]', '[ROLLOUT]'); + $request = (new ListJobRunsRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listJobRuns($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 listReleasesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $releasesElement = new Release(); + $releases = [ + $releasesElement, + ]; + $expectedResponse = new ListReleasesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setReleases($releases); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->deliveryPipelineName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]'); + $request = (new ListReleasesRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listReleases($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getReleases()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.deploy.v1.CloudDeploy/ListReleases', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listReleasesExceptionTest() + { + $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->deliveryPipelineName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]'); + $request = (new ListReleasesRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listReleases($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 listRolloutsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $rolloutsElement = new Rollout(); + $rollouts = [ + $rolloutsElement, + ]; + $expectedResponse = new ListRolloutsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setRollouts($rollouts); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->releaseName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]', '[RELEASE]'); + $request = (new ListRolloutsRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listRollouts($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getRollouts()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.deploy.v1.CloudDeploy/ListRollouts', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listRolloutsExceptionTest() + { + $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->releaseName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]', '[RELEASE]'); + $request = (new ListRolloutsRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listRollouts($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 listTargetsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $targetsElement = new Target(); + $targets = [ + $targetsElement, + ]; + $expectedResponse = new ListTargetsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setTargets($targets); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListTargetsRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listTargets($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getTargets()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.deploy.v1.CloudDeploy/ListTargets', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listTargetsExceptionTest() + { + $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->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListTargetsRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listTargets($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 retryJobTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new RetryJobResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedRollout = $gapicClient->rolloutName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]', '[RELEASE]', '[ROLLOUT]'); + $phaseId = 'phaseId-1676299681'; + $jobId = 'jobId-1154752291'; + $request = (new RetryJobRequest()) + ->setRollout($formattedRollout) + ->setPhaseId($phaseId) + ->setJobId($jobId); + $response = $gapicClient->retryJob($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.deploy.v1.CloudDeploy/RetryJob', $actualFuncCall); + $actualValue = $actualRequestObject->getRollout(); + $this->assertProtobufEquals($formattedRollout, $actualValue); + $actualValue = $actualRequestObject->getPhaseId(); + $this->assertProtobufEquals($phaseId, $actualValue); + $actualValue = $actualRequestObject->getJobId(); + $this->assertProtobufEquals($jobId, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function retryJobExceptionTest() + { + $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 + $formattedRollout = $gapicClient->rolloutName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]', '[RELEASE]', '[ROLLOUT]'); + $phaseId = 'phaseId-1676299681'; + $jobId = 'jobId-1154752291'; + $request = (new RetryJobRequest()) + ->setRollout($formattedRollout) + ->setPhaseId($phaseId) + ->setJobId($jobId); + try { + $gapicClient->retryJob($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 terminateJobRunTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new TerminateJobRunResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->jobRunName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]', '[RELEASE]', '[ROLLOUT]', '[JOB_RUN]'); + $request = (new TerminateJobRunRequest()) + ->setName($formattedName); + $response = $gapicClient->terminateJobRun($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.deploy.v1.CloudDeploy/TerminateJobRun', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function terminateJobRunExceptionTest() + { + $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->jobRunName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]', '[RELEASE]', '[ROLLOUT]', '[JOB_RUN]'); + $request = (new TerminateJobRunRequest()) + ->setName($formattedName); + try { + $gapicClient->terminateJobRun($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 updateDeliveryPipelineTest() + { + $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/updateDeliveryPipelineTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $uid = 'uid115792'; + $description = 'description-1724546052'; + $etag = 'etag3123477'; + $suspended = false; + $expectedResponse = new DeliveryPipeline(); + $expectedResponse->setName($name); + $expectedResponse->setUid($uid); + $expectedResponse->setDescription($description); + $expectedResponse->setEtag($etag); + $expectedResponse->setSuspended($suspended); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateDeliveryPipelineTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $updateMask = new FieldMask(); + $deliveryPipeline = new DeliveryPipeline(); + $request = (new UpdateDeliveryPipelineRequest()) + ->setUpdateMask($updateMask) + ->setDeliveryPipeline($deliveryPipeline); + $response = $gapicClient->updateDeliveryPipeline($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.cloud.deploy.v1.CloudDeploy/UpdateDeliveryPipeline', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $actualValue = $actualApiRequestObject->getDeliveryPipeline(); + $this->assertProtobufEquals($deliveryPipeline, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateDeliveryPipelineTest'); + $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 updateDeliveryPipelineExceptionTest() + { + $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/updateDeliveryPipelineTest'); + $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 + $updateMask = new FieldMask(); + $deliveryPipeline = new DeliveryPipeline(); + $request = (new UpdateDeliveryPipelineRequest()) + ->setUpdateMask($updateMask) + ->setDeliveryPipeline($deliveryPipeline); + $response = $gapicClient->updateDeliveryPipeline($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateDeliveryPipelineTest'); + 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 updateTargetTest() + { + $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/updateTargetTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $targetId = 'targetId-815576439'; + $uid = 'uid115792'; + $description = 'description-1724546052'; + $requireApproval = false; + $etag = 'etag3123477'; + $expectedResponse = new Target(); + $expectedResponse->setName($name); + $expectedResponse->setTargetId($targetId); + $expectedResponse->setUid($uid); + $expectedResponse->setDescription($description); + $expectedResponse->setRequireApproval($requireApproval); + $expectedResponse->setEtag($etag); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateTargetTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $updateMask = new FieldMask(); + $target = new Target(); + $request = (new UpdateTargetRequest()) + ->setUpdateMask($updateMask) + ->setTarget($target); + $response = $gapicClient->updateTarget($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.cloud.deploy.v1.CloudDeploy/UpdateTarget', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $actualValue = $actualApiRequestObject->getTarget(); + $this->assertProtobufEquals($target, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateTargetTest'); + $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 updateTargetExceptionTest() + { + $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/updateTargetTest'); + $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 + $updateMask = new FieldMask(); + $target = new Target(); + $request = (new UpdateTargetRequest()) + ->setUpdateMask($updateMask) + ->setTarget($target); + $response = $gapicClient->updateTarget($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateTargetTest'); + 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 getLocationTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $locationId = 'locationId552319461'; + $displayName = 'displayName1615086568'; + $expectedResponse = new Location(); + $expectedResponse->setName($name2); + $expectedResponse->setLocationId($locationId); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + $request = new GetLocationRequest(); + $response = $gapicClient->getLocation($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/GetLocation', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getLocationExceptionTest() + { + $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); + $request = new GetLocationRequest(); + try { + $gapicClient->getLocation($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 listLocationsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $locationsElement = new Location(); + $locations = [ + $locationsElement, + ]; + $expectedResponse = new ListLocationsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setLocations($locations); + $transport->addResponse($expectedResponse); + $request = new ListLocationsRequest(); + $response = $gapicClient->listLocations($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getLocations()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/ListLocations', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listLocationsExceptionTest() + { + $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); + $request = new ListLocationsRequest(); + try { + $gapicClient->listLocations($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 getIamPolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $version = 351608024; + $etag = '21'; + $expectedResponse = new Policy(); + $expectedResponse->setVersion($version); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $request = (new GetIamPolicyRequest()) + ->setResource($resource); + $response = $gapicClient->getIamPolicy($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.iam.v1.IAMPolicy/GetIamPolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getIamPolicyExceptionTest() + { + $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 + $resource = 'resource-341064690'; + $request = (new GetIamPolicyRequest()) + ->setResource($resource); + try { + $gapicClient->getIamPolicy($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 setIamPolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $version = 351608024; + $etag = '21'; + $expectedResponse = new Policy(); + $expectedResponse->setVersion($version); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $policy = new Policy(); + $request = (new SetIamPolicyRequest()) + ->setResource($resource) + ->setPolicy($policy); + $response = $gapicClient->setIamPolicy($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.iam.v1.IAMPolicy/SetIamPolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $actualValue = $actualRequestObject->getPolicy(); + $this->assertProtobufEquals($policy, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function setIamPolicyExceptionTest() + { + $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 + $resource = 'resource-341064690'; + $policy = new Policy(); + $request = (new SetIamPolicyRequest()) + ->setResource($resource) + ->setPolicy($policy); + try { + $gapicClient->setIamPolicy($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 testIamPermissionsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new TestIamPermissionsResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $permissions = []; + $request = (new TestIamPermissionsRequest()) + ->setResource($resource) + ->setPermissions($permissions); + $response = $gapicClient->testIamPermissions($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.iam.v1.IAMPolicy/TestIamPermissions', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $actualValue = $actualRequestObject->getPermissions(); + $this->assertProtobufEquals($permissions, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function testIamPermissionsExceptionTest() + { + $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 + $resource = 'resource-341064690'; + $permissions = []; + $request = (new TestIamPermissionsRequest()) + ->setResource($resource) + ->setPermissions($permissions); + try { + $gapicClient->testIamPermissions($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 abandonReleaseAsyncTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new AbandonReleaseResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->releaseName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]', '[RELEASE]'); + $request = (new AbandonReleaseRequest()) + ->setName($formattedName); + $response = $gapicClient->abandonReleaseAsync($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.cloud.deploy.v1.CloudDeploy/AbandonRelease', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/owl-bot-staging/Deploy/v1/tests/Unit/V1/CloudDeployClientTest.php b/owl-bot-staging/Deploy/v1/tests/Unit/V1/CloudDeployClientTest.php new file mode 100644 index 000000000000..1008182b1984 --- /dev/null +++ b/owl-bot-staging/Deploy/v1/tests/Unit/V1/CloudDeployClientTest.php @@ -0,0 +1,2640 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return CloudDeployClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new CloudDeployClient($options); + } + + /** @test */ + public function abandonReleaseTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new AbandonReleaseResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->releaseName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]', '[RELEASE]'); + $response = $gapicClient->abandonRelease($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.deploy.v1.CloudDeploy/AbandonRelease', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function abandonReleaseExceptionTest() + { + $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->releaseName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]', '[RELEASE]'); + try { + $gapicClient->abandonRelease($formattedName); + // 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 advanceRolloutTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new AdvanceRolloutResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->rolloutName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]', '[RELEASE]', '[ROLLOUT]'); + $phaseId = 'phaseId-1676299681'; + $response = $gapicClient->advanceRollout($formattedName, $phaseId); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.deploy.v1.CloudDeploy/AdvanceRollout', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $actualValue = $actualRequestObject->getPhaseId(); + $this->assertProtobufEquals($phaseId, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function advanceRolloutExceptionTest() + { + $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->rolloutName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]', '[RELEASE]', '[ROLLOUT]'); + $phaseId = 'phaseId-1676299681'; + try { + $gapicClient->advanceRollout($formattedName, $phaseId); + // 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 approveRolloutTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new ApproveRolloutResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->rolloutName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]', '[RELEASE]', '[ROLLOUT]'); + $approved = false; + $response = $gapicClient->approveRollout($formattedName, $approved); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.deploy.v1.CloudDeploy/ApproveRollout', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $actualValue = $actualRequestObject->getApproved(); + $this->assertProtobufEquals($approved, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function approveRolloutExceptionTest() + { + $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->rolloutName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]', '[RELEASE]', '[ROLLOUT]'); + $approved = false; + try { + $gapicClient->approveRollout($formattedName, $approved); + // 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 cancelRolloutTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new CancelRolloutResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->rolloutName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]', '[RELEASE]', '[ROLLOUT]'); + $response = $gapicClient->cancelRollout($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.deploy.v1.CloudDeploy/CancelRollout', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function cancelRolloutExceptionTest() + { + $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->rolloutName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]', '[RELEASE]', '[ROLLOUT]'); + try { + $gapicClient->cancelRollout($formattedName); + // 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 createDeliveryPipelineTest() + { + $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/createDeliveryPipelineTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $uid = 'uid115792'; + $description = 'description-1724546052'; + $etag = 'etag3123477'; + $suspended = false; + $expectedResponse = new DeliveryPipeline(); + $expectedResponse->setName($name); + $expectedResponse->setUid($uid); + $expectedResponse->setDescription($description); + $expectedResponse->setEtag($etag); + $expectedResponse->setSuspended($suspended); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createDeliveryPipelineTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $deliveryPipelineId = 'deliveryPipelineId1972590605'; + $deliveryPipeline = new DeliveryPipeline(); + $response = $gapicClient->createDeliveryPipeline($formattedParent, $deliveryPipelineId, $deliveryPipeline); + $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.cloud.deploy.v1.CloudDeploy/CreateDeliveryPipeline', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getDeliveryPipelineId(); + $this->assertProtobufEquals($deliveryPipelineId, $actualValue); + $actualValue = $actualApiRequestObject->getDeliveryPipeline(); + $this->assertProtobufEquals($deliveryPipeline, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createDeliveryPipelineTest'); + $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 createDeliveryPipelineExceptionTest() + { + $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/createDeliveryPipelineTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $deliveryPipelineId = 'deliveryPipelineId1972590605'; + $deliveryPipeline = new DeliveryPipeline(); + $response = $gapicClient->createDeliveryPipeline($formattedParent, $deliveryPipelineId, $deliveryPipeline); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createDeliveryPipelineTest'); + 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 createReleaseTest() + { + $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/createReleaseTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $uid = 'uid115792'; + $description = 'description-1724546052'; + $abandoned = true; + $skaffoldConfigUri = 'skaffoldConfigUri-860592176'; + $skaffoldConfigPath = 'skaffoldConfigPath-908718527'; + $etag = 'etag3123477'; + $skaffoldVersion = 'skaffoldVersion-1146663017'; + $expectedResponse = new Release(); + $expectedResponse->setName($name); + $expectedResponse->setUid($uid); + $expectedResponse->setDescription($description); + $expectedResponse->setAbandoned($abandoned); + $expectedResponse->setSkaffoldConfigUri($skaffoldConfigUri); + $expectedResponse->setSkaffoldConfigPath($skaffoldConfigPath); + $expectedResponse->setEtag($etag); + $expectedResponse->setSkaffoldVersion($skaffoldVersion); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createReleaseTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->deliveryPipelineName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]'); + $releaseId = 'releaseId-1517127597'; + $release = new Release(); + $response = $gapicClient->createRelease($formattedParent, $releaseId, $release); + $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.cloud.deploy.v1.CloudDeploy/CreateRelease', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getReleaseId(); + $this->assertProtobufEquals($releaseId, $actualValue); + $actualValue = $actualApiRequestObject->getRelease(); + $this->assertProtobufEquals($release, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createReleaseTest'); + $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 createReleaseExceptionTest() + { + $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/createReleaseTest'); + $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 + $formattedParent = $gapicClient->deliveryPipelineName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]'); + $releaseId = 'releaseId-1517127597'; + $release = new Release(); + $response = $gapicClient->createRelease($formattedParent, $releaseId, $release); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createReleaseTest'); + 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 createRolloutTest() + { + $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/createRolloutTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $uid = 'uid115792'; + $description = 'description-1724546052'; + $targetId = 'targetId-815576439'; + $failureReason = 'failureReason1743941273'; + $deployingBuild = 'deployingBuild931623626'; + $etag = 'etag3123477'; + $controllerRollout = 'controllerRollout-146558962'; + $expectedResponse = new Rollout(); + $expectedResponse->setName($name); + $expectedResponse->setUid($uid); + $expectedResponse->setDescription($description); + $expectedResponse->setTargetId($targetId); + $expectedResponse->setFailureReason($failureReason); + $expectedResponse->setDeployingBuild($deployingBuild); + $expectedResponse->setEtag($etag); + $expectedResponse->setControllerRollout($controllerRollout); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createRolloutTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->releaseName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]', '[RELEASE]'); + $rolloutId = 'rolloutId-91142551'; + $rollout = new Rollout(); + $rolloutTargetId = 'rolloutTargetId509050717'; + $rollout->setTargetId($rolloutTargetId); + $response = $gapicClient->createRollout($formattedParent, $rolloutId, $rollout); + $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.cloud.deploy.v1.CloudDeploy/CreateRollout', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getRolloutId(); + $this->assertProtobufEquals($rolloutId, $actualValue); + $actualValue = $actualApiRequestObject->getRollout(); + $this->assertProtobufEquals($rollout, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createRolloutTest'); + $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 createRolloutExceptionTest() + { + $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/createRolloutTest'); + $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 + $formattedParent = $gapicClient->releaseName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]', '[RELEASE]'); + $rolloutId = 'rolloutId-91142551'; + $rollout = new Rollout(); + $rolloutTargetId = 'rolloutTargetId509050717'; + $rollout->setTargetId($rolloutTargetId); + $response = $gapicClient->createRollout($formattedParent, $rolloutId, $rollout); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createRolloutTest'); + 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 createTargetTest() + { + $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/createTargetTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $targetId2 = 'targetId2-2084907012'; + $uid = 'uid115792'; + $description = 'description-1724546052'; + $requireApproval = false; + $etag = 'etag3123477'; + $expectedResponse = new Target(); + $expectedResponse->setName($name); + $expectedResponse->setTargetId($targetId2); + $expectedResponse->setUid($uid); + $expectedResponse->setDescription($description); + $expectedResponse->setRequireApproval($requireApproval); + $expectedResponse->setEtag($etag); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createTargetTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $targetId = 'targetId-815576439'; + $target = new Target(); + $response = $gapicClient->createTarget($formattedParent, $targetId, $target); + $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.cloud.deploy.v1.CloudDeploy/CreateTarget', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getTargetId(); + $this->assertProtobufEquals($targetId, $actualValue); + $actualValue = $actualApiRequestObject->getTarget(); + $this->assertProtobufEquals($target, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createTargetTest'); + $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 createTargetExceptionTest() + { + $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/createTargetTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $targetId = 'targetId-815576439'; + $target = new Target(); + $response = $gapicClient->createTarget($formattedParent, $targetId, $target); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createTargetTest'); + 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 deleteDeliveryPipelineTest() + { + $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/deleteDeliveryPipelineTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteDeliveryPipelineTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->deliveryPipelineName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]'); + $response = $gapicClient->deleteDeliveryPipeline($formattedName); + $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.cloud.deploy.v1.CloudDeploy/DeleteDeliveryPipeline', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteDeliveryPipelineTest'); + $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 deleteDeliveryPipelineExceptionTest() + { + $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/deleteDeliveryPipelineTest'); + $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->deliveryPipelineName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]'); + $response = $gapicClient->deleteDeliveryPipeline($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteDeliveryPipelineTest'); + 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 deleteTargetTest() + { + $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/deleteTargetTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteTargetTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->targetName('[PROJECT]', '[LOCATION]', '[TARGET]'); + $response = $gapicClient->deleteTarget($formattedName); + $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.cloud.deploy.v1.CloudDeploy/DeleteTarget', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteTargetTest'); + $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 deleteTargetExceptionTest() + { + $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/deleteTargetTest'); + $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->targetName('[PROJECT]', '[LOCATION]', '[TARGET]'); + $response = $gapicClient->deleteTarget($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteTargetTest'); + 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 getConfigTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $defaultSkaffoldVersion = 'defaultSkaffoldVersion1930298837'; + $expectedResponse = new Config(); + $expectedResponse->setName($name2); + $expectedResponse->setDefaultSkaffoldVersion($defaultSkaffoldVersion); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->configName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->getConfig($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.deploy.v1.CloudDeploy/GetConfig', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getConfigExceptionTest() + { + $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->configName('[PROJECT]', '[LOCATION]'); + try { + $gapicClient->getConfig($formattedName); + // 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 getDeliveryPipelineTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $uid = 'uid115792'; + $description = 'description-1724546052'; + $etag = 'etag3123477'; + $suspended = false; + $expectedResponse = new DeliveryPipeline(); + $expectedResponse->setName($name2); + $expectedResponse->setUid($uid); + $expectedResponse->setDescription($description); + $expectedResponse->setEtag($etag); + $expectedResponse->setSuspended($suspended); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->deliveryPipelineName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]'); + $response = $gapicClient->getDeliveryPipeline($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.deploy.v1.CloudDeploy/GetDeliveryPipeline', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getDeliveryPipelineExceptionTest() + { + $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->deliveryPipelineName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]'); + try { + $gapicClient->getDeliveryPipeline($formattedName); + // 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 getJobRunTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $uid = 'uid115792'; + $phaseId = 'phaseId-1676299681'; + $jobId = 'jobId-1154752291'; + $etag = 'etag3123477'; + $expectedResponse = new JobRun(); + $expectedResponse->setName($name2); + $expectedResponse->setUid($uid); + $expectedResponse->setPhaseId($phaseId); + $expectedResponse->setJobId($jobId); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->jobRunName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]', '[RELEASE]', '[ROLLOUT]', '[JOB_RUN]'); + $response = $gapicClient->getJobRun($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.deploy.v1.CloudDeploy/GetJobRun', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getJobRunExceptionTest() + { + $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->jobRunName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]', '[RELEASE]', '[ROLLOUT]', '[JOB_RUN]'); + try { + $gapicClient->getJobRun($formattedName); + // 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 getReleaseTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $uid = 'uid115792'; + $description = 'description-1724546052'; + $abandoned = true; + $skaffoldConfigUri = 'skaffoldConfigUri-860592176'; + $skaffoldConfigPath = 'skaffoldConfigPath-908718527'; + $etag = 'etag3123477'; + $skaffoldVersion = 'skaffoldVersion-1146663017'; + $expectedResponse = new Release(); + $expectedResponse->setName($name2); + $expectedResponse->setUid($uid); + $expectedResponse->setDescription($description); + $expectedResponse->setAbandoned($abandoned); + $expectedResponse->setSkaffoldConfigUri($skaffoldConfigUri); + $expectedResponse->setSkaffoldConfigPath($skaffoldConfigPath); + $expectedResponse->setEtag($etag); + $expectedResponse->setSkaffoldVersion($skaffoldVersion); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->releaseName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]', '[RELEASE]'); + $response = $gapicClient->getRelease($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.deploy.v1.CloudDeploy/GetRelease', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getReleaseExceptionTest() + { + $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->releaseName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]', '[RELEASE]'); + try { + $gapicClient->getRelease($formattedName); + // 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 getRolloutTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $uid = 'uid115792'; + $description = 'description-1724546052'; + $targetId = 'targetId-815576439'; + $failureReason = 'failureReason1743941273'; + $deployingBuild = 'deployingBuild931623626'; + $etag = 'etag3123477'; + $controllerRollout = 'controllerRollout-146558962'; + $expectedResponse = new Rollout(); + $expectedResponse->setName($name2); + $expectedResponse->setUid($uid); + $expectedResponse->setDescription($description); + $expectedResponse->setTargetId($targetId); + $expectedResponse->setFailureReason($failureReason); + $expectedResponse->setDeployingBuild($deployingBuild); + $expectedResponse->setEtag($etag); + $expectedResponse->setControllerRollout($controllerRollout); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->rolloutName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]', '[RELEASE]', '[ROLLOUT]'); + $response = $gapicClient->getRollout($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.deploy.v1.CloudDeploy/GetRollout', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getRolloutExceptionTest() + { + $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->rolloutName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]', '[RELEASE]', '[ROLLOUT]'); + try { + $gapicClient->getRollout($formattedName); + // 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 getTargetTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $targetId = 'targetId-815576439'; + $uid = 'uid115792'; + $description = 'description-1724546052'; + $requireApproval = false; + $etag = 'etag3123477'; + $expectedResponse = new Target(); + $expectedResponse->setName($name2); + $expectedResponse->setTargetId($targetId); + $expectedResponse->setUid($uid); + $expectedResponse->setDescription($description); + $expectedResponse->setRequireApproval($requireApproval); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->targetName('[PROJECT]', '[LOCATION]', '[TARGET]'); + $response = $gapicClient->getTarget($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.deploy.v1.CloudDeploy/GetTarget', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getTargetExceptionTest() + { + $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->targetName('[PROJECT]', '[LOCATION]', '[TARGET]'); + try { + $gapicClient->getTarget($formattedName); + // 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 ignoreJobTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new IgnoreJobResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedRollout = $gapicClient->rolloutName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]', '[RELEASE]', '[ROLLOUT]'); + $phaseId = 'phaseId-1676299681'; + $jobId = 'jobId-1154752291'; + $response = $gapicClient->ignoreJob($formattedRollout, $phaseId, $jobId); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.deploy.v1.CloudDeploy/IgnoreJob', $actualFuncCall); + $actualValue = $actualRequestObject->getRollout(); + $this->assertProtobufEquals($formattedRollout, $actualValue); + $actualValue = $actualRequestObject->getPhaseId(); + $this->assertProtobufEquals($phaseId, $actualValue); + $actualValue = $actualRequestObject->getJobId(); + $this->assertProtobufEquals($jobId, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function ignoreJobExceptionTest() + { + $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 + $formattedRollout = $gapicClient->rolloutName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]', '[RELEASE]', '[ROLLOUT]'); + $phaseId = 'phaseId-1676299681'; + $jobId = 'jobId-1154752291'; + try { + $gapicClient->ignoreJob($formattedRollout, $phaseId, $jobId); + // 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 listDeliveryPipelinesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $deliveryPipelinesElement = new DeliveryPipeline(); + $deliveryPipelines = [ + $deliveryPipelinesElement, + ]; + $expectedResponse = new ListDeliveryPipelinesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setDeliveryPipelines($deliveryPipelines); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->listDeliveryPipelines($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getDeliveryPipelines()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.deploy.v1.CloudDeploy/ListDeliveryPipelines', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listDeliveryPipelinesExceptionTest() + { + $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->locationName('[PROJECT]', '[LOCATION]'); + try { + $gapicClient->listDeliveryPipelines($formattedParent); + // 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 listJobRunsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $jobRunsElement = new JobRun(); + $jobRuns = [ + $jobRunsElement, + ]; + $expectedResponse = new ListJobRunsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setJobRuns($jobRuns); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->rolloutName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]', '[RELEASE]', '[ROLLOUT]'); + $response = $gapicClient->listJobRuns($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getJobRuns()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.deploy.v1.CloudDeploy/ListJobRuns', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listJobRunsExceptionTest() + { + $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->rolloutName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]', '[RELEASE]', '[ROLLOUT]'); + try { + $gapicClient->listJobRuns($formattedParent); + // 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 listReleasesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $releasesElement = new Release(); + $releases = [ + $releasesElement, + ]; + $expectedResponse = new ListReleasesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setReleases($releases); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->deliveryPipelineName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]'); + $response = $gapicClient->listReleases($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getReleases()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.deploy.v1.CloudDeploy/ListReleases', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listReleasesExceptionTest() + { + $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->deliveryPipelineName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]'); + try { + $gapicClient->listReleases($formattedParent); + // 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 listRolloutsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $rolloutsElement = new Rollout(); + $rollouts = [ + $rolloutsElement, + ]; + $expectedResponse = new ListRolloutsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setRollouts($rollouts); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->releaseName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]', '[RELEASE]'); + $response = $gapicClient->listRollouts($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getRollouts()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.deploy.v1.CloudDeploy/ListRollouts', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listRolloutsExceptionTest() + { + $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->releaseName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]', '[RELEASE]'); + try { + $gapicClient->listRollouts($formattedParent); + // 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 listTargetsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $targetsElement = new Target(); + $targets = [ + $targetsElement, + ]; + $expectedResponse = new ListTargetsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setTargets($targets); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->listTargets($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getTargets()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.deploy.v1.CloudDeploy/ListTargets', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listTargetsExceptionTest() + { + $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->locationName('[PROJECT]', '[LOCATION]'); + try { + $gapicClient->listTargets($formattedParent); + // 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 retryJobTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new RetryJobResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedRollout = $gapicClient->rolloutName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]', '[RELEASE]', '[ROLLOUT]'); + $phaseId = 'phaseId-1676299681'; + $jobId = 'jobId-1154752291'; + $response = $gapicClient->retryJob($formattedRollout, $phaseId, $jobId); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.deploy.v1.CloudDeploy/RetryJob', $actualFuncCall); + $actualValue = $actualRequestObject->getRollout(); + $this->assertProtobufEquals($formattedRollout, $actualValue); + $actualValue = $actualRequestObject->getPhaseId(); + $this->assertProtobufEquals($phaseId, $actualValue); + $actualValue = $actualRequestObject->getJobId(); + $this->assertProtobufEquals($jobId, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function retryJobExceptionTest() + { + $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 + $formattedRollout = $gapicClient->rolloutName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]', '[RELEASE]', '[ROLLOUT]'); + $phaseId = 'phaseId-1676299681'; + $jobId = 'jobId-1154752291'; + try { + $gapicClient->retryJob($formattedRollout, $phaseId, $jobId); + // 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 terminateJobRunTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new TerminateJobRunResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->jobRunName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]', '[RELEASE]', '[ROLLOUT]', '[JOB_RUN]'); + $response = $gapicClient->terminateJobRun($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.deploy.v1.CloudDeploy/TerminateJobRun', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function terminateJobRunExceptionTest() + { + $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->jobRunName('[PROJECT]', '[LOCATION]', '[DELIVERY_PIPELINE]', '[RELEASE]', '[ROLLOUT]', '[JOB_RUN]'); + try { + $gapicClient->terminateJobRun($formattedName); + // 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 updateDeliveryPipelineTest() + { + $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/updateDeliveryPipelineTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $uid = 'uid115792'; + $description = 'description-1724546052'; + $etag = 'etag3123477'; + $suspended = false; + $expectedResponse = new DeliveryPipeline(); + $expectedResponse->setName($name); + $expectedResponse->setUid($uid); + $expectedResponse->setDescription($description); + $expectedResponse->setEtag($etag); + $expectedResponse->setSuspended($suspended); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateDeliveryPipelineTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $updateMask = new FieldMask(); + $deliveryPipeline = new DeliveryPipeline(); + $response = $gapicClient->updateDeliveryPipeline($updateMask, $deliveryPipeline); + $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.cloud.deploy.v1.CloudDeploy/UpdateDeliveryPipeline', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $actualValue = $actualApiRequestObject->getDeliveryPipeline(); + $this->assertProtobufEquals($deliveryPipeline, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateDeliveryPipelineTest'); + $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 updateDeliveryPipelineExceptionTest() + { + $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/updateDeliveryPipelineTest'); + $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 + $updateMask = new FieldMask(); + $deliveryPipeline = new DeliveryPipeline(); + $response = $gapicClient->updateDeliveryPipeline($updateMask, $deliveryPipeline); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateDeliveryPipelineTest'); + 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 updateTargetTest() + { + $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/updateTargetTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $targetId = 'targetId-815576439'; + $uid = 'uid115792'; + $description = 'description-1724546052'; + $requireApproval = false; + $etag = 'etag3123477'; + $expectedResponse = new Target(); + $expectedResponse->setName($name); + $expectedResponse->setTargetId($targetId); + $expectedResponse->setUid($uid); + $expectedResponse->setDescription($description); + $expectedResponse->setRequireApproval($requireApproval); + $expectedResponse->setEtag($etag); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateTargetTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $updateMask = new FieldMask(); + $target = new Target(); + $response = $gapicClient->updateTarget($updateMask, $target); + $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.cloud.deploy.v1.CloudDeploy/UpdateTarget', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $actualValue = $actualApiRequestObject->getTarget(); + $this->assertProtobufEquals($target, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateTargetTest'); + $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 updateTargetExceptionTest() + { + $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/updateTargetTest'); + $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 + $updateMask = new FieldMask(); + $target = new Target(); + $response = $gapicClient->updateTarget($updateMask, $target); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateTargetTest'); + 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 getLocationTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $locationId = 'locationId552319461'; + $displayName = 'displayName1615086568'; + $expectedResponse = new Location(); + $expectedResponse->setName($name2); + $expectedResponse->setLocationId($locationId); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + $response = $gapicClient->getLocation(); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/GetLocation', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getLocationExceptionTest() + { + $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); + try { + $gapicClient->getLocation(); + // 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 listLocationsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $locationsElement = new Location(); + $locations = [ + $locationsElement, + ]; + $expectedResponse = new ListLocationsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setLocations($locations); + $transport->addResponse($expectedResponse); + $response = $gapicClient->listLocations(); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getLocations()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/ListLocations', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listLocationsExceptionTest() + { + $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); + try { + $gapicClient->listLocations(); + // 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 getIamPolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $version = 351608024; + $etag = '21'; + $expectedResponse = new Policy(); + $expectedResponse->setVersion($version); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $response = $gapicClient->getIamPolicy($resource); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.iam.v1.IAMPolicy/GetIamPolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getIamPolicyExceptionTest() + { + $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 + $resource = 'resource-341064690'; + try { + $gapicClient->getIamPolicy($resource); + // 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 setIamPolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $version = 351608024; + $etag = '21'; + $expectedResponse = new Policy(); + $expectedResponse->setVersion($version); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $policy = new Policy(); + $response = $gapicClient->setIamPolicy($resource, $policy); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.iam.v1.IAMPolicy/SetIamPolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $actualValue = $actualRequestObject->getPolicy(); + $this->assertProtobufEquals($policy, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function setIamPolicyExceptionTest() + { + $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 + $resource = 'resource-341064690'; + $policy = new Policy(); + try { + $gapicClient->setIamPolicy($resource, $policy); + // 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 testIamPermissionsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new TestIamPermissionsResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $permissions = []; + $response = $gapicClient->testIamPermissions($resource, $permissions); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.iam.v1.IAMPolicy/TestIamPermissions', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $actualValue = $actualRequestObject->getPermissions(); + $this->assertProtobufEquals($permissions, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function testIamPermissionsExceptionTest() + { + $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 + $resource = 'resource-341064690'; + $permissions = []; + try { + $gapicClient->testIamPermissions($resource, $permissions); + // 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()); + } +} diff --git a/owl-bot-staging/ErrorReporting/v1beta1/proto/src/GPBMetadata/Google/Devtools/Clouderrorreporting/V1Beta1/Common.php b/owl-bot-staging/ErrorReporting/v1beta1/proto/src/GPBMetadata/Google/Devtools/Clouderrorreporting/V1Beta1/Common.php new file mode 100644 index 000000000000..ec68ba0c1b8c Binary files /dev/null and b/owl-bot-staging/ErrorReporting/v1beta1/proto/src/GPBMetadata/Google/Devtools/Clouderrorreporting/V1Beta1/Common.php differ diff --git a/owl-bot-staging/ErrorReporting/v1beta1/proto/src/GPBMetadata/Google/Devtools/Clouderrorreporting/V1Beta1/ErrorGroupService.php b/owl-bot-staging/ErrorReporting/v1beta1/proto/src/GPBMetadata/Google/Devtools/Clouderrorreporting/V1Beta1/ErrorGroupService.php new file mode 100644 index 000000000000..0990e13f9749 --- /dev/null +++ b/owl-bot-staging/ErrorReporting/v1beta1/proto/src/GPBMetadata/Google/Devtools/Clouderrorreporting/V1Beta1/ErrorGroupService.php @@ -0,0 +1,42 @@ +internalAddGeneratedFile( + ' +á +Egoogle/devtools/clouderrorreporting/v1beta1/error_group_service.proto+google.devtools.clouderrorreporting.v1beta1google/api/client.protogoogle/api/field_behavior.protogoogle/api/resource.proto8google/devtools/clouderrorreporting/v1beta1/common.proto"\\ +GetGroupRequestI + +group_name ( B5àAúA/ +-clouderrorreporting.googleapis.com/ErrorGroup"a +UpdateGroupRequestK +group ( 27.google.devtools.clouderrorreporting.v1beta1.ErrorGroupBàA2û +ErrorGroupServiceÁ +GetGroup<.google.devtools.clouderrorreporting.v1beta1.GetGroupRequest7.google.devtools.clouderrorreporting.v1beta1.ErrorGroup">‚Óä“+)/v1beta1/{group_name=projects/*/groups/*}ÚA +group_nameÉ + UpdateGroup?.google.devtools.clouderrorreporting.v1beta1.UpdateGroupRequest7.google.devtools.clouderrorreporting.v1beta1.ErrorGroup"@‚Óä“2)/v1beta1/{group.name=projects/*/groups/*}:groupÚAgroupVÊA"clouderrorreporting.googleapis.comÒA.https://www.googleapis.com/auth/cloud-platformB” +/com.google.devtools.clouderrorreporting.v1beta1BErrorGroupServiceProtoPZOcloud.google.com/go/errorreporting/apiv1beta1/errorreportingpb;errorreportingpbøª#Google.Cloud.ErrorReporting.V1Beta1Ê#Google\\Cloud\\ErrorReporting\\V1beta1ê&Google::Cloud::ErrorReporting::V1beta1bproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/owl-bot-staging/ErrorReporting/v1beta1/proto/src/GPBMetadata/Google/Devtools/Clouderrorreporting/V1Beta1/ErrorStatsService.php b/owl-bot-staging/ErrorReporting/v1beta1/proto/src/GPBMetadata/Google/Devtools/Clouderrorreporting/V1Beta1/ErrorStatsService.php new file mode 100644 index 000000000000..8173694a253b Binary files /dev/null and b/owl-bot-staging/ErrorReporting/v1beta1/proto/src/GPBMetadata/Google/Devtools/Clouderrorreporting/V1Beta1/ErrorStatsService.php differ diff --git a/owl-bot-staging/ErrorReporting/v1beta1/proto/src/GPBMetadata/Google/Devtools/Clouderrorreporting/V1Beta1/ReportErrorsService.php b/owl-bot-staging/ErrorReporting/v1beta1/proto/src/GPBMetadata/Google/Devtools/Clouderrorreporting/V1Beta1/ReportErrorsService.php new file mode 100644 index 000000000000..c0f1536911b8 --- /dev/null +++ b/owl-bot-staging/ErrorReporting/v1beta1/proto/src/GPBMetadata/Google/Devtools/Clouderrorreporting/V1Beta1/ReportErrorsService.php @@ -0,0 +1,46 @@ +internalAddGeneratedFile( + ' +• +Ggoogle/devtools/clouderrorreporting/v1beta1/report_errors_service.proto+google.devtools.clouderrorreporting.v1beta1google/api/client.protogoogle/api/field_behavior.protogoogle/api/resource.proto8google/devtools/clouderrorreporting/v1beta1/common.protogoogle/protobuf/timestamp.proto"¹ +ReportErrorEventRequestI + project_name ( B3àAúA- ++cloudresourcemanager.googleapis.com/ProjectS +event ( 2?.google.devtools.clouderrorreporting.v1beta1.ReportedErrorEventBàA" +ReportErrorEventResponse"‹ +ReportedErrorEvent3 + +event_time ( 2.google.protobuf.TimestampBàAY +service_context ( 2;.google.devtools.clouderrorreporting.v1beta1.ServiceContextBàA +message ( BàAO +context ( 29.google.devtools.clouderrorreporting.v1beta1.ErrorContextBàA2å +ReportErrorsServiceõ +ReportErrorEventD.google.devtools.clouderrorreporting.v1beta1.ReportErrorEventRequestE.google.devtools.clouderrorreporting.v1beta1.ReportErrorEventResponse"T‚Óä“9"0/v1beta1/{project_name=projects/*}/events:report:eventÚAproject_name,eventVÊA"clouderrorreporting.googleapis.comÒA.https://www.googleapis.com/auth/cloud-platformB– +/com.google.devtools.clouderrorreporting.v1beta1BReportErrorsServiceProtoPZOcloud.google.com/go/errorreporting/apiv1beta1/errorreportingpb;errorreportingpbøª#Google.Cloud.ErrorReporting.V1Beta1Ê#Google\\Cloud\\ErrorReporting\\V1beta1ê&Google::Cloud::ErrorReporting::V1beta1bproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/DeleteEventsRequest.php b/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/DeleteEventsRequest.php new file mode 100644 index 000000000000..f014607d1ded --- /dev/null +++ b/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/DeleteEventsRequest.php @@ -0,0 +1,102 @@ +google.devtools.clouderrorreporting.v1beta1.DeleteEventsRequest + */ +class DeleteEventsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the Google Cloud Platform project. Written + * as `projects/{projectID}`, where `{projectID}` is the + * [Google Cloud Platform project + * ID](https://support.google.com/cloud/answer/6158840). + * Example: `projects/my-project-123`. + * + * Generated from protobuf field string project_name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $project_name = ''; + + /** + * @param string $projectName Required. The resource name of the Google Cloud Platform project. Written + * as `projects/{projectID}`, where `{projectID}` is the + * [Google Cloud Platform project + * ID](https://support.google.com/cloud/answer/6158840). + * + * Example: `projects/my-project-123`. Please see + * {@see ErrorStatsServiceClient::projectName()} for help formatting this field. + * + * @return \Google\Cloud\ErrorReporting\V1beta1\DeleteEventsRequest + * + * @experimental + */ + public static function build(string $projectName): self + { + return (new self()) + ->setProjectName($projectName); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $project_name + * Required. The resource name of the Google Cloud Platform project. Written + * as `projects/{projectID}`, where `{projectID}` is the + * [Google Cloud Platform project + * ID](https://support.google.com/cloud/answer/6158840). + * Example: `projects/my-project-123`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Devtools\Clouderrorreporting\V1Beta1\ErrorStatsService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the Google Cloud Platform project. Written + * as `projects/{projectID}`, where `{projectID}` is the + * [Google Cloud Platform project + * ID](https://support.google.com/cloud/answer/6158840). + * Example: `projects/my-project-123`. + * + * Generated from protobuf field string project_name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getProjectName() + { + return $this->project_name; + } + + /** + * Required. The resource name of the Google Cloud Platform project. Written + * as `projects/{projectID}`, where `{projectID}` is the + * [Google Cloud Platform project + * ID](https://support.google.com/cloud/answer/6158840). + * Example: `projects/my-project-123`. + * + * Generated from protobuf field string project_name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setProjectName($var) + { + GPBUtil::checkString($var, True); + $this->project_name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/DeleteEventsResponse.php b/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/DeleteEventsResponse.php new file mode 100644 index 000000000000..53e2ba2358d4 --- /dev/null +++ b/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/DeleteEventsResponse.php @@ -0,0 +1,33 @@ +google.devtools.clouderrorreporting.v1beta1.DeleteEventsResponse + */ +class DeleteEventsResponse extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Devtools\Clouderrorreporting\V1Beta1\ErrorStatsService::initOnce(); + parent::__construct($data); + } + +} + diff --git a/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/ErrorContext.php b/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/ErrorContext.php new file mode 100644 index 000000000000..1c5566968212 --- /dev/null +++ b/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/ErrorContext.php @@ -0,0 +1,206 @@ +google.devtools.clouderrorreporting.v1beta1.ErrorContext + */ +class ErrorContext extends \Google\Protobuf\Internal\Message +{ + /** + * The HTTP request which was processed when the error was + * triggered. + * + * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.HttpRequestContext http_request = 1; + */ + protected $http_request = null; + /** + * The user who caused or was affected by the crash. + * This can be a user ID, an email address, or an arbitrary token that + * uniquely identifies the user. + * When sending an error report, leave this field empty if the user was not + * logged in. In this case the + * Error Reporting system will use other data, such as remote IP address, to + * distinguish affected users. See `affected_users_count` in + * `ErrorGroupStats`. + * + * Generated from protobuf field string user = 2; + */ + protected $user = ''; + /** + * The location in the source code where the decision was made to + * report the error, usually the place where it was logged. + * For a logged exception this would be the source line where the + * exception is logged, usually close to the place where it was + * caught. + * + * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.SourceLocation report_location = 3; + */ + protected $report_location = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\ErrorReporting\V1beta1\HttpRequestContext $http_request + * The HTTP request which was processed when the error was + * triggered. + * @type string $user + * The user who caused or was affected by the crash. + * This can be a user ID, an email address, or an arbitrary token that + * uniquely identifies the user. + * When sending an error report, leave this field empty if the user was not + * logged in. In this case the + * Error Reporting system will use other data, such as remote IP address, to + * distinguish affected users. See `affected_users_count` in + * `ErrorGroupStats`. + * @type \Google\Cloud\ErrorReporting\V1beta1\SourceLocation $report_location + * The location in the source code where the decision was made to + * report the error, usually the place where it was logged. + * For a logged exception this would be the source line where the + * exception is logged, usually close to the place where it was + * caught. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Devtools\Clouderrorreporting\V1Beta1\Common::initOnce(); + parent::__construct($data); + } + + /** + * The HTTP request which was processed when the error was + * triggered. + * + * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.HttpRequestContext http_request = 1; + * @return \Google\Cloud\ErrorReporting\V1beta1\HttpRequestContext|null + */ + public function getHttpRequest() + { + return $this->http_request; + } + + public function hasHttpRequest() + { + return isset($this->http_request); + } + + public function clearHttpRequest() + { + unset($this->http_request); + } + + /** + * The HTTP request which was processed when the error was + * triggered. + * + * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.HttpRequestContext http_request = 1; + * @param \Google\Cloud\ErrorReporting\V1beta1\HttpRequestContext $var + * @return $this + */ + public function setHttpRequest($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\ErrorReporting\V1beta1\HttpRequestContext::class); + $this->http_request = $var; + + return $this; + } + + /** + * The user who caused or was affected by the crash. + * This can be a user ID, an email address, or an arbitrary token that + * uniquely identifies the user. + * When sending an error report, leave this field empty if the user was not + * logged in. In this case the + * Error Reporting system will use other data, such as remote IP address, to + * distinguish affected users. See `affected_users_count` in + * `ErrorGroupStats`. + * + * Generated from protobuf field string user = 2; + * @return string + */ + public function getUser() + { + return $this->user; + } + + /** + * The user who caused or was affected by the crash. + * This can be a user ID, an email address, or an arbitrary token that + * uniquely identifies the user. + * When sending an error report, leave this field empty if the user was not + * logged in. In this case the + * Error Reporting system will use other data, such as remote IP address, to + * distinguish affected users. See `affected_users_count` in + * `ErrorGroupStats`. + * + * Generated from protobuf field string user = 2; + * @param string $var + * @return $this + */ + public function setUser($var) + { + GPBUtil::checkString($var, True); + $this->user = $var; + + return $this; + } + + /** + * The location in the source code where the decision was made to + * report the error, usually the place where it was logged. + * For a logged exception this would be the source line where the + * exception is logged, usually close to the place where it was + * caught. + * + * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.SourceLocation report_location = 3; + * @return \Google\Cloud\ErrorReporting\V1beta1\SourceLocation|null + */ + public function getReportLocation() + { + return $this->report_location; + } + + public function hasReportLocation() + { + return isset($this->report_location); + } + + public function clearReportLocation() + { + unset($this->report_location); + } + + /** + * The location in the source code where the decision was made to + * report the error, usually the place where it was logged. + * For a logged exception this would be the source line where the + * exception is logged, usually close to the place where it was + * caught. + * + * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.SourceLocation report_location = 3; + * @param \Google\Cloud\ErrorReporting\V1beta1\SourceLocation $var + * @return $this + */ + public function setReportLocation($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\ErrorReporting\V1beta1\SourceLocation::class); + $this->report_location = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/ErrorEvent.php b/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/ErrorEvent.php new file mode 100644 index 000000000000..64d7396ca2d5 --- /dev/null +++ b/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/ErrorEvent.php @@ -0,0 +1,207 @@ +google.devtools.clouderrorreporting.v1beta1.ErrorEvent + */ +class ErrorEvent extends \Google\Protobuf\Internal\Message +{ + /** + * Time when the event occurred as provided in the error report. + * If the report did not contain a timestamp, the time the error was received + * by the Error Reporting system is used. + * + * Generated from protobuf field .google.protobuf.Timestamp event_time = 1; + */ + protected $event_time = null; + /** + * The `ServiceContext` for which this error was reported. + * + * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.ServiceContext service_context = 2; + */ + protected $service_context = null; + /** + * The stack trace that was reported or logged by the service. + * + * Generated from protobuf field string message = 3; + */ + protected $message = ''; + /** + * Data about the context in which the error occurred. + * + * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.ErrorContext context = 5; + */ + protected $context = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Timestamp $event_time + * Time when the event occurred as provided in the error report. + * If the report did not contain a timestamp, the time the error was received + * by the Error Reporting system is used. + * @type \Google\Cloud\ErrorReporting\V1beta1\ServiceContext $service_context + * The `ServiceContext` for which this error was reported. + * @type string $message + * The stack trace that was reported or logged by the service. + * @type \Google\Cloud\ErrorReporting\V1beta1\ErrorContext $context + * Data about the context in which the error occurred. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Devtools\Clouderrorreporting\V1Beta1\Common::initOnce(); + parent::__construct($data); + } + + /** + * Time when the event occurred as provided in the error report. + * If the report did not contain a timestamp, the time the error was received + * by the Error Reporting system is used. + * + * Generated from protobuf field .google.protobuf.Timestamp event_time = 1; + * @return \Google\Protobuf\Timestamp|null + */ + public function getEventTime() + { + return $this->event_time; + } + + public function hasEventTime() + { + return isset($this->event_time); + } + + public function clearEventTime() + { + unset($this->event_time); + } + + /** + * Time when the event occurred as provided in the error report. + * If the report did not contain a timestamp, the time the error was received + * by the Error Reporting system is used. + * + * Generated from protobuf field .google.protobuf.Timestamp event_time = 1; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setEventTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->event_time = $var; + + return $this; + } + + /** + * The `ServiceContext` for which this error was reported. + * + * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.ServiceContext service_context = 2; + * @return \Google\Cloud\ErrorReporting\V1beta1\ServiceContext|null + */ + public function getServiceContext() + { + return $this->service_context; + } + + public function hasServiceContext() + { + return isset($this->service_context); + } + + public function clearServiceContext() + { + unset($this->service_context); + } + + /** + * The `ServiceContext` for which this error was reported. + * + * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.ServiceContext service_context = 2; + * @param \Google\Cloud\ErrorReporting\V1beta1\ServiceContext $var + * @return $this + */ + public function setServiceContext($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\ErrorReporting\V1beta1\ServiceContext::class); + $this->service_context = $var; + + return $this; + } + + /** + * The stack trace that was reported or logged by the service. + * + * Generated from protobuf field string message = 3; + * @return string + */ + public function getMessage() + { + return $this->message; + } + + /** + * The stack trace that was reported or logged by the service. + * + * Generated from protobuf field string message = 3; + * @param string $var + * @return $this + */ + public function setMessage($var) + { + GPBUtil::checkString($var, True); + $this->message = $var; + + return $this; + } + + /** + * Data about the context in which the error occurred. + * + * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.ErrorContext context = 5; + * @return \Google\Cloud\ErrorReporting\V1beta1\ErrorContext|null + */ + public function getContext() + { + return $this->context; + } + + public function hasContext() + { + return isset($this->context); + } + + public function clearContext() + { + unset($this->context); + } + + /** + * Data about the context in which the error occurred. + * + * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.ErrorContext context = 5; + * @param \Google\Cloud\ErrorReporting\V1beta1\ErrorContext $var + * @return $this + */ + public function setContext($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\ErrorReporting\V1beta1\ErrorContext::class); + $this->context = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/ErrorGroup.php b/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/ErrorGroup.php new file mode 100644 index 000000000000..0b3b5c6b574a --- /dev/null +++ b/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/ErrorGroup.php @@ -0,0 +1,181 @@ +google.devtools.clouderrorreporting.v1beta1.ErrorGroup + */ +class ErrorGroup extends \Google\Protobuf\Internal\Message +{ + /** + * The group resource name. + * Example: projects/my-project-123/groups/CNSgkpnppqKCUw + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * Group IDs are unique for a given project. If the same kind of error + * occurs in different service contexts, it will receive the same group ID. + * + * Generated from protobuf field string group_id = 2; + */ + protected $group_id = ''; + /** + * Associated tracking issues. + * + * Generated from protobuf field repeated .google.devtools.clouderrorreporting.v1beta1.TrackingIssue tracking_issues = 3; + */ + private $tracking_issues; + /** + * Error group's resolution status. + * An unspecified resolution status will be interpreted as OPEN + * + * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.ResolutionStatus resolution_status = 5; + */ + protected $resolution_status = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The group resource name. + * Example: projects/my-project-123/groups/CNSgkpnppqKCUw + * @type string $group_id + * Group IDs are unique for a given project. If the same kind of error + * occurs in different service contexts, it will receive the same group ID. + * @type array<\Google\Cloud\ErrorReporting\V1beta1\TrackingIssue>|\Google\Protobuf\Internal\RepeatedField $tracking_issues + * Associated tracking issues. + * @type int $resolution_status + * Error group's resolution status. + * An unspecified resolution status will be interpreted as OPEN + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Devtools\Clouderrorreporting\V1Beta1\Common::initOnce(); + parent::__construct($data); + } + + /** + * The group resource name. + * Example: projects/my-project-123/groups/CNSgkpnppqKCUw + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The group resource name. + * Example: projects/my-project-123/groups/CNSgkpnppqKCUw + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Group IDs are unique for a given project. If the same kind of error + * occurs in different service contexts, it will receive the same group ID. + * + * Generated from protobuf field string group_id = 2; + * @return string + */ + public function getGroupId() + { + return $this->group_id; + } + + /** + * Group IDs are unique for a given project. If the same kind of error + * occurs in different service contexts, it will receive the same group ID. + * + * Generated from protobuf field string group_id = 2; + * @param string $var + * @return $this + */ + public function setGroupId($var) + { + GPBUtil::checkString($var, True); + $this->group_id = $var; + + return $this; + } + + /** + * Associated tracking issues. + * + * Generated from protobuf field repeated .google.devtools.clouderrorreporting.v1beta1.TrackingIssue tracking_issues = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTrackingIssues() + { + return $this->tracking_issues; + } + + /** + * Associated tracking issues. + * + * Generated from protobuf field repeated .google.devtools.clouderrorreporting.v1beta1.TrackingIssue tracking_issues = 3; + * @param array<\Google\Cloud\ErrorReporting\V1beta1\TrackingIssue>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTrackingIssues($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\ErrorReporting\V1beta1\TrackingIssue::class); + $this->tracking_issues = $arr; + + return $this; + } + + /** + * Error group's resolution status. + * An unspecified resolution status will be interpreted as OPEN + * + * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.ResolutionStatus resolution_status = 5; + * @return int + */ + public function getResolutionStatus() + { + return $this->resolution_status; + } + + /** + * Error group's resolution status. + * An unspecified resolution status will be interpreted as OPEN + * + * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.ResolutionStatus resolution_status = 5; + * @param int $var + * @return $this + */ + public function setResolutionStatus($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\ErrorReporting\V1beta1\ResolutionStatus::class); + $this->resolution_status = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/ErrorGroupOrder.php b/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/ErrorGroupOrder.php new file mode 100644 index 000000000000..fd726de75f01 --- /dev/null +++ b/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/ErrorGroupOrder.php @@ -0,0 +1,76 @@ +google.devtools.clouderrorreporting.v1beta1.ErrorGroupOrder + */ +class ErrorGroupOrder +{ + /** + * No group order specified. + * + * Generated from protobuf enum GROUP_ORDER_UNSPECIFIED = 0; + */ + const GROUP_ORDER_UNSPECIFIED = 0; + /** + * Total count of errors in the given time window in descending order. + * + * Generated from protobuf enum COUNT_DESC = 1; + */ + const COUNT_DESC = 1; + /** + * Timestamp when the group was last seen in the given time window + * in descending order. + * + * Generated from protobuf enum LAST_SEEN_DESC = 2; + */ + const LAST_SEEN_DESC = 2; + /** + * Timestamp when the group was created in descending order. + * + * Generated from protobuf enum CREATED_DESC = 3; + */ + const CREATED_DESC = 3; + /** + * Number of affected users in the given time window in descending order. + * + * Generated from protobuf enum AFFECTED_USERS_DESC = 4; + */ + const AFFECTED_USERS_DESC = 4; + + private static $valueToName = [ + self::GROUP_ORDER_UNSPECIFIED => 'GROUP_ORDER_UNSPECIFIED', + self::COUNT_DESC => 'COUNT_DESC', + self::LAST_SEEN_DESC => 'LAST_SEEN_DESC', + self::CREATED_DESC => 'CREATED_DESC', + self::AFFECTED_USERS_DESC => 'AFFECTED_USERS_DESC', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/ErrorGroupServiceGrpcClient.php b/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/ErrorGroupServiceGrpcClient.php new file mode 100644 index 000000000000..5f5856a4f6d7 --- /dev/null +++ b/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/ErrorGroupServiceGrpcClient.php @@ -0,0 +1,66 @@ +_simpleRequest('/google.devtools.clouderrorreporting.v1beta1.ErrorGroupService/GetGroup', + $argument, + ['\Google\Cloud\ErrorReporting\V1beta1\ErrorGroup', 'decode'], + $metadata, $options); + } + + /** + * Replace the data for the specified group. + * Fails if the group does not exist. + * @param \Google\Cloud\ErrorReporting\V1beta1\UpdateGroupRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function UpdateGroup(\Google\Cloud\ErrorReporting\V1beta1\UpdateGroupRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.devtools.clouderrorreporting.v1beta1.ErrorGroupService/UpdateGroup', + $argument, + ['\Google\Cloud\ErrorReporting\V1beta1\ErrorGroup', 'decode'], + $metadata, $options); + } + +} diff --git a/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/ErrorGroupStats.php b/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/ErrorGroupStats.php new file mode 100644 index 000000000000..d76b7b2712ee --- /dev/null +++ b/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/ErrorGroupStats.php @@ -0,0 +1,488 @@ +google.devtools.clouderrorreporting.v1beta1.ErrorGroupStats + */ +class ErrorGroupStats extends \Google\Protobuf\Internal\Message +{ + /** + * Group data that is independent of the filter criteria. + * + * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.ErrorGroup group = 1; + */ + protected $group = null; + /** + * Approximate total number of events in the given group that match + * the filter criteria. + * + * Generated from protobuf field int64 count = 2; + */ + protected $count = 0; + /** + * Approximate number of affected users in the given group that + * match the filter criteria. + * Users are distinguished by data in the `ErrorContext` of the + * individual error events, such as their login name or their remote + * IP address in case of HTTP requests. + * The number of affected users can be zero even if the number of + * errors is non-zero if no data was provided from which the + * affected user could be deduced. + * Users are counted based on data in the request + * context that was provided in the error report. If more users are + * implicitly affected, such as due to a crash of the whole service, + * this is not reflected here. + * + * Generated from protobuf field int64 affected_users_count = 3; + */ + protected $affected_users_count = 0; + /** + * Approximate number of occurrences over time. + * Timed counts returned by ListGroups are guaranteed to be: + * - Inside the requested time interval + * - Non-overlapping, and + * - Ordered by ascending time. + * + * Generated from protobuf field repeated .google.devtools.clouderrorreporting.v1beta1.TimedCount timed_counts = 4; + */ + private $timed_counts; + /** + * Approximate first occurrence that was ever seen for this group + * and which matches the given filter criteria, ignoring the + * time_range that was specified in the request. + * + * Generated from protobuf field .google.protobuf.Timestamp first_seen_time = 5; + */ + protected $first_seen_time = null; + /** + * Approximate last occurrence that was ever seen for this group and + * which matches the given filter criteria, ignoring the time_range + * that was specified in the request. + * + * Generated from protobuf field .google.protobuf.Timestamp last_seen_time = 6; + */ + protected $last_seen_time = null; + /** + * Service contexts with a non-zero error count for the given filter + * criteria. This list can be truncated if multiple services are affected. + * Refer to `num_affected_services` for the total count. + * + * Generated from protobuf field repeated .google.devtools.clouderrorreporting.v1beta1.ServiceContext affected_services = 7; + */ + private $affected_services; + /** + * The total number of services with a non-zero error count for the given + * filter criteria. + * + * Generated from protobuf field int32 num_affected_services = 8; + */ + protected $num_affected_services = 0; + /** + * An arbitrary event that is chosen as representative for the whole group. + * The representative event is intended to be used as a quick preview for + * the whole group. Events in the group are usually sufficiently similar + * to each other such that showing an arbitrary representative provides + * insight into the characteristics of the group as a whole. + * + * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.ErrorEvent representative = 9; + */ + protected $representative = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\ErrorReporting\V1beta1\ErrorGroup $group + * Group data that is independent of the filter criteria. + * @type int|string $count + * Approximate total number of events in the given group that match + * the filter criteria. + * @type int|string $affected_users_count + * Approximate number of affected users in the given group that + * match the filter criteria. + * Users are distinguished by data in the `ErrorContext` of the + * individual error events, such as their login name or their remote + * IP address in case of HTTP requests. + * The number of affected users can be zero even if the number of + * errors is non-zero if no data was provided from which the + * affected user could be deduced. + * Users are counted based on data in the request + * context that was provided in the error report. If more users are + * implicitly affected, such as due to a crash of the whole service, + * this is not reflected here. + * @type array<\Google\Cloud\ErrorReporting\V1beta1\TimedCount>|\Google\Protobuf\Internal\RepeatedField $timed_counts + * Approximate number of occurrences over time. + * Timed counts returned by ListGroups are guaranteed to be: + * - Inside the requested time interval + * - Non-overlapping, and + * - Ordered by ascending time. + * @type \Google\Protobuf\Timestamp $first_seen_time + * Approximate first occurrence that was ever seen for this group + * and which matches the given filter criteria, ignoring the + * time_range that was specified in the request. + * @type \Google\Protobuf\Timestamp $last_seen_time + * Approximate last occurrence that was ever seen for this group and + * which matches the given filter criteria, ignoring the time_range + * that was specified in the request. + * @type array<\Google\Cloud\ErrorReporting\V1beta1\ServiceContext>|\Google\Protobuf\Internal\RepeatedField $affected_services + * Service contexts with a non-zero error count for the given filter + * criteria. This list can be truncated if multiple services are affected. + * Refer to `num_affected_services` for the total count. + * @type int $num_affected_services + * The total number of services with a non-zero error count for the given + * filter criteria. + * @type \Google\Cloud\ErrorReporting\V1beta1\ErrorEvent $representative + * An arbitrary event that is chosen as representative for the whole group. + * The representative event is intended to be used as a quick preview for + * the whole group. Events in the group are usually sufficiently similar + * to each other such that showing an arbitrary representative provides + * insight into the characteristics of the group as a whole. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Devtools\Clouderrorreporting\V1Beta1\ErrorStatsService::initOnce(); + parent::__construct($data); + } + + /** + * Group data that is independent of the filter criteria. + * + * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.ErrorGroup group = 1; + * @return \Google\Cloud\ErrorReporting\V1beta1\ErrorGroup|null + */ + public function getGroup() + { + return $this->group; + } + + public function hasGroup() + { + return isset($this->group); + } + + public function clearGroup() + { + unset($this->group); + } + + /** + * Group data that is independent of the filter criteria. + * + * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.ErrorGroup group = 1; + * @param \Google\Cloud\ErrorReporting\V1beta1\ErrorGroup $var + * @return $this + */ + public function setGroup($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\ErrorReporting\V1beta1\ErrorGroup::class); + $this->group = $var; + + return $this; + } + + /** + * Approximate total number of events in the given group that match + * the filter criteria. + * + * Generated from protobuf field int64 count = 2; + * @return int|string + */ + public function getCount() + { + return $this->count; + } + + /** + * Approximate total number of events in the given group that match + * the filter criteria. + * + * Generated from protobuf field int64 count = 2; + * @param int|string $var + * @return $this + */ + public function setCount($var) + { + GPBUtil::checkInt64($var); + $this->count = $var; + + return $this; + } + + /** + * Approximate number of affected users in the given group that + * match the filter criteria. + * Users are distinguished by data in the `ErrorContext` of the + * individual error events, such as their login name or their remote + * IP address in case of HTTP requests. + * The number of affected users can be zero even if the number of + * errors is non-zero if no data was provided from which the + * affected user could be deduced. + * Users are counted based on data in the request + * context that was provided in the error report. If more users are + * implicitly affected, such as due to a crash of the whole service, + * this is not reflected here. + * + * Generated from protobuf field int64 affected_users_count = 3; + * @return int|string + */ + public function getAffectedUsersCount() + { + return $this->affected_users_count; + } + + /** + * Approximate number of affected users in the given group that + * match the filter criteria. + * Users are distinguished by data in the `ErrorContext` of the + * individual error events, such as their login name or their remote + * IP address in case of HTTP requests. + * The number of affected users can be zero even if the number of + * errors is non-zero if no data was provided from which the + * affected user could be deduced. + * Users are counted based on data in the request + * context that was provided in the error report. If more users are + * implicitly affected, such as due to a crash of the whole service, + * this is not reflected here. + * + * Generated from protobuf field int64 affected_users_count = 3; + * @param int|string $var + * @return $this + */ + public function setAffectedUsersCount($var) + { + GPBUtil::checkInt64($var); + $this->affected_users_count = $var; + + return $this; + } + + /** + * Approximate number of occurrences over time. + * Timed counts returned by ListGroups are guaranteed to be: + * - Inside the requested time interval + * - Non-overlapping, and + * - Ordered by ascending time. + * + * Generated from protobuf field repeated .google.devtools.clouderrorreporting.v1beta1.TimedCount timed_counts = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTimedCounts() + { + return $this->timed_counts; + } + + /** + * Approximate number of occurrences over time. + * Timed counts returned by ListGroups are guaranteed to be: + * - Inside the requested time interval + * - Non-overlapping, and + * - Ordered by ascending time. + * + * Generated from protobuf field repeated .google.devtools.clouderrorreporting.v1beta1.TimedCount timed_counts = 4; + * @param array<\Google\Cloud\ErrorReporting\V1beta1\TimedCount>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTimedCounts($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\ErrorReporting\V1beta1\TimedCount::class); + $this->timed_counts = $arr; + + return $this; + } + + /** + * Approximate first occurrence that was ever seen for this group + * and which matches the given filter criteria, ignoring the + * time_range that was specified in the request. + * + * Generated from protobuf field .google.protobuf.Timestamp first_seen_time = 5; + * @return \Google\Protobuf\Timestamp|null + */ + public function getFirstSeenTime() + { + return $this->first_seen_time; + } + + public function hasFirstSeenTime() + { + return isset($this->first_seen_time); + } + + public function clearFirstSeenTime() + { + unset($this->first_seen_time); + } + + /** + * Approximate first occurrence that was ever seen for this group + * and which matches the given filter criteria, ignoring the + * time_range that was specified in the request. + * + * Generated from protobuf field .google.protobuf.Timestamp first_seen_time = 5; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setFirstSeenTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->first_seen_time = $var; + + return $this; + } + + /** + * Approximate last occurrence that was ever seen for this group and + * which matches the given filter criteria, ignoring the time_range + * that was specified in the request. + * + * Generated from protobuf field .google.protobuf.Timestamp last_seen_time = 6; + * @return \Google\Protobuf\Timestamp|null + */ + public function getLastSeenTime() + { + return $this->last_seen_time; + } + + public function hasLastSeenTime() + { + return isset($this->last_seen_time); + } + + public function clearLastSeenTime() + { + unset($this->last_seen_time); + } + + /** + * Approximate last occurrence that was ever seen for this group and + * which matches the given filter criteria, ignoring the time_range + * that was specified in the request. + * + * Generated from protobuf field .google.protobuf.Timestamp last_seen_time = 6; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setLastSeenTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->last_seen_time = $var; + + return $this; + } + + /** + * Service contexts with a non-zero error count for the given filter + * criteria. This list can be truncated if multiple services are affected. + * Refer to `num_affected_services` for the total count. + * + * Generated from protobuf field repeated .google.devtools.clouderrorreporting.v1beta1.ServiceContext affected_services = 7; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAffectedServices() + { + return $this->affected_services; + } + + /** + * Service contexts with a non-zero error count for the given filter + * criteria. This list can be truncated if multiple services are affected. + * Refer to `num_affected_services` for the total count. + * + * Generated from protobuf field repeated .google.devtools.clouderrorreporting.v1beta1.ServiceContext affected_services = 7; + * @param array<\Google\Cloud\ErrorReporting\V1beta1\ServiceContext>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAffectedServices($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\ErrorReporting\V1beta1\ServiceContext::class); + $this->affected_services = $arr; + + return $this; + } + + /** + * The total number of services with a non-zero error count for the given + * filter criteria. + * + * Generated from protobuf field int32 num_affected_services = 8; + * @return int + */ + public function getNumAffectedServices() + { + return $this->num_affected_services; + } + + /** + * The total number of services with a non-zero error count for the given + * filter criteria. + * + * Generated from protobuf field int32 num_affected_services = 8; + * @param int $var + * @return $this + */ + public function setNumAffectedServices($var) + { + GPBUtil::checkInt32($var); + $this->num_affected_services = $var; + + return $this; + } + + /** + * An arbitrary event that is chosen as representative for the whole group. + * The representative event is intended to be used as a quick preview for + * the whole group. Events in the group are usually sufficiently similar + * to each other such that showing an arbitrary representative provides + * insight into the characteristics of the group as a whole. + * + * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.ErrorEvent representative = 9; + * @return \Google\Cloud\ErrorReporting\V1beta1\ErrorEvent|null + */ + public function getRepresentative() + { + return $this->representative; + } + + public function hasRepresentative() + { + return isset($this->representative); + } + + public function clearRepresentative() + { + unset($this->representative); + } + + /** + * An arbitrary event that is chosen as representative for the whole group. + * The representative event is intended to be used as a quick preview for + * the whole group. Events in the group are usually sufficiently similar + * to each other such that showing an arbitrary representative provides + * insight into the characteristics of the group as a whole. + * + * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.ErrorEvent representative = 9; + * @param \Google\Cloud\ErrorReporting\V1beta1\ErrorEvent $var + * @return $this + */ + public function setRepresentative($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\ErrorReporting\V1beta1\ErrorEvent::class); + $this->representative = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/ErrorStatsServiceGrpcClient.php b/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/ErrorStatsServiceGrpcClient.php new file mode 100644 index 000000000000..2a17f17379b1 --- /dev/null +++ b/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/ErrorStatsServiceGrpcClient.php @@ -0,0 +1,81 @@ +_simpleRequest('/google.devtools.clouderrorreporting.v1beta1.ErrorStatsService/ListGroupStats', + $argument, + ['\Google\Cloud\ErrorReporting\V1beta1\ListGroupStatsResponse', 'decode'], + $metadata, $options); + } + + /** + * Lists the specified events. + * @param \Google\Cloud\ErrorReporting\V1beta1\ListEventsRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function ListEvents(\Google\Cloud\ErrorReporting\V1beta1\ListEventsRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.devtools.clouderrorreporting.v1beta1.ErrorStatsService/ListEvents', + $argument, + ['\Google\Cloud\ErrorReporting\V1beta1\ListEventsResponse', 'decode'], + $metadata, $options); + } + + /** + * Deletes all error events of a given project. + * @param \Google\Cloud\ErrorReporting\V1beta1\DeleteEventsRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function DeleteEvents(\Google\Cloud\ErrorReporting\V1beta1\DeleteEventsRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.devtools.clouderrorreporting.v1beta1.ErrorStatsService/DeleteEvents', + $argument, + ['\Google\Cloud\ErrorReporting\V1beta1\DeleteEventsResponse', 'decode'], + $metadata, $options); + } + +} diff --git a/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/GetGroupRequest.php b/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/GetGroupRequest.php new file mode 100644 index 000000000000..c9e90c7098fe --- /dev/null +++ b/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/GetGroupRequest.php @@ -0,0 +1,102 @@ +google.devtools.clouderrorreporting.v1beta1.GetGroupRequest + */ +class GetGroupRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The group resource name. Written as + * `projects/{projectID}/groups/{group_name}`. Call + * [`groupStats.list`](https://cloud.google.com/error-reporting/reference/rest/v1beta1/projects.groupStats/list) + * to return a list of groups belonging to this project. + * Example: `projects/my-project-123/groups/my-group` + * + * Generated from protobuf field string group_name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $group_name = ''; + + /** + * @param string $groupName Required. The group resource name. Written as + * `projects/{projectID}/groups/{group_name}`. Call + * [`groupStats.list`](https://cloud.google.com/error-reporting/reference/rest/v1beta1/projects.groupStats/list) + * to return a list of groups belonging to this project. + * + * Example: `projects/my-project-123/groups/my-group` + * Please see {@see ErrorGroupServiceClient::errorGroupName()} for help formatting this field. + * + * @return \Google\Cloud\ErrorReporting\V1beta1\GetGroupRequest + * + * @experimental + */ + public static function build(string $groupName): self + { + return (new self()) + ->setGroupName($groupName); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $group_name + * Required. The group resource name. Written as + * `projects/{projectID}/groups/{group_name}`. Call + * [`groupStats.list`](https://cloud.google.com/error-reporting/reference/rest/v1beta1/projects.groupStats/list) + * to return a list of groups belonging to this project. + * Example: `projects/my-project-123/groups/my-group` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Devtools\Clouderrorreporting\V1Beta1\ErrorGroupService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The group resource name. Written as + * `projects/{projectID}/groups/{group_name}`. Call + * [`groupStats.list`](https://cloud.google.com/error-reporting/reference/rest/v1beta1/projects.groupStats/list) + * to return a list of groups belonging to this project. + * Example: `projects/my-project-123/groups/my-group` + * + * Generated from protobuf field string group_name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getGroupName() + { + return $this->group_name; + } + + /** + * Required. The group resource name. Written as + * `projects/{projectID}/groups/{group_name}`. Call + * [`groupStats.list`](https://cloud.google.com/error-reporting/reference/rest/v1beta1/projects.groupStats/list) + * to return a list of groups belonging to this project. + * Example: `projects/my-project-123/groups/my-group` + * + * Generated from protobuf field string group_name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setGroupName($var) + { + GPBUtil::checkString($var, True); + $this->group_name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/HttpRequestContext.php b/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/HttpRequestContext.php new file mode 100644 index 000000000000..95c45a2ac88f --- /dev/null +++ b/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/HttpRequestContext.php @@ -0,0 +1,252 @@ +google.devtools.clouderrorreporting.v1beta1.HttpRequestContext + */ +class HttpRequestContext extends \Google\Protobuf\Internal\Message +{ + /** + * The type of HTTP request, such as `GET`, `POST`, etc. + * + * Generated from protobuf field string method = 1; + */ + protected $method = ''; + /** + * The URL of the request. + * + * Generated from protobuf field string url = 2; + */ + protected $url = ''; + /** + * The user agent information that is provided with the request. + * + * Generated from protobuf field string user_agent = 3; + */ + protected $user_agent = ''; + /** + * The referrer information that is provided with the request. + * + * Generated from protobuf field string referrer = 4; + */ + protected $referrer = ''; + /** + * The HTTP response status code for the request. + * + * Generated from protobuf field int32 response_status_code = 5; + */ + protected $response_status_code = 0; + /** + * The IP address from which the request originated. + * This can be IPv4, IPv6, or a token which is derived from the + * IP address, depending on the data that has been provided + * in the error report. + * + * Generated from protobuf field string remote_ip = 6; + */ + protected $remote_ip = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $method + * The type of HTTP request, such as `GET`, `POST`, etc. + * @type string $url + * The URL of the request. + * @type string $user_agent + * The user agent information that is provided with the request. + * @type string $referrer + * The referrer information that is provided with the request. + * @type int $response_status_code + * The HTTP response status code for the request. + * @type string $remote_ip + * The IP address from which the request originated. + * This can be IPv4, IPv6, or a token which is derived from the + * IP address, depending on the data that has been provided + * in the error report. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Devtools\Clouderrorreporting\V1Beta1\Common::initOnce(); + parent::__construct($data); + } + + /** + * The type of HTTP request, such as `GET`, `POST`, etc. + * + * Generated from protobuf field string method = 1; + * @return string + */ + public function getMethod() + { + return $this->method; + } + + /** + * The type of HTTP request, such as `GET`, `POST`, etc. + * + * Generated from protobuf field string method = 1; + * @param string $var + * @return $this + */ + public function setMethod($var) + { + GPBUtil::checkString($var, True); + $this->method = $var; + + return $this; + } + + /** + * The URL of the request. + * + * Generated from protobuf field string url = 2; + * @return string + */ + public function getUrl() + { + return $this->url; + } + + /** + * The URL of the request. + * + * Generated from protobuf field string url = 2; + * @param string $var + * @return $this + */ + public function setUrl($var) + { + GPBUtil::checkString($var, True); + $this->url = $var; + + return $this; + } + + /** + * The user agent information that is provided with the request. + * + * Generated from protobuf field string user_agent = 3; + * @return string + */ + public function getUserAgent() + { + return $this->user_agent; + } + + /** + * The user agent information that is provided with the request. + * + * Generated from protobuf field string user_agent = 3; + * @param string $var + * @return $this + */ + public function setUserAgent($var) + { + GPBUtil::checkString($var, True); + $this->user_agent = $var; + + return $this; + } + + /** + * The referrer information that is provided with the request. + * + * Generated from protobuf field string referrer = 4; + * @return string + */ + public function getReferrer() + { + return $this->referrer; + } + + /** + * The referrer information that is provided with the request. + * + * Generated from protobuf field string referrer = 4; + * @param string $var + * @return $this + */ + public function setReferrer($var) + { + GPBUtil::checkString($var, True); + $this->referrer = $var; + + return $this; + } + + /** + * The HTTP response status code for the request. + * + * Generated from protobuf field int32 response_status_code = 5; + * @return int + */ + public function getResponseStatusCode() + { + return $this->response_status_code; + } + + /** + * The HTTP response status code for the request. + * + * Generated from protobuf field int32 response_status_code = 5; + * @param int $var + * @return $this + */ + public function setResponseStatusCode($var) + { + GPBUtil::checkInt32($var); + $this->response_status_code = $var; + + return $this; + } + + /** + * The IP address from which the request originated. + * This can be IPv4, IPv6, or a token which is derived from the + * IP address, depending on the data that has been provided + * in the error report. + * + * Generated from protobuf field string remote_ip = 6; + * @return string + */ + public function getRemoteIp() + { + return $this->remote_ip; + } + + /** + * The IP address from which the request originated. + * This can be IPv4, IPv6, or a token which is derived from the + * IP address, depending on the data that has been provided + * in the error report. + * + * Generated from protobuf field string remote_ip = 6; + * @param string $var + * @return $this + */ + public function setRemoteIp($var) + { + GPBUtil::checkString($var, True); + $this->remote_ip = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/ListEventsRequest.php b/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/ListEventsRequest.php new file mode 100644 index 000000000000..386253c088be --- /dev/null +++ b/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/ListEventsRequest.php @@ -0,0 +1,310 @@ +google.devtools.clouderrorreporting.v1beta1.ListEventsRequest + */ +class ListEventsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the Google Cloud Platform project. Written + * as `projects/{projectID}`, where `{projectID}` is the + * [Google Cloud Platform project + * ID](https://support.google.com/cloud/answer/6158840). + * Example: `projects/my-project-123`. + * + * Generated from protobuf field string project_name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $project_name = ''; + /** + * Required. The group for which events shall be returned. + * + * Generated from protobuf field string group_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $group_id = ''; + /** + * Optional. List only ErrorGroups which belong to a service context that + * matches the filter. + * Data for all service contexts is returned if this field is not specified. + * + * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.ServiceContextFilter service_filter = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $service_filter = null; + /** + * Optional. List only data for the given time range. + * If not set a default time range is used. The field time_range_begin + * in the response will specify the beginning of this time range. + * + * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.QueryTimeRange time_range = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $time_range = null; + /** + * Optional. The maximum number of results to return per response. + * + * Generated from protobuf field int32 page_size = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Optional. A `next_page_token` provided by a previous response. + * + * Generated from protobuf field string page_token = 7 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = ''; + + /** + * @param string $projectName Required. The resource name of the Google Cloud Platform project. Written + * as `projects/{projectID}`, where `{projectID}` is the + * [Google Cloud Platform project + * ID](https://support.google.com/cloud/answer/6158840). + * + * Example: `projects/my-project-123`. Please see + * {@see ErrorStatsServiceClient::projectName()} for help formatting this field. + * @param string $groupId Required. The group for which events shall be returned. + * + * @return \Google\Cloud\ErrorReporting\V1beta1\ListEventsRequest + * + * @experimental + */ + public static function build(string $projectName, string $groupId): self + { + return (new self()) + ->setProjectName($projectName) + ->setGroupId($groupId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $project_name + * Required. The resource name of the Google Cloud Platform project. Written + * as `projects/{projectID}`, where `{projectID}` is the + * [Google Cloud Platform project + * ID](https://support.google.com/cloud/answer/6158840). + * Example: `projects/my-project-123`. + * @type string $group_id + * Required. The group for which events shall be returned. + * @type \Google\Cloud\ErrorReporting\V1beta1\ServiceContextFilter $service_filter + * Optional. List only ErrorGroups which belong to a service context that + * matches the filter. + * Data for all service contexts is returned if this field is not specified. + * @type \Google\Cloud\ErrorReporting\V1beta1\QueryTimeRange $time_range + * Optional. List only data for the given time range. + * If not set a default time range is used. The field time_range_begin + * in the response will specify the beginning of this time range. + * @type int $page_size + * Optional. The maximum number of results to return per response. + * @type string $page_token + * Optional. A `next_page_token` provided by a previous response. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Devtools\Clouderrorreporting\V1Beta1\ErrorStatsService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the Google Cloud Platform project. Written + * as `projects/{projectID}`, where `{projectID}` is the + * [Google Cloud Platform project + * ID](https://support.google.com/cloud/answer/6158840). + * Example: `projects/my-project-123`. + * + * Generated from protobuf field string project_name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getProjectName() + { + return $this->project_name; + } + + /** + * Required. The resource name of the Google Cloud Platform project. Written + * as `projects/{projectID}`, where `{projectID}` is the + * [Google Cloud Platform project + * ID](https://support.google.com/cloud/answer/6158840). + * Example: `projects/my-project-123`. + * + * Generated from protobuf field string project_name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setProjectName($var) + { + GPBUtil::checkString($var, True); + $this->project_name = $var; + + return $this; + } + + /** + * Required. The group for which events shall be returned. + * + * Generated from protobuf field string group_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getGroupId() + { + return $this->group_id; + } + + /** + * Required. The group for which events shall be returned. + * + * Generated from protobuf field string group_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setGroupId($var) + { + GPBUtil::checkString($var, True); + $this->group_id = $var; + + return $this; + } + + /** + * Optional. List only ErrorGroups which belong to a service context that + * matches the filter. + * Data for all service contexts is returned if this field is not specified. + * + * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.ServiceContextFilter service_filter = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\ErrorReporting\V1beta1\ServiceContextFilter|null + */ + public function getServiceFilter() + { + return $this->service_filter; + } + + public function hasServiceFilter() + { + return isset($this->service_filter); + } + + public function clearServiceFilter() + { + unset($this->service_filter); + } + + /** + * Optional. List only ErrorGroups which belong to a service context that + * matches the filter. + * Data for all service contexts is returned if this field is not specified. + * + * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.ServiceContextFilter service_filter = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\ErrorReporting\V1beta1\ServiceContextFilter $var + * @return $this + */ + public function setServiceFilter($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\ErrorReporting\V1beta1\ServiceContextFilter::class); + $this->service_filter = $var; + + return $this; + } + + /** + * Optional. List only data for the given time range. + * If not set a default time range is used. The field time_range_begin + * in the response will specify the beginning of this time range. + * + * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.QueryTimeRange time_range = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\ErrorReporting\V1beta1\QueryTimeRange|null + */ + public function getTimeRange() + { + return $this->time_range; + } + + public function hasTimeRange() + { + return isset($this->time_range); + } + + public function clearTimeRange() + { + unset($this->time_range); + } + + /** + * Optional. List only data for the given time range. + * If not set a default time range is used. The field time_range_begin + * in the response will specify the beginning of this time range. + * + * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.QueryTimeRange time_range = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\ErrorReporting\V1beta1\QueryTimeRange $var + * @return $this + */ + public function setTimeRange($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\ErrorReporting\V1beta1\QueryTimeRange::class); + $this->time_range = $var; + + return $this; + } + + /** + * Optional. The maximum number of results to return per response. + * + * Generated from protobuf field int32 page_size = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. The maximum number of results to return per response. + * + * Generated from protobuf field int32 page_size = 6 [(.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 `next_page_token` provided by a previous response. + * + * Generated from protobuf field string page_token = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. A `next_page_token` provided by a previous response. + * + * Generated from protobuf field string page_token = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/ListEventsResponse.php b/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/ListEventsResponse.php new file mode 100644 index 000000000000..55faa7e5a56a --- /dev/null +++ b/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/ListEventsResponse.php @@ -0,0 +1,153 @@ +google.devtools.clouderrorreporting.v1beta1.ListEventsResponse + */ +class ListEventsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The error events which match the given request. + * + * Generated from protobuf field repeated .google.devtools.clouderrorreporting.v1beta1.ErrorEvent error_events = 1; + */ + private $error_events; + /** + * If non-empty, more results are available. + * Pass this token, along with the same query parameters as the first + * request, to view the next page of results. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * The timestamp specifies the start time to which the request was restricted. + * + * Generated from protobuf field .google.protobuf.Timestamp time_range_begin = 4; + */ + protected $time_range_begin = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\ErrorReporting\V1beta1\ErrorEvent>|\Google\Protobuf\Internal\RepeatedField $error_events + * The error events which match the given request. + * @type string $next_page_token + * If non-empty, more results are available. + * Pass this token, along with the same query parameters as the first + * request, to view the next page of results. + * @type \Google\Protobuf\Timestamp $time_range_begin + * The timestamp specifies the start time to which the request was restricted. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Devtools\Clouderrorreporting\V1Beta1\ErrorStatsService::initOnce(); + parent::__construct($data); + } + + /** + * The error events which match the given request. + * + * Generated from protobuf field repeated .google.devtools.clouderrorreporting.v1beta1.ErrorEvent error_events = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getErrorEvents() + { + return $this->error_events; + } + + /** + * The error events which match the given request. + * + * Generated from protobuf field repeated .google.devtools.clouderrorreporting.v1beta1.ErrorEvent error_events = 1; + * @param array<\Google\Cloud\ErrorReporting\V1beta1\ErrorEvent>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setErrorEvents($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\ErrorReporting\V1beta1\ErrorEvent::class); + $this->error_events = $arr; + + return $this; + } + + /** + * If non-empty, more results are available. + * Pass this token, along with the same query parameters as the first + * request, to view the next page of results. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * If non-empty, more results are available. + * Pass this token, along with the same query parameters as the first + * request, to view 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; + } + + /** + * The timestamp specifies the start time to which the request was restricted. + * + * Generated from protobuf field .google.protobuf.Timestamp time_range_begin = 4; + * @return \Google\Protobuf\Timestamp|null + */ + public function getTimeRangeBegin() + { + return $this->time_range_begin; + } + + public function hasTimeRangeBegin() + { + return isset($this->time_range_begin); + } + + public function clearTimeRangeBegin() + { + unset($this->time_range_begin); + } + + /** + * The timestamp specifies the start time to which the request was restricted. + * + * Generated from protobuf field .google.protobuf.Timestamp time_range_begin = 4; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setTimeRangeBegin($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->time_range_begin = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/ListGroupStatsRequest.php b/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/ListGroupStatsRequest.php new file mode 100644 index 000000000000..f2db50879944 --- /dev/null +++ b/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/ListGroupStatsRequest.php @@ -0,0 +1,521 @@ +google.devtools.clouderrorreporting.v1beta1.ListGroupStatsRequest + */ +class ListGroupStatsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the Google Cloud Platform project. Written + * as `projects/{projectID}` or `projects/{projectNumber}`, where `{projectID}` + * and `{projectNumber}` can be found in the + * [Google Cloud Console](https://support.google.com/cloud/answer/6158840). + * Examples: `projects/my-project-123`, `projects/5551234`. + * + * Generated from protobuf field string project_name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $project_name = ''; + /** + * Optional. List all ErrorGroupStats with these IDs. + * + * Generated from protobuf field repeated string group_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $group_id; + /** + * Optional. List only ErrorGroupStats which belong to a service + * context that matches the filter. + * Data for all service contexts is returned if this field is not specified. + * + * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.ServiceContextFilter service_filter = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $service_filter = null; + /** + * Optional. List data for the given time range. + * If not set, a default time range is used. The field + * time_range_begin in the response will specify the beginning + * of this time range. + * Only ErrorGroupStats with a non-zero count in the given time + * range are returned, unless the request contains an explicit + * group_id list. If a group_id list is given, also + * ErrorGroupStats with zero occurrences are returned. + * + * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.QueryTimeRange time_range = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $time_range = null; + /** + * Optional. The preferred duration for a single returned `TimedCount`. + * If not set, no timed counts are returned. + * + * Generated from protobuf field .google.protobuf.Duration timed_count_duration = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $timed_count_duration = null; + /** + * Optional. The alignment of the timed counts to be returned. + * Default is `ALIGNMENT_EQUAL_AT_END`. + * + * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.TimedCountAlignment alignment = 7 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $alignment = 0; + /** + * Optional. Time where the timed counts shall be aligned if rounded + * alignment is chosen. Default is 00:00 UTC. + * + * Generated from protobuf field .google.protobuf.Timestamp alignment_time = 8 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $alignment_time = null; + /** + * Optional. The sort order in which the results are returned. + * Default is `COUNT_DESC`. + * + * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.ErrorGroupOrder order = 9 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $order = 0; + /** + * Optional. The maximum number of results to return per response. + * Default is 20. + * + * Generated from protobuf field int32 page_size = 11 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Optional. A `next_page_token` provided by a previous response. To view + * additional results, pass this token along with the identical query + * parameters as the first request. + * + * Generated from protobuf field string page_token = 12 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = ''; + + /** + * @param string $projectName Required. The resource name of the Google Cloud Platform project. Written + * as `projects/{projectID}` or `projects/{projectNumber}`, where `{projectID}` + * and `{projectNumber}` can be found in the + * [Google Cloud Console](https://support.google.com/cloud/answer/6158840). + * + * Examples: `projects/my-project-123`, `projects/5551234`. Please see + * {@see ErrorStatsServiceClient::projectName()} for help formatting this field. + * @param \Google\Cloud\ErrorReporting\V1beta1\QueryTimeRange $timeRange Optional. List data for the given time range. + * If not set, a default time range is used. The field + * time_range_begin in the response will specify the beginning + * of this time range. + * Only ErrorGroupStats with a non-zero count in the given time + * range are returned, unless the request contains an explicit + * group_id list. If a group_id list is given, also + * ErrorGroupStats with zero occurrences are returned. + * + * @return \Google\Cloud\ErrorReporting\V1beta1\ListGroupStatsRequest + * + * @experimental + */ + public static function build(string $projectName, \Google\Cloud\ErrorReporting\V1beta1\QueryTimeRange $timeRange): self + { + return (new self()) + ->setProjectName($projectName) + ->setTimeRange($timeRange); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $project_name + * Required. The resource name of the Google Cloud Platform project. Written + * as `projects/{projectID}` or `projects/{projectNumber}`, where `{projectID}` + * and `{projectNumber}` can be found in the + * [Google Cloud Console](https://support.google.com/cloud/answer/6158840). + * Examples: `projects/my-project-123`, `projects/5551234`. + * @type array|\Google\Protobuf\Internal\RepeatedField $group_id + * Optional. List all ErrorGroupStats with these IDs. + * @type \Google\Cloud\ErrorReporting\V1beta1\ServiceContextFilter $service_filter + * Optional. List only ErrorGroupStats which belong to a service + * context that matches the filter. + * Data for all service contexts is returned if this field is not specified. + * @type \Google\Cloud\ErrorReporting\V1beta1\QueryTimeRange $time_range + * Optional. List data for the given time range. + * If not set, a default time range is used. The field + * time_range_begin in the response will specify the beginning + * of this time range. + * Only ErrorGroupStats with a non-zero count in the given time + * range are returned, unless the request contains an explicit + * group_id list. If a group_id list is given, also + * ErrorGroupStats with zero occurrences are returned. + * @type \Google\Protobuf\Duration $timed_count_duration + * Optional. The preferred duration for a single returned `TimedCount`. + * If not set, no timed counts are returned. + * @type int $alignment + * Optional. The alignment of the timed counts to be returned. + * Default is `ALIGNMENT_EQUAL_AT_END`. + * @type \Google\Protobuf\Timestamp $alignment_time + * Optional. Time where the timed counts shall be aligned if rounded + * alignment is chosen. Default is 00:00 UTC. + * @type int $order + * Optional. The sort order in which the results are returned. + * Default is `COUNT_DESC`. + * @type int $page_size + * Optional. The maximum number of results to return per response. + * Default is 20. + * @type string $page_token + * Optional. A `next_page_token` provided by a previous response. To view + * additional results, pass this token along with the identical query + * parameters as the first request. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Devtools\Clouderrorreporting\V1Beta1\ErrorStatsService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the Google Cloud Platform project. Written + * as `projects/{projectID}` or `projects/{projectNumber}`, where `{projectID}` + * and `{projectNumber}` can be found in the + * [Google Cloud Console](https://support.google.com/cloud/answer/6158840). + * Examples: `projects/my-project-123`, `projects/5551234`. + * + * Generated from protobuf field string project_name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getProjectName() + { + return $this->project_name; + } + + /** + * Required. The resource name of the Google Cloud Platform project. Written + * as `projects/{projectID}` or `projects/{projectNumber}`, where `{projectID}` + * and `{projectNumber}` can be found in the + * [Google Cloud Console](https://support.google.com/cloud/answer/6158840). + * Examples: `projects/my-project-123`, `projects/5551234`. + * + * Generated from protobuf field string project_name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setProjectName($var) + { + GPBUtil::checkString($var, True); + $this->project_name = $var; + + return $this; + } + + /** + * Optional. List all ErrorGroupStats with these IDs. + * + * Generated from protobuf field repeated string group_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getGroupId() + { + return $this->group_id; + } + + /** + * Optional. List all ErrorGroupStats with these IDs. + * + * Generated from protobuf field repeated string group_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setGroupId($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->group_id = $arr; + + return $this; + } + + /** + * Optional. List only ErrorGroupStats which belong to a service + * context that matches the filter. + * Data for all service contexts is returned if this field is not specified. + * + * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.ServiceContextFilter service_filter = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\ErrorReporting\V1beta1\ServiceContextFilter|null + */ + public function getServiceFilter() + { + return $this->service_filter; + } + + public function hasServiceFilter() + { + return isset($this->service_filter); + } + + public function clearServiceFilter() + { + unset($this->service_filter); + } + + /** + * Optional. List only ErrorGroupStats which belong to a service + * context that matches the filter. + * Data for all service contexts is returned if this field is not specified. + * + * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.ServiceContextFilter service_filter = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\ErrorReporting\V1beta1\ServiceContextFilter $var + * @return $this + */ + public function setServiceFilter($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\ErrorReporting\V1beta1\ServiceContextFilter::class); + $this->service_filter = $var; + + return $this; + } + + /** + * Optional. List data for the given time range. + * If not set, a default time range is used. The field + * time_range_begin in the response will specify the beginning + * of this time range. + * Only ErrorGroupStats with a non-zero count in the given time + * range are returned, unless the request contains an explicit + * group_id list. If a group_id list is given, also + * ErrorGroupStats with zero occurrences are returned. + * + * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.QueryTimeRange time_range = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\ErrorReporting\V1beta1\QueryTimeRange|null + */ + public function getTimeRange() + { + return $this->time_range; + } + + public function hasTimeRange() + { + return isset($this->time_range); + } + + public function clearTimeRange() + { + unset($this->time_range); + } + + /** + * Optional. List data for the given time range. + * If not set, a default time range is used. The field + * time_range_begin in the response will specify the beginning + * of this time range. + * Only ErrorGroupStats with a non-zero count in the given time + * range are returned, unless the request contains an explicit + * group_id list. If a group_id list is given, also + * ErrorGroupStats with zero occurrences are returned. + * + * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.QueryTimeRange time_range = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\ErrorReporting\V1beta1\QueryTimeRange $var + * @return $this + */ + public function setTimeRange($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\ErrorReporting\V1beta1\QueryTimeRange::class); + $this->time_range = $var; + + return $this; + } + + /** + * Optional. The preferred duration for a single returned `TimedCount`. + * If not set, no timed counts are returned. + * + * Generated from protobuf field .google.protobuf.Duration timed_count_duration = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Duration|null + */ + public function getTimedCountDuration() + { + return $this->timed_count_duration; + } + + public function hasTimedCountDuration() + { + return isset($this->timed_count_duration); + } + + public function clearTimedCountDuration() + { + unset($this->timed_count_duration); + } + + /** + * Optional. The preferred duration for a single returned `TimedCount`. + * If not set, no timed counts are returned. + * + * Generated from protobuf field .google.protobuf.Duration timed_count_duration = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setTimedCountDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->timed_count_duration = $var; + + return $this; + } + + /** + * Optional. The alignment of the timed counts to be returned. + * Default is `ALIGNMENT_EQUAL_AT_END`. + * + * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.TimedCountAlignment alignment = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getAlignment() + { + return $this->alignment; + } + + /** + * Optional. The alignment of the timed counts to be returned. + * Default is `ALIGNMENT_EQUAL_AT_END`. + * + * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.TimedCountAlignment alignment = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setAlignment($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\ErrorReporting\V1beta1\TimedCountAlignment::class); + $this->alignment = $var; + + return $this; + } + + /** + * Optional. Time where the timed counts shall be aligned if rounded + * alignment is chosen. Default is 00:00 UTC. + * + * Generated from protobuf field .google.protobuf.Timestamp alignment_time = 8 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getAlignmentTime() + { + return $this->alignment_time; + } + + public function hasAlignmentTime() + { + return isset($this->alignment_time); + } + + public function clearAlignmentTime() + { + unset($this->alignment_time); + } + + /** + * Optional. Time where the timed counts shall be aligned if rounded + * alignment is chosen. Default is 00:00 UTC. + * + * Generated from protobuf field .google.protobuf.Timestamp alignment_time = 8 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setAlignmentTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->alignment_time = $var; + + return $this; + } + + /** + * Optional. The sort order in which the results are returned. + * Default is `COUNT_DESC`. + * + * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.ErrorGroupOrder order = 9 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getOrder() + { + return $this->order; + } + + /** + * Optional. The sort order in which the results are returned. + * Default is `COUNT_DESC`. + * + * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.ErrorGroupOrder order = 9 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setOrder($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\ErrorReporting\V1beta1\ErrorGroupOrder::class); + $this->order = $var; + + return $this; + } + + /** + * Optional. The maximum number of results to return per response. + * Default is 20. + * + * Generated from protobuf field int32 page_size = 11 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. The maximum number of results to return per response. + * Default is 20. + * + * Generated from protobuf field int32 page_size = 11 [(.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 `next_page_token` provided by a previous response. To view + * additional results, pass this token along with the identical query + * parameters as the first request. + * + * Generated from protobuf field string page_token = 12 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. A `next_page_token` provided by a previous response. To view + * additional results, pass this token along with the identical query + * parameters as the first request. + * + * Generated from protobuf field string page_token = 12 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/ListGroupStatsResponse.php b/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/ListGroupStatsResponse.php new file mode 100644 index 000000000000..56bfa9df4b28 --- /dev/null +++ b/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/ListGroupStatsResponse.php @@ -0,0 +1,165 @@ +google.devtools.clouderrorreporting.v1beta1.ListGroupStatsResponse + */ +class ListGroupStatsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The error group stats which match the given request. + * + * Generated from protobuf field repeated .google.devtools.clouderrorreporting.v1beta1.ErrorGroupStats error_group_stats = 1; + */ + private $error_group_stats; + /** + * If non-empty, more results are available. + * Pass this token, along with the same query parameters as the first + * request, to view the next page of results. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * The timestamp specifies the start time to which the request was restricted. + * The start time is set based on the requested time range. It may be adjusted + * to a later time if a project has exceeded the storage quota and older data + * has been deleted. + * + * Generated from protobuf field .google.protobuf.Timestamp time_range_begin = 4; + */ + protected $time_range_begin = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\ErrorReporting\V1beta1\ErrorGroupStats>|\Google\Protobuf\Internal\RepeatedField $error_group_stats + * The error group stats which match the given request. + * @type string $next_page_token + * If non-empty, more results are available. + * Pass this token, along with the same query parameters as the first + * request, to view the next page of results. + * @type \Google\Protobuf\Timestamp $time_range_begin + * The timestamp specifies the start time to which the request was restricted. + * The start time is set based on the requested time range. It may be adjusted + * to a later time if a project has exceeded the storage quota and older data + * has been deleted. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Devtools\Clouderrorreporting\V1Beta1\ErrorStatsService::initOnce(); + parent::__construct($data); + } + + /** + * The error group stats which match the given request. + * + * Generated from protobuf field repeated .google.devtools.clouderrorreporting.v1beta1.ErrorGroupStats error_group_stats = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getErrorGroupStats() + { + return $this->error_group_stats; + } + + /** + * The error group stats which match the given request. + * + * Generated from protobuf field repeated .google.devtools.clouderrorreporting.v1beta1.ErrorGroupStats error_group_stats = 1; + * @param array<\Google\Cloud\ErrorReporting\V1beta1\ErrorGroupStats>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setErrorGroupStats($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\ErrorReporting\V1beta1\ErrorGroupStats::class); + $this->error_group_stats = $arr; + + return $this; + } + + /** + * If non-empty, more results are available. + * Pass this token, along with the same query parameters as the first + * request, to view the next page of results. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * If non-empty, more results are available. + * Pass this token, along with the same query parameters as the first + * request, to view 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; + } + + /** + * The timestamp specifies the start time to which the request was restricted. + * The start time is set based on the requested time range. It may be adjusted + * to a later time if a project has exceeded the storage quota and older data + * has been deleted. + * + * Generated from protobuf field .google.protobuf.Timestamp time_range_begin = 4; + * @return \Google\Protobuf\Timestamp|null + */ + public function getTimeRangeBegin() + { + return $this->time_range_begin; + } + + public function hasTimeRangeBegin() + { + return isset($this->time_range_begin); + } + + public function clearTimeRangeBegin() + { + unset($this->time_range_begin); + } + + /** + * The timestamp specifies the start time to which the request was restricted. + * The start time is set based on the requested time range. It may be adjusted + * to a later time if a project has exceeded the storage quota and older data + * has been deleted. + * + * Generated from protobuf field .google.protobuf.Timestamp time_range_begin = 4; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setTimeRangeBegin($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->time_range_begin = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/QueryTimeRange.php b/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/QueryTimeRange.php new file mode 100644 index 000000000000..e095a9c2c996 --- /dev/null +++ b/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/QueryTimeRange.php @@ -0,0 +1,68 @@ +google.devtools.clouderrorreporting.v1beta1.QueryTimeRange + */ +class QueryTimeRange extends \Google\Protobuf\Internal\Message +{ + /** + * Restricts the query to the specified time range. + * + * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.QueryTimeRange.Period period = 1; + */ + protected $period = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $period + * Restricts the query to the specified time range. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Devtools\Clouderrorreporting\V1Beta1\ErrorStatsService::initOnce(); + parent::__construct($data); + } + + /** + * Restricts the query to the specified time range. + * + * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.QueryTimeRange.Period period = 1; + * @return int + */ + public function getPeriod() + { + return $this->period; + } + + /** + * Restricts the query to the specified time range. + * + * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.QueryTimeRange.Period period = 1; + * @param int $var + * @return $this + */ + public function setPeriod($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\ErrorReporting\V1beta1\QueryTimeRange\Period::class); + $this->period = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/QueryTimeRange/Period.php b/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/QueryTimeRange/Period.php new file mode 100644 index 000000000000..9aa826cf2d57 --- /dev/null +++ b/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/QueryTimeRange/Period.php @@ -0,0 +1,90 @@ +google.devtools.clouderrorreporting.v1beta1.QueryTimeRange.Period + */ +class Period +{ + /** + * Do not use. + * + * Generated from protobuf enum PERIOD_UNSPECIFIED = 0; + */ + const PERIOD_UNSPECIFIED = 0; + /** + * Retrieve data for the last hour. + * Recommended minimum timed count duration: 1 min. + * + * Generated from protobuf enum PERIOD_1_HOUR = 1; + */ + const PERIOD_1_HOUR = 1; + /** + * Retrieve data for the last 6 hours. + * Recommended minimum timed count duration: 10 min. + * + * Generated from protobuf enum PERIOD_6_HOURS = 2; + */ + const PERIOD_6_HOURS = 2; + /** + * Retrieve data for the last day. + * Recommended minimum timed count duration: 1 hour. + * + * Generated from protobuf enum PERIOD_1_DAY = 3; + */ + const PERIOD_1_DAY = 3; + /** + * Retrieve data for the last week. + * Recommended minimum timed count duration: 6 hours. + * + * Generated from protobuf enum PERIOD_1_WEEK = 4; + */ + const PERIOD_1_WEEK = 4; + /** + * Retrieve data for the last 30 days. + * Recommended minimum timed count duration: 1 day. + * + * Generated from protobuf enum PERIOD_30_DAYS = 5; + */ + const PERIOD_30_DAYS = 5; + + private static $valueToName = [ + self::PERIOD_UNSPECIFIED => 'PERIOD_UNSPECIFIED', + self::PERIOD_1_HOUR => 'PERIOD_1_HOUR', + self::PERIOD_6_HOURS => 'PERIOD_6_HOURS', + self::PERIOD_1_DAY => 'PERIOD_1_DAY', + self::PERIOD_1_WEEK => 'PERIOD_1_WEEK', + self::PERIOD_30_DAYS => 'PERIOD_30_DAYS', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Period::class, \Google\Cloud\ErrorReporting\V1beta1\QueryTimeRange_Period::class); + diff --git a/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/QueryTimeRange_Period.php b/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/QueryTimeRange_Period.php new file mode 100644 index 000000000000..1ab3a0a72ac0 --- /dev/null +++ b/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/QueryTimeRange_Period.php @@ -0,0 +1,16 @@ +google.devtools.clouderrorreporting.v1beta1.ReportErrorEventRequest + */ +class ReportErrorEventRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the Google Cloud Platform project. Written + * as `projects/{projectId}`, where `{projectId}` is the + * [Google Cloud Platform project + * ID](https://support.google.com/cloud/answer/6158840). + * Example: // `projects/my-project-123`. + * + * Generated from protobuf field string project_name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $project_name = ''; + /** + * Required. The error event to be reported. + * + * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.ReportedErrorEvent event = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $event = null; + + /** + * @param string $projectName Required. The resource name of the Google Cloud Platform project. Written + * as `projects/{projectId}`, where `{projectId}` is the + * [Google Cloud Platform project + * ID](https://support.google.com/cloud/answer/6158840). + * + * Example: // `projects/my-project-123`. Please see + * {@see ReportErrorsServiceClient::projectName()} for help formatting this field. + * @param \Google\Cloud\ErrorReporting\V1beta1\ReportedErrorEvent $event Required. The error event to be reported. + * + * @return \Google\Cloud\ErrorReporting\V1beta1\ReportErrorEventRequest + * + * @experimental + */ + public static function build(string $projectName, \Google\Cloud\ErrorReporting\V1beta1\ReportedErrorEvent $event): self + { + return (new self()) + ->setProjectName($projectName) + ->setEvent($event); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $project_name + * Required. The resource name of the Google Cloud Platform project. Written + * as `projects/{projectId}`, where `{projectId}` is the + * [Google Cloud Platform project + * ID](https://support.google.com/cloud/answer/6158840). + * Example: // `projects/my-project-123`. + * @type \Google\Cloud\ErrorReporting\V1beta1\ReportedErrorEvent $event + * Required. The error event to be reported. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Devtools\Clouderrorreporting\V1Beta1\ReportErrorsService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the Google Cloud Platform project. Written + * as `projects/{projectId}`, where `{projectId}` is the + * [Google Cloud Platform project + * ID](https://support.google.com/cloud/answer/6158840). + * Example: // `projects/my-project-123`. + * + * Generated from protobuf field string project_name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getProjectName() + { + return $this->project_name; + } + + /** + * Required. The resource name of the Google Cloud Platform project. Written + * as `projects/{projectId}`, where `{projectId}` is the + * [Google Cloud Platform project + * ID](https://support.google.com/cloud/answer/6158840). + * Example: // `projects/my-project-123`. + * + * Generated from protobuf field string project_name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setProjectName($var) + { + GPBUtil::checkString($var, True); + $this->project_name = $var; + + return $this; + } + + /** + * Required. The error event to be reported. + * + * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.ReportedErrorEvent event = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\ErrorReporting\V1beta1\ReportedErrorEvent|null + */ + public function getEvent() + { + return $this->event; + } + + public function hasEvent() + { + return isset($this->event); + } + + public function clearEvent() + { + unset($this->event); + } + + /** + * Required. The error event to be reported. + * + * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.ReportedErrorEvent event = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\ErrorReporting\V1beta1\ReportedErrorEvent $var + * @return $this + */ + public function setEvent($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\ErrorReporting\V1beta1\ReportedErrorEvent::class); + $this->event = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/ReportErrorEventResponse.php b/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/ReportErrorEventResponse.php new file mode 100644 index 000000000000..14380862c6a8 --- /dev/null +++ b/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/ReportErrorEventResponse.php @@ -0,0 +1,34 @@ +google.devtools.clouderrorreporting.v1beta1.ReportErrorEventResponse + */ +class ReportErrorEventResponse extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Devtools\Clouderrorreporting\V1Beta1\ReportErrorsService::initOnce(); + parent::__construct($data); + } + +} + diff --git a/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/ReportErrorsServiceGrpcClient.php b/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/ReportErrorsServiceGrpcClient.php new file mode 100644 index 000000000000..bee909729749 --- /dev/null +++ b/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/ReportErrorsServiceGrpcClient.php @@ -0,0 +1,63 @@ +_simpleRequest('/google.devtools.clouderrorreporting.v1beta1.ReportErrorsService/ReportErrorEvent', + $argument, + ['\Google\Cloud\ErrorReporting\V1beta1\ReportErrorEventResponse', 'decode'], + $metadata, $options); + } + +} diff --git a/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/ReportedErrorEvent.php b/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/ReportedErrorEvent.php new file mode 100644 index 000000000000..d92ac7651617 --- /dev/null +++ b/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/ReportedErrorEvent.php @@ -0,0 +1,295 @@ +google.devtools.clouderrorreporting.v1beta1.ReportedErrorEvent + */ +class ReportedErrorEvent extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. Time when the event occurred. + * If not provided, the time when the event was received by the + * Error Reporting system will be used. + * + * Generated from protobuf field .google.protobuf.Timestamp event_time = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $event_time = null; + /** + * Required. The service context in which this error has occurred. + * + * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.ServiceContext service_context = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $service_context = null; + /** + * Required. The error message. + * If no `context.reportLocation` is provided, the message must contain a + * header (typically consisting of the exception type name and an error + * message) and an exception stack trace in one of the supported programming + * languages and formats. + * Supported languages are Java, Python, JavaScript, Ruby, C#, PHP, and Go. + * Supported stack trace formats are: + * * **Java**: Must be the return value of + * [`Throwable.printStackTrace()`](https://docs.oracle.com/javase/7/docs/api/java/lang/Throwable.html#printStackTrace%28%29). + * * **Python**: Must be the return value of + * [`traceback.format_exc()`](https://docs.python.org/2/library/traceback.html#traceback.format_exc). + * * **JavaScript**: Must be the value of + * [`error.stack`](https://github.com/v8/v8/wiki/Stack-Trace-API) as returned + * by V8. + * * **Ruby**: Must contain frames returned by + * [`Exception.backtrace`](https://ruby-doc.org/core-2.2.0/Exception.html#method-i-backtrace). + * * **C#**: Must be the return value of + * [`Exception.ToString()`](https://msdn.microsoft.com/en-us/library/system.exception.tostring.aspx). + * * **PHP**: Must start with `PHP (Notice|Parse error|Fatal error|Warning)` + * and contain the result of + * [`(string)$exception`](http://php.net/manual/en/exception.tostring.php). + * * **Go**: Must be the return value of + * [`runtime.Stack()`](https://golang.org/pkg/runtime/debug/#Stack). + * + * Generated from protobuf field string message = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $message = ''; + /** + * Optional. A description of the context in which the error occurred. + * + * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.ErrorContext context = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $context = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Timestamp $event_time + * Optional. Time when the event occurred. + * If not provided, the time when the event was received by the + * Error Reporting system will be used. + * @type \Google\Cloud\ErrorReporting\V1beta1\ServiceContext $service_context + * Required. The service context in which this error has occurred. + * @type string $message + * Required. The error message. + * If no `context.reportLocation` is provided, the message must contain a + * header (typically consisting of the exception type name and an error + * message) and an exception stack trace in one of the supported programming + * languages and formats. + * Supported languages are Java, Python, JavaScript, Ruby, C#, PHP, and Go. + * Supported stack trace formats are: + * * **Java**: Must be the return value of + * [`Throwable.printStackTrace()`](https://docs.oracle.com/javase/7/docs/api/java/lang/Throwable.html#printStackTrace%28%29). + * * **Python**: Must be the return value of + * [`traceback.format_exc()`](https://docs.python.org/2/library/traceback.html#traceback.format_exc). + * * **JavaScript**: Must be the value of + * [`error.stack`](https://github.com/v8/v8/wiki/Stack-Trace-API) as returned + * by V8. + * * **Ruby**: Must contain frames returned by + * [`Exception.backtrace`](https://ruby-doc.org/core-2.2.0/Exception.html#method-i-backtrace). + * * **C#**: Must be the return value of + * [`Exception.ToString()`](https://msdn.microsoft.com/en-us/library/system.exception.tostring.aspx). + * * **PHP**: Must start with `PHP (Notice|Parse error|Fatal error|Warning)` + * and contain the result of + * [`(string)$exception`](http://php.net/manual/en/exception.tostring.php). + * * **Go**: Must be the return value of + * [`runtime.Stack()`](https://golang.org/pkg/runtime/debug/#Stack). + * @type \Google\Cloud\ErrorReporting\V1beta1\ErrorContext $context + * Optional. A description of the context in which the error occurred. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Devtools\Clouderrorreporting\V1Beta1\ReportErrorsService::initOnce(); + parent::__construct($data); + } + + /** + * Optional. Time when the event occurred. + * If not provided, the time when the event was received by the + * Error Reporting system will be used. + * + * Generated from protobuf field .google.protobuf.Timestamp event_time = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getEventTime() + { + return $this->event_time; + } + + public function hasEventTime() + { + return isset($this->event_time); + } + + public function clearEventTime() + { + unset($this->event_time); + } + + /** + * Optional. Time when the event occurred. + * If not provided, the time when the event was received by the + * Error Reporting system will be used. + * + * Generated from protobuf field .google.protobuf.Timestamp event_time = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setEventTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->event_time = $var; + + return $this; + } + + /** + * Required. The service context in which this error has occurred. + * + * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.ServiceContext service_context = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\ErrorReporting\V1beta1\ServiceContext|null + */ + public function getServiceContext() + { + return $this->service_context; + } + + public function hasServiceContext() + { + return isset($this->service_context); + } + + public function clearServiceContext() + { + unset($this->service_context); + } + + /** + * Required. The service context in which this error has occurred. + * + * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.ServiceContext service_context = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\ErrorReporting\V1beta1\ServiceContext $var + * @return $this + */ + public function setServiceContext($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\ErrorReporting\V1beta1\ServiceContext::class); + $this->service_context = $var; + + return $this; + } + + /** + * Required. The error message. + * If no `context.reportLocation` is provided, the message must contain a + * header (typically consisting of the exception type name and an error + * message) and an exception stack trace in one of the supported programming + * languages and formats. + * Supported languages are Java, Python, JavaScript, Ruby, C#, PHP, and Go. + * Supported stack trace formats are: + * * **Java**: Must be the return value of + * [`Throwable.printStackTrace()`](https://docs.oracle.com/javase/7/docs/api/java/lang/Throwable.html#printStackTrace%28%29). + * * **Python**: Must be the return value of + * [`traceback.format_exc()`](https://docs.python.org/2/library/traceback.html#traceback.format_exc). + * * **JavaScript**: Must be the value of + * [`error.stack`](https://github.com/v8/v8/wiki/Stack-Trace-API) as returned + * by V8. + * * **Ruby**: Must contain frames returned by + * [`Exception.backtrace`](https://ruby-doc.org/core-2.2.0/Exception.html#method-i-backtrace). + * * **C#**: Must be the return value of + * [`Exception.ToString()`](https://msdn.microsoft.com/en-us/library/system.exception.tostring.aspx). + * * **PHP**: Must start with `PHP (Notice|Parse error|Fatal error|Warning)` + * and contain the result of + * [`(string)$exception`](http://php.net/manual/en/exception.tostring.php). + * * **Go**: Must be the return value of + * [`runtime.Stack()`](https://golang.org/pkg/runtime/debug/#Stack). + * + * Generated from protobuf field string message = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getMessage() + { + return $this->message; + } + + /** + * Required. The error message. + * If no `context.reportLocation` is provided, the message must contain a + * header (typically consisting of the exception type name and an error + * message) and an exception stack trace in one of the supported programming + * languages and formats. + * Supported languages are Java, Python, JavaScript, Ruby, C#, PHP, and Go. + * Supported stack trace formats are: + * * **Java**: Must be the return value of + * [`Throwable.printStackTrace()`](https://docs.oracle.com/javase/7/docs/api/java/lang/Throwable.html#printStackTrace%28%29). + * * **Python**: Must be the return value of + * [`traceback.format_exc()`](https://docs.python.org/2/library/traceback.html#traceback.format_exc). + * * **JavaScript**: Must be the value of + * [`error.stack`](https://github.com/v8/v8/wiki/Stack-Trace-API) as returned + * by V8. + * * **Ruby**: Must contain frames returned by + * [`Exception.backtrace`](https://ruby-doc.org/core-2.2.0/Exception.html#method-i-backtrace). + * * **C#**: Must be the return value of + * [`Exception.ToString()`](https://msdn.microsoft.com/en-us/library/system.exception.tostring.aspx). + * * **PHP**: Must start with `PHP (Notice|Parse error|Fatal error|Warning)` + * and contain the result of + * [`(string)$exception`](http://php.net/manual/en/exception.tostring.php). + * * **Go**: Must be the return value of + * [`runtime.Stack()`](https://golang.org/pkg/runtime/debug/#Stack). + * + * Generated from protobuf field string message = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setMessage($var) + { + GPBUtil::checkString($var, True); + $this->message = $var; + + return $this; + } + + /** + * Optional. A description of the context in which the error occurred. + * + * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.ErrorContext context = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\ErrorReporting\V1beta1\ErrorContext|null + */ + public function getContext() + { + return $this->context; + } + + public function hasContext() + { + return isset($this->context); + } + + public function clearContext() + { + unset($this->context); + } + + /** + * Optional. A description of the context in which the error occurred. + * + * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.ErrorContext context = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\ErrorReporting\V1beta1\ErrorContext $var + * @return $this + */ + public function setContext($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\ErrorReporting\V1beta1\ErrorContext::class); + $this->context = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/ResolutionStatus.php b/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/ResolutionStatus.php new file mode 100644 index 000000000000..a50feb043ec5 --- /dev/null +++ b/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/ResolutionStatus.php @@ -0,0 +1,78 @@ +google.devtools.clouderrorreporting.v1beta1.ResolutionStatus + */ +class ResolutionStatus +{ + /** + * Status is unknown. When left unspecified in requests, it is treated like + * OPEN. + * + * Generated from protobuf enum RESOLUTION_STATUS_UNSPECIFIED = 0; + */ + const RESOLUTION_STATUS_UNSPECIFIED = 0; + /** + * The error group is not being addressed. This is the default for + * new groups. It is also used for errors re-occurring after marked RESOLVED. + * + * Generated from protobuf enum OPEN = 1; + */ + const OPEN = 1; + /** + * Error Group manually acknowledged, it can have an issue link attached. + * + * Generated from protobuf enum ACKNOWLEDGED = 2; + */ + const ACKNOWLEDGED = 2; + /** + * Error Group manually resolved, more events for this group are not expected + * to occur. + * + * Generated from protobuf enum RESOLVED = 3; + */ + const RESOLVED = 3; + /** + * The error group is muted and excluded by default on group stats requests. + * + * Generated from protobuf enum MUTED = 4; + */ + const MUTED = 4; + + private static $valueToName = [ + self::RESOLUTION_STATUS_UNSPECIFIED => 'RESOLUTION_STATUS_UNSPECIFIED', + self::OPEN => 'OPEN', + self::ACKNOWLEDGED => 'ACKNOWLEDGED', + self::RESOLVED => 'RESOLVED', + self::MUTED => 'MUTED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/ServiceContext.php b/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/ServiceContext.php new file mode 100644 index 000000000000..df54f8cfb839 --- /dev/null +++ b/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/ServiceContext.php @@ -0,0 +1,180 @@ +google.devtools.clouderrorreporting.v1beta1.ServiceContext + */ +class ServiceContext extends \Google\Protobuf\Internal\Message +{ + /** + * An identifier of the service, such as the name of the + * executable, job, or Google App Engine service name. This field is expected + * to have a low number of values that are relatively stable over time, as + * opposed to `version`, which can be changed whenever new code is deployed. + * Contains the service name for error reports extracted from Google + * App Engine logs or `default` if the App Engine default service is used. + * + * Generated from protobuf field string service = 2; + */ + protected $service = ''; + /** + * Represents the source code version that the developer provided, + * which could represent a version label or a Git SHA-1 hash, for example. + * For App Engine standard environment, the version is set to the version of + * the app. + * + * Generated from protobuf field string version = 3; + */ + protected $version = ''; + /** + * Type of the MonitoredResource. List of possible values: + * https://cloud.google.com/monitoring/api/resources + * Value is set automatically for incoming errors and must not be set when + * reporting errors. + * + * Generated from protobuf field string resource_type = 4; + */ + protected $resource_type = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $service + * An identifier of the service, such as the name of the + * executable, job, or Google App Engine service name. This field is expected + * to have a low number of values that are relatively stable over time, as + * opposed to `version`, which can be changed whenever new code is deployed. + * Contains the service name for error reports extracted from Google + * App Engine logs or `default` if the App Engine default service is used. + * @type string $version + * Represents the source code version that the developer provided, + * which could represent a version label or a Git SHA-1 hash, for example. + * For App Engine standard environment, the version is set to the version of + * the app. + * @type string $resource_type + * Type of the MonitoredResource. List of possible values: + * https://cloud.google.com/monitoring/api/resources + * Value is set automatically for incoming errors and must not be set when + * reporting errors. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Devtools\Clouderrorreporting\V1Beta1\Common::initOnce(); + parent::__construct($data); + } + + /** + * An identifier of the service, such as the name of the + * executable, job, or Google App Engine service name. This field is expected + * to have a low number of values that are relatively stable over time, as + * opposed to `version`, which can be changed whenever new code is deployed. + * Contains the service name for error reports extracted from Google + * App Engine logs or `default` if the App Engine default service is used. + * + * Generated from protobuf field string service = 2; + * @return string + */ + public function getService() + { + return $this->service; + } + + /** + * An identifier of the service, such as the name of the + * executable, job, or Google App Engine service name. This field is expected + * to have a low number of values that are relatively stable over time, as + * opposed to `version`, which can be changed whenever new code is deployed. + * Contains the service name for error reports extracted from Google + * App Engine logs or `default` if the App Engine default service is used. + * + * Generated from protobuf field string service = 2; + * @param string $var + * @return $this + */ + public function setService($var) + { + GPBUtil::checkString($var, True); + $this->service = $var; + + return $this; + } + + /** + * Represents the source code version that the developer provided, + * which could represent a version label or a Git SHA-1 hash, for example. + * For App Engine standard environment, the version is set to the version of + * the app. + * + * Generated from protobuf field string version = 3; + * @return string + */ + public function getVersion() + { + return $this->version; + } + + /** + * Represents the source code version that the developer provided, + * which could represent a version label or a Git SHA-1 hash, for example. + * For App Engine standard environment, the version is set to the version of + * the app. + * + * Generated from protobuf field string version = 3; + * @param string $var + * @return $this + */ + public function setVersion($var) + { + GPBUtil::checkString($var, True); + $this->version = $var; + + return $this; + } + + /** + * Type of the MonitoredResource. List of possible values: + * https://cloud.google.com/monitoring/api/resources + * Value is set automatically for incoming errors and must not be set when + * reporting errors. + * + * Generated from protobuf field string resource_type = 4; + * @return string + */ + public function getResourceType() + { + return $this->resource_type; + } + + /** + * Type of the MonitoredResource. List of possible values: + * https://cloud.google.com/monitoring/api/resources + * Value is set automatically for incoming errors and must not be set when + * reporting errors. + * + * Generated from protobuf field string resource_type = 4; + * @param string $var + * @return $this + */ + public function setResourceType($var) + { + GPBUtil::checkString($var, True); + $this->resource_type = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/ServiceContextFilter.php b/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/ServiceContextFilter.php new file mode 100644 index 000000000000..140d3323103d --- /dev/null +++ b/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/ServiceContextFilter.php @@ -0,0 +1,150 @@ +google.devtools.clouderrorreporting.v1beta1.ServiceContextFilter + */ +class ServiceContextFilter extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. The exact value to match against + * [`ServiceContext.service`](/error-reporting/reference/rest/v1beta1/ServiceContext#FIELDS.service). + * + * Generated from protobuf field string service = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $service = ''; + /** + * Optional. The exact value to match against + * [`ServiceContext.version`](/error-reporting/reference/rest/v1beta1/ServiceContext#FIELDS.version). + * + * Generated from protobuf field string version = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $version = ''; + /** + * Optional. The exact value to match against + * [`ServiceContext.resource_type`](/error-reporting/reference/rest/v1beta1/ServiceContext#FIELDS.resource_type). + * + * Generated from protobuf field string resource_type = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $resource_type = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $service + * Optional. The exact value to match against + * [`ServiceContext.service`](/error-reporting/reference/rest/v1beta1/ServiceContext#FIELDS.service). + * @type string $version + * Optional. The exact value to match against + * [`ServiceContext.version`](/error-reporting/reference/rest/v1beta1/ServiceContext#FIELDS.version). + * @type string $resource_type + * Optional. The exact value to match against + * [`ServiceContext.resource_type`](/error-reporting/reference/rest/v1beta1/ServiceContext#FIELDS.resource_type). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Devtools\Clouderrorreporting\V1Beta1\ErrorStatsService::initOnce(); + parent::__construct($data); + } + + /** + * Optional. The exact value to match against + * [`ServiceContext.service`](/error-reporting/reference/rest/v1beta1/ServiceContext#FIELDS.service). + * + * Generated from protobuf field string service = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getService() + { + return $this->service; + } + + /** + * Optional. The exact value to match against + * [`ServiceContext.service`](/error-reporting/reference/rest/v1beta1/ServiceContext#FIELDS.service). + * + * Generated from protobuf field string service = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setService($var) + { + GPBUtil::checkString($var, True); + $this->service = $var; + + return $this; + } + + /** + * Optional. The exact value to match against + * [`ServiceContext.version`](/error-reporting/reference/rest/v1beta1/ServiceContext#FIELDS.version). + * + * Generated from protobuf field string version = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getVersion() + { + return $this->version; + } + + /** + * Optional. The exact value to match against + * [`ServiceContext.version`](/error-reporting/reference/rest/v1beta1/ServiceContext#FIELDS.version). + * + * Generated from protobuf field string version = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setVersion($var) + { + GPBUtil::checkString($var, True); + $this->version = $var; + + return $this; + } + + /** + * Optional. The exact value to match against + * [`ServiceContext.resource_type`](/error-reporting/reference/rest/v1beta1/ServiceContext#FIELDS.resource_type). + * + * Generated from protobuf field string resource_type = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getResourceType() + { + return $this->resource_type; + } + + /** + * Optional. The exact value to match against + * [`ServiceContext.resource_type`](/error-reporting/reference/rest/v1beta1/ServiceContext#FIELDS.resource_type). + * + * Generated from protobuf field string resource_type = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setResourceType($var) + { + GPBUtil::checkString($var, True); + $this->resource_type = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/SourceLocation.php b/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/SourceLocation.php new file mode 100644 index 000000000000..f85e34012700 --- /dev/null +++ b/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/SourceLocation.php @@ -0,0 +1,150 @@ +google.devtools.clouderrorreporting.v1beta1.SourceLocation + */ +class SourceLocation extends \Google\Protobuf\Internal\Message +{ + /** + * The source code filename, which can include a truncated relative + * path, or a full path from a production machine. + * + * Generated from protobuf field string file_path = 1; + */ + protected $file_path = ''; + /** + * 1-based. 0 indicates that the line number is unknown. + * + * Generated from protobuf field int32 line_number = 2; + */ + protected $line_number = 0; + /** + * Human-readable name of a function or method. + * The value can include optional context like the class or package name. + * For example, `my.package.MyClass.method` in case of Java. + * + * Generated from protobuf field string function_name = 4; + */ + protected $function_name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $file_path + * The source code filename, which can include a truncated relative + * path, or a full path from a production machine. + * @type int $line_number + * 1-based. 0 indicates that the line number is unknown. + * @type string $function_name + * Human-readable name of a function or method. + * The value can include optional context like the class or package name. + * For example, `my.package.MyClass.method` in case of Java. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Devtools\Clouderrorreporting\V1Beta1\Common::initOnce(); + parent::__construct($data); + } + + /** + * The source code filename, which can include a truncated relative + * path, or a full path from a production machine. + * + * Generated from protobuf field string file_path = 1; + * @return string + */ + public function getFilePath() + { + return $this->file_path; + } + + /** + * The source code filename, which can include a truncated relative + * path, or a full path from a production machine. + * + * Generated from protobuf field string file_path = 1; + * @param string $var + * @return $this + */ + public function setFilePath($var) + { + GPBUtil::checkString($var, True); + $this->file_path = $var; + + return $this; + } + + /** + * 1-based. 0 indicates that the line number is unknown. + * + * Generated from protobuf field int32 line_number = 2; + * @return int + */ + public function getLineNumber() + { + return $this->line_number; + } + + /** + * 1-based. 0 indicates that the line number is unknown. + * + * Generated from protobuf field int32 line_number = 2; + * @param int $var + * @return $this + */ + public function setLineNumber($var) + { + GPBUtil::checkInt32($var); + $this->line_number = $var; + + return $this; + } + + /** + * Human-readable name of a function or method. + * The value can include optional context like the class or package name. + * For example, `my.package.MyClass.method` in case of Java. + * + * Generated from protobuf field string function_name = 4; + * @return string + */ + public function getFunctionName() + { + return $this->function_name; + } + + /** + * Human-readable name of a function or method. + * The value can include optional context like the class or package name. + * For example, `my.package.MyClass.method` in case of Java. + * + * Generated from protobuf field string function_name = 4; + * @param string $var + * @return $this + */ + public function setFunctionName($var) + { + GPBUtil::checkString($var, True); + $this->function_name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/TimedCount.php b/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/TimedCount.php new file mode 100644 index 000000000000..7605fd7676fd --- /dev/null +++ b/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/TimedCount.php @@ -0,0 +1,157 @@ +google.devtools.clouderrorreporting.v1beta1.TimedCount + */ +class TimedCount extends \Google\Protobuf\Internal\Message +{ + /** + * Approximate number of occurrences in the given time period. + * + * Generated from protobuf field int64 count = 1; + */ + protected $count = 0; + /** + * Start of the time period to which `count` refers (included). + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 2; + */ + protected $start_time = null; + /** + * End of the time period to which `count` refers (excluded). + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 3; + */ + protected $end_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int|string $count + * Approximate number of occurrences in the given time period. + * @type \Google\Protobuf\Timestamp $start_time + * Start of the time period to which `count` refers (included). + * @type \Google\Protobuf\Timestamp $end_time + * End of the time period to which `count` refers (excluded). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Devtools\Clouderrorreporting\V1Beta1\ErrorStatsService::initOnce(); + parent::__construct($data); + } + + /** + * Approximate number of occurrences in the given time period. + * + * Generated from protobuf field int64 count = 1; + * @return int|string + */ + public function getCount() + { + return $this->count; + } + + /** + * Approximate number of occurrences in the given time period. + * + * Generated from protobuf field int64 count = 1; + * @param int|string $var + * @return $this + */ + public function setCount($var) + { + GPBUtil::checkInt64($var); + $this->count = $var; + + return $this; + } + + /** + * Start of the time period to which `count` refers (included). + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 2; + * @return \Google\Protobuf\Timestamp|null + */ + public function getStartTime() + { + return $this->start_time; + } + + public function hasStartTime() + { + return isset($this->start_time); + } + + public function clearStartTime() + { + unset($this->start_time); + } + + /** + * Start of the time period to which `count` refers (included). + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 2; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setStartTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->start_time = $var; + + return $this; + } + + /** + * End of the time period to which `count` refers (excluded). + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 3; + * @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); + } + + /** + * End of the time period to which `count` refers (excluded). + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 3; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setEndTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->end_time = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/TimedCountAlignment.php b/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/TimedCountAlignment.php new file mode 100644 index 000000000000..633e74c96e9d --- /dev/null +++ b/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/TimedCountAlignment.php @@ -0,0 +1,71 @@ +google.devtools.clouderrorreporting.v1beta1.TimedCountAlignment + */ +class TimedCountAlignment +{ + /** + * No alignment specified. + * + * Generated from protobuf enum ERROR_COUNT_ALIGNMENT_UNSPECIFIED = 0; + */ + const ERROR_COUNT_ALIGNMENT_UNSPECIFIED = 0; + /** + * The time periods shall be consecutive, have width equal to the + * requested duration, and be aligned at the `alignment_time` provided in + * the request. + * The `alignment_time` does not have to be inside the query period but + * even if it is outside, only time periods are returned which overlap + * with the query period. + * A rounded alignment will typically result in a + * different size of the first or the last time period. + * + * Generated from protobuf enum ALIGNMENT_EQUAL_ROUNDED = 1; + */ + const ALIGNMENT_EQUAL_ROUNDED = 1; + /** + * The time periods shall be consecutive, have width equal to the + * requested duration, and be aligned at the end of the requested time + * period. This can result in a different size of the + * first time period. + * + * Generated from protobuf enum ALIGNMENT_EQUAL_AT_END = 2; + */ + const ALIGNMENT_EQUAL_AT_END = 2; + + private static $valueToName = [ + self::ERROR_COUNT_ALIGNMENT_UNSPECIFIED => 'ERROR_COUNT_ALIGNMENT_UNSPECIFIED', + self::ALIGNMENT_EQUAL_ROUNDED => 'ALIGNMENT_EQUAL_ROUNDED', + self::ALIGNMENT_EQUAL_AT_END => 'ALIGNMENT_EQUAL_AT_END', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/TrackingIssue.php b/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/TrackingIssue.php new file mode 100644 index 000000000000..b6a97dcab003 --- /dev/null +++ b/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/TrackingIssue.php @@ -0,0 +1,71 @@ +google.devtools.clouderrorreporting.v1beta1.TrackingIssue + */ +class TrackingIssue extends \Google\Protobuf\Internal\Message +{ + /** + * A URL pointing to a related entry in an issue tracking system. + * Example: `https://github.com/user/project/issues/4` + * + * Generated from protobuf field string url = 1; + */ + protected $url = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $url + * A URL pointing to a related entry in an issue tracking system. + * Example: `https://github.com/user/project/issues/4` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Devtools\Clouderrorreporting\V1Beta1\Common::initOnce(); + parent::__construct($data); + } + + /** + * A URL pointing to a related entry in an issue tracking system. + * Example: `https://github.com/user/project/issues/4` + * + * Generated from protobuf field string url = 1; + * @return string + */ + public function getUrl() + { + return $this->url; + } + + /** + * A URL pointing to a related entry in an issue tracking system. + * Example: `https://github.com/user/project/issues/4` + * + * Generated from protobuf field string url = 1; + * @param string $var + * @return $this + */ + public function setUrl($var) + { + GPBUtil::checkString($var, True); + $this->url = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/UpdateGroupRequest.php b/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/UpdateGroupRequest.php new file mode 100644 index 000000000000..eb7d7c9e99b9 --- /dev/null +++ b/owl-bot-staging/ErrorReporting/v1beta1/proto/src/Google/Cloud/ErrorReporting/V1beta1/UpdateGroupRequest.php @@ -0,0 +1,90 @@ +google.devtools.clouderrorreporting.v1beta1.UpdateGroupRequest + */ +class UpdateGroupRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The group which replaces the resource on the server. + * + * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.ErrorGroup group = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $group = null; + + /** + * @param \Google\Cloud\ErrorReporting\V1beta1\ErrorGroup $group Required. The group which replaces the resource on the server. + * + * @return \Google\Cloud\ErrorReporting\V1beta1\UpdateGroupRequest + * + * @experimental + */ + public static function build(\Google\Cloud\ErrorReporting\V1beta1\ErrorGroup $group): self + { + return (new self()) + ->setGroup($group); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\ErrorReporting\V1beta1\ErrorGroup $group + * Required. The group which replaces the resource on the server. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Devtools\Clouderrorreporting\V1Beta1\ErrorGroupService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The group which replaces the resource on the server. + * + * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.ErrorGroup group = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\ErrorReporting\V1beta1\ErrorGroup|null + */ + public function getGroup() + { + return $this->group; + } + + public function hasGroup() + { + return isset($this->group); + } + + public function clearGroup() + { + unset($this->group); + } + + /** + * Required. The group which replaces the resource on the server. + * + * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.ErrorGroup group = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\ErrorReporting\V1beta1\ErrorGroup $var + * @return $this + */ + public function setGroup($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\ErrorReporting\V1beta1\ErrorGroup::class); + $this->group = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/ErrorReporting/v1beta1/samples/V1beta1/ErrorGroupServiceClient/get_group.php b/owl-bot-staging/ErrorReporting/v1beta1/samples/V1beta1/ErrorGroupServiceClient/get_group.php new file mode 100644 index 000000000000..d9bdec88dc1d --- /dev/null +++ b/owl-bot-staging/ErrorReporting/v1beta1/samples/V1beta1/ErrorGroupServiceClient/get_group.php @@ -0,0 +1,76 @@ +setGroupName($formattedGroupName); + + // Call the API and handle any network failures. + try { + /** @var ErrorGroup $response */ + $response = $errorGroupServiceClient->getGroup($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 +{ + $formattedGroupName = ErrorGroupServiceClient::errorGroupName('[PROJECT]', '[GROUP]'); + + get_group_sample($formattedGroupName); +} +// [END clouderrorreporting_v1beta1_generated_ErrorGroupService_GetGroup_sync] diff --git a/owl-bot-staging/ErrorReporting/v1beta1/samples/V1beta1/ErrorGroupServiceClient/update_group.php b/owl-bot-staging/ErrorReporting/v1beta1/samples/V1beta1/ErrorGroupServiceClient/update_group.php new file mode 100644 index 000000000000..a640215654eb --- /dev/null +++ b/owl-bot-staging/ErrorReporting/v1beta1/samples/V1beta1/ErrorGroupServiceClient/update_group.php @@ -0,0 +1,60 @@ +setGroup($group); + + // Call the API and handle any network failures. + try { + /** @var ErrorGroup $response */ + $response = $errorGroupServiceClient->updateGroup($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END clouderrorreporting_v1beta1_generated_ErrorGroupService_UpdateGroup_sync] diff --git a/owl-bot-staging/ErrorReporting/v1beta1/samples/V1beta1/ErrorStatsServiceClient/delete_events.php b/owl-bot-staging/ErrorReporting/v1beta1/samples/V1beta1/ErrorStatsServiceClient/delete_events.php new file mode 100644 index 000000000000..290523b740a6 --- /dev/null +++ b/owl-bot-staging/ErrorReporting/v1beta1/samples/V1beta1/ErrorStatsServiceClient/delete_events.php @@ -0,0 +1,76 @@ +setProjectName($formattedProjectName); + + // Call the API and handle any network failures. + try { + /** @var DeleteEventsResponse $response */ + $response = $errorStatsServiceClient->deleteEvents($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 +{ + $formattedProjectName = ErrorStatsServiceClient::projectName('[PROJECT]'); + + delete_events_sample($formattedProjectName); +} +// [END clouderrorreporting_v1beta1_generated_ErrorStatsService_DeleteEvents_sync] diff --git a/owl-bot-staging/ErrorReporting/v1beta1/samples/V1beta1/ErrorStatsServiceClient/list_events.php b/owl-bot-staging/ErrorReporting/v1beta1/samples/V1beta1/ErrorStatsServiceClient/list_events.php new file mode 100644 index 000000000000..5e4fbbaec9a5 --- /dev/null +++ b/owl-bot-staging/ErrorReporting/v1beta1/samples/V1beta1/ErrorStatsServiceClient/list_events.php @@ -0,0 +1,84 @@ +setProjectName($formattedProjectName) + ->setGroupId($groupId); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $errorStatsServiceClient->listEvents($request); + + /** @var ErrorEvent $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 +{ + $formattedProjectName = ErrorStatsServiceClient::projectName('[PROJECT]'); + $groupId = '[GROUP_ID]'; + + list_events_sample($formattedProjectName, $groupId); +} +// [END clouderrorreporting_v1beta1_generated_ErrorStatsService_ListEvents_sync] diff --git a/owl-bot-staging/ErrorReporting/v1beta1/samples/V1beta1/ErrorStatsServiceClient/list_group_stats.php b/owl-bot-staging/ErrorReporting/v1beta1/samples/V1beta1/ErrorStatsServiceClient/list_group_stats.php new file mode 100644 index 000000000000..987f871ee70c --- /dev/null +++ b/owl-bot-staging/ErrorReporting/v1beta1/samples/V1beta1/ErrorStatsServiceClient/list_group_stats.php @@ -0,0 +1,81 @@ +setProjectName($formattedProjectName); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $errorStatsServiceClient->listGroupStats($request); + + /** @var ErrorGroupStats $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 +{ + $formattedProjectName = ErrorStatsServiceClient::projectName('[PROJECT]'); + + list_group_stats_sample($formattedProjectName); +} +// [END clouderrorreporting_v1beta1_generated_ErrorStatsService_ListGroupStats_sync] diff --git a/owl-bot-staging/ErrorReporting/v1beta1/samples/V1beta1/ReportErrorsServiceClient/report_error_event.php b/owl-bot-staging/ErrorReporting/v1beta1/samples/V1beta1/ReportErrorsServiceClient/report_error_event.php new file mode 100644 index 000000000000..f8f5d3ae62a2 --- /dev/null +++ b/owl-bot-staging/ErrorReporting/v1beta1/samples/V1beta1/ReportErrorsServiceClient/report_error_event.php @@ -0,0 +1,121 @@ +setServiceContext($eventServiceContext) + ->setMessage($eventMessage); + $request = (new ReportErrorEventRequest()) + ->setProjectName($formattedProjectName) + ->setEvent($event); + + // Call the API and handle any network failures. + try { + /** @var ReportErrorEventResponse $response */ + $response = $reportErrorsServiceClient->reportErrorEvent($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 +{ + $formattedProjectName = ReportErrorsServiceClient::projectName('[PROJECT]'); + $eventMessage = '[MESSAGE]'; + + report_error_event_sample($formattedProjectName, $eventMessage); +} +// [END clouderrorreporting_v1beta1_generated_ReportErrorsService_ReportErrorEvent_sync] diff --git a/owl-bot-staging/ErrorReporting/v1beta1/src/V1beta1/Client/BaseClient/ErrorGroupServiceBaseClient.php b/owl-bot-staging/ErrorReporting/v1beta1/src/V1beta1/Client/BaseClient/ErrorGroupServiceBaseClient.php new file mode 100644 index 000000000000..eecc468f9a64 --- /dev/null +++ b/owl-bot-staging/ErrorReporting/v1beta1/src/V1beta1/Client/BaseClient/ErrorGroupServiceBaseClient.php @@ -0,0 +1,273 @@ + self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../../resources/error_group_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../../resources/error_group_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../../resources/error_group_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../../resources/error_group_service_rest_client_config.php', + ], + ], + ]; + } + + /** + * Formats a string containing the fully-qualified path to represent a error_group + * resource. + * + * @param string $project + * @param string $group + * + * @return string The formatted error_group resource. + * + * @experimental + */ + public static function errorGroupName(string $project, string $group): string + { + return self::getPathTemplate('errorGroup')->render([ + 'project' => $project, + 'group' => $group, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - errorGroup: projects/{project}/groups/{group} + * + * 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. + * + * @experimental + */ + 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 'clouderrorreporting.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. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *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' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods 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 + * + * @experimental + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($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); + } + + /** + * Get the specified group. + * + * The async variant is {@see self::getGroupAsync()} . + * + * @param GetGroupRequest $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 ErrorGroup + * + * @throws ApiException Thrown if the API call fails. + * + * @experimental + */ + public function getGroup(GetGroupRequest $request, array $callOptions = []): ErrorGroup + { + return $this->startApiCall('GetGroup', $request, $callOptions)->wait(); + } + + /** + * Replace the data for the specified group. + * Fails if the group does not exist. + * + * The async variant is {@see self::updateGroupAsync()} . + * + * @param UpdateGroupRequest $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 ErrorGroup + * + * @throws ApiException Thrown if the API call fails. + * + * @experimental + */ + public function updateGroup(UpdateGroupRequest $request, array $callOptions = []): ErrorGroup + { + return $this->startApiCall('UpdateGroup', $request, $callOptions)->wait(); + } +} diff --git a/owl-bot-staging/ErrorReporting/v1beta1/src/V1beta1/Client/BaseClient/ErrorStatsServiceBaseClient.php b/owl-bot-staging/ErrorReporting/v1beta1/src/V1beta1/Client/BaseClient/ErrorStatsServiceBaseClient.php new file mode 100644 index 000000000000..ae0b329b01a7 --- /dev/null +++ b/owl-bot-staging/ErrorReporting/v1beta1/src/V1beta1/Client/BaseClient/ErrorStatsServiceBaseClient.php @@ -0,0 +1,300 @@ + self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../../resources/error_stats_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../../resources/error_stats_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../../resources/error_stats_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../../resources/error_stats_service_rest_client_config.php', + ], + ], + ]; + } + + /** + * Formats a string containing the fully-qualified path to represent a project + * resource. + * + * @param string $project + * + * @return string The formatted project resource. + * + * @experimental + */ + public static function projectName(string $project): string + { + return self::getPathTemplate('project')->render([ + 'project' => $project, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - project: projects/{project} + * + * 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. + * + * @experimental + */ + 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 'clouderrorreporting.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. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *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' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods 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 + * + * @experimental + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($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); + } + + /** + * Deletes all error events of a given project. + * + * The async variant is {@see self::deleteEventsAsync()} . + * + * @param DeleteEventsRequest $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 DeleteEventsResponse + * + * @throws ApiException Thrown if the API call fails. + * + * @experimental + */ + public function deleteEvents(DeleteEventsRequest $request, array $callOptions = []): DeleteEventsResponse + { + return $this->startApiCall('DeleteEvents', $request, $callOptions)->wait(); + } + + /** + * Lists the specified events. + * + * The async variant is {@see self::listEventsAsync()} . + * + * @param ListEventsRequest $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. + * + * @experimental + */ + public function listEvents(ListEventsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListEvents', $request, $callOptions); + } + + /** + * Lists the specified groups. + * + * The async variant is {@see self::listGroupStatsAsync()} . + * + * @param ListGroupStatsRequest $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. + * + * @experimental + */ + public function listGroupStats(ListGroupStatsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListGroupStats', $request, $callOptions); + } +} diff --git a/owl-bot-staging/ErrorReporting/v1beta1/src/V1beta1/Client/BaseClient/ReportErrorsServiceBaseClient.php b/owl-bot-staging/ErrorReporting/v1beta1/src/V1beta1/Client/BaseClient/ReportErrorsServiceBaseClient.php new file mode 100644 index 000000000000..7bab8480a899 --- /dev/null +++ b/owl-bot-staging/ErrorReporting/v1beta1/src/V1beta1/Client/BaseClient/ReportErrorsServiceBaseClient.php @@ -0,0 +1,255 @@ + self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../../resources/report_errors_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../../resources/report_errors_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../../resources/report_errors_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../../resources/report_errors_service_rest_client_config.php', + ], + ], + ]; + } + + /** + * Formats a string containing the fully-qualified path to represent a project + * resource. + * + * @param string $project + * + * @return string The formatted project resource. + * + * @experimental + */ + public static function projectName(string $project): string + { + return self::getPathTemplate('project')->render([ + 'project' => $project, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - project: projects/{project} + * + * 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. + * + * @experimental + */ + 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 'clouderrorreporting.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. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *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' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods 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 + * + * @experimental + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($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); + } + + /** + * Report an individual error event and record the event to a log. + * + * This endpoint accepts **either** an OAuth token, + * **or** an [API key](https://support.google.com/cloud/answer/6158862) + * for authentication. To use an API key, append it to the URL as the value of + * a `key` parameter. For example: + * + * `POST + * https://clouderrorreporting.googleapis.com/v1beta1/{projectName}/events:report?key=123ABC456` + * + * **Note:** [Error Reporting](/error-reporting) is a global service built + * on Cloud Logging and doesn't analyze logs stored + * in regional log buckets or logs routed to other Google Cloud projects. + * + * + * The async variant is {@see self::reportErrorEventAsync()} . + * + * @param ReportErrorEventRequest $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 ReportErrorEventResponse + * + * @throws ApiException Thrown if the API call fails. + * + * @experimental + */ + public function reportErrorEvent(ReportErrorEventRequest $request, array $callOptions = []): ReportErrorEventResponse + { + return $this->startApiCall('ReportErrorEvent', $request, $callOptions)->wait(); + } +} diff --git a/owl-bot-staging/ErrorReporting/v1beta1/src/V1beta1/Client/ErrorGroupServiceClient.php b/owl-bot-staging/ErrorReporting/v1beta1/src/V1beta1/Client/ErrorGroupServiceClient.php new file mode 100644 index 000000000000..26ac1a62d22d --- /dev/null +++ b/owl-bot-staging/ErrorReporting/v1beta1/src/V1beta1/Client/ErrorGroupServiceClient.php @@ -0,0 +1,42 @@ +errorGroupName('[PROJECT]', '[GROUP]'); + * $response = $errorGroupServiceClient->getGroup($formattedGroupName); + * } finally { + * $errorGroupServiceClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + * + * @experimental + */ +class ErrorGroupServiceGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.devtools.clouderrorreporting.v1beta1.ErrorGroupService'; + + /** The default address of the service. */ + const SERVICE_ADDRESS = 'clouderrorreporting.googleapis.com'; + + /** The default port of the service. */ + const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + ]; + + private static $errorGroupNameTemplate; + + private static $pathTemplateMap; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/error_group_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/error_group_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/error_group_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/error_group_service_rest_client_config.php', + ], + ], + ]; + } + + private static function getErrorGroupNameTemplate() + { + if (self::$errorGroupNameTemplate == null) { + self::$errorGroupNameTemplate = new PathTemplate('projects/{project}/groups/{group}'); + } + + return self::$errorGroupNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'errorGroup' => self::getErrorGroupNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a error_group + * resource. + * + * @param string $project + * @param string $group + * + * @return string The formatted error_group resource. + * + * @experimental + */ + public static function errorGroupName($project, $group) + { + return self::getErrorGroupNameTemplate()->render([ + 'project' => $project, + 'group' => $group, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - errorGroup: projects/{project}/groups/{group} + * + * 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. + * + * @experimental + */ + public static function parseName($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * 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 'clouderrorreporting.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. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *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' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods 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 + * + * @experimental + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + } + + /** + * Get the specified group. + * + * Sample code: + * ``` + * $errorGroupServiceClient = new ErrorGroupServiceClient(); + * try { + * $formattedGroupName = $errorGroupServiceClient->errorGroupName('[PROJECT]', '[GROUP]'); + * $response = $errorGroupServiceClient->getGroup($formattedGroupName); + * } finally { + * $errorGroupServiceClient->close(); + * } + * ``` + * + * @param string $groupName Required. The group resource name. Written as + * `projects/{projectID}/groups/{group_name}`. Call + * [`groupStats.list`](https://cloud.google.com/error-reporting/reference/rest/v1beta1/projects.groupStats/list) + * to return a list of groups belonging to this project. + * + * Example: `projects/my-project-123/groups/my-group` + * @param array $optionalArgs { + * 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 \Google\Cloud\ErrorReporting\V1beta1\ErrorGroup + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function getGroup($groupName, array $optionalArgs = []) + { + $request = new GetGroupRequest(); + $requestParamHeaders = []; + $request->setGroupName($groupName); + $requestParamHeaders['group_name'] = $groupName; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetGroup', ErrorGroup::class, $optionalArgs, $request)->wait(); + } + + /** + * Replace the data for the specified group. + * Fails if the group does not exist. + * + * Sample code: + * ``` + * $errorGroupServiceClient = new ErrorGroupServiceClient(); + * try { + * $group = new ErrorGroup(); + * $response = $errorGroupServiceClient->updateGroup($group); + * } finally { + * $errorGroupServiceClient->close(); + * } + * ``` + * + * @param ErrorGroup $group Required. The group which replaces the resource on the server. + * @param array $optionalArgs { + * 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 \Google\Cloud\ErrorReporting\V1beta1\ErrorGroup + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function updateGroup($group, array $optionalArgs = []) + { + $request = new UpdateGroupRequest(); + $requestParamHeaders = []; + $request->setGroup($group); + $requestParamHeaders['group.name'] = $group->getName(); + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('UpdateGroup', ErrorGroup::class, $optionalArgs, $request)->wait(); + } +} diff --git a/owl-bot-staging/ErrorReporting/v1beta1/src/V1beta1/Gapic/ErrorStatsServiceGapicClient.php b/owl-bot-staging/ErrorReporting/v1beta1/src/V1beta1/Gapic/ErrorStatsServiceGapicClient.php new file mode 100644 index 000000000000..bf09507d96b8 --- /dev/null +++ b/owl-bot-staging/ErrorReporting/v1beta1/src/V1beta1/Gapic/ErrorStatsServiceGapicClient.php @@ -0,0 +1,530 @@ +projectName('[PROJECT]'); + * $response = $errorStatsServiceClient->deleteEvents($formattedProjectName); + * } finally { + * $errorStatsServiceClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + * + * @experimental + */ +class ErrorStatsServiceGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.devtools.clouderrorreporting.v1beta1.ErrorStatsService'; + + /** The default address of the service. */ + const SERVICE_ADDRESS = 'clouderrorreporting.googleapis.com'; + + /** The default port of the service. */ + const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + ]; + + private static $projectNameTemplate; + + private static $pathTemplateMap; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/error_stats_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/error_stats_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/error_stats_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/error_stats_service_rest_client_config.php', + ], + ], + ]; + } + + private static function getProjectNameTemplate() + { + if (self::$projectNameTemplate == null) { + self::$projectNameTemplate = new PathTemplate('projects/{project}'); + } + + return self::$projectNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'project' => self::getProjectNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a project + * resource. + * + * @param string $project + * + * @return string The formatted project resource. + * + * @experimental + */ + public static function projectName($project) + { + return self::getProjectNameTemplate()->render([ + 'project' => $project, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - project: projects/{project} + * + * 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. + * + * @experimental + */ + public static function parseName($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * 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 'clouderrorreporting.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. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *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' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods 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 + * + * @experimental + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + } + + /** + * Deletes all error events of a given project. + * + * Sample code: + * ``` + * $errorStatsServiceClient = new ErrorStatsServiceClient(); + * try { + * $formattedProjectName = $errorStatsServiceClient->projectName('[PROJECT]'); + * $response = $errorStatsServiceClient->deleteEvents($formattedProjectName); + * } finally { + * $errorStatsServiceClient->close(); + * } + * ``` + * + * @param string $projectName Required. The resource name of the Google Cloud Platform project. Written + * as `projects/{projectID}`, where `{projectID}` is the + * [Google Cloud Platform project + * ID](https://support.google.com/cloud/answer/6158840). + * + * Example: `projects/my-project-123`. + * @param array $optionalArgs { + * 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 \Google\Cloud\ErrorReporting\V1beta1\DeleteEventsResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function deleteEvents($projectName, array $optionalArgs = []) + { + $request = new DeleteEventsRequest(); + $requestParamHeaders = []; + $request->setProjectName($projectName); + $requestParamHeaders['project_name'] = $projectName; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('DeleteEvents', DeleteEventsResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Lists the specified events. + * + * Sample code: + * ``` + * $errorStatsServiceClient = new ErrorStatsServiceClient(); + * try { + * $formattedProjectName = $errorStatsServiceClient->projectName('[PROJECT]'); + * $groupId = 'group_id'; + * // Iterate over pages of elements + * $pagedResponse = $errorStatsServiceClient->listEvents($formattedProjectName, $groupId); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $errorStatsServiceClient->listEvents($formattedProjectName, $groupId); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $errorStatsServiceClient->close(); + * } + * ``` + * + * @param string $projectName Required. The resource name of the Google Cloud Platform project. Written + * as `projects/{projectID}`, where `{projectID}` is the + * [Google Cloud Platform project + * ID](https://support.google.com/cloud/answer/6158840). + * + * Example: `projects/my-project-123`. + * @param string $groupId Required. The group for which events shall be returned. + * @param array $optionalArgs { + * Optional. + * + * @type ServiceContextFilter $serviceFilter + * Optional. List only ErrorGroups which belong to a service context that + * matches the filter. + * Data for all service contexts is returned if this field is not specified. + * @type QueryTimeRange $timeRange + * Optional. List only data for the given time range. + * If not set a default time range is used. The field time_range_begin + * in the response will specify the beginning of this time range. + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @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 \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function listEvents($projectName, $groupId, array $optionalArgs = []) + { + $request = new ListEventsRequest(); + $requestParamHeaders = []; + $request->setProjectName($projectName); + $request->setGroupId($groupId); + $requestParamHeaders['project_name'] = $projectName; + if (isset($optionalArgs['serviceFilter'])) { + $request->setServiceFilter($optionalArgs['serviceFilter']); + } + + if (isset($optionalArgs['timeRange'])) { + $request->setTimeRange($optionalArgs['timeRange']); + } + + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListEvents', $optionalArgs, ListEventsResponse::class, $request); + } + + /** + * Lists the specified groups. + * + * Sample code: + * ``` + * $errorStatsServiceClient = new ErrorStatsServiceClient(); + * try { + * $formattedProjectName = $errorStatsServiceClient->projectName('[PROJECT]'); + * // Iterate over pages of elements + * $pagedResponse = $errorStatsServiceClient->listGroupStats($formattedProjectName); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $errorStatsServiceClient->listGroupStats($formattedProjectName); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $errorStatsServiceClient->close(); + * } + * ``` + * + * @param string $projectName Required. The resource name of the Google Cloud Platform project. Written + * as `projects/{projectID}` or `projects/{projectNumber}`, where `{projectID}` + * and `{projectNumber}` can be found in the + * [Google Cloud Console](https://support.google.com/cloud/answer/6158840). + * + * Examples: `projects/my-project-123`, `projects/5551234`. + * @param array $optionalArgs { + * Optional. + * + * @type string[] $groupId + * Optional. List all ErrorGroupStats with these IDs. + * @type ServiceContextFilter $serviceFilter + * Optional. List only ErrorGroupStats which belong to a service + * context that matches the filter. + * Data for all service contexts is returned if this field is not specified. + * @type QueryTimeRange $timeRange + * Optional. List data for the given time range. + * If not set, a default time range is used. The field + * time_range_begin in the response will specify the beginning + * of this time range. + * Only ErrorGroupStats with a non-zero count in the given time + * range are returned, unless the request contains an explicit + * group_id list. If a group_id list is given, also + * ErrorGroupStats with zero occurrences are returned. + * @type Duration $timedCountDuration + * Optional. The preferred duration for a single returned `TimedCount`. + * If not set, no timed counts are returned. + * @type int $alignment + * Optional. The alignment of the timed counts to be returned. + * Default is `ALIGNMENT_EQUAL_AT_END`. + * For allowed values, use constants defined on {@see \Google\Cloud\ErrorReporting\V1beta1\TimedCountAlignment} + * @type Timestamp $alignmentTime + * Optional. Time where the timed counts shall be aligned if rounded + * alignment is chosen. Default is 00:00 UTC. + * @type int $order + * Optional. The sort order in which the results are returned. + * Default is `COUNT_DESC`. + * For allowed values, use constants defined on {@see \Google\Cloud\ErrorReporting\V1beta1\ErrorGroupOrder} + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @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 \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function listGroupStats($projectName, array $optionalArgs = []) + { + $request = new ListGroupStatsRequest(); + $requestParamHeaders = []; + $request->setProjectName($projectName); + $requestParamHeaders['project_name'] = $projectName; + if (isset($optionalArgs['groupId'])) { + $request->setGroupId($optionalArgs['groupId']); + } + + if (isset($optionalArgs['serviceFilter'])) { + $request->setServiceFilter($optionalArgs['serviceFilter']); + } + + if (isset($optionalArgs['timeRange'])) { + $request->setTimeRange($optionalArgs['timeRange']); + } + + if (isset($optionalArgs['timedCountDuration'])) { + $request->setTimedCountDuration($optionalArgs['timedCountDuration']); + } + + if (isset($optionalArgs['alignment'])) { + $request->setAlignment($optionalArgs['alignment']); + } + + if (isset($optionalArgs['alignmentTime'])) { + $request->setAlignmentTime($optionalArgs['alignmentTime']); + } + + if (isset($optionalArgs['order'])) { + $request->setOrder($optionalArgs['order']); + } + + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListGroupStats', $optionalArgs, ListGroupStatsResponse::class, $request); + } +} diff --git a/owl-bot-staging/ErrorReporting/v1beta1/src/V1beta1/Gapic/ReportErrorsServiceGapicClient.php b/owl-bot-staging/ErrorReporting/v1beta1/src/V1beta1/Gapic/ReportErrorsServiceGapicClient.php new file mode 100644 index 000000000000..870892c397ab --- /dev/null +++ b/owl-bot-staging/ErrorReporting/v1beta1/src/V1beta1/Gapic/ReportErrorsServiceGapicClient.php @@ -0,0 +1,313 @@ +projectName('[PROJECT]'); + * $event = new ReportedErrorEvent(); + * $response = $reportErrorsServiceClient->reportErrorEvent($formattedProjectName, $event); + * } finally { + * $reportErrorsServiceClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + * + * @experimental + */ +class ReportErrorsServiceGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.devtools.clouderrorreporting.v1beta1.ReportErrorsService'; + + /** The default address of the service. */ + const SERVICE_ADDRESS = 'clouderrorreporting.googleapis.com'; + + /** The default port of the service. */ + const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + ]; + + private static $projectNameTemplate; + + private static $pathTemplateMap; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/report_errors_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/report_errors_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/report_errors_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/report_errors_service_rest_client_config.php', + ], + ], + ]; + } + + private static function getProjectNameTemplate() + { + if (self::$projectNameTemplate == null) { + self::$projectNameTemplate = new PathTemplate('projects/{project}'); + } + + return self::$projectNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'project' => self::getProjectNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a project + * resource. + * + * @param string $project + * + * @return string The formatted project resource. + * + * @experimental + */ + public static function projectName($project) + { + return self::getProjectNameTemplate()->render([ + 'project' => $project, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - project: projects/{project} + * + * 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. + * + * @experimental + */ + public static function parseName($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * 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 'clouderrorreporting.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. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *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' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods 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 + * + * @experimental + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + } + + /** + * Report an individual error event and record the event to a log. + * + * This endpoint accepts **either** an OAuth token, + * **or** an [API key](https://support.google.com/cloud/answer/6158862) + * for authentication. To use an API key, append it to the URL as the value of + * a `key` parameter. For example: + * + * `POST + * https://clouderrorreporting.googleapis.com/v1beta1/{projectName}/events:report?key=123ABC456` + * + * **Note:** [Error Reporting](/error-reporting) is a global service built + * on Cloud Logging and doesn't analyze logs stored + * in regional log buckets or logs routed to other Google Cloud projects. + * + * + * Sample code: + * ``` + * $reportErrorsServiceClient = new ReportErrorsServiceClient(); + * try { + * $formattedProjectName = $reportErrorsServiceClient->projectName('[PROJECT]'); + * $event = new ReportedErrorEvent(); + * $response = $reportErrorsServiceClient->reportErrorEvent($formattedProjectName, $event); + * } finally { + * $reportErrorsServiceClient->close(); + * } + * ``` + * + * @param string $projectName Required. The resource name of the Google Cloud Platform project. Written + * as `projects/{projectId}`, where `{projectId}` is the + * [Google Cloud Platform project + * ID](https://support.google.com/cloud/answer/6158840). + * + * Example: // `projects/my-project-123`. + * @param ReportedErrorEvent $event Required. The error event to be reported. + * @param array $optionalArgs { + * 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 \Google\Cloud\ErrorReporting\V1beta1\ReportErrorEventResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function reportErrorEvent($projectName, $event, array $optionalArgs = []) + { + $request = new ReportErrorEventRequest(); + $requestParamHeaders = []; + $request->setProjectName($projectName); + $request->setEvent($event); + $requestParamHeaders['project_name'] = $projectName; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('ReportErrorEvent', ReportErrorEventResponse::class, $optionalArgs, $request)->wait(); + } +} diff --git a/owl-bot-staging/ErrorReporting/v1beta1/src/V1beta1/ReportErrorsServiceClient.php b/owl-bot-staging/ErrorReporting/v1beta1/src/V1beta1/ReportErrorsServiceClient.php new file mode 100644 index 000000000000..1cf0f5c77828 --- /dev/null +++ b/owl-bot-staging/ErrorReporting/v1beta1/src/V1beta1/ReportErrorsServiceClient.php @@ -0,0 +1,36 @@ + [ + 'google.devtools.clouderrorreporting.v1beta1.ErrorGroupService' => [ + 'GetGroup' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\ErrorReporting\V1beta1\ErrorGroup', + 'headerParams' => [ + [ + 'keyName' => 'group_name', + 'fieldAccessors' => [ + 'getGroupName', + ], + ], + ], + ], + 'UpdateGroup' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\ErrorReporting\V1beta1\ErrorGroup', + 'headerParams' => [ + [ + 'keyName' => 'group.name', + 'fieldAccessors' => [ + 'getGroup', + 'getName', + ], + ], + ], + ], + 'templateMap' => [ + 'errorGroup' => 'projects/{project}/groups/{group}', + ], + ], + ], +]; diff --git a/owl-bot-staging/ErrorReporting/v1beta1/src/V1beta1/resources/error_group_service_rest_client_config.php b/owl-bot-staging/ErrorReporting/v1beta1/src/V1beta1/resources/error_group_service_rest_client_config.php new file mode 100644 index 000000000000..e967a41f87ee --- /dev/null +++ b/owl-bot-staging/ErrorReporting/v1beta1/src/V1beta1/resources/error_group_service_rest_client_config.php @@ -0,0 +1,33 @@ + [ + 'google.devtools.clouderrorreporting.v1beta1.ErrorGroupService' => [ + 'GetGroup' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta1/{group_name=projects/*/groups/*}', + 'placeholders' => [ + 'group_name' => [ + 'getters' => [ + 'getGroupName', + ], + ], + ], + ], + 'UpdateGroup' => [ + 'method' => 'put', + 'uriTemplate' => '/v1beta1/{group.name=projects/*/groups/*}', + 'body' => 'group', + 'placeholders' => [ + 'group.name' => [ + 'getters' => [ + 'getGroup', + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/ErrorReporting/v1beta1/src/V1beta1/resources/error_stats_service_client_config.json b/owl-bot-staging/ErrorReporting/v1beta1/src/V1beta1/resources/error_stats_service_client_config.json new file mode 100644 index 000000000000..0a7501188091 --- /dev/null +++ b/owl-bot-staging/ErrorReporting/v1beta1/src/V1beta1/resources/error_stats_service_client_config.json @@ -0,0 +1,50 @@ +{ + "interfaces": { + "google.devtools.clouderrorreporting.v1beta1.ErrorStatsService": { + "retry_codes": { + "no_retry_codes": [], + "retry_policy_1_codes": [ + "UNAVAILABLE", + "DEADLINE_EXCEEDED" + ] + }, + "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": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 600000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 600000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "DeleteEvents": { + "timeout_millis": 600000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListEvents": { + "timeout_millis": 600000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListGroupStats": { + "timeout_millis": 600000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + } + } + } + } +} diff --git a/owl-bot-staging/ErrorReporting/v1beta1/src/V1beta1/resources/error_stats_service_descriptor_config.php b/owl-bot-staging/ErrorReporting/v1beta1/src/V1beta1/resources/error_stats_service_descriptor_config.php new file mode 100644 index 000000000000..43712e675c86 --- /dev/null +++ b/owl-bot-staging/ErrorReporting/v1beta1/src/V1beta1/resources/error_stats_service_descriptor_config.php @@ -0,0 +1,63 @@ + [ + 'google.devtools.clouderrorreporting.v1beta1.ErrorStatsService' => [ + 'DeleteEvents' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\ErrorReporting\V1beta1\DeleteEventsResponse', + 'headerParams' => [ + [ + 'keyName' => 'project_name', + 'fieldAccessors' => [ + 'getProjectName', + ], + ], + ], + ], + 'ListEvents' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getErrorEvents', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\ErrorReporting\V1beta1\ListEventsResponse', + 'headerParams' => [ + [ + 'keyName' => 'project_name', + 'fieldAccessors' => [ + 'getProjectName', + ], + ], + ], + ], + 'ListGroupStats' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getErrorGroupStats', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\ErrorReporting\V1beta1\ListGroupStatsResponse', + 'headerParams' => [ + [ + 'keyName' => 'project_name', + 'fieldAccessors' => [ + 'getProjectName', + ], + ], + ], + ], + 'templateMap' => [ + 'project' => 'projects/{project}', + ], + ], + ], +]; diff --git a/owl-bot-staging/ErrorReporting/v1beta1/src/V1beta1/resources/error_stats_service_rest_client_config.php b/owl-bot-staging/ErrorReporting/v1beta1/src/V1beta1/resources/error_stats_service_rest_client_config.php new file mode 100644 index 000000000000..8b9bb159bcb1 --- /dev/null +++ b/owl-bot-staging/ErrorReporting/v1beta1/src/V1beta1/resources/error_stats_service_rest_client_config.php @@ -0,0 +1,45 @@ + [ + 'google.devtools.clouderrorreporting.v1beta1.ErrorStatsService' => [ + 'DeleteEvents' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1beta1/{project_name=projects/*}/events', + 'placeholders' => [ + 'project_name' => [ + 'getters' => [ + 'getProjectName', + ], + ], + ], + ], + 'ListEvents' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta1/{project_name=projects/*}/events', + 'placeholders' => [ + 'project_name' => [ + 'getters' => [ + 'getProjectName', + ], + ], + ], + 'queryParams' => [ + 'group_id', + ], + ], + 'ListGroupStats' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta1/{project_name=projects/*}/groupStats', + 'placeholders' => [ + 'project_name' => [ + 'getters' => [ + 'getProjectName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/ErrorReporting/v1beta1/src/V1beta1/resources/report_errors_service_client_config.json b/owl-bot-staging/ErrorReporting/v1beta1/src/V1beta1/resources/report_errors_service_client_config.json new file mode 100644 index 000000000000..701d5afb9615 --- /dev/null +++ b/owl-bot-staging/ErrorReporting/v1beta1/src/V1beta1/resources/report_errors_service_client_config.json @@ -0,0 +1,37 @@ +{ + "interfaces": { + "google.devtools.clouderrorreporting.v1beta1.ReportErrorsService": { + "retry_codes": { + "no_retry_codes": [], + "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 + }, + "no_retry_1_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 600000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 600000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ReportErrorEvent": { + "timeout_millis": 600000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + } + } + } + } +} diff --git a/owl-bot-staging/ErrorReporting/v1beta1/src/V1beta1/resources/report_errors_service_descriptor_config.php b/owl-bot-staging/ErrorReporting/v1beta1/src/V1beta1/resources/report_errors_service_descriptor_config.php new file mode 100644 index 000000000000..d95e271868e2 --- /dev/null +++ b/owl-bot-staging/ErrorReporting/v1beta1/src/V1beta1/resources/report_errors_service_descriptor_config.php @@ -0,0 +1,23 @@ + [ + 'google.devtools.clouderrorreporting.v1beta1.ReportErrorsService' => [ + 'ReportErrorEvent' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\ErrorReporting\V1beta1\ReportErrorEventResponse', + 'headerParams' => [ + [ + 'keyName' => 'project_name', + 'fieldAccessors' => [ + 'getProjectName', + ], + ], + ], + ], + 'templateMap' => [ + 'project' => 'projects/{project}', + ], + ], + ], +]; diff --git a/owl-bot-staging/ErrorReporting/v1beta1/src/V1beta1/resources/report_errors_service_rest_client_config.php b/owl-bot-staging/ErrorReporting/v1beta1/src/V1beta1/resources/report_errors_service_rest_client_config.php new file mode 100644 index 000000000000..c7565d89467b --- /dev/null +++ b/owl-bot-staging/ErrorReporting/v1beta1/src/V1beta1/resources/report_errors_service_rest_client_config.php @@ -0,0 +1,21 @@ + [ + 'google.devtools.clouderrorreporting.v1beta1.ReportErrorsService' => [ + 'ReportErrorEvent' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta1/{project_name=projects/*}/events:report', + 'body' => 'event', + 'placeholders' => [ + 'project_name' => [ + 'getters' => [ + 'getProjectName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/ErrorReporting/v1beta1/tests/Unit/V1beta1/Client/ErrorGroupServiceClientTest.php b/owl-bot-staging/ErrorReporting/v1beta1/tests/Unit/V1beta1/Client/ErrorGroupServiceClientTest.php new file mode 100644 index 000000000000..100a41dab981 --- /dev/null +++ b/owl-bot-staging/ErrorReporting/v1beta1/tests/Unit/V1beta1/Client/ErrorGroupServiceClientTest.php @@ -0,0 +1,226 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return ErrorGroupServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new ErrorGroupServiceClient($options); + } + + /** @test */ + public function getGroupTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $groupId = 'groupId506361563'; + $expectedResponse = new ErrorGroup(); + $expectedResponse->setName($name); + $expectedResponse->setGroupId($groupId); + $transport->addResponse($expectedResponse); + // Mock request + $formattedGroupName = $gapicClient->errorGroupName('[PROJECT]', '[GROUP]'); + $request = (new GetGroupRequest()) + ->setGroupName($formattedGroupName); + $response = $gapicClient->getGroup($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.devtools.clouderrorreporting.v1beta1.ErrorGroupService/GetGroup', $actualFuncCall); + $actualValue = $actualRequestObject->getGroupName(); + $this->assertProtobufEquals($formattedGroupName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getGroupExceptionTest() + { + $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 + $formattedGroupName = $gapicClient->errorGroupName('[PROJECT]', '[GROUP]'); + $request = (new GetGroupRequest()) + ->setGroupName($formattedGroupName); + try { + $gapicClient->getGroup($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 updateGroupTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $groupId = 'groupId506361563'; + $expectedResponse = new ErrorGroup(); + $expectedResponse->setName($name); + $expectedResponse->setGroupId($groupId); + $transport->addResponse($expectedResponse); + // Mock request + $group = new ErrorGroup(); + $request = (new UpdateGroupRequest()) + ->setGroup($group); + $response = $gapicClient->updateGroup($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.devtools.clouderrorreporting.v1beta1.ErrorGroupService/UpdateGroup', $actualFuncCall); + $actualValue = $actualRequestObject->getGroup(); + $this->assertProtobufEquals($group, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateGroupExceptionTest() + { + $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 + $group = new ErrorGroup(); + $request = (new UpdateGroupRequest()) + ->setGroup($group); + try { + $gapicClient->updateGroup($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 getGroupAsyncTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $groupId = 'groupId506361563'; + $expectedResponse = new ErrorGroup(); + $expectedResponse->setName($name); + $expectedResponse->setGroupId($groupId); + $transport->addResponse($expectedResponse); + // Mock request + $formattedGroupName = $gapicClient->errorGroupName('[PROJECT]', '[GROUP]'); + $request = (new GetGroupRequest()) + ->setGroupName($formattedGroupName); + $response = $gapicClient->getGroupAsync($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.devtools.clouderrorreporting.v1beta1.ErrorGroupService/GetGroup', $actualFuncCall); + $actualValue = $actualRequestObject->getGroupName(); + $this->assertProtobufEquals($formattedGroupName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/owl-bot-staging/ErrorReporting/v1beta1/tests/Unit/V1beta1/Client/ErrorStatsServiceClientTest.php b/owl-bot-staging/ErrorReporting/v1beta1/tests/Unit/V1beta1/Client/ErrorStatsServiceClientTest.php new file mode 100644 index 000000000000..d99c4491f0f9 --- /dev/null +++ b/owl-bot-staging/ErrorReporting/v1beta1/tests/Unit/V1beta1/Client/ErrorStatsServiceClientTest.php @@ -0,0 +1,307 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return ErrorStatsServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new ErrorStatsServiceClient($options); + } + + /** @test */ + public function deleteEventsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new DeleteEventsResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedProjectName = $gapicClient->projectName('[PROJECT]'); + $request = (new DeleteEventsRequest()) + ->setProjectName($formattedProjectName); + $response = $gapicClient->deleteEvents($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.devtools.clouderrorreporting.v1beta1.ErrorStatsService/DeleteEvents', $actualFuncCall); + $actualValue = $actualRequestObject->getProjectName(); + $this->assertProtobufEquals($formattedProjectName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteEventsExceptionTest() + { + $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 + $formattedProjectName = $gapicClient->projectName('[PROJECT]'); + $request = (new DeleteEventsRequest()) + ->setProjectName($formattedProjectName); + try { + $gapicClient->deleteEvents($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 listEventsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $errorEventsElement = new ErrorEvent(); + $errorEvents = [ + $errorEventsElement, + ]; + $expectedResponse = new ListEventsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setErrorEvents($errorEvents); + $transport->addResponse($expectedResponse); + // Mock request + $formattedProjectName = $gapicClient->projectName('[PROJECT]'); + $groupId = 'groupId506361563'; + $request = (new ListEventsRequest()) + ->setProjectName($formattedProjectName) + ->setGroupId($groupId); + $response = $gapicClient->listEvents($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getErrorEvents()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.devtools.clouderrorreporting.v1beta1.ErrorStatsService/ListEvents', $actualFuncCall); + $actualValue = $actualRequestObject->getProjectName(); + $this->assertProtobufEquals($formattedProjectName, $actualValue); + $actualValue = $actualRequestObject->getGroupId(); + $this->assertProtobufEquals($groupId, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listEventsExceptionTest() + { + $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 + $formattedProjectName = $gapicClient->projectName('[PROJECT]'); + $groupId = 'groupId506361563'; + $request = (new ListEventsRequest()) + ->setProjectName($formattedProjectName) + ->setGroupId($groupId); + try { + $gapicClient->listEvents($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 listGroupStatsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $errorGroupStatsElement = new ErrorGroupStats(); + $errorGroupStats = [ + $errorGroupStatsElement, + ]; + $expectedResponse = new ListGroupStatsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setErrorGroupStats($errorGroupStats); + $transport->addResponse($expectedResponse); + // Mock request + $formattedProjectName = $gapicClient->projectName('[PROJECT]'); + $request = (new ListGroupStatsRequest()) + ->setProjectName($formattedProjectName); + $response = $gapicClient->listGroupStats($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getErrorGroupStats()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.devtools.clouderrorreporting.v1beta1.ErrorStatsService/ListGroupStats', $actualFuncCall); + $actualValue = $actualRequestObject->getProjectName(); + $this->assertProtobufEquals($formattedProjectName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listGroupStatsExceptionTest() + { + $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 + $formattedProjectName = $gapicClient->projectName('[PROJECT]'); + $request = (new ListGroupStatsRequest()) + ->setProjectName($formattedProjectName); + try { + $gapicClient->listGroupStats($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 deleteEventsAsyncTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new DeleteEventsResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedProjectName = $gapicClient->projectName('[PROJECT]'); + $request = (new DeleteEventsRequest()) + ->setProjectName($formattedProjectName); + $response = $gapicClient->deleteEventsAsync($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.devtools.clouderrorreporting.v1beta1.ErrorStatsService/DeleteEvents', $actualFuncCall); + $actualValue = $actualRequestObject->getProjectName(); + $this->assertProtobufEquals($formattedProjectName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/owl-bot-staging/ErrorReporting/v1beta1/tests/Unit/V1beta1/Client/ReportErrorsServiceClientTest.php b/owl-bot-staging/ErrorReporting/v1beta1/tests/Unit/V1beta1/Client/ReportErrorsServiceClientTest.php new file mode 100644 index 000000000000..be5d01d1b07a --- /dev/null +++ b/owl-bot-staging/ErrorReporting/v1beta1/tests/Unit/V1beta1/Client/ReportErrorsServiceClientTest.php @@ -0,0 +1,175 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return ReportErrorsServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new ReportErrorsServiceClient($options); + } + + /** @test */ + public function reportErrorEventTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new ReportErrorEventResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedProjectName = $gapicClient->projectName('[PROJECT]'); + $event = new ReportedErrorEvent(); + $eventServiceContext = new ServiceContext(); + $event->setServiceContext($eventServiceContext); + $eventMessage = 'eventMessage1863181325'; + $event->setMessage($eventMessage); + $request = (new ReportErrorEventRequest()) + ->setProjectName($formattedProjectName) + ->setEvent($event); + $response = $gapicClient->reportErrorEvent($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.devtools.clouderrorreporting.v1beta1.ReportErrorsService/ReportErrorEvent', $actualFuncCall); + $actualValue = $actualRequestObject->getProjectName(); + $this->assertProtobufEquals($formattedProjectName, $actualValue); + $actualValue = $actualRequestObject->getEvent(); + $this->assertProtobufEquals($event, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function reportErrorEventExceptionTest() + { + $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 + $formattedProjectName = $gapicClient->projectName('[PROJECT]'); + $event = new ReportedErrorEvent(); + $eventServiceContext = new ServiceContext(); + $event->setServiceContext($eventServiceContext); + $eventMessage = 'eventMessage1863181325'; + $event->setMessage($eventMessage); + $request = (new ReportErrorEventRequest()) + ->setProjectName($formattedProjectName) + ->setEvent($event); + try { + $gapicClient->reportErrorEvent($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 reportErrorEventAsyncTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new ReportErrorEventResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedProjectName = $gapicClient->projectName('[PROJECT]'); + $event = new ReportedErrorEvent(); + $eventServiceContext = new ServiceContext(); + $event->setServiceContext($eventServiceContext); + $eventMessage = 'eventMessage1863181325'; + $event->setMessage($eventMessage); + $request = (new ReportErrorEventRequest()) + ->setProjectName($formattedProjectName) + ->setEvent($event); + $response = $gapicClient->reportErrorEventAsync($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.devtools.clouderrorreporting.v1beta1.ReportErrorsService/ReportErrorEvent', $actualFuncCall); + $actualValue = $actualRequestObject->getProjectName(); + $this->assertProtobufEquals($formattedProjectName, $actualValue); + $actualValue = $actualRequestObject->getEvent(); + $this->assertProtobufEquals($event, $actualValue); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/owl-bot-staging/ErrorReporting/v1beta1/tests/Unit/V1beta1/ErrorGroupServiceClientTest.php b/owl-bot-staging/ErrorReporting/v1beta1/tests/Unit/V1beta1/ErrorGroupServiceClientTest.php new file mode 100644 index 000000000000..9df60a549c5e --- /dev/null +++ b/owl-bot-staging/ErrorReporting/v1beta1/tests/Unit/V1beta1/ErrorGroupServiceClientTest.php @@ -0,0 +1,185 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return ErrorGroupServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new ErrorGroupServiceClient($options); + } + + /** @test */ + public function getGroupTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $groupId = 'groupId506361563'; + $expectedResponse = new ErrorGroup(); + $expectedResponse->setName($name); + $expectedResponse->setGroupId($groupId); + $transport->addResponse($expectedResponse); + // Mock request + $formattedGroupName = $gapicClient->errorGroupName('[PROJECT]', '[GROUP]'); + $response = $gapicClient->getGroup($formattedGroupName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.devtools.clouderrorreporting.v1beta1.ErrorGroupService/GetGroup', $actualFuncCall); + $actualValue = $actualRequestObject->getGroupName(); + $this->assertProtobufEquals($formattedGroupName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getGroupExceptionTest() + { + $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 + $formattedGroupName = $gapicClient->errorGroupName('[PROJECT]', '[GROUP]'); + try { + $gapicClient->getGroup($formattedGroupName); + // 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 updateGroupTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $groupId = 'groupId506361563'; + $expectedResponse = new ErrorGroup(); + $expectedResponse->setName($name); + $expectedResponse->setGroupId($groupId); + $transport->addResponse($expectedResponse); + // Mock request + $group = new ErrorGroup(); + $response = $gapicClient->updateGroup($group); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.devtools.clouderrorreporting.v1beta1.ErrorGroupService/UpdateGroup', $actualFuncCall); + $actualValue = $actualRequestObject->getGroup(); + $this->assertProtobufEquals($group, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateGroupExceptionTest() + { + $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 + $group = new ErrorGroup(); + try { + $gapicClient->updateGroup($group); + // 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()); + } +} diff --git a/owl-bot-staging/ErrorReporting/v1beta1/tests/Unit/V1beta1/ErrorStatsServiceClientTest.php b/owl-bot-staging/ErrorReporting/v1beta1/tests/Unit/V1beta1/ErrorStatsServiceClientTest.php new file mode 100644 index 000000000000..4fd50e022e43 --- /dev/null +++ b/owl-bot-staging/ErrorReporting/v1beta1/tests/Unit/V1beta1/ErrorStatsServiceClientTest.php @@ -0,0 +1,263 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return ErrorStatsServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new ErrorStatsServiceClient($options); + } + + /** @test */ + public function deleteEventsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new DeleteEventsResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedProjectName = $gapicClient->projectName('[PROJECT]'); + $response = $gapicClient->deleteEvents($formattedProjectName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.devtools.clouderrorreporting.v1beta1.ErrorStatsService/DeleteEvents', $actualFuncCall); + $actualValue = $actualRequestObject->getProjectName(); + $this->assertProtobufEquals($formattedProjectName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteEventsExceptionTest() + { + $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 + $formattedProjectName = $gapicClient->projectName('[PROJECT]'); + try { + $gapicClient->deleteEvents($formattedProjectName); + // 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 listEventsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $errorEventsElement = new ErrorEvent(); + $errorEvents = [ + $errorEventsElement, + ]; + $expectedResponse = new ListEventsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setErrorEvents($errorEvents); + $transport->addResponse($expectedResponse); + // Mock request + $formattedProjectName = $gapicClient->projectName('[PROJECT]'); + $groupId = 'groupId506361563'; + $response = $gapicClient->listEvents($formattedProjectName, $groupId); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getErrorEvents()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.devtools.clouderrorreporting.v1beta1.ErrorStatsService/ListEvents', $actualFuncCall); + $actualValue = $actualRequestObject->getProjectName(); + $this->assertProtobufEquals($formattedProjectName, $actualValue); + $actualValue = $actualRequestObject->getGroupId(); + $this->assertProtobufEquals($groupId, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listEventsExceptionTest() + { + $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 + $formattedProjectName = $gapicClient->projectName('[PROJECT]'); + $groupId = 'groupId506361563'; + try { + $gapicClient->listEvents($formattedProjectName, $groupId); + // 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 listGroupStatsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $errorGroupStatsElement = new ErrorGroupStats(); + $errorGroupStats = [ + $errorGroupStatsElement, + ]; + $expectedResponse = new ListGroupStatsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setErrorGroupStats($errorGroupStats); + $transport->addResponse($expectedResponse); + // Mock request + $formattedProjectName = $gapicClient->projectName('[PROJECT]'); + $response = $gapicClient->listGroupStats($formattedProjectName); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getErrorGroupStats()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.devtools.clouderrorreporting.v1beta1.ErrorStatsService/ListGroupStats', $actualFuncCall); + $actualValue = $actualRequestObject->getProjectName(); + $this->assertProtobufEquals($formattedProjectName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listGroupStatsExceptionTest() + { + $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 + $formattedProjectName = $gapicClient->projectName('[PROJECT]'); + try { + $gapicClient->listGroupStats($formattedProjectName); + // 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()); + } +} diff --git a/owl-bot-staging/ErrorReporting/v1beta1/tests/Unit/V1beta1/ReportErrorsServiceClientTest.php b/owl-bot-staging/ErrorReporting/v1beta1/tests/Unit/V1beta1/ReportErrorsServiceClientTest.php new file mode 100644 index 000000000000..8b8a666af77d --- /dev/null +++ b/owl-bot-staging/ErrorReporting/v1beta1/tests/Unit/V1beta1/ReportErrorsServiceClientTest.php @@ -0,0 +1,133 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return ReportErrorsServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new ReportErrorsServiceClient($options); + } + + /** @test */ + public function reportErrorEventTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new ReportErrorEventResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedProjectName = $gapicClient->projectName('[PROJECT]'); + $event = new ReportedErrorEvent(); + $eventServiceContext = new ServiceContext(); + $event->setServiceContext($eventServiceContext); + $eventMessage = 'eventMessage1863181325'; + $event->setMessage($eventMessage); + $response = $gapicClient->reportErrorEvent($formattedProjectName, $event); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.devtools.clouderrorreporting.v1beta1.ReportErrorsService/ReportErrorEvent', $actualFuncCall); + $actualValue = $actualRequestObject->getProjectName(); + $this->assertProtobufEquals($formattedProjectName, $actualValue); + $actualValue = $actualRequestObject->getEvent(); + $this->assertProtobufEquals($event, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function reportErrorEventExceptionTest() + { + $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 + $formattedProjectName = $gapicClient->projectName('[PROJECT]'); + $event = new ReportedErrorEvent(); + $eventServiceContext = new ServiceContext(); + $event->setServiceContext($eventServiceContext); + $eventMessage = 'eventMessage1863181325'; + $event->setMessage($eventMessage); + try { + $gapicClient->reportErrorEvent($formattedProjectName, $event); + // 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()); + } +} diff --git a/owl-bot-staging/EssentialContacts/v1/proto/src/GPBMetadata/Google/Cloud/Essentialcontacts/V1/Enums.php b/owl-bot-staging/EssentialContacts/v1/proto/src/GPBMetadata/Google/Cloud/Essentialcontacts/V1/Enums.php new file mode 100644 index 000000000000..c48076205818 Binary files /dev/null and b/owl-bot-staging/EssentialContacts/v1/proto/src/GPBMetadata/Google/Cloud/Essentialcontacts/V1/Enums.php differ diff --git a/owl-bot-staging/EssentialContacts/v1/proto/src/GPBMetadata/Google/Cloud/Essentialcontacts/V1/Service.php b/owl-bot-staging/EssentialContacts/v1/proto/src/GPBMetadata/Google/Cloud/Essentialcontacts/V1/Service.php new file mode 100644 index 000000000000..1b912e16b8da --- /dev/null +++ b/owl-bot-staging/EssentialContacts/v1/proto/src/GPBMetadata/Google/Cloud/Essentialcontacts/V1/Service.php @@ -0,0 +1,86 @@ +internalAddGeneratedFile( + ' +" +/google/cloud/essentialcontacts/v1/service.proto!google.cloud.essentialcontacts.v1google/api/client.protogoogle/api/field_behavior.protogoogle/api/resource.proto-google/cloud/essentialcontacts/v1/enums.protogoogle/protobuf/empty.proto google/protobuf/field_mask.protogoogle/protobuf/timestamp.proto"Ñ +Contact +name (  +email ( d +#notification_category_subscriptions (27.google.cloud.essentialcontacts.v1.NotificationCategory + language_tag ( L +validation_state (22.google.cloud.essentialcontacts.v1.ValidationState1 + validate_time ( 2.google.protobuf.Timestamp:«êA§ +(essentialcontacts.googleapis.com/Contact%projects/{project}/contacts/{contact}#folders/{folder}/contacts/{contact}/organizations/{organization}/contacts/{contact}"ˆ +ListContactsRequest@ +parent ( B0àAúA*(essentialcontacts.googleapis.com/Contact + page_size (BàA + +page_token ( BàA"m +ListContactsResponse< +contacts ( 2*.google.cloud.essentialcontacts.v1.Contact +next_page_token ( "S +GetContactRequest> +name ( B0àAúA* +(essentialcontacts.googleapis.com/Contact"V +DeleteContactRequest> +name ( B0àAúA* +(essentialcontacts.googleapis.com/Contact"š +CreateContactRequest@ +parent ( B0àAúA*(essentialcontacts.googleapis.com/Contact@ +contact ( 2*.google.cloud.essentialcontacts.v1.ContactBàA"Ž +UpdateContactRequest@ +contact ( 2*.google.cloud.essentialcontacts.v1.ContactBàA4 + update_mask ( 2.google.protobuf.FieldMaskBàA"å +ComputeContactsRequest@ +parent ( B0àAúA*(essentialcontacts.googleapis.com/ContactX +notification_categories (27.google.cloud.essentialcontacts.v1.NotificationCategory + page_size (BàA + +page_token ( BàA"p +ComputeContactsResponse< +contacts ( 2*.google.cloud.essentialcontacts.v1.Contact +next_page_token ( "ý +SendTestMessageRequestB +contacts ( B0àAúA* +(essentialcontacts.googleapis.com/ContactB +resource ( B0àAúA*(essentialcontacts.googleapis.com/Contact[ +notification_category (27.google.cloud.essentialcontacts.v1.NotificationCategoryBàA2Ë +EssentialContactsService˜ + CreateContact7.google.cloud.essentialcontacts.v1.CreateContactRequest*.google.cloud.essentialcontacts.v1.Contact"¡‚Ó䓉" /v1/{parent=projects/*}/contacts:contactZ*"/v1/{parent=folders/*}/contacts:contactZ0"%/v1/{parent=organizations/*}/contacts:contactÚAparent,contactµ + UpdateContact7.google.cloud.essentialcontacts.v1.UpdateContactRequest*.google.cloud.essentialcontacts.v1.Contact"¾‚Óä“¡2(/v1/{contact.name=projects/*/contacts/*}:contactZ22\'/v1/{contact.name=folders/*/contacts/*}:contactZ82-/v1/{contact.name=organizations/*/contacts/*}:contactÚAcontact,update_maskþ + ListContacts6.google.cloud.essentialcontacts.v1.ListContactsRequest7.google.cloud.essentialcontacts.v1.ListContactsResponse"}‚Óä“n /v1/{parent=projects/*}/contactsZ!/v1/{parent=folders/*}/contactsZ\'%/v1/{parent=organizations/*}/contactsÚAparentë + +GetContact4.google.cloud.essentialcontacts.v1.GetContactRequest*.google.cloud.essentialcontacts.v1.Contact"{‚Óä“n /v1/{name=projects/*/contacts/*}Z!/v1/{name=folders/*/contacts/*}Z\'%/v1/{name=organizations/*/contacts/*}ÚAnameÝ + DeleteContact7.google.cloud.essentialcontacts.v1.DeleteContactRequest.google.protobuf.Empty"{‚Óä“n* /v1/{name=projects/*/contacts/*}Z!*/v1/{name=folders/*/contacts/*}Z\'*%/v1/{name=organizations/*/contacts/*}ÚAname˜ +ComputeContacts9.google.cloud.essentialcontacts.v1.ComputeContactsRequest:.google.cloud.essentialcontacts.v1.ComputeContactsResponse"‚Ó䓆(/v1/{parent=projects/*}/contacts:computeZ)\'/v1/{parent=folders/*}/contacts:computeZ/-/v1/{parent=organizations/*}/contacts:compute› +SendTestMessage9.google.cloud.essentialcontacts.v1.SendTestMessageRequest.google.protobuf.Empty"´‚Óä“­"2/v1/{resource=projects/*}/contacts:sendTestMessage:*Z6"1/v1/{resource=folders/*}/contacts:sendTestMessage:*Z<"7/v1/{resource=organizations/*}/contacts:sendTestMessage:*TÊA essentialcontacts.googleapis.comÒA.https://www.googleapis.com/auth/cloud-platformBí +%com.google.cloud.essentialcontacts.v1PZScloud.google.com/go/essentialcontacts/apiv1/essentialcontactspb;essentialcontactspbª!Google.Cloud.EssentialContacts.V1Ê!Google\\Cloud\\EssentialContacts\\V1ê$Google::Cloud::EssentialContacts::V1bproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/owl-bot-staging/EssentialContacts/v1/proto/src/Google/Cloud/EssentialContacts/V1/ComputeContactsRequest.php b/owl-bot-staging/EssentialContacts/v1/proto/src/Google/Cloud/EssentialContacts/V1/ComputeContactsRequest.php new file mode 100644 index 000000000000..a00eed430a0d --- /dev/null +++ b/owl-bot-staging/EssentialContacts/v1/proto/src/Google/Cloud/EssentialContacts/V1/ComputeContactsRequest.php @@ -0,0 +1,209 @@ +google.cloud.essentialcontacts.v1.ComputeContactsRequest + */ +class ComputeContactsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the resource to compute contacts for. + * Format: organizations/{organization_id}, + * folders/{folder_id} or projects/{project_id} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The categories of notifications to compute contacts for. If ALL is included + * in this list, contacts subscribed to any notification category will be + * returned. + * + * Generated from protobuf field repeated .google.cloud.essentialcontacts.v1.NotificationCategory notification_categories = 6; + */ + private $notification_categories; + /** + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. The presence of `next_page_token` in the + * response indicates that more results might be available. + * If not specified, the default page_size is 100. + * + * Generated from protobuf field int32 page_size = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Optional. If present, retrieves the next batch of results from the + * preceding call to this method. `page_token` must be the value of + * `next_page_token` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + * + * Generated from protobuf field string page_token = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The name of the resource to compute contacts for. + * Format: organizations/{organization_id}, + * folders/{folder_id} or projects/{project_id} + * @type array|\Google\Protobuf\Internal\RepeatedField $notification_categories + * The categories of notifications to compute contacts for. If ALL is included + * in this list, contacts subscribed to any notification category will be + * returned. + * @type int $page_size + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. The presence of `next_page_token` in the + * response indicates that more results might be available. + * If not specified, the default page_size is 100. + * @type string $page_token + * Optional. If present, retrieves the next batch of results from the + * preceding call to this method. `page_token` must be the value of + * `next_page_token` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Essentialcontacts\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the resource to compute contacts for. + * Format: organizations/{organization_id}, + * folders/{folder_id} or projects/{project_id} + * + * 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. The name of the resource to compute contacts for. + * Format: organizations/{organization_id}, + * folders/{folder_id} or projects/{project_id} + * + * 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; + } + + /** + * The categories of notifications to compute contacts for. If ALL is included + * in this list, contacts subscribed to any notification category will be + * returned. + * + * Generated from protobuf field repeated .google.cloud.essentialcontacts.v1.NotificationCategory notification_categories = 6; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getNotificationCategories() + { + return $this->notification_categories; + } + + /** + * The categories of notifications to compute contacts for. If ALL is included + * in this list, contacts subscribed to any notification category will be + * returned. + * + * Generated from protobuf field repeated .google.cloud.essentialcontacts.v1.NotificationCategory notification_categories = 6; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setNotificationCategories($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM, \Google\Cloud\EssentialContacts\V1\NotificationCategory::class); + $this->notification_categories = $arr; + + return $this; + } + + /** + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. The presence of `next_page_token` in the + * response indicates that more results might be available. + * If not specified, the default page_size is 100. + * + * Generated from protobuf field int32 page_size = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. The presence of `next_page_token` in the + * response indicates that more results might be available. + * If not specified, the default page_size is 100. + * + * Generated from protobuf field int32 page_size = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * Optional. If present, retrieves the next batch of results from the + * preceding call to this method. `page_token` must be the value of + * `next_page_token` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + * + * Generated from protobuf field string page_token = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. If present, retrieves the next batch of results from the + * preceding call to this method. `page_token` must be the value of + * `next_page_token` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + * + * Generated from protobuf field string page_token = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/EssentialContacts/v1/proto/src/Google/Cloud/EssentialContacts/V1/ComputeContactsResponse.php b/owl-bot-staging/EssentialContacts/v1/proto/src/Google/Cloud/EssentialContacts/V1/ComputeContactsResponse.php new file mode 100644 index 000000000000..3bd97e666fdd --- /dev/null +++ b/owl-bot-staging/EssentialContacts/v1/proto/src/Google/Cloud/EssentialContacts/V1/ComputeContactsResponse.php @@ -0,0 +1,121 @@ +google.cloud.essentialcontacts.v1.ComputeContactsResponse + */ +class ComputeContactsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * All contacts for the resource that are subscribed to the specified + * notification categories, including contacts inherited from any parent + * resources. + * + * Generated from protobuf field repeated .google.cloud.essentialcontacts.v1.Contact contacts = 1; + */ + private $contacts; + /** + * If there are more results than those appearing in this response, then + * `next_page_token` is included. To get the next set of results, call this + * method again using the value of `next_page_token` as `page_token` and the + * rest of the parameters the same as the original request. + * + * 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\EssentialContacts\V1\Contact>|\Google\Protobuf\Internal\RepeatedField $contacts + * All contacts for the resource that are subscribed to the specified + * notification categories, including contacts inherited from any parent + * resources. + * @type string $next_page_token + * If there are more results than those appearing in this response, then + * `next_page_token` is included. To get the next set of results, call this + * method again using the value of `next_page_token` as `page_token` and the + * rest of the parameters the same as the original request. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Essentialcontacts\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * All contacts for the resource that are subscribed to the specified + * notification categories, including contacts inherited from any parent + * resources. + * + * Generated from protobuf field repeated .google.cloud.essentialcontacts.v1.Contact contacts = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getContacts() + { + return $this->contacts; + } + + /** + * All contacts for the resource that are subscribed to the specified + * notification categories, including contacts inherited from any parent + * resources. + * + * Generated from protobuf field repeated .google.cloud.essentialcontacts.v1.Contact contacts = 1; + * @param array<\Google\Cloud\EssentialContacts\V1\Contact>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setContacts($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\EssentialContacts\V1\Contact::class); + $this->contacts = $arr; + + return $this; + } + + /** + * If there are more results than those appearing in this response, then + * `next_page_token` is included. To get the next set of results, call this + * method again using the value of `next_page_token` as `page_token` and the + * rest of the parameters the same as the original request. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * If there are more results than those appearing in this response, then + * `next_page_token` is included. To get the next set of results, call this + * method again using the value of `next_page_token` as `page_token` and the + * rest of the parameters the same as the original request. + * + * 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/EssentialContacts/v1/proto/src/Google/Cloud/EssentialContacts/V1/Contact.php b/owl-bot-staging/EssentialContacts/v1/proto/src/Google/Cloud/EssentialContacts/V1/Contact.php new file mode 100644 index 000000000000..895ee5d8e570 --- /dev/null +++ b/owl-bot-staging/EssentialContacts/v1/proto/src/Google/Cloud/EssentialContacts/V1/Contact.php @@ -0,0 +1,283 @@ +google.cloud.essentialcontacts.v1.Contact + */ +class Contact extends \Google\Protobuf\Internal\Message +{ + /** + * The identifier for the contact. + * Format: {resource_type}/{resource_id}/contacts/{contact_id} + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * Required. The email address to send notifications to. This does not need to + * be a Google account. + * + * Generated from protobuf field string email = 2; + */ + protected $email = ''; + /** + * The categories of notifications that the contact will receive + * communications for. + * + * Generated from protobuf field repeated .google.cloud.essentialcontacts.v1.NotificationCategory notification_category_subscriptions = 3; + */ + private $notification_category_subscriptions; + /** + * The preferred language for notifications, as a ISO 639-1 language code. See + * [Supported + * languages](https://cloud.google.com/resource-manager/docs/managing-notification-contacts#supported-languages) + * for a list of supported languages. + * + * Generated from protobuf field string language_tag = 4; + */ + protected $language_tag = ''; + /** + * The validity of the contact. A contact is considered valid if it is the + * correct recipient for notifications for a particular resource. + * + * Generated from protobuf field .google.cloud.essentialcontacts.v1.ValidationState validation_state = 8; + */ + protected $validation_state = 0; + /** + * The last time the validation_state was updated, either manually or + * automatically. A contact is considered stale if its validation state was + * updated more than 1 year ago. + * + * Generated from protobuf field .google.protobuf.Timestamp validate_time = 9; + */ + protected $validate_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The identifier for the contact. + * Format: {resource_type}/{resource_id}/contacts/{contact_id} + * @type string $email + * Required. The email address to send notifications to. This does not need to + * be a Google account. + * @type array|\Google\Protobuf\Internal\RepeatedField $notification_category_subscriptions + * The categories of notifications that the contact will receive + * communications for. + * @type string $language_tag + * The preferred language for notifications, as a ISO 639-1 language code. See + * [Supported + * languages](https://cloud.google.com/resource-manager/docs/managing-notification-contacts#supported-languages) + * for a list of supported languages. + * @type int $validation_state + * The validity of the contact. A contact is considered valid if it is the + * correct recipient for notifications for a particular resource. + * @type \Google\Protobuf\Timestamp $validate_time + * The last time the validation_state was updated, either manually or + * automatically. A contact is considered stale if its validation state was + * updated more than 1 year ago. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Essentialcontacts\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * The identifier for the contact. + * Format: {resource_type}/{resource_id}/contacts/{contact_id} + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The identifier for the contact. + * Format: {resource_type}/{resource_id}/contacts/{contact_id} + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Required. The email address to send notifications to. This does not need to + * be a Google account. + * + * Generated from protobuf field string email = 2; + * @return string + */ + public function getEmail() + { + return $this->email; + } + + /** + * Required. The email address to send notifications to. This does not need to + * be a Google account. + * + * Generated from protobuf field string email = 2; + * @param string $var + * @return $this + */ + public function setEmail($var) + { + GPBUtil::checkString($var, True); + $this->email = $var; + + return $this; + } + + /** + * The categories of notifications that the contact will receive + * communications for. + * + * Generated from protobuf field repeated .google.cloud.essentialcontacts.v1.NotificationCategory notification_category_subscriptions = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getNotificationCategorySubscriptions() + { + return $this->notification_category_subscriptions; + } + + /** + * The categories of notifications that the contact will receive + * communications for. + * + * Generated from protobuf field repeated .google.cloud.essentialcontacts.v1.NotificationCategory notification_category_subscriptions = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setNotificationCategorySubscriptions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM, \Google\Cloud\EssentialContacts\V1\NotificationCategory::class); + $this->notification_category_subscriptions = $arr; + + return $this; + } + + /** + * The preferred language for notifications, as a ISO 639-1 language code. See + * [Supported + * languages](https://cloud.google.com/resource-manager/docs/managing-notification-contacts#supported-languages) + * for a list of supported languages. + * + * Generated from protobuf field string language_tag = 4; + * @return string + */ + public function getLanguageTag() + { + return $this->language_tag; + } + + /** + * The preferred language for notifications, as a ISO 639-1 language code. See + * [Supported + * languages](https://cloud.google.com/resource-manager/docs/managing-notification-contacts#supported-languages) + * for a list of supported languages. + * + * Generated from protobuf field string language_tag = 4; + * @param string $var + * @return $this + */ + public function setLanguageTag($var) + { + GPBUtil::checkString($var, True); + $this->language_tag = $var; + + return $this; + } + + /** + * The validity of the contact. A contact is considered valid if it is the + * correct recipient for notifications for a particular resource. + * + * Generated from protobuf field .google.cloud.essentialcontacts.v1.ValidationState validation_state = 8; + * @return int + */ + public function getValidationState() + { + return $this->validation_state; + } + + /** + * The validity of the contact. A contact is considered valid if it is the + * correct recipient for notifications for a particular resource. + * + * Generated from protobuf field .google.cloud.essentialcontacts.v1.ValidationState validation_state = 8; + * @param int $var + * @return $this + */ + public function setValidationState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\EssentialContacts\V1\ValidationState::class); + $this->validation_state = $var; + + return $this; + } + + /** + * The last time the validation_state was updated, either manually or + * automatically. A contact is considered stale if its validation state was + * updated more than 1 year ago. + * + * Generated from protobuf field .google.protobuf.Timestamp validate_time = 9; + * @return \Google\Protobuf\Timestamp|null + */ + public function getValidateTime() + { + return $this->validate_time; + } + + public function hasValidateTime() + { + return isset($this->validate_time); + } + + public function clearValidateTime() + { + unset($this->validate_time); + } + + /** + * The last time the validation_state was updated, either manually or + * automatically. A contact is considered stale if its validation state was + * updated more than 1 year ago. + * + * Generated from protobuf field .google.protobuf.Timestamp validate_time = 9; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setValidateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->validate_time = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/EssentialContacts/v1/proto/src/Google/Cloud/EssentialContacts/V1/CreateContactRequest.php b/owl-bot-staging/EssentialContacts/v1/proto/src/Google/Cloud/EssentialContacts/V1/CreateContactRequest.php new file mode 100644 index 000000000000..aa04a1644f45 --- /dev/null +++ b/owl-bot-staging/EssentialContacts/v1/proto/src/Google/Cloud/EssentialContacts/V1/CreateContactRequest.php @@ -0,0 +1,142 @@ +google.cloud.essentialcontacts.v1.CreateContactRequest + */ +class CreateContactRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource to save this contact for. + * Format: organizations/{organization_id}, folders/{folder_id} or + * projects/{project_id} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The contact to create. Must specify an email address and language + * tag. + * + * Generated from protobuf field .google.cloud.essentialcontacts.v1.Contact contact = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $contact = null; + + /** + * @param string $parent Required. The resource to save this contact for. + * Format: organizations/{organization_id}, folders/{folder_id} or + * projects/{project_id} + * Please see {@see EssentialContactsServiceClient::projectName()} for help formatting this field. + * @param \Google\Cloud\EssentialContacts\V1\Contact $contact Required. The contact to create. Must specify an email address and language + * tag. + * + * @return \Google\Cloud\EssentialContacts\V1\CreateContactRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\EssentialContacts\V1\Contact $contact): self + { + return (new self()) + ->setParent($parent) + ->setContact($contact); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The resource to save this contact for. + * Format: organizations/{organization_id}, folders/{folder_id} or + * projects/{project_id} + * @type \Google\Cloud\EssentialContacts\V1\Contact $contact + * Required. The contact to create. Must specify an email address and language + * tag. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Essentialcontacts\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource to save this contact for. + * Format: organizations/{organization_id}, folders/{folder_id} or + * projects/{project_id} + * + * 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. The resource to save this contact for. + * Format: organizations/{organization_id}, folders/{folder_id} or + * projects/{project_id} + * + * 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. The contact to create. Must specify an email address and language + * tag. + * + * Generated from protobuf field .google.cloud.essentialcontacts.v1.Contact contact = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\EssentialContacts\V1\Contact|null + */ + public function getContact() + { + return $this->contact; + } + + public function hasContact() + { + return isset($this->contact); + } + + public function clearContact() + { + unset($this->contact); + } + + /** + * Required. The contact to create. Must specify an email address and language + * tag. + * + * Generated from protobuf field .google.cloud.essentialcontacts.v1.Contact contact = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\EssentialContacts\V1\Contact $var + * @return $this + */ + public function setContact($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\EssentialContacts\V1\Contact::class); + $this->contact = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/EssentialContacts/v1/proto/src/Google/Cloud/EssentialContacts/V1/DeleteContactRequest.php b/owl-bot-staging/EssentialContacts/v1/proto/src/Google/Cloud/EssentialContacts/V1/DeleteContactRequest.php new file mode 100644 index 000000000000..f07753c9588d --- /dev/null +++ b/owl-bot-staging/EssentialContacts/v1/proto/src/Google/Cloud/EssentialContacts/V1/DeleteContactRequest.php @@ -0,0 +1,96 @@ +google.cloud.essentialcontacts.v1.DeleteContactRequest + */ +class DeleteContactRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the contact to delete. + * Format: organizations/{organization_id}/contacts/{contact_id}, + * folders/{folder_id}/contacts/{contact_id} or + * projects/{project_id}/contacts/{contact_id} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The name of the contact to delete. + * Format: organizations/{organization_id}/contacts/{contact_id}, + * folders/{folder_id}/contacts/{contact_id} or + * projects/{project_id}/contacts/{contact_id} + * Please see {@see EssentialContactsServiceClient::contactName()} for help formatting this field. + * + * @return \Google\Cloud\EssentialContacts\V1\DeleteContactRequest + * + * @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 contact to delete. + * Format: organizations/{organization_id}/contacts/{contact_id}, + * folders/{folder_id}/contacts/{contact_id} or + * projects/{project_id}/contacts/{contact_id} + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Essentialcontacts\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the contact to delete. + * Format: organizations/{organization_id}/contacts/{contact_id}, + * folders/{folder_id}/contacts/{contact_id} or + * projects/{project_id}/contacts/{contact_id} + * + * 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 contact to delete. + * Format: organizations/{organization_id}/contacts/{contact_id}, + * folders/{folder_id}/contacts/{contact_id} or + * projects/{project_id}/contacts/{contact_id} + * + * 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; + } + +} + diff --git a/owl-bot-staging/EssentialContacts/v1/proto/src/Google/Cloud/EssentialContacts/V1/EssentialContactsServiceGrpcClient.php b/owl-bot-staging/EssentialContacts/v1/proto/src/Google/Cloud/EssentialContacts/V1/EssentialContactsServiceGrpcClient.php new file mode 100644 index 000000000000..9f4d2da086dc --- /dev/null +++ b/owl-bot-staging/EssentialContacts/v1/proto/src/Google/Cloud/EssentialContacts/V1/EssentialContactsServiceGrpcClient.php @@ -0,0 +1,144 @@ +_simpleRequest('/google.cloud.essentialcontacts.v1.EssentialContactsService/CreateContact', + $argument, + ['\Google\Cloud\EssentialContacts\V1\Contact', 'decode'], + $metadata, $options); + } + + /** + * Updates a contact. + * Note: A contact's email address cannot be changed. + * @param \Google\Cloud\EssentialContacts\V1\UpdateContactRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function UpdateContact(\Google\Cloud\EssentialContacts\V1\UpdateContactRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.essentialcontacts.v1.EssentialContactsService/UpdateContact', + $argument, + ['\Google\Cloud\EssentialContacts\V1\Contact', 'decode'], + $metadata, $options); + } + + /** + * Lists the contacts that have been set on a resource. + * @param \Google\Cloud\EssentialContacts\V1\ListContactsRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function ListContacts(\Google\Cloud\EssentialContacts\V1\ListContactsRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.essentialcontacts.v1.EssentialContactsService/ListContacts', + $argument, + ['\Google\Cloud\EssentialContacts\V1\ListContactsResponse', 'decode'], + $metadata, $options); + } + + /** + * Gets a single contact. + * @param \Google\Cloud\EssentialContacts\V1\GetContactRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function GetContact(\Google\Cloud\EssentialContacts\V1\GetContactRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.essentialcontacts.v1.EssentialContactsService/GetContact', + $argument, + ['\Google\Cloud\EssentialContacts\V1\Contact', 'decode'], + $metadata, $options); + } + + /** + * Deletes a contact. + * @param \Google\Cloud\EssentialContacts\V1\DeleteContactRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function DeleteContact(\Google\Cloud\EssentialContacts\V1\DeleteContactRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.essentialcontacts.v1.EssentialContactsService/DeleteContact', + $argument, + ['\Google\Protobuf\GPBEmpty', 'decode'], + $metadata, $options); + } + + /** + * Lists all contacts for the resource that are subscribed to the + * specified notification categories, including contacts inherited from + * any parent resources. + * @param \Google\Cloud\EssentialContacts\V1\ComputeContactsRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function ComputeContacts(\Google\Cloud\EssentialContacts\V1\ComputeContactsRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.essentialcontacts.v1.EssentialContactsService/ComputeContacts', + $argument, + ['\Google\Cloud\EssentialContacts\V1\ComputeContactsResponse', 'decode'], + $metadata, $options); + } + + /** + * Allows a contact admin to send a test message to contact to verify that it + * has been configured correctly. + * @param \Google\Cloud\EssentialContacts\V1\SendTestMessageRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function SendTestMessage(\Google\Cloud\EssentialContacts\V1\SendTestMessageRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.essentialcontacts.v1.EssentialContactsService/SendTestMessage', + $argument, + ['\Google\Protobuf\GPBEmpty', 'decode'], + $metadata, $options); + } + +} diff --git a/owl-bot-staging/EssentialContacts/v1/proto/src/Google/Cloud/EssentialContacts/V1/GetContactRequest.php b/owl-bot-staging/EssentialContacts/v1/proto/src/Google/Cloud/EssentialContacts/V1/GetContactRequest.php new file mode 100644 index 000000000000..dbdbff500ad2 --- /dev/null +++ b/owl-bot-staging/EssentialContacts/v1/proto/src/Google/Cloud/EssentialContacts/V1/GetContactRequest.php @@ -0,0 +1,96 @@ +google.cloud.essentialcontacts.v1.GetContactRequest + */ +class GetContactRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the contact to retrieve. + * Format: organizations/{organization_id}/contacts/{contact_id}, + * folders/{folder_id}/contacts/{contact_id} or + * projects/{project_id}/contacts/{contact_id} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The name of the contact to retrieve. + * Format: organizations/{organization_id}/contacts/{contact_id}, + * folders/{folder_id}/contacts/{contact_id} or + * projects/{project_id}/contacts/{contact_id} + * Please see {@see EssentialContactsServiceClient::contactName()} for help formatting this field. + * + * @return \Google\Cloud\EssentialContacts\V1\GetContactRequest + * + * @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 contact to retrieve. + * Format: organizations/{organization_id}/contacts/{contact_id}, + * folders/{folder_id}/contacts/{contact_id} or + * projects/{project_id}/contacts/{contact_id} + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Essentialcontacts\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the contact to retrieve. + * Format: organizations/{organization_id}/contacts/{contact_id}, + * folders/{folder_id}/contacts/{contact_id} or + * projects/{project_id}/contacts/{contact_id} + * + * 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 contact to retrieve. + * Format: organizations/{organization_id}/contacts/{contact_id}, + * folders/{folder_id}/contacts/{contact_id} or + * projects/{project_id}/contacts/{contact_id} + * + * 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; + } + +} + diff --git a/owl-bot-staging/EssentialContacts/v1/proto/src/Google/Cloud/EssentialContacts/V1/ListContactsRequest.php b/owl-bot-staging/EssentialContacts/v1/proto/src/Google/Cloud/EssentialContacts/V1/ListContactsRequest.php new file mode 100644 index 000000000000..4cb6c56e7bb4 --- /dev/null +++ b/owl-bot-staging/EssentialContacts/v1/proto/src/Google/Cloud/EssentialContacts/V1/ListContactsRequest.php @@ -0,0 +1,183 @@ +google.cloud.essentialcontacts.v1.ListContactsRequest + */ +class ListContactsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent resource name. + * Format: organizations/{organization_id}, folders/{folder_id} or + * projects/{project_id} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. The presence of `next_page_token` in the + * response indicates that more results might be available. + * If not specified, the default page_size is 100. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Optional. If present, retrieves the next batch of results from the + * preceding call to this method. `page_token` must be the value of + * `next_page_token` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = ''; + + /** + * @param string $parent Required. The parent resource name. + * Format: organizations/{organization_id}, folders/{folder_id} or + * projects/{project_id} + * Please see {@see EssentialContactsServiceClient::projectName()} for help formatting this field. + * + * @return \Google\Cloud\EssentialContacts\V1\ListContactsRequest + * + * @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. The parent resource name. + * Format: organizations/{organization_id}, folders/{folder_id} or + * projects/{project_id} + * @type int $page_size + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. The presence of `next_page_token` in the + * response indicates that more results might be available. + * If not specified, the default page_size is 100. + * @type string $page_token + * Optional. If present, retrieves the next batch of results from the + * preceding call to this method. `page_token` must be the value of + * `next_page_token` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Essentialcontacts\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent resource name. + * Format: organizations/{organization_id}, folders/{folder_id} or + * projects/{project_id} + * + * 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. The parent resource name. + * Format: organizations/{organization_id}, folders/{folder_id} or + * projects/{project_id} + * + * 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. The maximum number of results to return from this request. + * Non-positive values are ignored. The presence of `next_page_token` in the + * response indicates that more results might be available. + * If not specified, the default page_size is 100. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. The presence of `next_page_token` in the + * response indicates that more results might be available. + * If not specified, the default page_size is 100. + * + * 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. If present, retrieves the next batch of results from the + * preceding call to this method. `page_token` must be the value of + * `next_page_token` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. If present, retrieves the next batch of results from the + * preceding call to this method. `page_token` must be the value of + * `next_page_token` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + * + * 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; + } + +} + diff --git a/owl-bot-staging/EssentialContacts/v1/proto/src/Google/Cloud/EssentialContacts/V1/ListContactsResponse.php b/owl-bot-staging/EssentialContacts/v1/proto/src/Google/Cloud/EssentialContacts/V1/ListContactsResponse.php new file mode 100644 index 000000000000..7d094531e0d4 --- /dev/null +++ b/owl-bot-staging/EssentialContacts/v1/proto/src/Google/Cloud/EssentialContacts/V1/ListContactsResponse.php @@ -0,0 +1,113 @@ +google.cloud.essentialcontacts.v1.ListContactsResponse + */ +class ListContactsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The contacts for the specified resource. + * + * Generated from protobuf field repeated .google.cloud.essentialcontacts.v1.Contact contacts = 1; + */ + private $contacts; + /** + * If there are more results than those appearing in this response, then + * `next_page_token` is included. To get the next set of results, call this + * method again using the value of `next_page_token` as `page_token` and the + * rest of the parameters the same as the original request. + * + * 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\EssentialContacts\V1\Contact>|\Google\Protobuf\Internal\RepeatedField $contacts + * The contacts for the specified resource. + * @type string $next_page_token + * If there are more results than those appearing in this response, then + * `next_page_token` is included. To get the next set of results, call this + * method again using the value of `next_page_token` as `page_token` and the + * rest of the parameters the same as the original request. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Essentialcontacts\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * The contacts for the specified resource. + * + * Generated from protobuf field repeated .google.cloud.essentialcontacts.v1.Contact contacts = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getContacts() + { + return $this->contacts; + } + + /** + * The contacts for the specified resource. + * + * Generated from protobuf field repeated .google.cloud.essentialcontacts.v1.Contact contacts = 1; + * @param array<\Google\Cloud\EssentialContacts\V1\Contact>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setContacts($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\EssentialContacts\V1\Contact::class); + $this->contacts = $arr; + + return $this; + } + + /** + * If there are more results than those appearing in this response, then + * `next_page_token` is included. To get the next set of results, call this + * method again using the value of `next_page_token` as `page_token` and the + * rest of the parameters the same as the original request. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * If there are more results than those appearing in this response, then + * `next_page_token` is included. To get the next set of results, call this + * method again using the value of `next_page_token` as `page_token` and the + * rest of the parameters the same as the original request. + * + * 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/EssentialContacts/v1/proto/src/Google/Cloud/EssentialContacts/V1/NotificationCategory.php b/owl-bot-staging/EssentialContacts/v1/proto/src/Google/Cloud/EssentialContacts/V1/NotificationCategory.php new file mode 100644 index 000000000000..4839f5697d55 --- /dev/null +++ b/owl-bot-staging/EssentialContacts/v1/proto/src/Google/Cloud/EssentialContacts/V1/NotificationCategory.php @@ -0,0 +1,113 @@ +google.cloud.essentialcontacts.v1.NotificationCategory + */ +class NotificationCategory +{ + /** + * Notification category is unrecognized or unspecified. + * + * Generated from protobuf enum NOTIFICATION_CATEGORY_UNSPECIFIED = 0; + */ + const NOTIFICATION_CATEGORY_UNSPECIFIED = 0; + /** + * All notifications related to the resource, including notifications + * pertaining to categories added in the future. + * + * Generated from protobuf enum ALL = 2; + */ + const ALL = 2; + /** + * Notifications related to imminent account suspension. + * + * Generated from protobuf enum SUSPENSION = 3; + */ + const SUSPENSION = 3; + /** + * Notifications related to security/privacy incidents, notifications, and + * vulnerabilities. + * + * Generated from protobuf enum SECURITY = 5; + */ + const SECURITY = 5; + /** + * Notifications related to technical events and issues such as outages, + * errors, or bugs. + * + * Generated from protobuf enum TECHNICAL = 6; + */ + const TECHNICAL = 6; + /** + * Notifications related to billing and payments notifications, price updates, + * errors, or credits. + * + * Generated from protobuf enum BILLING = 7; + */ + const BILLING = 7; + /** + * Notifications related to enforcement actions, regulatory compliance, or + * government notices. + * + * Generated from protobuf enum LEGAL = 8; + */ + const LEGAL = 8; + /** + * Notifications related to new versions, product terms updates, or + * deprecations. + * + * Generated from protobuf enum PRODUCT_UPDATES = 9; + */ + const PRODUCT_UPDATES = 9; + /** + * Child category of TECHNICAL. If assigned, technical incident notifications + * will go to these contacts instead of TECHNICAL. + * + * Generated from protobuf enum TECHNICAL_INCIDENTS = 10; + */ + const TECHNICAL_INCIDENTS = 10; + + private static $valueToName = [ + self::NOTIFICATION_CATEGORY_UNSPECIFIED => 'NOTIFICATION_CATEGORY_UNSPECIFIED', + self::ALL => 'ALL', + self::SUSPENSION => 'SUSPENSION', + self::SECURITY => 'SECURITY', + self::TECHNICAL => 'TECHNICAL', + self::BILLING => 'BILLING', + self::LEGAL => 'LEGAL', + self::PRODUCT_UPDATES => 'PRODUCT_UPDATES', + self::TECHNICAL_INCIDENTS => 'TECHNICAL_INCIDENTS', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/owl-bot-staging/EssentialContacts/v1/proto/src/Google/Cloud/EssentialContacts/V1/SendTestMessageRequest.php b/owl-bot-staging/EssentialContacts/v1/proto/src/Google/Cloud/EssentialContacts/V1/SendTestMessageRequest.php new file mode 100644 index 000000000000..e756f41f0c33 --- /dev/null +++ b/owl-bot-staging/EssentialContacts/v1/proto/src/Google/Cloud/EssentialContacts/V1/SendTestMessageRequest.php @@ -0,0 +1,167 @@ +google.cloud.essentialcontacts.v1.SendTestMessageRequest + */ +class SendTestMessageRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The list of names of the contacts to send a test message to. + * Format: organizations/{organization_id}/contacts/{contact_id}, + * folders/{folder_id}/contacts/{contact_id} or + * projects/{project_id}/contacts/{contact_id} + * + * Generated from protobuf field repeated string contacts = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + private $contacts; + /** + * Required. The name of the resource to send the test message for. All + * contacts must either be set directly on this resource or inherited from + * another resource that is an ancestor of this one. Format: + * organizations/{organization_id}, folders/{folder_id} or + * projects/{project_id} + * + * Generated from protobuf field string resource = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $resource = ''; + /** + * Required. The notification category to send the test message for. All + * contacts must be subscribed to this category. + * + * Generated from protobuf field .google.cloud.essentialcontacts.v1.NotificationCategory notification_category = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $notification_category = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $contacts + * Required. The list of names of the contacts to send a test message to. + * Format: organizations/{organization_id}/contacts/{contact_id}, + * folders/{folder_id}/contacts/{contact_id} or + * projects/{project_id}/contacts/{contact_id} + * @type string $resource + * Required. The name of the resource to send the test message for. All + * contacts must either be set directly on this resource or inherited from + * another resource that is an ancestor of this one. Format: + * organizations/{organization_id}, folders/{folder_id} or + * projects/{project_id} + * @type int $notification_category + * Required. The notification category to send the test message for. All + * contacts must be subscribed to this category. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Essentialcontacts\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. The list of names of the contacts to send a test message to. + * Format: organizations/{organization_id}/contacts/{contact_id}, + * folders/{folder_id}/contacts/{contact_id} or + * projects/{project_id}/contacts/{contact_id} + * + * Generated from protobuf field repeated string contacts = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getContacts() + { + return $this->contacts; + } + + /** + * Required. The list of names of the contacts to send a test message to. + * Format: organizations/{organization_id}/contacts/{contact_id}, + * folders/{folder_id}/contacts/{contact_id} or + * projects/{project_id}/contacts/{contact_id} + * + * Generated from protobuf field repeated string contacts = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setContacts($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->contacts = $arr; + + return $this; + } + + /** + * Required. The name of the resource to send the test message for. All + * contacts must either be set directly on this resource or inherited from + * another resource that is an ancestor of this one. Format: + * organizations/{organization_id}, folders/{folder_id} or + * projects/{project_id} + * + * Generated from protobuf field string resource = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getResource() + { + return $this->resource; + } + + /** + * Required. The name of the resource to send the test message for. All + * contacts must either be set directly on this resource or inherited from + * another resource that is an ancestor of this one. Format: + * organizations/{organization_id}, folders/{folder_id} or + * projects/{project_id} + * + * Generated from protobuf field string resource = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setResource($var) + { + GPBUtil::checkString($var, True); + $this->resource = $var; + + return $this; + } + + /** + * Required. The notification category to send the test message for. All + * contacts must be subscribed to this category. + * + * Generated from protobuf field .google.cloud.essentialcontacts.v1.NotificationCategory notification_category = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getNotificationCategory() + { + return $this->notification_category; + } + + /** + * Required. The notification category to send the test message for. All + * contacts must be subscribed to this category. + * + * Generated from protobuf field .google.cloud.essentialcontacts.v1.NotificationCategory notification_category = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setNotificationCategory($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\EssentialContacts\V1\NotificationCategory::class); + $this->notification_category = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/EssentialContacts/v1/proto/src/Google/Cloud/EssentialContacts/V1/UpdateContactRequest.php b/owl-bot-staging/EssentialContacts/v1/proto/src/Google/Cloud/EssentialContacts/V1/UpdateContactRequest.php new file mode 100644 index 000000000000..33f95f31b4a2 --- /dev/null +++ b/owl-bot-staging/EssentialContacts/v1/proto/src/Google/Cloud/EssentialContacts/V1/UpdateContactRequest.php @@ -0,0 +1,151 @@ +google.cloud.essentialcontacts.v1.UpdateContactRequest + */ +class UpdateContactRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The contact resource to replace the existing saved contact. Note: + * the email address of the contact cannot be modified. + * + * Generated from protobuf field .google.cloud.essentialcontacts.v1.Contact contact = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $contact = null; + /** + * Optional. The update mask applied to the resource. For the `FieldMask` + * definition, see + * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $update_mask = null; + + /** + * @param \Google\Cloud\EssentialContacts\V1\Contact $contact Required. The contact resource to replace the existing saved contact. Note: + * the email address of the contact cannot be modified. + * @param \Google\Protobuf\FieldMask $updateMask Optional. The update mask applied to the resource. For the `FieldMask` + * definition, see + * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + * + * @return \Google\Cloud\EssentialContacts\V1\UpdateContactRequest + * + * @experimental + */ + public static function build(\Google\Cloud\EssentialContacts\V1\Contact $contact, \Google\Protobuf\FieldMask $updateMask): self + { + return (new self()) + ->setContact($contact) + ->setUpdateMask($updateMask); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\EssentialContacts\V1\Contact $contact + * Required. The contact resource to replace the existing saved contact. Note: + * the email address of the contact cannot be modified. + * @type \Google\Protobuf\FieldMask $update_mask + * Optional. The update mask applied to the resource. For the `FieldMask` + * definition, see + * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Essentialcontacts\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. The contact resource to replace the existing saved contact. Note: + * the email address of the contact cannot be modified. + * + * Generated from protobuf field .google.cloud.essentialcontacts.v1.Contact contact = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\EssentialContacts\V1\Contact|null + */ + public function getContact() + { + return $this->contact; + } + + public function hasContact() + { + return isset($this->contact); + } + + public function clearContact() + { + unset($this->contact); + } + + /** + * Required. The contact resource to replace the existing saved contact. Note: + * the email address of the contact cannot be modified. + * + * Generated from protobuf field .google.cloud.essentialcontacts.v1.Contact contact = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\EssentialContacts\V1\Contact $var + * @return $this + */ + public function setContact($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\EssentialContacts\V1\Contact::class); + $this->contact = $var; + + return $this; + } + + /** + * Optional. The update mask applied to the resource. For the `FieldMask` + * definition, see + * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Optional. The update mask applied to the resource. For the `FieldMask` + * definition, see + * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/EssentialContacts/v1/proto/src/Google/Cloud/EssentialContacts/V1/ValidationState.php b/owl-bot-staging/EssentialContacts/v1/proto/src/Google/Cloud/EssentialContacts/V1/ValidationState.php new file mode 100644 index 000000000000..d1085febe567 --- /dev/null +++ b/owl-bot-staging/EssentialContacts/v1/proto/src/Google/Cloud/EssentialContacts/V1/ValidationState.php @@ -0,0 +1,64 @@ +google.cloud.essentialcontacts.v1.ValidationState + */ +class ValidationState +{ + /** + * The validation state is unknown or unspecified. + * + * Generated from protobuf enum VALIDATION_STATE_UNSPECIFIED = 0; + */ + const VALIDATION_STATE_UNSPECIFIED = 0; + /** + * The contact is marked as valid. This is usually done manually by the + * contact admin. All new contacts begin in the valid state. + * + * Generated from protobuf enum VALID = 1; + */ + const VALID = 1; + /** + * The contact is considered invalid. This may become the state if the + * contact's email is found to be unreachable. + * + * Generated from protobuf enum INVALID = 2; + */ + const INVALID = 2; + + private static $valueToName = [ + self::VALIDATION_STATE_UNSPECIFIED => 'VALIDATION_STATE_UNSPECIFIED', + self::VALID => 'VALID', + self::INVALID => 'INVALID', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/owl-bot-staging/EssentialContacts/v1/samples/V1/EssentialContactsServiceClient/compute_contacts.php b/owl-bot-staging/EssentialContacts/v1/samples/V1/EssentialContactsServiceClient/compute_contacts.php new file mode 100644 index 000000000000..dd83dfdc6419 --- /dev/null +++ b/owl-bot-staging/EssentialContacts/v1/samples/V1/EssentialContactsServiceClient/compute_contacts.php @@ -0,0 +1,80 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $essentialContactsServiceClient->computeContacts($request); + + /** @var Contact $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 = EssentialContactsServiceClient::projectName('[PROJECT]'); + + compute_contacts_sample($formattedParent); +} +// [END essentialcontacts_v1_generated_EssentialContactsService_ComputeContacts_sync] diff --git a/owl-bot-staging/EssentialContacts/v1/samples/V1/EssentialContactsServiceClient/create_contact.php b/owl-bot-staging/EssentialContacts/v1/samples/V1/EssentialContactsServiceClient/create_contact.php new file mode 100644 index 000000000000..652bf6b0f2d2 --- /dev/null +++ b/owl-bot-staging/EssentialContacts/v1/samples/V1/EssentialContactsServiceClient/create_contact.php @@ -0,0 +1,75 @@ +setParent($formattedParent) + ->setContact($contact); + + // Call the API and handle any network failures. + try { + /** @var Contact $response */ + $response = $essentialContactsServiceClient->createContact($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 = EssentialContactsServiceClient::projectName('[PROJECT]'); + + create_contact_sample($formattedParent); +} +// [END essentialcontacts_v1_generated_EssentialContactsService_CreateContact_sync] diff --git a/owl-bot-staging/EssentialContacts/v1/samples/V1/EssentialContactsServiceClient/delete_contact.php b/owl-bot-staging/EssentialContacts/v1/samples/V1/EssentialContactsServiceClient/delete_contact.php new file mode 100644 index 000000000000..d8e7317ad6b1 --- /dev/null +++ b/owl-bot-staging/EssentialContacts/v1/samples/V1/EssentialContactsServiceClient/delete_contact.php @@ -0,0 +1,72 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + $essentialContactsServiceClient->deleteContact($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 = EssentialContactsServiceClient::contactName('[PROJECT]', '[CONTACT]'); + + delete_contact_sample($formattedName); +} +// [END essentialcontacts_v1_generated_EssentialContactsService_DeleteContact_sync] diff --git a/owl-bot-staging/EssentialContacts/v1/samples/V1/EssentialContactsServiceClient/get_contact.php b/owl-bot-staging/EssentialContacts/v1/samples/V1/EssentialContactsServiceClient/get_contact.php new file mode 100644 index 000000000000..e457a3a8ea03 --- /dev/null +++ b/owl-bot-staging/EssentialContacts/v1/samples/V1/EssentialContactsServiceClient/get_contact.php @@ -0,0 +1,74 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var Contact $response */ + $response = $essentialContactsServiceClient->getContact($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 = EssentialContactsServiceClient::contactName('[PROJECT]', '[CONTACT]'); + + get_contact_sample($formattedName); +} +// [END essentialcontacts_v1_generated_EssentialContactsService_GetContact_sync] diff --git a/owl-bot-staging/EssentialContacts/v1/samples/V1/EssentialContactsServiceClient/list_contacts.php b/owl-bot-staging/EssentialContacts/v1/samples/V1/EssentialContactsServiceClient/list_contacts.php new file mode 100644 index 000000000000..5e65c6d7198a --- /dev/null +++ b/owl-bot-staging/EssentialContacts/v1/samples/V1/EssentialContactsServiceClient/list_contacts.php @@ -0,0 +1,78 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $essentialContactsServiceClient->listContacts($request); + + /** @var Contact $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 = EssentialContactsServiceClient::projectName('[PROJECT]'); + + list_contacts_sample($formattedParent); +} +// [END essentialcontacts_v1_generated_EssentialContactsService_ListContacts_sync] diff --git a/owl-bot-staging/EssentialContacts/v1/samples/V1/EssentialContactsServiceClient/send_test_message.php b/owl-bot-staging/EssentialContacts/v1/samples/V1/EssentialContactsServiceClient/send_test_message.php new file mode 100644 index 000000000000..187f0fad033c --- /dev/null +++ b/owl-bot-staging/EssentialContacts/v1/samples/V1/EssentialContactsServiceClient/send_test_message.php @@ -0,0 +1,90 @@ +setContacts($formattedContacts) + ->setResource($formattedResource) + ->setNotificationCategory($notificationCategory); + + // Call the API and handle any network failures. + try { + $essentialContactsServiceClient->sendTestMessage($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 +{ + $formattedContactsElement = EssentialContactsServiceClient::contactName('[PROJECT]', '[CONTACT]'); + $formattedResource = EssentialContactsServiceClient::projectName('[PROJECT]'); + $notificationCategory = NotificationCategory::NOTIFICATION_CATEGORY_UNSPECIFIED; + + send_test_message_sample($formattedContactsElement, $formattedResource, $notificationCategory); +} +// [END essentialcontacts_v1_generated_EssentialContactsService_SendTestMessage_sync] diff --git a/owl-bot-staging/EssentialContacts/v1/samples/V1/EssentialContactsServiceClient/update_contact.php b/owl-bot-staging/EssentialContacts/v1/samples/V1/EssentialContactsServiceClient/update_contact.php new file mode 100644 index 000000000000..9dd27a98a0cc --- /dev/null +++ b/owl-bot-staging/EssentialContacts/v1/samples/V1/EssentialContactsServiceClient/update_contact.php @@ -0,0 +1,60 @@ +setContact($contact); + + // Call the API and handle any network failures. + try { + /** @var Contact $response */ + $response = $essentialContactsServiceClient->updateContact($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END essentialcontacts_v1_generated_EssentialContactsService_UpdateContact_sync] diff --git a/owl-bot-staging/EssentialContacts/v1/src/V1/Client/BaseClient/EssentialContactsServiceBaseClient.php b/owl-bot-staging/EssentialContacts/v1/src/V1/Client/BaseClient/EssentialContactsServiceBaseClient.php new file mode 100644 index 000000000000..32c6117c33b1 --- /dev/null +++ b/owl-bot-staging/EssentialContacts/v1/src/V1/Client/BaseClient/EssentialContactsServiceBaseClient.php @@ -0,0 +1,493 @@ + self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../../resources/essential_contacts_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../../resources/essential_contacts_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../../resources/essential_contacts_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../../resources/essential_contacts_service_rest_client_config.php', + ], + ], + ]; + } + + /** + * Formats a string containing the fully-qualified path to represent a contact + * resource. + * + * @param string $project + * @param string $contact + * + * @return string The formatted contact resource. + */ + public static function contactName(string $project, string $contact): string + { + return self::getPathTemplate('contact')->render([ + 'project' => $project, + 'contact' => $contact, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a folder + * resource. + * + * @param string $folder + * + * @return string The formatted folder resource. + */ + public static function folderName(string $folder): string + { + return self::getPathTemplate('folder')->render([ + 'folder' => $folder, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * folder_contact resource. + * + * @param string $folder + * @param string $contact + * + * @return string The formatted folder_contact resource. + */ + public static function folderContactName(string $folder, string $contact): string + { + return self::getPathTemplate('folderContact')->render([ + 'folder' => $folder, + 'contact' => $contact, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a organization + * resource. + * + * @param string $organization + * + * @return string The formatted organization resource. + */ + public static function organizationName(string $organization): string + { + return self::getPathTemplate('organization')->render([ + 'organization' => $organization, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * organization_contact resource. + * + * @param string $organization + * @param string $contact + * + * @return string The formatted organization_contact resource. + */ + public static function organizationContactName(string $organization, string $contact): string + { + return self::getPathTemplate('organizationContact')->render([ + 'organization' => $organization, + 'contact' => $contact, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a project + * resource. + * + * @param string $project + * + * @return string The formatted project resource. + */ + public static function projectName(string $project): string + { + return self::getPathTemplate('project')->render([ + 'project' => $project, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_contact resource. + * + * @param string $project + * @param string $contact + * + * @return string The formatted project_contact resource. + */ + public static function projectContactName(string $project, string $contact): string + { + return self::getPathTemplate('projectContact')->render([ + 'project' => $project, + 'contact' => $contact, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - contact: projects/{project}/contacts/{contact} + * - folder: folders/{folder} + * - folderContact: folders/{folder}/contacts/{contact} + * - organization: organizations/{organization} + * - organizationContact: organizations/{organization}/contacts/{contact} + * - project: projects/{project} + * - projectContact: projects/{project}/contacts/{contact} + * + * 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 'essentialcontacts.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. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *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' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods 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); + } + + /** 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); + } + + /** + * Lists all contacts for the resource that are subscribed to the + * specified notification categories, including contacts inherited from + * any parent resources. + * + * The async variant is {@see self::computeContactsAsync()} . + * + * @param ComputeContactsRequest $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 computeContacts(ComputeContactsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ComputeContacts', $request, $callOptions); + } + + /** + * Adds a new contact for a resource. + * + * The async variant is {@see self::createContactAsync()} . + * + * @param CreateContactRequest $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 Contact + * + * @throws ApiException Thrown if the API call fails. + */ + public function createContact(CreateContactRequest $request, array $callOptions = []): Contact + { + return $this->startApiCall('CreateContact', $request, $callOptions)->wait(); + } + + /** + * Deletes a contact. + * + * The async variant is {@see self::deleteContactAsync()} . + * + * @param DeleteContactRequest $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 deleteContact(DeleteContactRequest $request, array $callOptions = []): void + { + $this->startApiCall('DeleteContact', $request, $callOptions)->wait(); + } + + /** + * Gets a single contact. + * + * The async variant is {@see self::getContactAsync()} . + * + * @param GetContactRequest $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 Contact + * + * @throws ApiException Thrown if the API call fails. + */ + public function getContact(GetContactRequest $request, array $callOptions = []): Contact + { + return $this->startApiCall('GetContact', $request, $callOptions)->wait(); + } + + /** + * Lists the contacts that have been set on a resource. + * + * The async variant is {@see self::listContactsAsync()} . + * + * @param ListContactsRequest $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 listContacts(ListContactsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListContacts', $request, $callOptions); + } + + /** + * Allows a contact admin to send a test message to contact to verify that it + * has been configured correctly. + * + * The async variant is {@see self::sendTestMessageAsync()} . + * + * @param SendTestMessageRequest $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 sendTestMessage(SendTestMessageRequest $request, array $callOptions = []): void + { + $this->startApiCall('SendTestMessage', $request, $callOptions)->wait(); + } + + /** + * Updates a contact. + * Note: A contact's email address cannot be changed. + * + * The async variant is {@see self::updateContactAsync()} . + * + * @param UpdateContactRequest $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 Contact + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateContact(UpdateContactRequest $request, array $callOptions = []): Contact + { + return $this->startApiCall('UpdateContact', $request, $callOptions)->wait(); + } +} diff --git a/owl-bot-staging/EssentialContacts/v1/src/V1/Client/EssentialContactsServiceClient.php b/owl-bot-staging/EssentialContacts/v1/src/V1/Client/EssentialContactsServiceClient.php new file mode 100644 index 000000000000..e5f6c658786d --- /dev/null +++ b/owl-bot-staging/EssentialContacts/v1/src/V1/Client/EssentialContactsServiceClient.php @@ -0,0 +1,40 @@ +projectName('[PROJECT]'); + * // Iterate over pages of elements + * $pagedResponse = $essentialContactsServiceClient->computeContacts($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $essentialContactsServiceClient->computeContacts($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $essentialContactsServiceClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + */ +class EssentialContactsServiceGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.essentialcontacts.v1.EssentialContactsService'; + + /** The default address of the service. */ + const SERVICE_ADDRESS = 'essentialcontacts.googleapis.com'; + + /** The default port of the service. */ + const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + ]; + + private static $contactNameTemplate; + + private static $folderNameTemplate; + + private static $folderContactNameTemplate; + + private static $organizationNameTemplate; + + private static $organizationContactNameTemplate; + + private static $projectNameTemplate; + + private static $projectContactNameTemplate; + + private static $pathTemplateMap; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/essential_contacts_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/essential_contacts_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/essential_contacts_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/essential_contacts_service_rest_client_config.php', + ], + ], + ]; + } + + private static function getContactNameTemplate() + { + if (self::$contactNameTemplate == null) { + self::$contactNameTemplate = new PathTemplate('projects/{project}/contacts/{contact}'); + } + + return self::$contactNameTemplate; + } + + private static function getFolderNameTemplate() + { + if (self::$folderNameTemplate == null) { + self::$folderNameTemplate = new PathTemplate('folders/{folder}'); + } + + return self::$folderNameTemplate; + } + + private static function getFolderContactNameTemplate() + { + if (self::$folderContactNameTemplate == null) { + self::$folderContactNameTemplate = new PathTemplate('folders/{folder}/contacts/{contact}'); + } + + return self::$folderContactNameTemplate; + } + + private static function getOrganizationNameTemplate() + { + if (self::$organizationNameTemplate == null) { + self::$organizationNameTemplate = new PathTemplate('organizations/{organization}'); + } + + return self::$organizationNameTemplate; + } + + private static function getOrganizationContactNameTemplate() + { + if (self::$organizationContactNameTemplate == null) { + self::$organizationContactNameTemplate = new PathTemplate('organizations/{organization}/contacts/{contact}'); + } + + return self::$organizationContactNameTemplate; + } + + private static function getProjectNameTemplate() + { + if (self::$projectNameTemplate == null) { + self::$projectNameTemplate = new PathTemplate('projects/{project}'); + } + + return self::$projectNameTemplate; + } + + private static function getProjectContactNameTemplate() + { + if (self::$projectContactNameTemplate == null) { + self::$projectContactNameTemplate = new PathTemplate('projects/{project}/contacts/{contact}'); + } + + return self::$projectContactNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'contact' => self::getContactNameTemplate(), + 'folder' => self::getFolderNameTemplate(), + 'folderContact' => self::getFolderContactNameTemplate(), + 'organization' => self::getOrganizationNameTemplate(), + 'organizationContact' => self::getOrganizationContactNameTemplate(), + 'project' => self::getProjectNameTemplate(), + 'projectContact' => self::getProjectContactNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a contact + * resource. + * + * @param string $project + * @param string $contact + * + * @return string The formatted contact resource. + */ + public static function contactName($project, $contact) + { + return self::getContactNameTemplate()->render([ + 'project' => $project, + 'contact' => $contact, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a folder + * resource. + * + * @param string $folder + * + * @return string The formatted folder resource. + */ + public static function folderName($folder) + { + return self::getFolderNameTemplate()->render([ + 'folder' => $folder, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * folder_contact resource. + * + * @param string $folder + * @param string $contact + * + * @return string The formatted folder_contact resource. + */ + public static function folderContactName($folder, $contact) + { + return self::getFolderContactNameTemplate()->render([ + 'folder' => $folder, + 'contact' => $contact, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a organization + * resource. + * + * @param string $organization + * + * @return string The formatted organization resource. + */ + public static function organizationName($organization) + { + return self::getOrganizationNameTemplate()->render([ + 'organization' => $organization, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * organization_contact resource. + * + * @param string $organization + * @param string $contact + * + * @return string The formatted organization_contact resource. + */ + public static function organizationContactName($organization, $contact) + { + return self::getOrganizationContactNameTemplate()->render([ + 'organization' => $organization, + 'contact' => $contact, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a project + * resource. + * + * @param string $project + * + * @return string The formatted project resource. + */ + public static function projectName($project) + { + return self::getProjectNameTemplate()->render([ + 'project' => $project, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_contact resource. + * + * @param string $project + * @param string $contact + * + * @return string The formatted project_contact resource. + */ + public static function projectContactName($project, $contact) + { + return self::getProjectContactNameTemplate()->render([ + 'project' => $project, + 'contact' => $contact, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - contact: projects/{project}/contacts/{contact} + * - folder: folders/{folder} + * - folderContact: folders/{folder}/contacts/{contact} + * - organization: organizations/{organization} + * - organizationContact: organizations/{organization}/contacts/{contact} + * - project: projects/{project} + * - projectContact: projects/{project}/contacts/{contact} + * + * 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($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * 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 'essentialcontacts.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. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *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' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods 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); + } + + /** + * Lists all contacts for the resource that are subscribed to the + * specified notification categories, including contacts inherited from + * any parent resources. + * + * Sample code: + * ``` + * $essentialContactsServiceClient = new EssentialContactsServiceClient(); + * try { + * $formattedParent = $essentialContactsServiceClient->projectName('[PROJECT]'); + * // Iterate over pages of elements + * $pagedResponse = $essentialContactsServiceClient->computeContacts($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $essentialContactsServiceClient->computeContacts($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $essentialContactsServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The name of the resource to compute contacts for. + * Format: organizations/{organization_id}, + * folders/{folder_id} or projects/{project_id} + * @param array $optionalArgs { + * Optional. + * + * @type int[] $notificationCategories + * The categories of notifications to compute contacts for. If ALL is included + * in this list, contacts subscribed to any notification category will be + * returned. + * For allowed values, use constants defined on {@see \Google\Cloud\EssentialContacts\V1\NotificationCategory} + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @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 \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function computeContacts($parent, array $optionalArgs = []) + { + $request = new ComputeContactsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['notificationCategories'])) { + $request->setNotificationCategories($optionalArgs['notificationCategories']); + } + + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ComputeContacts', $optionalArgs, ComputeContactsResponse::class, $request); + } + + /** + * Adds a new contact for a resource. + * + * Sample code: + * ``` + * $essentialContactsServiceClient = new EssentialContactsServiceClient(); + * try { + * $formattedParent = $essentialContactsServiceClient->projectName('[PROJECT]'); + * $contact = new Contact(); + * $response = $essentialContactsServiceClient->createContact($formattedParent, $contact); + * } finally { + * $essentialContactsServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The resource to save this contact for. + * Format: organizations/{organization_id}, folders/{folder_id} or + * projects/{project_id} + * @param Contact $contact Required. The contact to create. Must specify an email address and language + * tag. + * @param array $optionalArgs { + * 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 \Google\Cloud\EssentialContacts\V1\Contact + * + * @throws ApiException if the remote call fails + */ + public function createContact($parent, $contact, array $optionalArgs = []) + { + $request = new CreateContactRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setContact($contact); + $requestParamHeaders['parent'] = $parent; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('CreateContact', Contact::class, $optionalArgs, $request)->wait(); + } + + /** + * Deletes a contact. + * + * Sample code: + * ``` + * $essentialContactsServiceClient = new EssentialContactsServiceClient(); + * try { + * $formattedName = $essentialContactsServiceClient->contactName('[PROJECT]', '[CONTACT]'); + * $essentialContactsServiceClient->deleteContact($formattedName); + * } finally { + * $essentialContactsServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the contact to delete. + * Format: organizations/{organization_id}/contacts/{contact_id}, + * folders/{folder_id}/contacts/{contact_id} or + * projects/{project_id}/contacts/{contact_id} + * @param array $optionalArgs { + * 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 if the remote call fails + */ + public function deleteContact($name, array $optionalArgs = []) + { + $request = new DeleteContactRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('DeleteContact', GPBEmpty::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets a single contact. + * + * Sample code: + * ``` + * $essentialContactsServiceClient = new EssentialContactsServiceClient(); + * try { + * $formattedName = $essentialContactsServiceClient->contactName('[PROJECT]', '[CONTACT]'); + * $response = $essentialContactsServiceClient->getContact($formattedName); + * } finally { + * $essentialContactsServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the contact to retrieve. + * Format: organizations/{organization_id}/contacts/{contact_id}, + * folders/{folder_id}/contacts/{contact_id} or + * projects/{project_id}/contacts/{contact_id} + * @param array $optionalArgs { + * 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 \Google\Cloud\EssentialContacts\V1\Contact + * + * @throws ApiException if the remote call fails + */ + public function getContact($name, array $optionalArgs = []) + { + $request = new GetContactRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetContact', Contact::class, $optionalArgs, $request)->wait(); + } + + /** + * Lists the contacts that have been set on a resource. + * + * Sample code: + * ``` + * $essentialContactsServiceClient = new EssentialContactsServiceClient(); + * try { + * $formattedParent = $essentialContactsServiceClient->projectName('[PROJECT]'); + * // Iterate over pages of elements + * $pagedResponse = $essentialContactsServiceClient->listContacts($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $essentialContactsServiceClient->listContacts($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $essentialContactsServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The parent resource name. + * Format: organizations/{organization_id}, folders/{folder_id} or + * projects/{project_id} + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @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 \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listContacts($parent, array $optionalArgs = []) + { + $request = new ListContactsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListContacts', $optionalArgs, ListContactsResponse::class, $request); + } + + /** + * Allows a contact admin to send a test message to contact to verify that it + * has been configured correctly. + * + * Sample code: + * ``` + * $essentialContactsServiceClient = new EssentialContactsServiceClient(); + * try { + * $formattedContacts = [ + * $essentialContactsServiceClient->contactName('[PROJECT]', '[CONTACT]'), + * ]; + * $formattedResource = $essentialContactsServiceClient->projectName('[PROJECT]'); + * $notificationCategory = NotificationCategory::NOTIFICATION_CATEGORY_UNSPECIFIED; + * $essentialContactsServiceClient->sendTestMessage($formattedContacts, $formattedResource, $notificationCategory); + * } finally { + * $essentialContactsServiceClient->close(); + * } + * ``` + * + * @param string[] $contacts Required. The list of names of the contacts to send a test message to. + * Format: organizations/{organization_id}/contacts/{contact_id}, + * folders/{folder_id}/contacts/{contact_id} or + * projects/{project_id}/contacts/{contact_id} + * @param string $resource Required. The name of the resource to send the test message for. All + * contacts must either be set directly on this resource or inherited from + * another resource that is an ancestor of this one. Format: + * organizations/{organization_id}, folders/{folder_id} or + * projects/{project_id} + * @param int $notificationCategory Required. The notification category to send the test message for. All + * contacts must be subscribed to this category. + * For allowed values, use constants defined on {@see \Google\Cloud\EssentialContacts\V1\NotificationCategory} + * @param array $optionalArgs { + * 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 if the remote call fails + */ + public function sendTestMessage($contacts, $resource, $notificationCategory, array $optionalArgs = []) + { + $request = new SendTestMessageRequest(); + $requestParamHeaders = []; + $request->setContacts($contacts); + $request->setResource($resource); + $request->setNotificationCategory($notificationCategory); + $requestParamHeaders['resource'] = $resource; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('SendTestMessage', GPBEmpty::class, $optionalArgs, $request)->wait(); + } + + /** + * Updates a contact. + * Note: A contact's email address cannot be changed. + * + * Sample code: + * ``` + * $essentialContactsServiceClient = new EssentialContactsServiceClient(); + * try { + * $contact = new Contact(); + * $response = $essentialContactsServiceClient->updateContact($contact); + * } finally { + * $essentialContactsServiceClient->close(); + * } + * ``` + * + * @param Contact $contact Required. The contact resource to replace the existing saved contact. Note: + * the email address of the contact cannot be modified. + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * Optional. The update mask applied to the resource. For the `FieldMask` + * definition, see + * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + * @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 \Google\Cloud\EssentialContacts\V1\Contact + * + * @throws ApiException if the remote call fails + */ + public function updateContact($contact, array $optionalArgs = []) + { + $request = new UpdateContactRequest(); + $requestParamHeaders = []; + $request->setContact($contact); + $requestParamHeaders['contact.name'] = $contact->getName(); + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('UpdateContact', Contact::class, $optionalArgs, $request)->wait(); + } +} diff --git a/owl-bot-staging/EssentialContacts/v1/src/V1/gapic_metadata.json b/owl-bot-staging/EssentialContacts/v1/src/V1/gapic_metadata.json new file mode 100644 index 000000000000..2a955b8f76f0 --- /dev/null +++ b/owl-bot-staging/EssentialContacts/v1/src/V1/gapic_metadata.json @@ -0,0 +1,53 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services\/RPCs to the corresponding library clients\/methods", + "language": "php", + "protoPackage": "google.cloud.essentialcontacts.v1", + "libraryPackage": "Google\\Cloud\\EssentialContacts\\V1", + "services": { + "EssentialContactsService": { + "clients": { + "grpc": { + "libraryClient": "EssentialContactsServiceGapicClient", + "rpcs": { + "ComputeContacts": { + "methods": [ + "computeContacts" + ] + }, + "CreateContact": { + "methods": [ + "createContact" + ] + }, + "DeleteContact": { + "methods": [ + "deleteContact" + ] + }, + "GetContact": { + "methods": [ + "getContact" + ] + }, + "ListContacts": { + "methods": [ + "listContacts" + ] + }, + "SendTestMessage": { + "methods": [ + "sendTestMessage" + ] + }, + "UpdateContact": { + "methods": [ + "updateContact" + ] + } + } + } + } + } + } +} \ No newline at end of file diff --git a/owl-bot-staging/EssentialContacts/v1/src/V1/resources/essential_contacts_service_client_config.json b/owl-bot-staging/EssentialContacts/v1/src/V1/resources/essential_contacts_service_client_config.json new file mode 100644 index 000000000000..304dacd21d0f --- /dev/null +++ b/owl-bot-staging/EssentialContacts/v1/src/V1/resources/essential_contacts_service_client_config.json @@ -0,0 +1,79 @@ +{ + "interfaces": { + "google.cloud.essentialcontacts.v1.EssentialContactsService": { + "retry_codes": { + "no_retry_codes": [], + "retry_policy_1_codes": [ + "UNAVAILABLE" + ], + "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": 1.3, + "max_retry_delay_millis": 10000, + "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": { + "ComputeContacts": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "CreateContact": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "DeleteContact": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "GetContact": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListContacts": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "SendTestMessage": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "UpdateContact": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + } + } + } + } +} diff --git a/owl-bot-staging/EssentialContacts/v1/src/V1/resources/essential_contacts_service_descriptor_config.php b/owl-bot-staging/EssentialContacts/v1/src/V1/resources/essential_contacts_service_descriptor_config.php new file mode 100644 index 000000000000..fffc2713f526 --- /dev/null +++ b/owl-bot-staging/EssentialContacts/v1/src/V1/resources/essential_contacts_service_descriptor_config.php @@ -0,0 +1,118 @@ + [ + 'google.cloud.essentialcontacts.v1.EssentialContactsService' => [ + 'ComputeContacts' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getContacts', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\EssentialContacts\V1\ComputeContactsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'CreateContact' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\EssentialContacts\V1\Contact', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'DeleteContact' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetContact' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\EssentialContacts\V1\Contact', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'ListContacts' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getContacts', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\EssentialContacts\V1\ListContactsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'SendTestMessage' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'resource', + 'fieldAccessors' => [ + 'getResource', + ], + ], + ], + ], + 'UpdateContact' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\EssentialContacts\V1\Contact', + 'headerParams' => [ + [ + 'keyName' => 'contact.name', + 'fieldAccessors' => [ + 'getContact', + 'getName', + ], + ], + ], + ], + 'templateMap' => [ + 'contact' => 'projects/{project}/contacts/{contact}', + 'folder' => 'folders/{folder}', + 'folderContact' => 'folders/{folder}/contacts/{contact}', + 'organization' => 'organizations/{organization}', + 'organizationContact' => 'organizations/{organization}/contacts/{contact}', + 'project' => 'projects/{project}', + 'projectContact' => 'projects/{project}/contacts/{contact}', + ], + ], + ], +]; diff --git a/owl-bot-staging/EssentialContacts/v1/src/V1/resources/essential_contacts_service_rest_client_config.php b/owl-bot-staging/EssentialContacts/v1/src/V1/resources/essential_contacts_service_rest_client_config.php new file mode 100644 index 000000000000..04bf88c1516f --- /dev/null +++ b/owl-bot-staging/EssentialContacts/v1/src/V1/resources/essential_contacts_service_rest_client_config.php @@ -0,0 +1,166 @@ + [ + 'google.cloud.essentialcontacts.v1.EssentialContactsService' => [ + 'ComputeContacts' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*}/contacts:compute', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=folders/*}/contacts:compute', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=organizations/*}/contacts:compute', + ], + ], + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'CreateContact' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*}/contacts', + 'body' => 'contact', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=folders/*}/contacts', + 'body' => 'contact', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=organizations/*}/contacts', + 'body' => 'contact', + ], + ], + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'DeleteContact' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/contacts/*}', + 'additionalBindings' => [ + [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=folders/*/contacts/*}', + ], + [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=organizations/*/contacts/*}', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetContact' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/contacts/*}', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=folders/*/contacts/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=organizations/*/contacts/*}', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListContacts' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*}/contacts', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=folders/*}/contacts', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=organizations/*}/contacts', + ], + ], + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'SendTestMessage' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*}/contacts:sendTestMessage', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=folders/*}/contacts:sendTestMessage', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=organizations/*}/contacts:sendTestMessage', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + 'UpdateContact' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{contact.name=projects/*/contacts/*}', + 'body' => 'contact', + 'additionalBindings' => [ + [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{contact.name=folders/*/contacts/*}', + 'body' => 'contact', + ], + [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{contact.name=organizations/*/contacts/*}', + 'body' => 'contact', + ], + ], + 'placeholders' => [ + 'contact.name' => [ + 'getters' => [ + 'getContact', + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/EssentialContacts/v1/tests/Unit/V1/Client/EssentialContactsServiceClientTest.php b/owl-bot-staging/EssentialContacts/v1/tests/Unit/V1/Client/EssentialContactsServiceClientTest.php new file mode 100644 index 000000000000..caeb5d0e0301 --- /dev/null +++ b/owl-bot-staging/EssentialContacts/v1/tests/Unit/V1/Client/EssentialContactsServiceClientTest.php @@ -0,0 +1,601 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return EssentialContactsServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new EssentialContactsServiceClient($options); + } + + /** @test */ + public function computeContactsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $contactsElement = new Contact(); + $contacts = [ + $contactsElement, + ]; + $expectedResponse = new ComputeContactsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setContacts($contacts); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $request = (new ComputeContactsRequest()) + ->setParent($formattedParent); + $response = $gapicClient->computeContacts($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getContacts()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.essentialcontacts.v1.EssentialContactsService/ComputeContacts', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function computeContactsExceptionTest() + { + $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->projectName('[PROJECT]'); + $request = (new ComputeContactsRequest()) + ->setParent($formattedParent); + try { + $gapicClient->computeContacts($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 createContactTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $email = 'email96619420'; + $languageTag = 'languageTag-2091510221'; + $expectedResponse = new Contact(); + $expectedResponse->setName($name); + $expectedResponse->setEmail($email); + $expectedResponse->setLanguageTag($languageTag); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $contact = new Contact(); + $request = (new CreateContactRequest()) + ->setParent($formattedParent) + ->setContact($contact); + $response = $gapicClient->createContact($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.essentialcontacts.v1.EssentialContactsService/CreateContact', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getContact(); + $this->assertProtobufEquals($contact, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createContactExceptionTest() + { + $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->projectName('[PROJECT]'); + $contact = new Contact(); + $request = (new CreateContactRequest()) + ->setParent($formattedParent) + ->setContact($contact); + try { + $gapicClient->createContact($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 deleteContactTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->contactName('[PROJECT]', '[CONTACT]'); + $request = (new DeleteContactRequest()) + ->setName($formattedName); + $gapicClient->deleteContact($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.essentialcontacts.v1.EssentialContactsService/DeleteContact', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteContactExceptionTest() + { + $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->contactName('[PROJECT]', '[CONTACT]'); + $request = (new DeleteContactRequest()) + ->setName($formattedName); + try { + $gapicClient->deleteContact($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 getContactTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $email = 'email96619420'; + $languageTag = 'languageTag-2091510221'; + $expectedResponse = new Contact(); + $expectedResponse->setName($name2); + $expectedResponse->setEmail($email); + $expectedResponse->setLanguageTag($languageTag); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->contactName('[PROJECT]', '[CONTACT]'); + $request = (new GetContactRequest()) + ->setName($formattedName); + $response = $gapicClient->getContact($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.essentialcontacts.v1.EssentialContactsService/GetContact', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getContactExceptionTest() + { + $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->contactName('[PROJECT]', '[CONTACT]'); + $request = (new GetContactRequest()) + ->setName($formattedName); + try { + $gapicClient->getContact($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 listContactsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $contactsElement = new Contact(); + $contacts = [ + $contactsElement, + ]; + $expectedResponse = new ListContactsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setContacts($contacts); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $request = (new ListContactsRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listContacts($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getContacts()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.essentialcontacts.v1.EssentialContactsService/ListContacts', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listContactsExceptionTest() + { + $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->projectName('[PROJECT]'); + $request = (new ListContactsRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listContacts($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 sendTestMessageTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedContacts = [ + $gapicClient->contactName('[PROJECT]', '[CONTACT]'), + ]; + $formattedResource = $gapicClient->projectName('[PROJECT]'); + $notificationCategory = NotificationCategory::NOTIFICATION_CATEGORY_UNSPECIFIED; + $request = (new SendTestMessageRequest()) + ->setContacts($formattedContacts) + ->setResource($formattedResource) + ->setNotificationCategory($notificationCategory); + $gapicClient->sendTestMessage($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.essentialcontacts.v1.EssentialContactsService/SendTestMessage', $actualFuncCall); + $actualValue = $actualRequestObject->getContacts(); + $this->assertProtobufEquals($formattedContacts, $actualValue); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($formattedResource, $actualValue); + $actualValue = $actualRequestObject->getNotificationCategory(); + $this->assertProtobufEquals($notificationCategory, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function sendTestMessageExceptionTest() + { + $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 + $formattedContacts = [ + $gapicClient->contactName('[PROJECT]', '[CONTACT]'), + ]; + $formattedResource = $gapicClient->projectName('[PROJECT]'); + $notificationCategory = NotificationCategory::NOTIFICATION_CATEGORY_UNSPECIFIED; + $request = (new SendTestMessageRequest()) + ->setContacts($formattedContacts) + ->setResource($formattedResource) + ->setNotificationCategory($notificationCategory); + try { + $gapicClient->sendTestMessage($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 updateContactTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $email = 'email96619420'; + $languageTag = 'languageTag-2091510221'; + $expectedResponse = new Contact(); + $expectedResponse->setName($name); + $expectedResponse->setEmail($email); + $expectedResponse->setLanguageTag($languageTag); + $transport->addResponse($expectedResponse); + // Mock request + $contact = new Contact(); + $request = (new UpdateContactRequest()) + ->setContact($contact); + $response = $gapicClient->updateContact($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.essentialcontacts.v1.EssentialContactsService/UpdateContact', $actualFuncCall); + $actualValue = $actualRequestObject->getContact(); + $this->assertProtobufEquals($contact, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateContactExceptionTest() + { + $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 + $contact = new Contact(); + $request = (new UpdateContactRequest()) + ->setContact($contact); + try { + $gapicClient->updateContact($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 computeContactsAsyncTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $contactsElement = new Contact(); + $contacts = [ + $contactsElement, + ]; + $expectedResponse = new ComputeContactsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setContacts($contacts); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $request = (new ComputeContactsRequest()) + ->setParent($formattedParent); + $response = $gapicClient->computeContactsAsync($request)->wait(); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getContacts()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.essentialcontacts.v1.EssentialContactsService/ComputeContacts', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/owl-bot-staging/EssentialContacts/v1/tests/Unit/V1/EssentialContactsServiceClientTest.php b/owl-bot-staging/EssentialContacts/v1/tests/Unit/V1/EssentialContactsServiceClientTest.php new file mode 100644 index 000000000000..a21e0e6a56ba --- /dev/null +++ b/owl-bot-staging/EssentialContacts/v1/tests/Unit/V1/EssentialContactsServiceClientTest.php @@ -0,0 +1,523 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return EssentialContactsServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new EssentialContactsServiceClient($options); + } + + /** @test */ + public function computeContactsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $contactsElement = new Contact(); + $contacts = [ + $contactsElement, + ]; + $expectedResponse = new ComputeContactsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setContacts($contacts); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $response = $gapicClient->computeContacts($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getContacts()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.essentialcontacts.v1.EssentialContactsService/ComputeContacts', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function computeContactsExceptionTest() + { + $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->projectName('[PROJECT]'); + try { + $gapicClient->computeContacts($formattedParent); + // 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 createContactTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $email = 'email96619420'; + $languageTag = 'languageTag-2091510221'; + $expectedResponse = new Contact(); + $expectedResponse->setName($name); + $expectedResponse->setEmail($email); + $expectedResponse->setLanguageTag($languageTag); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $contact = new Contact(); + $response = $gapicClient->createContact($formattedParent, $contact); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.essentialcontacts.v1.EssentialContactsService/CreateContact', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getContact(); + $this->assertProtobufEquals($contact, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createContactExceptionTest() + { + $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->projectName('[PROJECT]'); + $contact = new Contact(); + try { + $gapicClient->createContact($formattedParent, $contact); + // 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 deleteContactTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->contactName('[PROJECT]', '[CONTACT]'); + $gapicClient->deleteContact($formattedName); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.essentialcontacts.v1.EssentialContactsService/DeleteContact', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteContactExceptionTest() + { + $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->contactName('[PROJECT]', '[CONTACT]'); + try { + $gapicClient->deleteContact($formattedName); + // 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 getContactTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $email = 'email96619420'; + $languageTag = 'languageTag-2091510221'; + $expectedResponse = new Contact(); + $expectedResponse->setName($name2); + $expectedResponse->setEmail($email); + $expectedResponse->setLanguageTag($languageTag); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->contactName('[PROJECT]', '[CONTACT]'); + $response = $gapicClient->getContact($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.essentialcontacts.v1.EssentialContactsService/GetContact', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getContactExceptionTest() + { + $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->contactName('[PROJECT]', '[CONTACT]'); + try { + $gapicClient->getContact($formattedName); + // 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 listContactsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $contactsElement = new Contact(); + $contacts = [ + $contactsElement, + ]; + $expectedResponse = new ListContactsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setContacts($contacts); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $response = $gapicClient->listContacts($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getContacts()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.essentialcontacts.v1.EssentialContactsService/ListContacts', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listContactsExceptionTest() + { + $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->projectName('[PROJECT]'); + try { + $gapicClient->listContacts($formattedParent); + // 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 sendTestMessageTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedContacts = [ + $gapicClient->contactName('[PROJECT]', '[CONTACT]'), + ]; + $formattedResource = $gapicClient->projectName('[PROJECT]'); + $notificationCategory = NotificationCategory::NOTIFICATION_CATEGORY_UNSPECIFIED; + $gapicClient->sendTestMessage($formattedContacts, $formattedResource, $notificationCategory); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.essentialcontacts.v1.EssentialContactsService/SendTestMessage', $actualFuncCall); + $actualValue = $actualRequestObject->getContacts(); + $this->assertProtobufEquals($formattedContacts, $actualValue); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($formattedResource, $actualValue); + $actualValue = $actualRequestObject->getNotificationCategory(); + $this->assertProtobufEquals($notificationCategory, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function sendTestMessageExceptionTest() + { + $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 + $formattedContacts = [ + $gapicClient->contactName('[PROJECT]', '[CONTACT]'), + ]; + $formattedResource = $gapicClient->projectName('[PROJECT]'); + $notificationCategory = NotificationCategory::NOTIFICATION_CATEGORY_UNSPECIFIED; + try { + $gapicClient->sendTestMessage($formattedContacts, $formattedResource, $notificationCategory); + // 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 updateContactTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $email = 'email96619420'; + $languageTag = 'languageTag-2091510221'; + $expectedResponse = new Contact(); + $expectedResponse->setName($name); + $expectedResponse->setEmail($email); + $expectedResponse->setLanguageTag($languageTag); + $transport->addResponse($expectedResponse); + // Mock request + $contact = new Contact(); + $response = $gapicClient->updateContact($contact); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.essentialcontacts.v1.EssentialContactsService/UpdateContact', $actualFuncCall); + $actualValue = $actualRequestObject->getContact(); + $this->assertProtobufEquals($contact, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateContactExceptionTest() + { + $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 + $contact = new Contact(); + try { + $gapicClient->updateContact($contact); + // 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()); + } +} diff --git a/owl-bot-staging/EventarcPublishing/v1/proto/src/GPBMetadata/Google/Cloud/Eventarc/Publishing/V1/Publisher.php b/owl-bot-staging/EventarcPublishing/v1/proto/src/GPBMetadata/Google/Cloud/Eventarc/Publishing/V1/Publisher.php new file mode 100644 index 000000000000..026594dd2e33 --- /dev/null +++ b/owl-bot-staging/EventarcPublishing/v1/proto/src/GPBMetadata/Google/Cloud/Eventarc/Publishing/V1/Publisher.php @@ -0,0 +1,44 @@ +internalAddGeneratedFile( + ' + + +3google/cloud/eventarc/publishing/v1/publisher.proto#google.cloud.eventarc.publishing.v1google/api/client.protogoogle/protobuf/any.proto"~ +%PublishChannelConnectionEventsRequest +channel_connection ( $ +events ( 2.google.protobuf.Any + text_events ( "( +&PublishChannelConnectionEventsResponse"b +PublishEventsRequest +channel ( $ +events ( 2.google.protobuf.Any + text_events ( " +PublishEventsResponse2Ð + Publisher˜ +PublishChannelConnectionEventsJ.google.cloud.eventarc.publishing.v1.PublishChannelConnectionEventsRequestK.google.cloud.eventarc.publishing.v1.PublishChannelConnectionEventsResponse"]‚Óä“W"R/v1/{channel_connection=projects/*/locations/*/channelConnections/*}:publishEvents:*Ð + PublishEvents9.google.cloud.eventarc.publishing.v1.PublishEventsRequest:.google.cloud.eventarc.publishing.v1.PublishEventsResponse"H‚Óä“B"=/v1/{channel=projects/*/locations/*/channels/*}:publishEvents:*UÊA!eventarcpublishing.googleapis.comÒA.https://www.googleapis.com/auth/cloud-platformBú +\'com.google.cloud.eventarc.publishing.v1BPublisherProtoPZGcloud.google.com/go/eventarc/publishing/apiv1/publishingpb;publishingpbª#Google.Cloud.Eventarc.Publishing.V1Ê#Google\\Cloud\\Eventarc\\Publishing\\V1ê\'Google::Cloud::Eventarc::Publishing::V1bproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/owl-bot-staging/EventarcPublishing/v1/proto/src/Google/Cloud/Eventarc/Publishing/V1/PublishChannelConnectionEventsRequest.php b/owl-bot-staging/EventarcPublishing/v1/proto/src/Google/Cloud/Eventarc/Publishing/V1/PublishChannelConnectionEventsRequest.php new file mode 100644 index 000000000000..79180267cebb --- /dev/null +++ b/owl-bot-staging/EventarcPublishing/v1/proto/src/Google/Cloud/Eventarc/Publishing/V1/PublishChannelConnectionEventsRequest.php @@ -0,0 +1,159 @@ +google.cloud.eventarc.publishing.v1.PublishChannelConnectionEventsRequest + */ +class PublishChannelConnectionEventsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * The channel_connection that the events are published from. For example: + * `projects/{partner_project_id}/locations/{location}/channelConnections/{channel_connection_id}`. + * + * Generated from protobuf field string channel_connection = 1; + */ + protected $channel_connection = ''; + /** + * The CloudEvents v1.0 events to publish. No other types are allowed. + * If this field is set, then the `text_events` fields must not be set. + * + * Generated from protobuf field repeated .google.protobuf.Any events = 2; + */ + private $events; + /** + * The text representation of events to publish. + * CloudEvent v1.0 in JSON format is the only allowed type. Refer to + * https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/json-format.md + * for specification. + * If this field is set, then the `events` fields must not be set. + * + * Generated from protobuf field repeated string text_events = 3; + */ + private $text_events; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $channel_connection + * The channel_connection that the events are published from. For example: + * `projects/{partner_project_id}/locations/{location}/channelConnections/{channel_connection_id}`. + * @type array<\Google\Protobuf\Any>|\Google\Protobuf\Internal\RepeatedField $events + * The CloudEvents v1.0 events to publish. No other types are allowed. + * If this field is set, then the `text_events` fields must not be set. + * @type array|\Google\Protobuf\Internal\RepeatedField $text_events + * The text representation of events to publish. + * CloudEvent v1.0 in JSON format is the only allowed type. Refer to + * https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/json-format.md + * for specification. + * If this field is set, then the `events` fields must not be set. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Eventarc\Publishing\V1\Publisher::initOnce(); + parent::__construct($data); + } + + /** + * The channel_connection that the events are published from. For example: + * `projects/{partner_project_id}/locations/{location}/channelConnections/{channel_connection_id}`. + * + * Generated from protobuf field string channel_connection = 1; + * @return string + */ + public function getChannelConnection() + { + return $this->channel_connection; + } + + /** + * The channel_connection that the events are published from. For example: + * `projects/{partner_project_id}/locations/{location}/channelConnections/{channel_connection_id}`. + * + * Generated from protobuf field string channel_connection = 1; + * @param string $var + * @return $this + */ + public function setChannelConnection($var) + { + GPBUtil::checkString($var, True); + $this->channel_connection = $var; + + return $this; + } + + /** + * The CloudEvents v1.0 events to publish. No other types are allowed. + * If this field is set, then the `text_events` fields must not be set. + * + * Generated from protobuf field repeated .google.protobuf.Any events = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getEvents() + { + return $this->events; + } + + /** + * The CloudEvents v1.0 events to publish. No other types are allowed. + * If this field is set, then the `text_events` fields must not be set. + * + * Generated from protobuf field repeated .google.protobuf.Any events = 2; + * @param array<\Google\Protobuf\Any>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setEvents($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Any::class); + $this->events = $arr; + + return $this; + } + + /** + * The text representation of events to publish. + * CloudEvent v1.0 in JSON format is the only allowed type. Refer to + * https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/json-format.md + * for specification. + * If this field is set, then the `events` fields must not be set. + * + * Generated from protobuf field repeated string text_events = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTextEvents() + { + return $this->text_events; + } + + /** + * The text representation of events to publish. + * CloudEvent v1.0 in JSON format is the only allowed type. Refer to + * https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/json-format.md + * for specification. + * If this field is set, then the `events` fields must not be set. + * + * Generated from protobuf field repeated string text_events = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTextEvents($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->text_events = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/EventarcPublishing/v1/proto/src/Google/Cloud/Eventarc/Publishing/V1/PublishChannelConnectionEventsResponse.php b/owl-bot-staging/EventarcPublishing/v1/proto/src/Google/Cloud/Eventarc/Publishing/V1/PublishChannelConnectionEventsResponse.php new file mode 100644 index 000000000000..6a7494facfc6 --- /dev/null +++ b/owl-bot-staging/EventarcPublishing/v1/proto/src/Google/Cloud/Eventarc/Publishing/V1/PublishChannelConnectionEventsResponse.php @@ -0,0 +1,33 @@ +google.cloud.eventarc.publishing.v1.PublishChannelConnectionEventsResponse + */ +class PublishChannelConnectionEventsResponse extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Eventarc\Publishing\V1\Publisher::initOnce(); + parent::__construct($data); + } + +} + diff --git a/owl-bot-staging/EventarcPublishing/v1/proto/src/Google/Cloud/Eventarc/Publishing/V1/PublishEventsRequest.php b/owl-bot-staging/EventarcPublishing/v1/proto/src/Google/Cloud/Eventarc/Publishing/V1/PublishEventsRequest.php new file mode 100644 index 000000000000..f5c6a6cfa164 --- /dev/null +++ b/owl-bot-staging/EventarcPublishing/v1/proto/src/Google/Cloud/Eventarc/Publishing/V1/PublishEventsRequest.php @@ -0,0 +1,159 @@ +google.cloud.eventarc.publishing.v1.PublishEventsRequest + */ +class PublishEventsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * The full name of the channel to publish to. For example: + * `projects/{project}/locations/{location}/channels/{channel-id}`. + * + * Generated from protobuf field string channel = 1; + */ + protected $channel = ''; + /** + * The CloudEvents v1.0 events to publish. No other types are allowed. + * If this field is set, then the `text_events` fields must not be set. + * + * Generated from protobuf field repeated .google.protobuf.Any events = 2; + */ + private $events; + /** + * The text representation of events to publish. + * CloudEvent v1.0 in JSON format is the only allowed type. Refer to + * https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/json-format.md + * for specification. + * If this field is set, then the `events` fields must not be set. + * + * Generated from protobuf field repeated string text_events = 3; + */ + private $text_events; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $channel + * The full name of the channel to publish to. For example: + * `projects/{project}/locations/{location}/channels/{channel-id}`. + * @type array<\Google\Protobuf\Any>|\Google\Protobuf\Internal\RepeatedField $events + * The CloudEvents v1.0 events to publish. No other types are allowed. + * If this field is set, then the `text_events` fields must not be set. + * @type array|\Google\Protobuf\Internal\RepeatedField $text_events + * The text representation of events to publish. + * CloudEvent v1.0 in JSON format is the only allowed type. Refer to + * https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/json-format.md + * for specification. + * If this field is set, then the `events` fields must not be set. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Eventarc\Publishing\V1\Publisher::initOnce(); + parent::__construct($data); + } + + /** + * The full name of the channel to publish to. For example: + * `projects/{project}/locations/{location}/channels/{channel-id}`. + * + * Generated from protobuf field string channel = 1; + * @return string + */ + public function getChannel() + { + return $this->channel; + } + + /** + * The full name of the channel to publish to. For example: + * `projects/{project}/locations/{location}/channels/{channel-id}`. + * + * Generated from protobuf field string channel = 1; + * @param string $var + * @return $this + */ + public function setChannel($var) + { + GPBUtil::checkString($var, True); + $this->channel = $var; + + return $this; + } + + /** + * The CloudEvents v1.0 events to publish. No other types are allowed. + * If this field is set, then the `text_events` fields must not be set. + * + * Generated from protobuf field repeated .google.protobuf.Any events = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getEvents() + { + return $this->events; + } + + /** + * The CloudEvents v1.0 events to publish. No other types are allowed. + * If this field is set, then the `text_events` fields must not be set. + * + * Generated from protobuf field repeated .google.protobuf.Any events = 2; + * @param array<\Google\Protobuf\Any>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setEvents($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Any::class); + $this->events = $arr; + + return $this; + } + + /** + * The text representation of events to publish. + * CloudEvent v1.0 in JSON format is the only allowed type. Refer to + * https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/json-format.md + * for specification. + * If this field is set, then the `events` fields must not be set. + * + * Generated from protobuf field repeated string text_events = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTextEvents() + { + return $this->text_events; + } + + /** + * The text representation of events to publish. + * CloudEvent v1.0 in JSON format is the only allowed type. Refer to + * https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/json-format.md + * for specification. + * If this field is set, then the `events` fields must not be set. + * + * Generated from protobuf field repeated string text_events = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTextEvents($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->text_events = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/EventarcPublishing/v1/proto/src/Google/Cloud/Eventarc/Publishing/V1/PublishEventsResponse.php b/owl-bot-staging/EventarcPublishing/v1/proto/src/Google/Cloud/Eventarc/Publishing/V1/PublishEventsResponse.php new file mode 100644 index 000000000000..4291ac3bfd78 --- /dev/null +++ b/owl-bot-staging/EventarcPublishing/v1/proto/src/Google/Cloud/Eventarc/Publishing/V1/PublishEventsResponse.php @@ -0,0 +1,33 @@ +google.cloud.eventarc.publishing.v1.PublishEventsResponse + */ +class PublishEventsResponse extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Eventarc\Publishing\V1\Publisher::initOnce(); + parent::__construct($data); + } + +} + diff --git a/owl-bot-staging/EventarcPublishing/v1/proto/src/Google/Cloud/Eventarc/Publishing/V1/PublisherGrpcClient.php b/owl-bot-staging/EventarcPublishing/v1/proto/src/Google/Cloud/Eventarc/Publishing/V1/PublisherGrpcClient.php new file mode 100644 index 000000000000..53e8b7edf935 --- /dev/null +++ b/owl-bot-staging/EventarcPublishing/v1/proto/src/Google/Cloud/Eventarc/Publishing/V1/PublisherGrpcClient.php @@ -0,0 +1,87 @@ +_simpleRequest('/google.cloud.eventarc.publishing.v1.Publisher/PublishChannelConnectionEvents', + $argument, + ['\Google\Cloud\Eventarc\Publishing\V1\PublishChannelConnectionEventsResponse', 'decode'], + $metadata, $options); + } + + /** + * Publish events to a subscriber's channel. + * @param \Google\Cloud\Eventarc\Publishing\V1\PublishEventsRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function PublishEvents(\Google\Cloud\Eventarc\Publishing\V1\PublishEventsRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.eventarc.publishing.v1.Publisher/PublishEvents', + $argument, + ['\Google\Cloud\Eventarc\Publishing\V1\PublishEventsResponse', 'decode'], + $metadata, $options); + } + +} diff --git a/owl-bot-staging/EventarcPublishing/v1/samples/V1/PublisherClient/publish_channel_connection_events.php b/owl-bot-staging/EventarcPublishing/v1/samples/V1/PublisherClient/publish_channel_connection_events.php new file mode 100644 index 000000000000..8c76a6070404 --- /dev/null +++ b/owl-bot-staging/EventarcPublishing/v1/samples/V1/PublisherClient/publish_channel_connection_events.php @@ -0,0 +1,57 @@ +publishChannelConnectionEvents($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END eventarcpublishing_v1_generated_Publisher_PublishChannelConnectionEvents_sync] diff --git a/owl-bot-staging/EventarcPublishing/v1/samples/V1/PublisherClient/publish_events.php b/owl-bot-staging/EventarcPublishing/v1/samples/V1/PublisherClient/publish_events.php new file mode 100644 index 000000000000..aae1a0668c60 --- /dev/null +++ b/owl-bot-staging/EventarcPublishing/v1/samples/V1/PublisherClient/publish_events.php @@ -0,0 +1,57 @@ +publishEvents($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END eventarcpublishing_v1_generated_Publisher_PublishEvents_sync] diff --git a/owl-bot-staging/EventarcPublishing/v1/src/V1/Client/BaseClient/PublisherBaseClient.php b/owl-bot-staging/EventarcPublishing/v1/src/V1/Client/BaseClient/PublisherBaseClient.php new file mode 100644 index 000000000000..7a47d1e8bb3b --- /dev/null +++ b/owl-bot-staging/EventarcPublishing/v1/src/V1/Client/BaseClient/PublisherBaseClient.php @@ -0,0 +1,237 @@ + self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../../resources/publisher_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../../resources/publisher_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../../resources/publisher_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../../resources/publisher_rest_client_config.php', + ], + ], + ]; + } + + /** + * 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 'eventarcpublishing.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. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *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' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods 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); + } + + /** 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); + } + + /** + * Publish events to a ChannelConnection in a partner's project. + * + * The async variant is {@see self::publishChannelConnectionEventsAsync()} . + * + * @param PublishChannelConnectionEventsRequest $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 PublishChannelConnectionEventsResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function publishChannelConnectionEvents(PublishChannelConnectionEventsRequest $request, array $callOptions = []): PublishChannelConnectionEventsResponse + { + return $this->startApiCall('PublishChannelConnectionEvents', $request, $callOptions)->wait(); + } + + /** + * Publish events to a subscriber's channel. + * + * The async variant is {@see self::publishEventsAsync()} . + * + * @param PublishEventsRequest $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 PublishEventsResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function publishEvents(PublishEventsRequest $request, array $callOptions = []): PublishEventsResponse + { + return $this->startApiCall('PublishEvents', $request, $callOptions)->wait(); + } +} diff --git a/owl-bot-staging/EventarcPublishing/v1/src/V1/Client/PublisherClient.php b/owl-bot-staging/EventarcPublishing/v1/src/V1/Client/PublisherClient.php new file mode 100644 index 000000000000..353777a80665 --- /dev/null +++ b/owl-bot-staging/EventarcPublishing/v1/src/V1/Client/PublisherClient.php @@ -0,0 +1,40 @@ +publishChannelConnectionEvents(); + * } finally { + * $publisherClient->close(); + * } + * ``` + */ +class PublisherGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.eventarc.publishing.v1.Publisher'; + + /** The default address of the service. */ + const SERVICE_ADDRESS = 'eventarcpublishing.googleapis.com'; + + /** The default port of the service. */ + const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + ]; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/publisher_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/publisher_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/publisher_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/publisher_rest_client_config.php', + ], + ], + ]; + } + + /** + * 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 'eventarcpublishing.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. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *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' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods 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); + } + + /** + * Publish events to a ChannelConnection in a partner's project. + * + * Sample code: + * ``` + * $publisherClient = new PublisherClient(); + * try { + * $response = $publisherClient->publishChannelConnectionEvents(); + * } finally { + * $publisherClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $channelConnection + * The channel_connection that the events are published from. For example: + * `projects/{partner_project_id}/locations/{location}/channelConnections/{channel_connection_id}`. + * @type Any[] $events + * The CloudEvents v1.0 events to publish. No other types are allowed. + * If this field is set, then the `text_events` fields must not be set. + * @type string[] $textEvents + * The text representation of events to publish. + * CloudEvent v1.0 in JSON format is the only allowed type. Refer to + * https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/json-format.md + * for specification. + * If this field is set, then the `events` fields must not be set. + * @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 \Google\Cloud\Eventarc\Publishing\V1\PublishChannelConnectionEventsResponse + * + * @throws ApiException if the remote call fails + */ + public function publishChannelConnectionEvents(array $optionalArgs = []) + { + $request = new PublishChannelConnectionEventsRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['channelConnection'])) { + $request->setChannelConnection($optionalArgs['channelConnection']); + $requestParamHeaders['channel_connection'] = $optionalArgs['channelConnection']; + } + + if (isset($optionalArgs['events'])) { + $request->setEvents($optionalArgs['events']); + } + + if (isset($optionalArgs['textEvents'])) { + $request->setTextEvents($optionalArgs['textEvents']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('PublishChannelConnectionEvents', PublishChannelConnectionEventsResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Publish events to a subscriber's channel. + * + * Sample code: + * ``` + * $publisherClient = new PublisherClient(); + * try { + * $response = $publisherClient->publishEvents(); + * } finally { + * $publisherClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $channel + * The full name of the channel to publish to. For example: + * `projects/{project}/locations/{location}/channels/{channel-id}`. + * @type Any[] $events + * The CloudEvents v1.0 events to publish. No other types are allowed. + * If this field is set, then the `text_events` fields must not be set. + * @type string[] $textEvents + * The text representation of events to publish. + * CloudEvent v1.0 in JSON format is the only allowed type. Refer to + * https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/json-format.md + * for specification. + * If this field is set, then the `events` fields must not be set. + * @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 \Google\Cloud\Eventarc\Publishing\V1\PublishEventsResponse + * + * @throws ApiException if the remote call fails + */ + public function publishEvents(array $optionalArgs = []) + { + $request = new PublishEventsRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['channel'])) { + $request->setChannel($optionalArgs['channel']); + $requestParamHeaders['channel'] = $optionalArgs['channel']; + } + + if (isset($optionalArgs['events'])) { + $request->setEvents($optionalArgs['events']); + } + + if (isset($optionalArgs['textEvents'])) { + $request->setTextEvents($optionalArgs['textEvents']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('PublishEvents', PublishEventsResponse::class, $optionalArgs, $request)->wait(); + } +} diff --git a/owl-bot-staging/EventarcPublishing/v1/src/V1/PublisherClient.php b/owl-bot-staging/EventarcPublishing/v1/src/V1/PublisherClient.php new file mode 100644 index 000000000000..c5d913b397f5 --- /dev/null +++ b/owl-bot-staging/EventarcPublishing/v1/src/V1/PublisherClient.php @@ -0,0 +1,34 @@ + [ + 'google.cloud.eventarc.publishing.v1.Publisher' => [ + 'PublishChannelConnectionEvents' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Eventarc\Publishing\V1\PublishChannelConnectionEventsResponse', + 'headerParams' => [ + [ + 'keyName' => 'channel_connection', + 'fieldAccessors' => [ + 'getChannelConnection', + ], + ], + ], + ], + 'PublishEvents' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Eventarc\Publishing\V1\PublishEventsResponse', + 'headerParams' => [ + [ + 'keyName' => 'channel', + 'fieldAccessors' => [ + 'getChannel', + ], + ], + ], + ], + ], + ], +]; diff --git a/owl-bot-staging/EventarcPublishing/v1/src/V1/resources/publisher_rest_client_config.php b/owl-bot-staging/EventarcPublishing/v1/src/V1/resources/publisher_rest_client_config.php new file mode 100644 index 000000000000..2c4ad8b6ef1c --- /dev/null +++ b/owl-bot-staging/EventarcPublishing/v1/src/V1/resources/publisher_rest_client_config.php @@ -0,0 +1,33 @@ + [ + 'google.cloud.eventarc.publishing.v1.Publisher' => [ + 'PublishChannelConnectionEvents' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{channel_connection=projects/*/locations/*/channelConnections/*}:publishEvents', + 'body' => '*', + 'placeholders' => [ + 'channel_connection' => [ + 'getters' => [ + 'getChannelConnection', + ], + ], + ], + ], + 'PublishEvents' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{channel=projects/*/locations/*/channels/*}:publishEvents', + 'body' => '*', + 'placeholders' => [ + 'channel' => [ + 'getters' => [ + 'getChannel', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/EventarcPublishing/v1/tests/Unit/V1/Client/PublisherClientTest.php b/owl-bot-staging/EventarcPublishing/v1/tests/Unit/V1/Client/PublisherClientTest.php new file mode 100644 index 000000000000..39e04dec518f --- /dev/null +++ b/owl-bot-staging/EventarcPublishing/v1/tests/Unit/V1/Client/PublisherClientTest.php @@ -0,0 +1,194 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return PublisherClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new PublisherClient($options); + } + + /** @test */ + public function publishChannelConnectionEventsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new PublishChannelConnectionEventsResponse(); + $transport->addResponse($expectedResponse); + $request = new PublishChannelConnectionEventsRequest(); + $response = $gapicClient->publishChannelConnectionEvents($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.eventarc.publishing.v1.Publisher/PublishChannelConnectionEvents', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function publishChannelConnectionEventsExceptionTest() + { + $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); + $request = new PublishChannelConnectionEventsRequest(); + try { + $gapicClient->publishChannelConnectionEvents($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 publishEventsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new PublishEventsResponse(); + $transport->addResponse($expectedResponse); + $request = new PublishEventsRequest(); + $response = $gapicClient->publishEvents($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.eventarc.publishing.v1.Publisher/PublishEvents', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function publishEventsExceptionTest() + { + $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); + $request = new PublishEventsRequest(); + try { + $gapicClient->publishEvents($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 publishChannelConnectionEventsAsyncTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new PublishChannelConnectionEventsResponse(); + $transport->addResponse($expectedResponse); + $request = new PublishChannelConnectionEventsRequest(); + $response = $gapicClient->publishChannelConnectionEventsAsync($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.cloud.eventarc.publishing.v1.Publisher/PublishChannelConnectionEvents', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/owl-bot-staging/EventarcPublishing/v1/tests/Unit/V1/PublisherClientTest.php b/owl-bot-staging/EventarcPublishing/v1/tests/Unit/V1/PublisherClientTest.php new file mode 100644 index 000000000000..22b9275862a8 --- /dev/null +++ b/owl-bot-staging/EventarcPublishing/v1/tests/Unit/V1/PublisherClientTest.php @@ -0,0 +1,166 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return PublisherClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new PublisherClient($options); + } + + /** @test */ + public function publishChannelConnectionEventsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new PublishChannelConnectionEventsResponse(); + $transport->addResponse($expectedResponse); + $response = $gapicClient->publishChannelConnectionEvents(); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.eventarc.publishing.v1.Publisher/PublishChannelConnectionEvents', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function publishChannelConnectionEventsExceptionTest() + { + $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); + try { + $gapicClient->publishChannelConnectionEvents(); + // 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 publishEventsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new PublishEventsResponse(); + $transport->addResponse($expectedResponse); + $response = $gapicClient->publishEvents(); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.eventarc.publishing.v1.Publisher/PublishEvents', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function publishEventsExceptionTest() + { + $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); + try { + $gapicClient->publishEvents(); + // 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()); + } +} diff --git a/owl-bot-staging/GSuiteAddOns/v1/proto/src/GPBMetadata/Google/Cloud/Gsuiteaddons/V1/Gsuiteaddons.php b/owl-bot-staging/GSuiteAddOns/v1/proto/src/GPBMetadata/Google/Cloud/Gsuiteaddons/V1/Gsuiteaddons.php new file mode 100644 index 000000000000..b3872fe3224b --- /dev/null +++ b/owl-bot-staging/GSuiteAddOns/v1/proto/src/GPBMetadata/Google/Cloud/Gsuiteaddons/V1/Gsuiteaddons.php @@ -0,0 +1,116 @@ +internalAddGeneratedFile( + ' +š% +/google/cloud/gsuiteaddons/v1/gsuiteaddons.protogoogle.cloud.gsuiteaddons.v1google/api/client.protogoogle/api/field_behavior.protogoogle/api/resource.proto>google/apps/script/type/calendar/calendar_addon_manifest.proto6google/apps/script/type/docs/docs_addon_manifest.proto8google/apps/script/type/drive/drive_addon_manifest.proto8google/apps/script/type/gmail/gmail_addon_manifest.proto-google/apps/script/type/script_manifest.proto:google/apps/script/type/sheets/sheets_addon_manifest.proto:google/apps/script/type/slides/slides_addon_manifest.protogoogle/protobuf/empty.protogoogle/protobuf/wrappers.proto"Z +GetAuthorizationRequest? +name ( B1àAúA+ +)gsuiteaddons.googleapis.com/Authorization"§ + Authorization +name (  +service_account_email (  +oauth_client_id ( :PêAM +)gsuiteaddons.googleapis.com/Authorization projects/{project}/authorization"½ +CreateDeploymentRequestC +parent ( B3àAúA- ++cloudresourcemanager.googleapis.com/Project + deployment_id ( BàAA + +deployment ( 2(.google.cloud.gsuiteaddons.v1.DeploymentBàA"] +ReplaceDeploymentRequestA + +deployment ( 2(.google.cloud.gsuiteaddons.v1.DeploymentBàA"T +GetDeploymentRequest< +name ( B.àAúA( +&gsuiteaddons.googleapis.com/Deployment"„ +ListDeploymentsRequestC +parent ( B3àAúA- ++cloudresourcemanager.googleapis.com/Project + page_size ( + +page_token ( "q +ListDeploymentsResponse= + deployments ( 2(.google.cloud.gsuiteaddons.v1.Deployment +next_page_token ( "e +DeleteDeploymentRequest< +name ( B.àAúA( +&gsuiteaddons.googleapis.com/Deployment +etag ( "X +InstallDeploymentRequest< +name ( B.àAúA( +&gsuiteaddons.googleapis.com/Deployment"Z +UninstallDeploymentRequest< +name ( B.àAúA( +&gsuiteaddons.googleapis.com/Deployment"Z +GetInstallStatusRequest? +name ( B1àAúA+ +)gsuiteaddons.googleapis.com/InstallStatus"· + InstallStatus +name ( - + installed ( 2.google.protobuf.BoolValue:iêAf +)gsuiteaddons.googleapis.com/InstallStatus9projects/{project}/deployments/{deployment}/installStatus"Ï + +Deployment +name (  + oauth_scopes ( 5 +add_ons ( 2$.google.cloud.gsuiteaddons.v1.AddOns +etag ( :XêAU +&gsuiteaddons.googleapis.com/Deployment+projects/{project}/deployments/{deployment}"š +AddOns< +common ( 2,.google.apps.script.type.CommonAddOnManifest@ +gmail ( 21.google.apps.script.type.gmail.GmailAddOnManifest@ +drive ( 21.google.apps.script.type.drive.DriveAddOnManifestI +calendar ( 27.google.apps.script.type.calendar.CalendarAddOnManifest= +docs ( 2/.google.apps.script.type.docs.DocsAddOnManifestC +sheets ( 23.google.apps.script.type.sheets.SheetsAddOnManifestC +slides + ( 23.google.apps.script.type.slides.SlidesAddOnManifest: + http_options ( 2$.google.apps.script.type.HttpOptions2¤ + GSuiteAddOnsª +GetAuthorization5.google.cloud.gsuiteaddons.v1.GetAuthorizationRequest+.google.cloud.gsuiteaddons.v1.Authorization"2‚Óä“%#/v1/{name=projects/*/authorization}ÚAnameÎ +CreateDeployment5.google.cloud.gsuiteaddons.v1.CreateDeploymentRequest(.google.cloud.gsuiteaddons.v1.Deployment"Y‚Óä“1"#/v1/{parent=projects/*}/deployments: +deploymentÚAparent,deployment,deployment_idÆ +ReplaceDeployment6.google.cloud.gsuiteaddons.v1.ReplaceDeploymentRequest(.google.cloud.gsuiteaddons.v1.Deployment"O‚Óä“<./v1/{deployment.name=projects/*/deployments/*}: +deploymentÚA +deployment¡ + GetDeployment2.google.cloud.gsuiteaddons.v1.GetDeploymentRequest(.google.cloud.gsuiteaddons.v1.Deployment"2‚Óä“%#/v1/{name=projects/*/deployments/*}ÚAname´ +ListDeployments4.google.cloud.gsuiteaddons.v1.ListDeploymentsRequest5.google.cloud.gsuiteaddons.v1.ListDeploymentsResponse"4‚Óä“%#/v1/{parent=projects/*}/deploymentsÚAparent• +DeleteDeployment5.google.cloud.gsuiteaddons.v1.DeleteDeploymentRequest.google.protobuf.Empty"2‚Óä“%*#/v1/{name=projects/*/deployments/*}ÚAname¢ +InstallDeployment6.google.cloud.gsuiteaddons.v1.InstallDeploymentRequest.google.protobuf.Empty"=‚Óä“0"+/v1/{name=projects/*/deployments/*}:install:*ÚAname¨ +UninstallDeployment8.google.cloud.gsuiteaddons.v1.UninstallDeploymentRequest.google.protobuf.Empty"?‚Óä“2"-/v1/{name=projects/*/deployments/*}:uninstall:*ÚAname¸ +GetInstallStatus5.google.cloud.gsuiteaddons.v1.GetInstallStatusRequest+.google.cloud.gsuiteaddons.v1.InstallStatus"@‚Óä“31/v1/{name=projects/*/deployments/*/installStatus}ÚAnameOÊAgsuiteaddons.googleapis.comÒA.https://www.googleapis.com/auth/cloud-platformBÝ + com.google.cloud.gsuiteaddons.v1BGSuiteAddOnsProtoPZDcloud.google.com/go/gsuiteaddons/apiv1/gsuiteaddonspb;gsuiteaddonspbªGoogle.Cloud.GSuiteAddOns.V1ÊGoogle\\Cloud\\GSuiteAddOns\\V1êGoogle::Cloud::GSuiteAddOns::V1bproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/owl-bot-staging/GSuiteAddOns/v1/proto/src/Google/Cloud/GSuiteAddOns/V1/AddOns.php b/owl-bot-staging/GSuiteAddOns/v1/proto/src/Google/Cloud/GSuiteAddOns/V1/AddOns.php new file mode 100644 index 000000000000..e03bb68d1fd1 --- /dev/null +++ b/owl-bot-staging/GSuiteAddOns/v1/proto/src/Google/Cloud/GSuiteAddOns/V1/AddOns.php @@ -0,0 +1,385 @@ +google.cloud.gsuiteaddons.v1.AddOns + */ +class AddOns extends \Google\Protobuf\Internal\Message +{ + /** + * Configuration that is common across all Google Workspace Add-ons. + * + * Generated from protobuf field .google.apps.script.type.CommonAddOnManifest common = 1; + */ + protected $common = null; + /** + * Gmail add-on configuration. + * + * Generated from protobuf field .google.apps.script.type.gmail.GmailAddOnManifest gmail = 2; + */ + protected $gmail = null; + /** + * Drive add-on configuration. + * + * Generated from protobuf field .google.apps.script.type.drive.DriveAddOnManifest drive = 5; + */ + protected $drive = null; + /** + * Calendar add-on configuration. + * + * Generated from protobuf field .google.apps.script.type.calendar.CalendarAddOnManifest calendar = 6; + */ + protected $calendar = null; + /** + * Docs add-on configuration. + * + * Generated from protobuf field .google.apps.script.type.docs.DocsAddOnManifest docs = 7; + */ + protected $docs = null; + /** + * Sheets add-on configuration. + * + * Generated from protobuf field .google.apps.script.type.sheets.SheetsAddOnManifest sheets = 8; + */ + protected $sheets = null; + /** + * Slides add-on configuration. + * + * Generated from protobuf field .google.apps.script.type.slides.SlidesAddOnManifest slides = 10; + */ + protected $slides = null; + /** + * Options for sending requests to add-on HTTP endpoints + * + * Generated from protobuf field .google.apps.script.type.HttpOptions http_options = 15; + */ + protected $http_options = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Apps\Script\Type\CommonAddOnManifest $common + * Configuration that is common across all Google Workspace Add-ons. + * @type \Google\Apps\Script\Type\Gmail\GmailAddOnManifest $gmail + * Gmail add-on configuration. + * @type \Google\Apps\Script\Type\Drive\DriveAddOnManifest $drive + * Drive add-on configuration. + * @type \Google\Apps\Script\Type\Calendar\CalendarAddOnManifest $calendar + * Calendar add-on configuration. + * @type \Google\Apps\Script\Type\Docs\DocsAddOnManifest $docs + * Docs add-on configuration. + * @type \Google\Apps\Script\Type\Sheets\SheetsAddOnManifest $sheets + * Sheets add-on configuration. + * @type \Google\Apps\Script\Type\Slides\SlidesAddOnManifest $slides + * Slides add-on configuration. + * @type \Google\Apps\Script\Type\HttpOptions $http_options + * Options for sending requests to add-on HTTP endpoints + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gsuiteaddons\V1\Gsuiteaddons::initOnce(); + parent::__construct($data); + } + + /** + * Configuration that is common across all Google Workspace Add-ons. + * + * Generated from protobuf field .google.apps.script.type.CommonAddOnManifest common = 1; + * @return \Google\Apps\Script\Type\CommonAddOnManifest|null + */ + public function getCommon() + { + return $this->common; + } + + public function hasCommon() + { + return isset($this->common); + } + + public function clearCommon() + { + unset($this->common); + } + + /** + * Configuration that is common across all Google Workspace Add-ons. + * + * Generated from protobuf field .google.apps.script.type.CommonAddOnManifest common = 1; + * @param \Google\Apps\Script\Type\CommonAddOnManifest $var + * @return $this + */ + public function setCommon($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Script\Type\CommonAddOnManifest::class); + $this->common = $var; + + return $this; + } + + /** + * Gmail add-on configuration. + * + * Generated from protobuf field .google.apps.script.type.gmail.GmailAddOnManifest gmail = 2; + * @return \Google\Apps\Script\Type\Gmail\GmailAddOnManifest|null + */ + public function getGmail() + { + return $this->gmail; + } + + public function hasGmail() + { + return isset($this->gmail); + } + + public function clearGmail() + { + unset($this->gmail); + } + + /** + * Gmail add-on configuration. + * + * Generated from protobuf field .google.apps.script.type.gmail.GmailAddOnManifest gmail = 2; + * @param \Google\Apps\Script\Type\Gmail\GmailAddOnManifest $var + * @return $this + */ + public function setGmail($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Script\Type\Gmail\GmailAddOnManifest::class); + $this->gmail = $var; + + return $this; + } + + /** + * Drive add-on configuration. + * + * Generated from protobuf field .google.apps.script.type.drive.DriveAddOnManifest drive = 5; + * @return \Google\Apps\Script\Type\Drive\DriveAddOnManifest|null + */ + public function getDrive() + { + return $this->drive; + } + + public function hasDrive() + { + return isset($this->drive); + } + + public function clearDrive() + { + unset($this->drive); + } + + /** + * Drive add-on configuration. + * + * Generated from protobuf field .google.apps.script.type.drive.DriveAddOnManifest drive = 5; + * @param \Google\Apps\Script\Type\Drive\DriveAddOnManifest $var + * @return $this + */ + public function setDrive($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Script\Type\Drive\DriveAddOnManifest::class); + $this->drive = $var; + + return $this; + } + + /** + * Calendar add-on configuration. + * + * Generated from protobuf field .google.apps.script.type.calendar.CalendarAddOnManifest calendar = 6; + * @return \Google\Apps\Script\Type\Calendar\CalendarAddOnManifest|null + */ + public function getCalendar() + { + return $this->calendar; + } + + public function hasCalendar() + { + return isset($this->calendar); + } + + public function clearCalendar() + { + unset($this->calendar); + } + + /** + * Calendar add-on configuration. + * + * Generated from protobuf field .google.apps.script.type.calendar.CalendarAddOnManifest calendar = 6; + * @param \Google\Apps\Script\Type\Calendar\CalendarAddOnManifest $var + * @return $this + */ + public function setCalendar($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Script\Type\Calendar\CalendarAddOnManifest::class); + $this->calendar = $var; + + return $this; + } + + /** + * Docs add-on configuration. + * + * Generated from protobuf field .google.apps.script.type.docs.DocsAddOnManifest docs = 7; + * @return \Google\Apps\Script\Type\Docs\DocsAddOnManifest|null + */ + public function getDocs() + { + return $this->docs; + } + + public function hasDocs() + { + return isset($this->docs); + } + + public function clearDocs() + { + unset($this->docs); + } + + /** + * Docs add-on configuration. + * + * Generated from protobuf field .google.apps.script.type.docs.DocsAddOnManifest docs = 7; + * @param \Google\Apps\Script\Type\Docs\DocsAddOnManifest $var + * @return $this + */ + public function setDocs($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Script\Type\Docs\DocsAddOnManifest::class); + $this->docs = $var; + + return $this; + } + + /** + * Sheets add-on configuration. + * + * Generated from protobuf field .google.apps.script.type.sheets.SheetsAddOnManifest sheets = 8; + * @return \Google\Apps\Script\Type\Sheets\SheetsAddOnManifest|null + */ + public function getSheets() + { + return $this->sheets; + } + + public function hasSheets() + { + return isset($this->sheets); + } + + public function clearSheets() + { + unset($this->sheets); + } + + /** + * Sheets add-on configuration. + * + * Generated from protobuf field .google.apps.script.type.sheets.SheetsAddOnManifest sheets = 8; + * @param \Google\Apps\Script\Type\Sheets\SheetsAddOnManifest $var + * @return $this + */ + public function setSheets($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Script\Type\Sheets\SheetsAddOnManifest::class); + $this->sheets = $var; + + return $this; + } + + /** + * Slides add-on configuration. + * + * Generated from protobuf field .google.apps.script.type.slides.SlidesAddOnManifest slides = 10; + * @return \Google\Apps\Script\Type\Slides\SlidesAddOnManifest|null + */ + public function getSlides() + { + return $this->slides; + } + + public function hasSlides() + { + return isset($this->slides); + } + + public function clearSlides() + { + unset($this->slides); + } + + /** + * Slides add-on configuration. + * + * Generated from protobuf field .google.apps.script.type.slides.SlidesAddOnManifest slides = 10; + * @param \Google\Apps\Script\Type\Slides\SlidesAddOnManifest $var + * @return $this + */ + public function setSlides($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Script\Type\Slides\SlidesAddOnManifest::class); + $this->slides = $var; + + return $this; + } + + /** + * Options for sending requests to add-on HTTP endpoints + * + * Generated from protobuf field .google.apps.script.type.HttpOptions http_options = 15; + * @return \Google\Apps\Script\Type\HttpOptions|null + */ + public function getHttpOptions() + { + return $this->http_options; + } + + public function hasHttpOptions() + { + return isset($this->http_options); + } + + public function clearHttpOptions() + { + unset($this->http_options); + } + + /** + * Options for sending requests to add-on HTTP endpoints + * + * Generated from protobuf field .google.apps.script.type.HttpOptions http_options = 15; + * @param \Google\Apps\Script\Type\HttpOptions $var + * @return $this + */ + public function setHttpOptions($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Script\Type\HttpOptions::class); + $this->http_options = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GSuiteAddOns/v1/proto/src/Google/Cloud/GSuiteAddOns/V1/Authorization.php b/owl-bot-staging/GSuiteAddOns/v1/proto/src/Google/Cloud/GSuiteAddOns/V1/Authorization.php new file mode 100644 index 000000000000..904cb85121ea --- /dev/null +++ b/owl-bot-staging/GSuiteAddOns/v1/proto/src/Google/Cloud/GSuiteAddOns/V1/Authorization.php @@ -0,0 +1,147 @@ +google.cloud.gsuiteaddons.v1.Authorization + */ +class Authorization extends \Google\Protobuf\Internal\Message +{ + /** + * The canonical full name of this resource. + * Example: `projects/123/authorization` + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * The email address of the service account used to authenticate requests to + * add-on callback endpoints. + * + * Generated from protobuf field string service_account_email = 2; + */ + protected $service_account_email = ''; + /** + * The OAuth client ID used to obtain OAuth access tokens for a user on the + * add-on's behalf. + * + * Generated from protobuf field string oauth_client_id = 3; + */ + protected $oauth_client_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The canonical full name of this resource. + * Example: `projects/123/authorization` + * @type string $service_account_email + * The email address of the service account used to authenticate requests to + * add-on callback endpoints. + * @type string $oauth_client_id + * The OAuth client ID used to obtain OAuth access tokens for a user on the + * add-on's behalf. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gsuiteaddons\V1\Gsuiteaddons::initOnce(); + parent::__construct($data); + } + + /** + * The canonical full name of this resource. + * Example: `projects/123/authorization` + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The canonical full name of this resource. + * Example: `projects/123/authorization` + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The email address of the service account used to authenticate requests to + * add-on callback endpoints. + * + * Generated from protobuf field string service_account_email = 2; + * @return string + */ + public function getServiceAccountEmail() + { + return $this->service_account_email; + } + + /** + * The email address of the service account used to authenticate requests to + * add-on callback endpoints. + * + * Generated from protobuf field string service_account_email = 2; + * @param string $var + * @return $this + */ + public function setServiceAccountEmail($var) + { + GPBUtil::checkString($var, True); + $this->service_account_email = $var; + + return $this; + } + + /** + * The OAuth client ID used to obtain OAuth access tokens for a user on the + * add-on's behalf. + * + * Generated from protobuf field string oauth_client_id = 3; + * @return string + */ + public function getOauthClientId() + { + return $this->oauth_client_id; + } + + /** + * The OAuth client ID used to obtain OAuth access tokens for a user on the + * add-on's behalf. + * + * Generated from protobuf field string oauth_client_id = 3; + * @param string $var + * @return $this + */ + public function setOauthClientId($var) + { + GPBUtil::checkString($var, True); + $this->oauth_client_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GSuiteAddOns/v1/proto/src/Google/Cloud/GSuiteAddOns/V1/CreateDeploymentRequest.php b/owl-bot-staging/GSuiteAddOns/v1/proto/src/Google/Cloud/GSuiteAddOns/V1/CreateDeploymentRequest.php new file mode 100644 index 000000000000..58cf6cc05a17 --- /dev/null +++ b/owl-bot-staging/GSuiteAddOns/v1/proto/src/Google/Cloud/GSuiteAddOns/V1/CreateDeploymentRequest.php @@ -0,0 +1,174 @@ +google.cloud.gsuiteaddons.v1.CreateDeploymentRequest + */ +class CreateDeploymentRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the project in which to create the deployment. + * Example: `projects/my_project`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The id to use for this deployment. The full name of the created + * resource will be `projects//deployments/`. + * + * Generated from protobuf field string deployment_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $deployment_id = ''; + /** + * Required. The deployment to create (deployment.name cannot be set). + * + * Generated from protobuf field .google.cloud.gsuiteaddons.v1.Deployment deployment = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $deployment = null; + + /** + * @param string $parent Required. Name of the project in which to create the deployment. + * + * Example: `projects/my_project`. Please see + * {@see GSuiteAddOnsClient::projectName()} for help formatting this field. + * @param \Google\Cloud\GSuiteAddOns\V1\Deployment $deployment Required. The deployment to create (deployment.name cannot be set). + * @param string $deploymentId Required. The id to use for this deployment. The full name of the created + * resource will be `projects//deployments/`. + * + * @return \Google\Cloud\GSuiteAddOns\V1\CreateDeploymentRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\GSuiteAddOns\V1\Deployment $deployment, string $deploymentId): self + { + return (new self()) + ->setParent($parent) + ->setDeployment($deployment) + ->setDeploymentId($deploymentId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. Name of the project in which to create the deployment. + * Example: `projects/my_project`. + * @type string $deployment_id + * Required. The id to use for this deployment. The full name of the created + * resource will be `projects//deployments/`. + * @type \Google\Cloud\GSuiteAddOns\V1\Deployment $deployment + * Required. The deployment to create (deployment.name cannot be set). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gsuiteaddons\V1\Gsuiteaddons::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the project in which to create the deployment. + * Example: `projects/my_project`. + * + * 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 project in which to create the deployment. + * Example: `projects/my_project`. + * + * 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. The id to use for this deployment. The full name of the created + * resource will be `projects//deployments/`. + * + * Generated from protobuf field string deployment_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getDeploymentId() + { + return $this->deployment_id; + } + + /** + * Required. The id to use for this deployment. The full name of the created + * resource will be `projects//deployments/`. + * + * Generated from protobuf field string deployment_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setDeploymentId($var) + { + GPBUtil::checkString($var, True); + $this->deployment_id = $var; + + return $this; + } + + /** + * Required. The deployment to create (deployment.name cannot be set). + * + * Generated from protobuf field .google.cloud.gsuiteaddons.v1.Deployment deployment = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\GSuiteAddOns\V1\Deployment|null + */ + public function getDeployment() + { + return $this->deployment; + } + + public function hasDeployment() + { + return isset($this->deployment); + } + + public function clearDeployment() + { + unset($this->deployment); + } + + /** + * Required. The deployment to create (deployment.name cannot be set). + * + * Generated from protobuf field .google.cloud.gsuiteaddons.v1.Deployment deployment = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\GSuiteAddOns\V1\Deployment $var + * @return $this + */ + public function setDeployment($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GSuiteAddOns\V1\Deployment::class); + $this->deployment = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GSuiteAddOns/v1/proto/src/Google/Cloud/GSuiteAddOns/V1/DeleteDeploymentRequest.php b/owl-bot-staging/GSuiteAddOns/v1/proto/src/Google/Cloud/GSuiteAddOns/V1/DeleteDeploymentRequest.php new file mode 100644 index 000000000000..fd86c02f4bad --- /dev/null +++ b/owl-bot-staging/GSuiteAddOns/v1/proto/src/Google/Cloud/GSuiteAddOns/V1/DeleteDeploymentRequest.php @@ -0,0 +1,125 @@ +google.cloud.gsuiteaddons.v1.DeleteDeploymentRequest + */ +class DeleteDeploymentRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The full resource name of the deployment to delete. + * Example: `projects/my_project/deployments/my_deployment`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * The etag of the deployment to delete. + * If this is provided, it must match the server's etag. + * + * Generated from protobuf field string etag = 2; + */ + protected $etag = ''; + + /** + * @param string $name Required. The full resource name of the deployment to delete. + * + * Example: `projects/my_project/deployments/my_deployment`. Please see + * {@see GSuiteAddOnsClient::deploymentName()} for help formatting this field. + * + * @return \Google\Cloud\GSuiteAddOns\V1\DeleteDeploymentRequest + * + * @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 full resource name of the deployment to delete. + * Example: `projects/my_project/deployments/my_deployment`. + * @type string $etag + * The etag of the deployment to delete. + * If this is provided, it must match the server's etag. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gsuiteaddons\V1\Gsuiteaddons::initOnce(); + parent::__construct($data); + } + + /** + * Required. The full resource name of the deployment to delete. + * Example: `projects/my_project/deployments/my_deployment`. + * + * 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 full resource name of the deployment to delete. + * Example: `projects/my_project/deployments/my_deployment`. + * + * 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; + } + + /** + * The etag of the deployment to delete. + * If this is provided, it must match the server's etag. + * + * Generated from protobuf field string etag = 2; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * The etag of the deployment to delete. + * If this is provided, it must match the server's etag. + * + * Generated from protobuf field string etag = 2; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, True); + $this->etag = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GSuiteAddOns/v1/proto/src/Google/Cloud/GSuiteAddOns/V1/Deployment.php b/owl-bot-staging/GSuiteAddOns/v1/proto/src/Google/Cloud/GSuiteAddOns/V1/Deployment.php new file mode 100644 index 000000000000..4eb8c8fefa1d --- /dev/null +++ b/owl-bot-staging/GSuiteAddOns/v1/proto/src/Google/Cloud/GSuiteAddOns/V1/Deployment.php @@ -0,0 +1,195 @@ +google.cloud.gsuiteaddons.v1.Deployment + */ +class Deployment extends \Google\Protobuf\Internal\Message +{ + /** + * The deployment resource name. + * Example: projects/123/deployments/my_deployment. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * The list of Google OAuth scopes for which to request consent from the end + * user before executing an add-on endpoint. + * + * Generated from protobuf field repeated string oauth_scopes = 2; + */ + private $oauth_scopes; + /** + * The Google Workspace Add-on configuration. + * + * Generated from protobuf field .google.cloud.gsuiteaddons.v1.AddOns add_ons = 3; + */ + protected $add_ons = null; + /** + * This value is computed by the server based on the version of the + * deployment in storage, and may be sent on update and delete requests to + * ensure the client has an up-to-date value before proceeding. + * + * Generated from protobuf field string etag = 5; + */ + protected $etag = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The deployment resource name. + * Example: projects/123/deployments/my_deployment. + * @type array|\Google\Protobuf\Internal\RepeatedField $oauth_scopes + * The list of Google OAuth scopes for which to request consent from the end + * user before executing an add-on endpoint. + * @type \Google\Cloud\GSuiteAddOns\V1\AddOns $add_ons + * The Google Workspace Add-on configuration. + * @type string $etag + * This value is computed by the server based on the version of the + * deployment in storage, and may be sent on update and delete requests to + * ensure the client has an up-to-date value before proceeding. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gsuiteaddons\V1\Gsuiteaddons::initOnce(); + parent::__construct($data); + } + + /** + * The deployment resource name. + * Example: projects/123/deployments/my_deployment. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The deployment resource name. + * Example: projects/123/deployments/my_deployment. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The list of Google OAuth scopes for which to request consent from the end + * user before executing an add-on endpoint. + * + * Generated from protobuf field repeated string oauth_scopes = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getOauthScopes() + { + return $this->oauth_scopes; + } + + /** + * The list of Google OAuth scopes for which to request consent from the end + * user before executing an add-on endpoint. + * + * Generated from protobuf field repeated string oauth_scopes = 2; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setOauthScopes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->oauth_scopes = $arr; + + return $this; + } + + /** + * The Google Workspace Add-on configuration. + * + * Generated from protobuf field .google.cloud.gsuiteaddons.v1.AddOns add_ons = 3; + * @return \Google\Cloud\GSuiteAddOns\V1\AddOns|null + */ + public function getAddOns() + { + return $this->add_ons; + } + + public function hasAddOns() + { + return isset($this->add_ons); + } + + public function clearAddOns() + { + unset($this->add_ons); + } + + /** + * The Google Workspace Add-on configuration. + * + * Generated from protobuf field .google.cloud.gsuiteaddons.v1.AddOns add_ons = 3; + * @param \Google\Cloud\GSuiteAddOns\V1\AddOns $var + * @return $this + */ + public function setAddOns($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GSuiteAddOns\V1\AddOns::class); + $this->add_ons = $var; + + return $this; + } + + /** + * This value is computed by the server based on the version of the + * deployment in storage, and may be sent on update and delete requests to + * ensure the client has an up-to-date value before proceeding. + * + * Generated from protobuf field string etag = 5; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * This value is computed by the server based on the version of the + * deployment in storage, and may be sent on update and delete requests to + * ensure the client has an up-to-date value before proceeding. + * + * Generated from protobuf field string etag = 5; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, True); + $this->etag = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GSuiteAddOns/v1/proto/src/Google/Cloud/GSuiteAddOns/V1/GSuiteAddOnsGrpcClient.php b/owl-bot-staging/GSuiteAddOns/v1/proto/src/Google/Cloud/GSuiteAddOns/V1/GSuiteAddOnsGrpcClient.php new file mode 100644 index 000000000000..49592e751e79 --- /dev/null +++ b/owl-bot-staging/GSuiteAddOns/v1/proto/src/Google/Cloud/GSuiteAddOns/V1/GSuiteAddOnsGrpcClient.php @@ -0,0 +1,201 @@ +_simpleRequest('/google.cloud.gsuiteaddons.v1.GSuiteAddOns/GetAuthorization', + $argument, + ['\Google\Cloud\GSuiteAddOns\V1\Authorization', 'decode'], + $metadata, $options); + } + + /** + * Creates a deployment with the specified name and configuration. + * @param \Google\Cloud\GSuiteAddOns\V1\CreateDeploymentRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function CreateDeployment(\Google\Cloud\GSuiteAddOns\V1\CreateDeploymentRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.gsuiteaddons.v1.GSuiteAddOns/CreateDeployment', + $argument, + ['\Google\Cloud\GSuiteAddOns\V1\Deployment', 'decode'], + $metadata, $options); + } + + /** + * Creates or replaces a deployment with the specified name. + * @param \Google\Cloud\GSuiteAddOns\V1\ReplaceDeploymentRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function ReplaceDeployment(\Google\Cloud\GSuiteAddOns\V1\ReplaceDeploymentRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.gsuiteaddons.v1.GSuiteAddOns/ReplaceDeployment', + $argument, + ['\Google\Cloud\GSuiteAddOns\V1\Deployment', 'decode'], + $metadata, $options); + } + + /** + * Gets the deployment with the specified name. + * @param \Google\Cloud\GSuiteAddOns\V1\GetDeploymentRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function GetDeployment(\Google\Cloud\GSuiteAddOns\V1\GetDeploymentRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.gsuiteaddons.v1.GSuiteAddOns/GetDeployment', + $argument, + ['\Google\Cloud\GSuiteAddOns\V1\Deployment', 'decode'], + $metadata, $options); + } + + /** + * Lists all deployments in a particular project. + * @param \Google\Cloud\GSuiteAddOns\V1\ListDeploymentsRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function ListDeployments(\Google\Cloud\GSuiteAddOns\V1\ListDeploymentsRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.gsuiteaddons.v1.GSuiteAddOns/ListDeployments', + $argument, + ['\Google\Cloud\GSuiteAddOns\V1\ListDeploymentsResponse', 'decode'], + $metadata, $options); + } + + /** + * Deletes the deployment with the given name. + * @param \Google\Cloud\GSuiteAddOns\V1\DeleteDeploymentRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function DeleteDeployment(\Google\Cloud\GSuiteAddOns\V1\DeleteDeploymentRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.gsuiteaddons.v1.GSuiteAddOns/DeleteDeployment', + $argument, + ['\Google\Protobuf\GPBEmpty', 'decode'], + $metadata, $options); + } + + /** + * Installs a deployment in developer mode. + * See: + * https://developers.google.com/gsuite/add-ons/how-tos/testing-gsuite-addons. + * @param \Google\Cloud\GSuiteAddOns\V1\InstallDeploymentRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function InstallDeployment(\Google\Cloud\GSuiteAddOns\V1\InstallDeploymentRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.gsuiteaddons.v1.GSuiteAddOns/InstallDeployment', + $argument, + ['\Google\Protobuf\GPBEmpty', 'decode'], + $metadata, $options); + } + + /** + * Uninstalls a developer mode deployment. + * See: + * https://developers.google.com/gsuite/add-ons/how-tos/testing-gsuite-addons. + * @param \Google\Cloud\GSuiteAddOns\V1\UninstallDeploymentRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function UninstallDeployment(\Google\Cloud\GSuiteAddOns\V1\UninstallDeploymentRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.gsuiteaddons.v1.GSuiteAddOns/UninstallDeployment', + $argument, + ['\Google\Protobuf\GPBEmpty', 'decode'], + $metadata, $options); + } + + /** + * Fetches the install status of a developer mode deployment. + * @param \Google\Cloud\GSuiteAddOns\V1\GetInstallStatusRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function GetInstallStatus(\Google\Cloud\GSuiteAddOns\V1\GetInstallStatusRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.gsuiteaddons.v1.GSuiteAddOns/GetInstallStatus', + $argument, + ['\Google\Cloud\GSuiteAddOns\V1\InstallStatus', 'decode'], + $metadata, $options); + } + +} diff --git a/owl-bot-staging/GSuiteAddOns/v1/proto/src/Google/Cloud/GSuiteAddOns/V1/GetAuthorizationRequest.php b/owl-bot-staging/GSuiteAddOns/v1/proto/src/Google/Cloud/GSuiteAddOns/V1/GetAuthorizationRequest.php new file mode 100644 index 000000000000..431a860fb261 --- /dev/null +++ b/owl-bot-staging/GSuiteAddOns/v1/proto/src/Google/Cloud/GSuiteAddOns/V1/GetAuthorizationRequest.php @@ -0,0 +1,92 @@ +google.cloud.gsuiteaddons.v1.GetAuthorizationRequest + */ +class GetAuthorizationRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the project for which to get the Google Workspace Add-ons + * authorization information. + * Example: `projects/my_project/authorization`. + * + * Generated from protobuf field string name = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. Name of the project for which to get the Google Workspace Add-ons + * authorization information. + * + * Example: `projects/my_project/authorization`. Please see + * {@see GSuiteAddOnsClient::authorizationName()} for help formatting this field. + * + * @return \Google\Cloud\GSuiteAddOns\V1\GetAuthorizationRequest + * + * @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 project for which to get the Google Workspace Add-ons + * authorization information. + * Example: `projects/my_project/authorization`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gsuiteaddons\V1\Gsuiteaddons::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the project for which to get the Google Workspace Add-ons + * authorization information. + * Example: `projects/my_project/authorization`. + * + * Generated from protobuf field string name = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Name of the project for which to get the Google Workspace Add-ons + * authorization information. + * Example: `projects/my_project/authorization`. + * + * Generated from protobuf field string name = 2 [(.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; + } + +} + diff --git a/owl-bot-staging/GSuiteAddOns/v1/proto/src/Google/Cloud/GSuiteAddOns/V1/GetDeploymentRequest.php b/owl-bot-staging/GSuiteAddOns/v1/proto/src/Google/Cloud/GSuiteAddOns/V1/GetDeploymentRequest.php new file mode 100644 index 000000000000..6de539926055 --- /dev/null +++ b/owl-bot-staging/GSuiteAddOns/v1/proto/src/Google/Cloud/GSuiteAddOns/V1/GetDeploymentRequest.php @@ -0,0 +1,87 @@ +google.cloud.gsuiteaddons.v1.GetDeploymentRequest + */ +class GetDeploymentRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The full resource name of the deployment to get. + * Example: `projects/my_project/deployments/my_deployment`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The full resource name of the deployment to get. + * + * Example: `projects/my_project/deployments/my_deployment`. Please see + * {@see GSuiteAddOnsClient::deploymentName()} for help formatting this field. + * + * @return \Google\Cloud\GSuiteAddOns\V1\GetDeploymentRequest + * + * @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 full resource name of the deployment to get. + * Example: `projects/my_project/deployments/my_deployment`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gsuiteaddons\V1\Gsuiteaddons::initOnce(); + parent::__construct($data); + } + + /** + * Required. The full resource name of the deployment to get. + * Example: `projects/my_project/deployments/my_deployment`. + * + * 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 full resource name of the deployment to get. + * Example: `projects/my_project/deployments/my_deployment`. + * + * 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; + } + +} + diff --git a/owl-bot-staging/GSuiteAddOns/v1/proto/src/Google/Cloud/GSuiteAddOns/V1/GetInstallStatusRequest.php b/owl-bot-staging/GSuiteAddOns/v1/proto/src/Google/Cloud/GSuiteAddOns/V1/GetInstallStatusRequest.php new file mode 100644 index 000000000000..e326d58f39be --- /dev/null +++ b/owl-bot-staging/GSuiteAddOns/v1/proto/src/Google/Cloud/GSuiteAddOns/V1/GetInstallStatusRequest.php @@ -0,0 +1,87 @@ +google.cloud.gsuiteaddons.v1.GetInstallStatusRequest + */ +class GetInstallStatusRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The full resource name of the deployment. + * Example: `projects/my_project/deployments/my_deployment/installStatus`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The full resource name of the deployment. + * + * Example: `projects/my_project/deployments/my_deployment/installStatus`. Please see + * {@see GSuiteAddOnsClient::installStatusName()} for help formatting this field. + * + * @return \Google\Cloud\GSuiteAddOns\V1\GetInstallStatusRequest + * + * @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 full resource name of the deployment. + * Example: `projects/my_project/deployments/my_deployment/installStatus`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gsuiteaddons\V1\Gsuiteaddons::initOnce(); + parent::__construct($data); + } + + /** + * Required. The full resource name of the deployment. + * Example: `projects/my_project/deployments/my_deployment/installStatus`. + * + * 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 full resource name of the deployment. + * Example: `projects/my_project/deployments/my_deployment/installStatus`. + * + * 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; + } + +} + diff --git a/owl-bot-staging/GSuiteAddOns/v1/proto/src/Google/Cloud/GSuiteAddOns/V1/InstallDeploymentRequest.php b/owl-bot-staging/GSuiteAddOns/v1/proto/src/Google/Cloud/GSuiteAddOns/V1/InstallDeploymentRequest.php new file mode 100644 index 000000000000..c0cddef7f5b5 --- /dev/null +++ b/owl-bot-staging/GSuiteAddOns/v1/proto/src/Google/Cloud/GSuiteAddOns/V1/InstallDeploymentRequest.php @@ -0,0 +1,87 @@ +google.cloud.gsuiteaddons.v1.InstallDeploymentRequest + */ +class InstallDeploymentRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The full resource name of the deployment to install. + * Example: `projects/my_project/deployments/my_deployment`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The full resource name of the deployment to install. + * + * Example: `projects/my_project/deployments/my_deployment`. Please see + * {@see GSuiteAddOnsClient::deploymentName()} for help formatting this field. + * + * @return \Google\Cloud\GSuiteAddOns\V1\InstallDeploymentRequest + * + * @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 full resource name of the deployment to install. + * Example: `projects/my_project/deployments/my_deployment`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gsuiteaddons\V1\Gsuiteaddons::initOnce(); + parent::__construct($data); + } + + /** + * Required. The full resource name of the deployment to install. + * Example: `projects/my_project/deployments/my_deployment`. + * + * 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 full resource name of the deployment to install. + * Example: `projects/my_project/deployments/my_deployment`. + * + * 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; + } + +} + diff --git a/owl-bot-staging/GSuiteAddOns/v1/proto/src/Google/Cloud/GSuiteAddOns/V1/InstallStatus.php b/owl-bot-staging/GSuiteAddOns/v1/proto/src/Google/Cloud/GSuiteAddOns/V1/InstallStatus.php new file mode 100644 index 000000000000..d3636bd3028c --- /dev/null +++ b/owl-bot-staging/GSuiteAddOns/v1/proto/src/Google/Cloud/GSuiteAddOns/V1/InstallStatus.php @@ -0,0 +1,142 @@ +google.cloud.gsuiteaddons.v1.InstallStatus + */ +class InstallStatus extends \Google\Protobuf\Internal\Message +{ + /** + * The canonical full resource name of the deployment install status. + * Example: `projects/123/deployments/my_deployment/installStatus`. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * True if the deployment is installed for the user + * + * Generated from protobuf field .google.protobuf.BoolValue installed = 2; + */ + protected $installed = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The canonical full resource name of the deployment install status. + * Example: `projects/123/deployments/my_deployment/installStatus`. + * @type \Google\Protobuf\BoolValue $installed + * True if the deployment is installed for the user + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gsuiteaddons\V1\Gsuiteaddons::initOnce(); + parent::__construct($data); + } + + /** + * The canonical full resource name of the deployment install status. + * Example: `projects/123/deployments/my_deployment/installStatus`. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The canonical full resource name of the deployment install status. + * Example: `projects/123/deployments/my_deployment/installStatus`. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * True if the deployment is installed for the user + * + * Generated from protobuf field .google.protobuf.BoolValue installed = 2; + * @return \Google\Protobuf\BoolValue|null + */ + public function getInstalled() + { + return $this->installed; + } + + public function hasInstalled() + { + return isset($this->installed); + } + + public function clearInstalled() + { + unset($this->installed); + } + + /** + * Returns the unboxed value from getInstalled() + + * True if the deployment is installed for the user + * + * Generated from protobuf field .google.protobuf.BoolValue installed = 2; + * @return bool|null + */ + public function getInstalledUnwrapped() + { + return $this->readWrapperValue("installed"); + } + + /** + * True if the deployment is installed for the user + * + * Generated from protobuf field .google.protobuf.BoolValue installed = 2; + * @param \Google\Protobuf\BoolValue $var + * @return $this + */ + public function setInstalled($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\BoolValue::class); + $this->installed = $var; + + return $this; + } + + /** + * Sets the field by wrapping a primitive type in a Google\Protobuf\BoolValue object. + + * True if the deployment is installed for the user + * + * Generated from protobuf field .google.protobuf.BoolValue installed = 2; + * @param bool|null $var + * @return $this + */ + public function setInstalledUnwrapped($var) + { + $this->writeWrapperValue("installed", $var); + return $this;} + +} + diff --git a/owl-bot-staging/GSuiteAddOns/v1/proto/src/Google/Cloud/GSuiteAddOns/V1/ListDeploymentsRequest.php b/owl-bot-staging/GSuiteAddOns/v1/proto/src/Google/Cloud/GSuiteAddOns/V1/ListDeploymentsRequest.php new file mode 100644 index 000000000000..0d3789df7934 --- /dev/null +++ b/owl-bot-staging/GSuiteAddOns/v1/proto/src/Google/Cloud/GSuiteAddOns/V1/ListDeploymentsRequest.php @@ -0,0 +1,179 @@ +google.cloud.gsuiteaddons.v1.ListDeploymentsRequest + */ +class ListDeploymentsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the project in which to create the deployment. + * Example: `projects/my_project`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The maximum number of deployments to return. The service may return fewer + * than this value. + * If unspecified, at most 1000 deployments will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * A page token, received from a previous `ListDeployments` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListDeployments` must + * match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + + /** + * @param string $parent Required. Name of the project in which to create the deployment. + * + * Example: `projects/my_project`. Please see + * {@see GSuiteAddOnsClient::projectName()} for help formatting this field. + * + * @return \Google\Cloud\GSuiteAddOns\V1\ListDeploymentsRequest + * + * @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 project in which to create the deployment. + * Example: `projects/my_project`. + * @type int $page_size + * The maximum number of deployments to return. The service may return fewer + * than this value. + * If unspecified, at most 1000 deployments will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + * @type string $page_token + * A page token, received from a previous `ListDeployments` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListDeployments` must + * match the call that provided the page token. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gsuiteaddons\V1\Gsuiteaddons::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the project in which to create the deployment. + * Example: `projects/my_project`. + * + * 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 project in which to create the deployment. + * Example: `projects/my_project`. + * + * 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; + } + + /** + * The maximum number of deployments to return. The service may return fewer + * than this value. + * If unspecified, at most 1000 deployments will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of deployments to return. The service may return fewer + * than this value. + * If unspecified, at most 1000 deployments will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * A page token, received from a previous `ListDeployments` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListDeployments` must + * match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * A page token, received from a previous `ListDeployments` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListDeployments` must + * match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GSuiteAddOns/v1/proto/src/Google/Cloud/GSuiteAddOns/V1/ListDeploymentsResponse.php b/owl-bot-staging/GSuiteAddOns/v1/proto/src/Google/Cloud/GSuiteAddOns/V1/ListDeploymentsResponse.php new file mode 100644 index 000000000000..4a2b06a63091 --- /dev/null +++ b/owl-bot-staging/GSuiteAddOns/v1/proto/src/Google/Cloud/GSuiteAddOns/V1/ListDeploymentsResponse.php @@ -0,0 +1,105 @@ +google.cloud.gsuiteaddons.v1.ListDeploymentsResponse + */ +class ListDeploymentsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of deployments for the given project. + * + * Generated from protobuf field repeated .google.cloud.gsuiteaddons.v1.Deployment deployments = 1; + */ + private $deployments; + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * 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\GSuiteAddOns\V1\Deployment>|\Google\Protobuf\Internal\RepeatedField $deployments + * The list of deployments for the given project. + * @type string $next_page_token + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gsuiteaddons\V1\Gsuiteaddons::initOnce(); + parent::__construct($data); + } + + /** + * The list of deployments for the given project. + * + * Generated from protobuf field repeated .google.cloud.gsuiteaddons.v1.Deployment deployments = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDeployments() + { + return $this->deployments; + } + + /** + * The list of deployments for the given project. + * + * Generated from protobuf field repeated .google.cloud.gsuiteaddons.v1.Deployment deployments = 1; + * @param array<\Google\Cloud\GSuiteAddOns\V1\Deployment>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDeployments($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\GSuiteAddOns\V1\Deployment::class); + $this->deployments = $arr; + + return $this; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * 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/GSuiteAddOns/v1/proto/src/Google/Cloud/GSuiteAddOns/V1/ReplaceDeploymentRequest.php b/owl-bot-staging/GSuiteAddOns/v1/proto/src/Google/Cloud/GSuiteAddOns/V1/ReplaceDeploymentRequest.php new file mode 100644 index 000000000000..3a79b65b564f --- /dev/null +++ b/owl-bot-staging/GSuiteAddOns/v1/proto/src/Google/Cloud/GSuiteAddOns/V1/ReplaceDeploymentRequest.php @@ -0,0 +1,90 @@ +google.cloud.gsuiteaddons.v1.ReplaceDeploymentRequest + */ +class ReplaceDeploymentRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The deployment to create or replace. + * + * Generated from protobuf field .google.cloud.gsuiteaddons.v1.Deployment deployment = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $deployment = null; + + /** + * @param \Google\Cloud\GSuiteAddOns\V1\Deployment $deployment Required. The deployment to create or replace. + * + * @return \Google\Cloud\GSuiteAddOns\V1\ReplaceDeploymentRequest + * + * @experimental + */ + public static function build(\Google\Cloud\GSuiteAddOns\V1\Deployment $deployment): self + { + return (new self()) + ->setDeployment($deployment); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\GSuiteAddOns\V1\Deployment $deployment + * Required. The deployment to create or replace. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gsuiteaddons\V1\Gsuiteaddons::initOnce(); + parent::__construct($data); + } + + /** + * Required. The deployment to create or replace. + * + * Generated from protobuf field .google.cloud.gsuiteaddons.v1.Deployment deployment = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\GSuiteAddOns\V1\Deployment|null + */ + public function getDeployment() + { + return $this->deployment; + } + + public function hasDeployment() + { + return isset($this->deployment); + } + + public function clearDeployment() + { + unset($this->deployment); + } + + /** + * Required. The deployment to create or replace. + * + * Generated from protobuf field .google.cloud.gsuiteaddons.v1.Deployment deployment = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\GSuiteAddOns\V1\Deployment $var + * @return $this + */ + public function setDeployment($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GSuiteAddOns\V1\Deployment::class); + $this->deployment = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GSuiteAddOns/v1/proto/src/Google/Cloud/GSuiteAddOns/V1/UninstallDeploymentRequest.php b/owl-bot-staging/GSuiteAddOns/v1/proto/src/Google/Cloud/GSuiteAddOns/V1/UninstallDeploymentRequest.php new file mode 100644 index 000000000000..92f1cbe2a500 --- /dev/null +++ b/owl-bot-staging/GSuiteAddOns/v1/proto/src/Google/Cloud/GSuiteAddOns/V1/UninstallDeploymentRequest.php @@ -0,0 +1,87 @@ +google.cloud.gsuiteaddons.v1.UninstallDeploymentRequest + */ +class UninstallDeploymentRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The full resource name of the deployment to install. + * Example: `projects/my_project/deployments/my_deployment`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The full resource name of the deployment to install. + * + * Example: `projects/my_project/deployments/my_deployment`. Please see + * {@see GSuiteAddOnsClient::deploymentName()} for help formatting this field. + * + * @return \Google\Cloud\GSuiteAddOns\V1\UninstallDeploymentRequest + * + * @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 full resource name of the deployment to install. + * Example: `projects/my_project/deployments/my_deployment`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gsuiteaddons\V1\Gsuiteaddons::initOnce(); + parent::__construct($data); + } + + /** + * Required. The full resource name of the deployment to install. + * Example: `projects/my_project/deployments/my_deployment`. + * + * 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 full resource name of the deployment to install. + * Example: `projects/my_project/deployments/my_deployment`. + * + * 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; + } + +} + diff --git a/owl-bot-staging/GSuiteAddOns/v1/samples/V1/GSuiteAddOnsClient/create_deployment.php b/owl-bot-staging/GSuiteAddOns/v1/samples/V1/GSuiteAddOnsClient/create_deployment.php new file mode 100644 index 000000000000..a226d9d259fd --- /dev/null +++ b/owl-bot-staging/GSuiteAddOns/v1/samples/V1/GSuiteAddOnsClient/create_deployment.php @@ -0,0 +1,79 @@ +/deployments/`. + */ +function create_deployment_sample(string $formattedParent, string $deploymentId): void +{ + // Create a client. + $gSuiteAddOnsClient = new GSuiteAddOnsClient(); + + // Prepare the request message. + $deployment = new Deployment(); + $request = (new CreateDeploymentRequest()) + ->setParent($formattedParent) + ->setDeploymentId($deploymentId) + ->setDeployment($deployment); + + // Call the API and handle any network failures. + try { + /** @var Deployment $response */ + $response = $gSuiteAddOnsClient->createDeployment($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 = GSuiteAddOnsClient::projectName('[PROJECT]'); + $deploymentId = '[DEPLOYMENT_ID]'; + + create_deployment_sample($formattedParent, $deploymentId); +} +// [END gsuiteaddons_v1_generated_GSuiteAddOns_CreateDeployment_sync] diff --git a/owl-bot-staging/GSuiteAddOns/v1/samples/V1/GSuiteAddOnsClient/delete_deployment.php b/owl-bot-staging/GSuiteAddOns/v1/samples/V1/GSuiteAddOnsClient/delete_deployment.php new file mode 100644 index 000000000000..12acf6f6b01d --- /dev/null +++ b/owl-bot-staging/GSuiteAddOns/v1/samples/V1/GSuiteAddOnsClient/delete_deployment.php @@ -0,0 +1,71 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + $gSuiteAddOnsClient->deleteDeployment($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 = GSuiteAddOnsClient::deploymentName('[PROJECT]', '[DEPLOYMENT]'); + + delete_deployment_sample($formattedName); +} +// [END gsuiteaddons_v1_generated_GSuiteAddOns_DeleteDeployment_sync] diff --git a/owl-bot-staging/GSuiteAddOns/v1/samples/V1/GSuiteAddOnsClient/get_authorization.php b/owl-bot-staging/GSuiteAddOns/v1/samples/V1/GSuiteAddOnsClient/get_authorization.php new file mode 100644 index 000000000000..304a833a5a89 --- /dev/null +++ b/owl-bot-staging/GSuiteAddOns/v1/samples/V1/GSuiteAddOnsClient/get_authorization.php @@ -0,0 +1,74 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var Authorization $response */ + $response = $gSuiteAddOnsClient->getAuthorization($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 = GSuiteAddOnsClient::authorizationName('[PROJECT]'); + + get_authorization_sample($formattedName); +} +// [END gsuiteaddons_v1_generated_GSuiteAddOns_GetAuthorization_sync] diff --git a/owl-bot-staging/GSuiteAddOns/v1/samples/V1/GSuiteAddOnsClient/get_deployment.php b/owl-bot-staging/GSuiteAddOns/v1/samples/V1/GSuiteAddOnsClient/get_deployment.php new file mode 100644 index 000000000000..bb06f0bce06d --- /dev/null +++ b/owl-bot-staging/GSuiteAddOns/v1/samples/V1/GSuiteAddOnsClient/get_deployment.php @@ -0,0 +1,73 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var Deployment $response */ + $response = $gSuiteAddOnsClient->getDeployment($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 = GSuiteAddOnsClient::deploymentName('[PROJECT]', '[DEPLOYMENT]'); + + get_deployment_sample($formattedName); +} +// [END gsuiteaddons_v1_generated_GSuiteAddOns_GetDeployment_sync] diff --git a/owl-bot-staging/GSuiteAddOns/v1/samples/V1/GSuiteAddOnsClient/get_install_status.php b/owl-bot-staging/GSuiteAddOns/v1/samples/V1/GSuiteAddOnsClient/get_install_status.php new file mode 100644 index 000000000000..97925956096d --- /dev/null +++ b/owl-bot-staging/GSuiteAddOns/v1/samples/V1/GSuiteAddOnsClient/get_install_status.php @@ -0,0 +1,73 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var InstallStatus $response */ + $response = $gSuiteAddOnsClient->getInstallStatus($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 = GSuiteAddOnsClient::installStatusName('[PROJECT]', '[DEPLOYMENT]'); + + get_install_status_sample($formattedName); +} +// [END gsuiteaddons_v1_generated_GSuiteAddOns_GetInstallStatus_sync] diff --git a/owl-bot-staging/GSuiteAddOns/v1/samples/V1/GSuiteAddOnsClient/install_deployment.php b/owl-bot-staging/GSuiteAddOns/v1/samples/V1/GSuiteAddOnsClient/install_deployment.php new file mode 100644 index 000000000000..77185c7b40c1 --- /dev/null +++ b/owl-bot-staging/GSuiteAddOns/v1/samples/V1/GSuiteAddOnsClient/install_deployment.php @@ -0,0 +1,73 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + $gSuiteAddOnsClient->installDeployment($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 = GSuiteAddOnsClient::deploymentName('[PROJECT]', '[DEPLOYMENT]'); + + install_deployment_sample($formattedName); +} +// [END gsuiteaddons_v1_generated_GSuiteAddOns_InstallDeployment_sync] diff --git a/owl-bot-staging/GSuiteAddOns/v1/samples/V1/GSuiteAddOnsClient/list_deployments.php b/owl-bot-staging/GSuiteAddOns/v1/samples/V1/GSuiteAddOnsClient/list_deployments.php new file mode 100644 index 000000000000..1326fcb5fbdc --- /dev/null +++ b/owl-bot-staging/GSuiteAddOns/v1/samples/V1/GSuiteAddOnsClient/list_deployments.php @@ -0,0 +1,78 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $gSuiteAddOnsClient->listDeployments($request); + + /** @var Deployment $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 = GSuiteAddOnsClient::projectName('[PROJECT]'); + + list_deployments_sample($formattedParent); +} +// [END gsuiteaddons_v1_generated_GSuiteAddOns_ListDeployments_sync] diff --git a/owl-bot-staging/GSuiteAddOns/v1/samples/V1/GSuiteAddOnsClient/replace_deployment.php b/owl-bot-staging/GSuiteAddOns/v1/samples/V1/GSuiteAddOnsClient/replace_deployment.php new file mode 100644 index 000000000000..69ba15603e23 --- /dev/null +++ b/owl-bot-staging/GSuiteAddOns/v1/samples/V1/GSuiteAddOnsClient/replace_deployment.php @@ -0,0 +1,59 @@ +setDeployment($deployment); + + // Call the API and handle any network failures. + try { + /** @var Deployment $response */ + $response = $gSuiteAddOnsClient->replaceDeployment($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END gsuiteaddons_v1_generated_GSuiteAddOns_ReplaceDeployment_sync] diff --git a/owl-bot-staging/GSuiteAddOns/v1/samples/V1/GSuiteAddOnsClient/uninstall_deployment.php b/owl-bot-staging/GSuiteAddOns/v1/samples/V1/GSuiteAddOnsClient/uninstall_deployment.php new file mode 100644 index 000000000000..e27b5d95111a --- /dev/null +++ b/owl-bot-staging/GSuiteAddOns/v1/samples/V1/GSuiteAddOnsClient/uninstall_deployment.php @@ -0,0 +1,73 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + $gSuiteAddOnsClient->uninstallDeployment($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 = GSuiteAddOnsClient::deploymentName('[PROJECT]', '[DEPLOYMENT]'); + + uninstall_deployment_sample($formattedName); +} +// [END gsuiteaddons_v1_generated_GSuiteAddOns_UninstallDeployment_sync] diff --git a/owl-bot-staging/GSuiteAddOns/v1/src/V1/Client/BaseClient/GSuiteAddOnsBaseClient.php b/owl-bot-staging/GSuiteAddOns/v1/src/V1/Client/BaseClient/GSuiteAddOnsBaseClient.php new file mode 100644 index 000000000000..a43fefe39cd2 --- /dev/null +++ b/owl-bot-staging/GSuiteAddOns/v1/src/V1/Client/BaseClient/GSuiteAddOnsBaseClient.php @@ -0,0 +1,520 @@ + self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../../resources/g_suite_add_ons_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../../resources/g_suite_add_ons_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../../resources/g_suite_add_ons_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../../resources/g_suite_add_ons_rest_client_config.php', + ], + ], + ]; + } + + /** + * Formats a string containing the fully-qualified path to represent a + * authorization resource. + * + * @param string $project + * + * @return string The formatted authorization resource. + */ + public static function authorizationName(string $project): string + { + return self::getPathTemplate('authorization')->render([ + 'project' => $project, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a deployment + * resource. + * + * @param string $project + * @param string $deployment + * + * @return string The formatted deployment resource. + */ + public static function deploymentName(string $project, string $deployment): string + { + return self::getPathTemplate('deployment')->render([ + 'project' => $project, + 'deployment' => $deployment, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * install_status resource. + * + * @param string $project + * @param string $deployment + * + * @return string The formatted install_status resource. + */ + public static function installStatusName(string $project, string $deployment): string + { + return self::getPathTemplate('installStatus')->render([ + 'project' => $project, + 'deployment' => $deployment, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a project + * resource. + * + * @param string $project + * + * @return string The formatted project resource. + */ + public static function projectName(string $project): string + { + return self::getPathTemplate('project')->render([ + 'project' => $project, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - authorization: projects/{project}/authorization + * - deployment: projects/{project}/deployments/{deployment} + * - installStatus: projects/{project}/deployments/{deployment}/installStatus + * - project: projects/{project} + * + * 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 'gsuiteaddons.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. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *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' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods 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); + } + + /** 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 deployment with the specified name and configuration. + * + * The async variant is {@see self::createDeploymentAsync()} . + * + * @param CreateDeploymentRequest $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 Deployment + * + * @throws ApiException Thrown if the API call fails. + */ + public function createDeployment(CreateDeploymentRequest $request, array $callOptions = []): Deployment + { + return $this->startApiCall('CreateDeployment', $request, $callOptions)->wait(); + } + + /** + * Deletes the deployment with the given name. + * + * The async variant is {@see self::deleteDeploymentAsync()} . + * + * @param DeleteDeploymentRequest $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 deleteDeployment(DeleteDeploymentRequest $request, array $callOptions = []): void + { + $this->startApiCall('DeleteDeployment', $request, $callOptions)->wait(); + } + + /** + * Gets the authorization information for deployments in a given project. + * + * The async variant is {@see self::getAuthorizationAsync()} . + * + * @param GetAuthorizationRequest $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 Authorization + * + * @throws ApiException Thrown if the API call fails. + */ + public function getAuthorization(GetAuthorizationRequest $request, array $callOptions = []): Authorization + { + return $this->startApiCall('GetAuthorization', $request, $callOptions)->wait(); + } + + /** + * Gets the deployment with the specified name. + * + * The async variant is {@see self::getDeploymentAsync()} . + * + * @param GetDeploymentRequest $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 Deployment + * + * @throws ApiException Thrown if the API call fails. + */ + public function getDeployment(GetDeploymentRequest $request, array $callOptions = []): Deployment + { + return $this->startApiCall('GetDeployment', $request, $callOptions)->wait(); + } + + /** + * Fetches the install status of a developer mode deployment. + * + * The async variant is {@see self::getInstallStatusAsync()} . + * + * @param GetInstallStatusRequest $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 InstallStatus + * + * @throws ApiException Thrown if the API call fails. + */ + public function getInstallStatus(GetInstallStatusRequest $request, array $callOptions = []): InstallStatus + { + return $this->startApiCall('GetInstallStatus', $request, $callOptions)->wait(); + } + + /** + * Installs a deployment in developer mode. + * See: + * https://developers.google.com/gsuite/add-ons/how-tos/testing-gsuite-addons. + * + * The async variant is {@see self::installDeploymentAsync()} . + * + * @param InstallDeploymentRequest $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 installDeployment(InstallDeploymentRequest $request, array $callOptions = []): void + { + $this->startApiCall('InstallDeployment', $request, $callOptions)->wait(); + } + + /** + * Lists all deployments in a particular project. + * + * The async variant is {@see self::listDeploymentsAsync()} . + * + * @param ListDeploymentsRequest $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 listDeployments(ListDeploymentsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListDeployments', $request, $callOptions); + } + + /** + * Creates or replaces a deployment with the specified name. + * + * The async variant is {@see self::replaceDeploymentAsync()} . + * + * @param ReplaceDeploymentRequest $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 Deployment + * + * @throws ApiException Thrown if the API call fails. + */ + public function replaceDeployment(ReplaceDeploymentRequest $request, array $callOptions = []): Deployment + { + return $this->startApiCall('ReplaceDeployment', $request, $callOptions)->wait(); + } + + /** + * Uninstalls a developer mode deployment. + * See: + * https://developers.google.com/gsuite/add-ons/how-tos/testing-gsuite-addons. + * + * The async variant is {@see self::uninstallDeploymentAsync()} . + * + * @param UninstallDeploymentRequest $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 uninstallDeployment(UninstallDeploymentRequest $request, array $callOptions = []): void + { + $this->startApiCall('UninstallDeployment', $request, $callOptions)->wait(); + } +} diff --git a/owl-bot-staging/GSuiteAddOns/v1/src/V1/Client/GSuiteAddOnsClient.php b/owl-bot-staging/GSuiteAddOns/v1/src/V1/Client/GSuiteAddOnsClient.php new file mode 100644 index 000000000000..95e8054f51ca --- /dev/null +++ b/owl-bot-staging/GSuiteAddOns/v1/src/V1/Client/GSuiteAddOnsClient.php @@ -0,0 +1,40 @@ +projectName('[PROJECT]'); + * $deploymentId = 'deployment_id'; + * $deployment = new Deployment(); + * $response = $gSuiteAddOnsClient->createDeployment($formattedParent, $deploymentId, $deployment); + * } finally { + * $gSuiteAddOnsClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + */ +class GSuiteAddOnsGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.gsuiteaddons.v1.GSuiteAddOns'; + + /** The default address of the service. */ + const SERVICE_ADDRESS = 'gsuiteaddons.googleapis.com'; + + /** The default port of the service. */ + const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + ]; + + private static $authorizationNameTemplate; + + private static $deploymentNameTemplate; + + private static $installStatusNameTemplate; + + private static $projectNameTemplate; + + private static $pathTemplateMap; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/g_suite_add_ons_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/g_suite_add_ons_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/g_suite_add_ons_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/g_suite_add_ons_rest_client_config.php', + ], + ], + ]; + } + + private static function getAuthorizationNameTemplate() + { + if (self::$authorizationNameTemplate == null) { + self::$authorizationNameTemplate = new PathTemplate('projects/{project}/authorization'); + } + + return self::$authorizationNameTemplate; + } + + private static function getDeploymentNameTemplate() + { + if (self::$deploymentNameTemplate == null) { + self::$deploymentNameTemplate = new PathTemplate('projects/{project}/deployments/{deployment}'); + } + + return self::$deploymentNameTemplate; + } + + private static function getInstallStatusNameTemplate() + { + if (self::$installStatusNameTemplate == null) { + self::$installStatusNameTemplate = new PathTemplate('projects/{project}/deployments/{deployment}/installStatus'); + } + + return self::$installStatusNameTemplate; + } + + private static function getProjectNameTemplate() + { + if (self::$projectNameTemplate == null) { + self::$projectNameTemplate = new PathTemplate('projects/{project}'); + } + + return self::$projectNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'authorization' => self::getAuthorizationNameTemplate(), + 'deployment' => self::getDeploymentNameTemplate(), + 'installStatus' => self::getInstallStatusNameTemplate(), + 'project' => self::getProjectNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a + * authorization resource. + * + * @param string $project + * + * @return string The formatted authorization resource. + */ + public static function authorizationName($project) + { + return self::getAuthorizationNameTemplate()->render([ + 'project' => $project, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a deployment + * resource. + * + * @param string $project + * @param string $deployment + * + * @return string The formatted deployment resource. + */ + public static function deploymentName($project, $deployment) + { + return self::getDeploymentNameTemplate()->render([ + 'project' => $project, + 'deployment' => $deployment, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * install_status resource. + * + * @param string $project + * @param string $deployment + * + * @return string The formatted install_status resource. + */ + public static function installStatusName($project, $deployment) + { + return self::getInstallStatusNameTemplate()->render([ + 'project' => $project, + 'deployment' => $deployment, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a project + * resource. + * + * @param string $project + * + * @return string The formatted project resource. + */ + public static function projectName($project) + { + return self::getProjectNameTemplate()->render([ + 'project' => $project, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - authorization: projects/{project}/authorization + * - deployment: projects/{project}/deployments/{deployment} + * - installStatus: projects/{project}/deployments/{deployment}/installStatus + * - project: projects/{project} + * + * 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($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * 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 'gsuiteaddons.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. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *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' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods 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); + } + + /** + * Creates a deployment with the specified name and configuration. + * + * Sample code: + * ``` + * $gSuiteAddOnsClient = new GSuiteAddOnsClient(); + * try { + * $formattedParent = $gSuiteAddOnsClient->projectName('[PROJECT]'); + * $deploymentId = 'deployment_id'; + * $deployment = new Deployment(); + * $response = $gSuiteAddOnsClient->createDeployment($formattedParent, $deploymentId, $deployment); + * } finally { + * $gSuiteAddOnsClient->close(); + * } + * ``` + * + * @param string $parent Required. Name of the project in which to create the deployment. + * + * Example: `projects/my_project`. + * @param string $deploymentId Required. The id to use for this deployment. The full name of the created + * resource will be `projects//deployments/`. + * @param Deployment $deployment Required. The deployment to create (deployment.name cannot be set). + * @param array $optionalArgs { + * 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 \Google\Cloud\GSuiteAddOns\V1\Deployment + * + * @throws ApiException if the remote call fails + */ + public function createDeployment($parent, $deploymentId, $deployment, array $optionalArgs = []) + { + $request = new CreateDeploymentRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setDeploymentId($deploymentId); + $request->setDeployment($deployment); + $requestParamHeaders['parent'] = $parent; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('CreateDeployment', Deployment::class, $optionalArgs, $request)->wait(); + } + + /** + * Deletes the deployment with the given name. + * + * Sample code: + * ``` + * $gSuiteAddOnsClient = new GSuiteAddOnsClient(); + * try { + * $formattedName = $gSuiteAddOnsClient->deploymentName('[PROJECT]', '[DEPLOYMENT]'); + * $gSuiteAddOnsClient->deleteDeployment($formattedName); + * } finally { + * $gSuiteAddOnsClient->close(); + * } + * ``` + * + * @param string $name Required. The full resource name of the deployment to delete. + * + * Example: `projects/my_project/deployments/my_deployment`. + * @param array $optionalArgs { + * Optional. + * + * @type string $etag + * The etag of the deployment to delete. + * If this is provided, it must match the server's etag. + * @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 if the remote call fails + */ + public function deleteDeployment($name, array $optionalArgs = []) + { + $request = new DeleteDeploymentRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['etag'])) { + $request->setEtag($optionalArgs['etag']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('DeleteDeployment', GPBEmpty::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets the authorization information for deployments in a given project. + * + * Sample code: + * ``` + * $gSuiteAddOnsClient = new GSuiteAddOnsClient(); + * try { + * $formattedName = $gSuiteAddOnsClient->authorizationName('[PROJECT]'); + * $response = $gSuiteAddOnsClient->getAuthorization($formattedName); + * } finally { + * $gSuiteAddOnsClient->close(); + * } + * ``` + * + * @param string $name Required. Name of the project for which to get the Google Workspace Add-ons + * authorization information. + * + * Example: `projects/my_project/authorization`. + * @param array $optionalArgs { + * 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 \Google\Cloud\GSuiteAddOns\V1\Authorization + * + * @throws ApiException if the remote call fails + */ + public function getAuthorization($name, array $optionalArgs = []) + { + $request = new GetAuthorizationRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetAuthorization', Authorization::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets the deployment with the specified name. + * + * Sample code: + * ``` + * $gSuiteAddOnsClient = new GSuiteAddOnsClient(); + * try { + * $formattedName = $gSuiteAddOnsClient->deploymentName('[PROJECT]', '[DEPLOYMENT]'); + * $response = $gSuiteAddOnsClient->getDeployment($formattedName); + * } finally { + * $gSuiteAddOnsClient->close(); + * } + * ``` + * + * @param string $name Required. The full resource name of the deployment to get. + * + * Example: `projects/my_project/deployments/my_deployment`. + * @param array $optionalArgs { + * 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 \Google\Cloud\GSuiteAddOns\V1\Deployment + * + * @throws ApiException if the remote call fails + */ + public function getDeployment($name, array $optionalArgs = []) + { + $request = new GetDeploymentRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetDeployment', Deployment::class, $optionalArgs, $request)->wait(); + } + + /** + * Fetches the install status of a developer mode deployment. + * + * Sample code: + * ``` + * $gSuiteAddOnsClient = new GSuiteAddOnsClient(); + * try { + * $formattedName = $gSuiteAddOnsClient->installStatusName('[PROJECT]', '[DEPLOYMENT]'); + * $response = $gSuiteAddOnsClient->getInstallStatus($formattedName); + * } finally { + * $gSuiteAddOnsClient->close(); + * } + * ``` + * + * @param string $name Required. The full resource name of the deployment. + * + * Example: `projects/my_project/deployments/my_deployment/installStatus`. + * @param array $optionalArgs { + * 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 \Google\Cloud\GSuiteAddOns\V1\InstallStatus + * + * @throws ApiException if the remote call fails + */ + public function getInstallStatus($name, array $optionalArgs = []) + { + $request = new GetInstallStatusRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetInstallStatus', InstallStatus::class, $optionalArgs, $request)->wait(); + } + + /** + * Installs a deployment in developer mode. + * See: + * https://developers.google.com/gsuite/add-ons/how-tos/testing-gsuite-addons. + * + * Sample code: + * ``` + * $gSuiteAddOnsClient = new GSuiteAddOnsClient(); + * try { + * $formattedName = $gSuiteAddOnsClient->deploymentName('[PROJECT]', '[DEPLOYMENT]'); + * $gSuiteAddOnsClient->installDeployment($formattedName); + * } finally { + * $gSuiteAddOnsClient->close(); + * } + * ``` + * + * @param string $name Required. The full resource name of the deployment to install. + * + * Example: `projects/my_project/deployments/my_deployment`. + * @param array $optionalArgs { + * 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 if the remote call fails + */ + public function installDeployment($name, array $optionalArgs = []) + { + $request = new InstallDeploymentRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('InstallDeployment', GPBEmpty::class, $optionalArgs, $request)->wait(); + } + + /** + * Lists all deployments in a particular project. + * + * Sample code: + * ``` + * $gSuiteAddOnsClient = new GSuiteAddOnsClient(); + * try { + * $formattedParent = $gSuiteAddOnsClient->projectName('[PROJECT]'); + * // Iterate over pages of elements + * $pagedResponse = $gSuiteAddOnsClient->listDeployments($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $gSuiteAddOnsClient->listDeployments($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $gSuiteAddOnsClient->close(); + * } + * ``` + * + * @param string $parent Required. Name of the project in which to create the deployment. + * + * Example: `projects/my_project`. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @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 \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listDeployments($parent, array $optionalArgs = []) + { + $request = new ListDeploymentsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListDeployments', $optionalArgs, ListDeploymentsResponse::class, $request); + } + + /** + * Creates or replaces a deployment with the specified name. + * + * Sample code: + * ``` + * $gSuiteAddOnsClient = new GSuiteAddOnsClient(); + * try { + * $deployment = new Deployment(); + * $response = $gSuiteAddOnsClient->replaceDeployment($deployment); + * } finally { + * $gSuiteAddOnsClient->close(); + * } + * ``` + * + * @param Deployment $deployment Required. The deployment to create or replace. + * @param array $optionalArgs { + * 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 \Google\Cloud\GSuiteAddOns\V1\Deployment + * + * @throws ApiException if the remote call fails + */ + public function replaceDeployment($deployment, array $optionalArgs = []) + { + $request = new ReplaceDeploymentRequest(); + $requestParamHeaders = []; + $request->setDeployment($deployment); + $requestParamHeaders['deployment.name'] = $deployment->getName(); + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('ReplaceDeployment', Deployment::class, $optionalArgs, $request)->wait(); + } + + /** + * Uninstalls a developer mode deployment. + * See: + * https://developers.google.com/gsuite/add-ons/how-tos/testing-gsuite-addons. + * + * Sample code: + * ``` + * $gSuiteAddOnsClient = new GSuiteAddOnsClient(); + * try { + * $formattedName = $gSuiteAddOnsClient->deploymentName('[PROJECT]', '[DEPLOYMENT]'); + * $gSuiteAddOnsClient->uninstallDeployment($formattedName); + * } finally { + * $gSuiteAddOnsClient->close(); + * } + * ``` + * + * @param string $name Required. The full resource name of the deployment to install. + * + * Example: `projects/my_project/deployments/my_deployment`. + * @param array $optionalArgs { + * 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 if the remote call fails + */ + public function uninstallDeployment($name, array $optionalArgs = []) + { + $request = new UninstallDeploymentRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('UninstallDeployment', GPBEmpty::class, $optionalArgs, $request)->wait(); + } +} diff --git a/owl-bot-staging/GSuiteAddOns/v1/src/V1/gapic_metadata.json b/owl-bot-staging/GSuiteAddOns/v1/src/V1/gapic_metadata.json new file mode 100644 index 000000000000..7e5b8ce080e6 --- /dev/null +++ b/owl-bot-staging/GSuiteAddOns/v1/src/V1/gapic_metadata.json @@ -0,0 +1,63 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services\/RPCs to the corresponding library clients\/methods", + "language": "php", + "protoPackage": "google.cloud.gsuiteaddons.v1", + "libraryPackage": "Google\\Cloud\\GSuiteAddOns\\V1", + "services": { + "GSuiteAddOns": { + "clients": { + "grpc": { + "libraryClient": "GSuiteAddOnsGapicClient", + "rpcs": { + "CreateDeployment": { + "methods": [ + "createDeployment" + ] + }, + "DeleteDeployment": { + "methods": [ + "deleteDeployment" + ] + }, + "GetAuthorization": { + "methods": [ + "getAuthorization" + ] + }, + "GetDeployment": { + "methods": [ + "getDeployment" + ] + }, + "GetInstallStatus": { + "methods": [ + "getInstallStatus" + ] + }, + "InstallDeployment": { + "methods": [ + "installDeployment" + ] + }, + "ListDeployments": { + "methods": [ + "listDeployments" + ] + }, + "ReplaceDeployment": { + "methods": [ + "replaceDeployment" + ] + }, + "UninstallDeployment": { + "methods": [ + "uninstallDeployment" + ] + } + } + } + } + } + } +} \ No newline at end of file diff --git a/owl-bot-staging/GSuiteAddOns/v1/src/V1/resources/g_suite_add_ons_client_config.json b/owl-bot-staging/GSuiteAddOns/v1/src/V1/resources/g_suite_add_ons_client_config.json new file mode 100644 index 000000000000..72ccdb04dcea --- /dev/null +++ b/owl-bot-staging/GSuiteAddOns/v1/src/V1/resources/g_suite_add_ons_client_config.json @@ -0,0 +1,100 @@ +{ + "interfaces": { + "google.cloud.gsuiteaddons.v1.GSuiteAddOns": { + "retry_codes": { + "no_retry_codes": [], + "retry_policy_1_codes": [ + "UNAVAILABLE", + "UNKNOWN" + ], + "no_retry_1_codes": [], + "no_retry_2_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": 1.3, + "max_retry_delay_millis": 10000, + "initial_rpc_timeout_millis": 10000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 10000, + "total_timeout_millis": 10000 + }, + "no_retry_1_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 10000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 10000, + "total_timeout_millis": 10000 + }, + "no_retry_2_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 120000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 120000, + "total_timeout_millis": 120000 + } + }, + "methods": { + "CreateDeployment": { + "timeout_millis": 10000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "DeleteDeployment": { + "timeout_millis": 10000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "GetAuthorization": { + "timeout_millis": 120000, + "retry_codes_name": "no_retry_2_codes", + "retry_params_name": "no_retry_2_params" + }, + "GetDeployment": { + "timeout_millis": 10000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetInstallStatus": { + "timeout_millis": 10000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "InstallDeployment": { + "timeout_millis": 10000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListDeployments": { + "timeout_millis": 10000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ReplaceDeployment": { + "timeout_millis": 10000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "UninstallDeployment": { + "timeout_millis": 10000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + } + } + } + } +} diff --git a/owl-bot-staging/GSuiteAddOns/v1/src/V1/resources/g_suite_add_ons_descriptor_config.php b/owl-bot-staging/GSuiteAddOns/v1/src/V1/resources/g_suite_add_ons_descriptor_config.php new file mode 100644 index 000000000000..324f1a563071 --- /dev/null +++ b/owl-bot-staging/GSuiteAddOns/v1/src/V1/resources/g_suite_add_ons_descriptor_config.php @@ -0,0 +1,131 @@ + [ + 'google.cloud.gsuiteaddons.v1.GSuiteAddOns' => [ + 'CreateDeployment' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\GSuiteAddOns\V1\Deployment', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'DeleteDeployment' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetAuthorization' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\GSuiteAddOns\V1\Authorization', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetDeployment' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\GSuiteAddOns\V1\Deployment', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetInstallStatus' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\GSuiteAddOns\V1\InstallStatus', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'InstallDeployment' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'ListDeployments' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getDeployments', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\GSuiteAddOns\V1\ListDeploymentsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ReplaceDeployment' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\GSuiteAddOns\V1\Deployment', + 'headerParams' => [ + [ + 'keyName' => 'deployment.name', + 'fieldAccessors' => [ + 'getDeployment', + 'getName', + ], + ], + ], + ], + 'UninstallDeployment' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'templateMap' => [ + 'authorization' => 'projects/{project}/authorization', + 'deployment' => 'projects/{project}/deployments/{deployment}', + 'installStatus' => 'projects/{project}/deployments/{deployment}/installStatus', + 'project' => 'projects/{project}', + ], + ], + ], +]; diff --git a/owl-bot-staging/GSuiteAddOns/v1/src/V1/resources/g_suite_add_ons_rest_client_config.php b/owl-bot-staging/GSuiteAddOns/v1/src/V1/resources/g_suite_add_ons_rest_client_config.php new file mode 100644 index 000000000000..38e022bdead8 --- /dev/null +++ b/owl-bot-staging/GSuiteAddOns/v1/src/V1/resources/g_suite_add_ons_rest_client_config.php @@ -0,0 +1,116 @@ + [ + 'google.cloud.gsuiteaddons.v1.GSuiteAddOns' => [ + 'CreateDeployment' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*}/deployments', + 'body' => 'deployment', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'deployment_id', + ], + ], + 'DeleteDeployment' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/deployments/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetAuthorization' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/authorization}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetDeployment' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/deployments/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetInstallStatus' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/deployments/*/installStatus}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'InstallDeployment' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/deployments/*}:install', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListDeployments' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*}/deployments', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ReplaceDeployment' => [ + 'method' => 'put', + 'uriTemplate' => '/v1/{deployment.name=projects/*/deployments/*}', + 'body' => 'deployment', + 'placeholders' => [ + 'deployment.name' => [ + 'getters' => [ + 'getDeployment', + 'getName', + ], + ], + ], + ], + 'UninstallDeployment' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/deployments/*}:uninstall', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/GSuiteAddOns/v1/tests/Unit/V1/Client/GSuiteAddOnsClientTest.php b/owl-bot-staging/GSuiteAddOns/v1/tests/Unit/V1/Client/GSuiteAddOnsClientTest.php new file mode 100644 index 000000000000..bee744fc1009 --- /dev/null +++ b/owl-bot-staging/GSuiteAddOns/v1/tests/Unit/V1/Client/GSuiteAddOnsClientTest.php @@ -0,0 +1,710 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return GSuiteAddOnsClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new GSuiteAddOnsClient($options); + } + + /** @test */ + public function createDeploymentTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $etag = 'etag3123477'; + $expectedResponse = new Deployment(); + $expectedResponse->setName($name); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $deploymentId = 'deploymentId51250389'; + $deployment = new Deployment(); + $request = (new CreateDeploymentRequest()) + ->setParent($formattedParent) + ->setDeploymentId($deploymentId) + ->setDeployment($deployment); + $response = $gapicClient->createDeployment($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gsuiteaddons.v1.GSuiteAddOns/CreateDeployment', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getDeploymentId(); + $this->assertProtobufEquals($deploymentId, $actualValue); + $actualValue = $actualRequestObject->getDeployment(); + $this->assertProtobufEquals($deployment, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createDeploymentExceptionTest() + { + $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->projectName('[PROJECT]'); + $deploymentId = 'deploymentId51250389'; + $deployment = new Deployment(); + $request = (new CreateDeploymentRequest()) + ->setParent($formattedParent) + ->setDeploymentId($deploymentId) + ->setDeployment($deployment); + try { + $gapicClient->createDeployment($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 deleteDeploymentTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->deploymentName('[PROJECT]', '[DEPLOYMENT]'); + $request = (new DeleteDeploymentRequest()) + ->setName($formattedName); + $gapicClient->deleteDeployment($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gsuiteaddons.v1.GSuiteAddOns/DeleteDeployment', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteDeploymentExceptionTest() + { + $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->deploymentName('[PROJECT]', '[DEPLOYMENT]'); + $request = (new DeleteDeploymentRequest()) + ->setName($formattedName); + try { + $gapicClient->deleteDeployment($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 getAuthorizationTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $serviceAccountEmail = 'serviceAccountEmail-1300473088'; + $oauthClientId = 'oauthClientId-1137123737'; + $expectedResponse = new Authorization(); + $expectedResponse->setName($name2); + $expectedResponse->setServiceAccountEmail($serviceAccountEmail); + $expectedResponse->setOauthClientId($oauthClientId); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->authorizationName('[PROJECT]'); + $request = (new GetAuthorizationRequest()) + ->setName($formattedName); + $response = $gapicClient->getAuthorization($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gsuiteaddons.v1.GSuiteAddOns/GetAuthorization', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getAuthorizationExceptionTest() + { + $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->authorizationName('[PROJECT]'); + $request = (new GetAuthorizationRequest()) + ->setName($formattedName); + try { + $gapicClient->getAuthorization($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 getDeploymentTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $etag = 'etag3123477'; + $expectedResponse = new Deployment(); + $expectedResponse->setName($name2); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->deploymentName('[PROJECT]', '[DEPLOYMENT]'); + $request = (new GetDeploymentRequest()) + ->setName($formattedName); + $response = $gapicClient->getDeployment($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gsuiteaddons.v1.GSuiteAddOns/GetDeployment', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getDeploymentExceptionTest() + { + $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->deploymentName('[PROJECT]', '[DEPLOYMENT]'); + $request = (new GetDeploymentRequest()) + ->setName($formattedName); + try { + $gapicClient->getDeployment($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 getInstallStatusTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $expectedResponse = new InstallStatus(); + $expectedResponse->setName($name2); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->installStatusName('[PROJECT]', '[DEPLOYMENT]'); + $request = (new GetInstallStatusRequest()) + ->setName($formattedName); + $response = $gapicClient->getInstallStatus($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gsuiteaddons.v1.GSuiteAddOns/GetInstallStatus', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getInstallStatusExceptionTest() + { + $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->installStatusName('[PROJECT]', '[DEPLOYMENT]'); + $request = (new GetInstallStatusRequest()) + ->setName($formattedName); + try { + $gapicClient->getInstallStatus($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 installDeploymentTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->deploymentName('[PROJECT]', '[DEPLOYMENT]'); + $request = (new InstallDeploymentRequest()) + ->setName($formattedName); + $gapicClient->installDeployment($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gsuiteaddons.v1.GSuiteAddOns/InstallDeployment', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function installDeploymentExceptionTest() + { + $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->deploymentName('[PROJECT]', '[DEPLOYMENT]'); + $request = (new InstallDeploymentRequest()) + ->setName($formattedName); + try { + $gapicClient->installDeployment($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 listDeploymentsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $deploymentsElement = new Deployment(); + $deployments = [ + $deploymentsElement, + ]; + $expectedResponse = new ListDeploymentsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setDeployments($deployments); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $request = (new ListDeploymentsRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listDeployments($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getDeployments()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gsuiteaddons.v1.GSuiteAddOns/ListDeployments', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listDeploymentsExceptionTest() + { + $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->projectName('[PROJECT]'); + $request = (new ListDeploymentsRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listDeployments($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 replaceDeploymentTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $etag = 'etag3123477'; + $expectedResponse = new Deployment(); + $expectedResponse->setName($name); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $deployment = new Deployment(); + $request = (new ReplaceDeploymentRequest()) + ->setDeployment($deployment); + $response = $gapicClient->replaceDeployment($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gsuiteaddons.v1.GSuiteAddOns/ReplaceDeployment', $actualFuncCall); + $actualValue = $actualRequestObject->getDeployment(); + $this->assertProtobufEquals($deployment, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function replaceDeploymentExceptionTest() + { + $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 + $deployment = new Deployment(); + $request = (new ReplaceDeploymentRequest()) + ->setDeployment($deployment); + try { + $gapicClient->replaceDeployment($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 uninstallDeploymentTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->deploymentName('[PROJECT]', '[DEPLOYMENT]'); + $request = (new UninstallDeploymentRequest()) + ->setName($formattedName); + $gapicClient->uninstallDeployment($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gsuiteaddons.v1.GSuiteAddOns/UninstallDeployment', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function uninstallDeploymentExceptionTest() + { + $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->deploymentName('[PROJECT]', '[DEPLOYMENT]'); + $request = (new UninstallDeploymentRequest()) + ->setName($formattedName); + try { + $gapicClient->uninstallDeployment($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 createDeploymentAsyncTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $etag = 'etag3123477'; + $expectedResponse = new Deployment(); + $expectedResponse->setName($name); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $deploymentId = 'deploymentId51250389'; + $deployment = new Deployment(); + $request = (new CreateDeploymentRequest()) + ->setParent($formattedParent) + ->setDeploymentId($deploymentId) + ->setDeployment($deployment); + $response = $gapicClient->createDeploymentAsync($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.cloud.gsuiteaddons.v1.GSuiteAddOns/CreateDeployment', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getDeploymentId(); + $this->assertProtobufEquals($deploymentId, $actualValue); + $actualValue = $actualRequestObject->getDeployment(); + $this->assertProtobufEquals($deployment, $actualValue); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/owl-bot-staging/GSuiteAddOns/v1/tests/Unit/V1/GSuiteAddOnsClientTest.php b/owl-bot-staging/GSuiteAddOns/v1/tests/Unit/V1/GSuiteAddOnsClientTest.php new file mode 100644 index 000000000000..4041c03a9c5d --- /dev/null +++ b/owl-bot-staging/GSuiteAddOns/v1/tests/Unit/V1/GSuiteAddOnsClientTest.php @@ -0,0 +1,622 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return GSuiteAddOnsClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new GSuiteAddOnsClient($options); + } + + /** @test */ + public function createDeploymentTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $etag = 'etag3123477'; + $expectedResponse = new Deployment(); + $expectedResponse->setName($name); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $deploymentId = 'deploymentId51250389'; + $deployment = new Deployment(); + $response = $gapicClient->createDeployment($formattedParent, $deploymentId, $deployment); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gsuiteaddons.v1.GSuiteAddOns/CreateDeployment', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getDeploymentId(); + $this->assertProtobufEquals($deploymentId, $actualValue); + $actualValue = $actualRequestObject->getDeployment(); + $this->assertProtobufEquals($deployment, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createDeploymentExceptionTest() + { + $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->projectName('[PROJECT]'); + $deploymentId = 'deploymentId51250389'; + $deployment = new Deployment(); + try { + $gapicClient->createDeployment($formattedParent, $deploymentId, $deployment); + // 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 deleteDeploymentTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->deploymentName('[PROJECT]', '[DEPLOYMENT]'); + $gapicClient->deleteDeployment($formattedName); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gsuiteaddons.v1.GSuiteAddOns/DeleteDeployment', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteDeploymentExceptionTest() + { + $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->deploymentName('[PROJECT]', '[DEPLOYMENT]'); + try { + $gapicClient->deleteDeployment($formattedName); + // 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 getAuthorizationTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $serviceAccountEmail = 'serviceAccountEmail-1300473088'; + $oauthClientId = 'oauthClientId-1137123737'; + $expectedResponse = new Authorization(); + $expectedResponse->setName($name2); + $expectedResponse->setServiceAccountEmail($serviceAccountEmail); + $expectedResponse->setOauthClientId($oauthClientId); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->authorizationName('[PROJECT]'); + $response = $gapicClient->getAuthorization($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gsuiteaddons.v1.GSuiteAddOns/GetAuthorization', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getAuthorizationExceptionTest() + { + $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->authorizationName('[PROJECT]'); + try { + $gapicClient->getAuthorization($formattedName); + // 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 getDeploymentTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $etag = 'etag3123477'; + $expectedResponse = new Deployment(); + $expectedResponse->setName($name2); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->deploymentName('[PROJECT]', '[DEPLOYMENT]'); + $response = $gapicClient->getDeployment($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gsuiteaddons.v1.GSuiteAddOns/GetDeployment', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getDeploymentExceptionTest() + { + $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->deploymentName('[PROJECT]', '[DEPLOYMENT]'); + try { + $gapicClient->getDeployment($formattedName); + // 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 getInstallStatusTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $expectedResponse = new InstallStatus(); + $expectedResponse->setName($name2); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->installStatusName('[PROJECT]', '[DEPLOYMENT]'); + $response = $gapicClient->getInstallStatus($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gsuiteaddons.v1.GSuiteAddOns/GetInstallStatus', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getInstallStatusExceptionTest() + { + $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->installStatusName('[PROJECT]', '[DEPLOYMENT]'); + try { + $gapicClient->getInstallStatus($formattedName); + // 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 installDeploymentTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->deploymentName('[PROJECT]', '[DEPLOYMENT]'); + $gapicClient->installDeployment($formattedName); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gsuiteaddons.v1.GSuiteAddOns/InstallDeployment', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function installDeploymentExceptionTest() + { + $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->deploymentName('[PROJECT]', '[DEPLOYMENT]'); + try { + $gapicClient->installDeployment($formattedName); + // 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 listDeploymentsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $deploymentsElement = new Deployment(); + $deployments = [ + $deploymentsElement, + ]; + $expectedResponse = new ListDeploymentsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setDeployments($deployments); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $response = $gapicClient->listDeployments($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getDeployments()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gsuiteaddons.v1.GSuiteAddOns/ListDeployments', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listDeploymentsExceptionTest() + { + $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->projectName('[PROJECT]'); + try { + $gapicClient->listDeployments($formattedParent); + // 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 replaceDeploymentTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $etag = 'etag3123477'; + $expectedResponse = new Deployment(); + $expectedResponse->setName($name); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $deployment = new Deployment(); + $response = $gapicClient->replaceDeployment($deployment); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gsuiteaddons.v1.GSuiteAddOns/ReplaceDeployment', $actualFuncCall); + $actualValue = $actualRequestObject->getDeployment(); + $this->assertProtobufEquals($deployment, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function replaceDeploymentExceptionTest() + { + $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 + $deployment = new Deployment(); + try { + $gapicClient->replaceDeployment($deployment); + // 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 uninstallDeploymentTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->deploymentName('[PROJECT]', '[DEPLOYMENT]'); + $gapicClient->uninstallDeployment($formattedName); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gsuiteaddons.v1.GSuiteAddOns/UninstallDeployment', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function uninstallDeploymentExceptionTest() + { + $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->deploymentName('[PROJECT]', '[DEPLOYMENT]'); + try { + $gapicClient->uninstallDeployment($formattedName); + // 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()); + } +} diff --git a/owl-bot-staging/GkeBackup/v1/proto/src/GPBMetadata/Google/Cloud/Gkebackup/V1/Backup.php b/owl-bot-staging/GkeBackup/v1/proto/src/GPBMetadata/Google/Cloud/Gkebackup/V1/Backup.php new file mode 100644 index 000000000000..6eae59915799 Binary files /dev/null and b/owl-bot-staging/GkeBackup/v1/proto/src/GPBMetadata/Google/Cloud/Gkebackup/V1/Backup.php differ diff --git a/owl-bot-staging/GkeBackup/v1/proto/src/GPBMetadata/Google/Cloud/Gkebackup/V1/BackupPlan.php b/owl-bot-staging/GkeBackup/v1/proto/src/GPBMetadata/Google/Cloud/Gkebackup/V1/BackupPlan.php new file mode 100644 index 000000000000..702bab3b9041 Binary files /dev/null and b/owl-bot-staging/GkeBackup/v1/proto/src/GPBMetadata/Google/Cloud/Gkebackup/V1/BackupPlan.php differ diff --git a/owl-bot-staging/GkeBackup/v1/proto/src/GPBMetadata/Google/Cloud/Gkebackup/V1/Common.php b/owl-bot-staging/GkeBackup/v1/proto/src/GPBMetadata/Google/Cloud/Gkebackup/V1/Common.php new file mode 100644 index 000000000000..fecc578c3e7b --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/proto/src/GPBMetadata/Google/Cloud/Gkebackup/V1/Common.php @@ -0,0 +1,40 @@ +internalAddGeneratedFile( + ' +– +&google/cloud/gkebackup/v1/common.protogoogle.cloud.gkebackup.v1" + +Namespaces + +namespaces ( "1 +NamespacedName + namespace (  +name ( "V +NamespacedNamesC +namespaced_names ( 2).google.cloud.gkebackup.v1.NamespacedName"W + EncryptionKeyF +gcp_kms_encryption_key ( B&úA# +!cloudkms.googleapis.com/CryptoKeyB +com.google.cloud.gkebackup.v1B CommonProtoPZ;cloud.google.com/go/gkebackup/apiv1/gkebackuppb;gkebackuppbªGoogle.Cloud.GkeBackup.V1ÊGoogle\\Cloud\\GkeBackup\\V1êGoogle::Cloud::GkeBackup::V1bproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/owl-bot-staging/GkeBackup/v1/proto/src/GPBMetadata/Google/Cloud/Gkebackup/V1/Gkebackup.php b/owl-bot-staging/GkeBackup/v1/proto/src/GPBMetadata/Google/Cloud/Gkebackup/V1/Gkebackup.php new file mode 100644 index 000000000000..302c6ff51d84 --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/proto/src/GPBMetadata/Google/Cloud/Gkebackup/V1/Gkebackup.php @@ -0,0 +1,228 @@ +internalAddGeneratedFile( + ' +âO +)google/cloud/gkebackup/v1/gkebackup.protogoogle.cloud.gkebackup.v1google/api/client.protogoogle/api/field_behavior.protogoogle/api/resource.proto&google/cloud/gkebackup/v1/backup.proto+google/cloud/gkebackup/v1/backup_plan.proto\'google/cloud/gkebackup/v1/restore.proto,google/cloud/gkebackup/v1/restore_plan.proto&google/cloud/gkebackup/v1/volume.proto#google/longrunning/operations.proto google/protobuf/field_mask.protogoogle/protobuf/timestamp.proto"€ +OperationMetadata4 + create_time ( 2.google.protobuf.TimestampBàA1 +end_time ( 2.google.protobuf.TimestampBàA +target ( BàA +verb ( BàA +status_message ( BàA# +requested_cancellation (BàA + api_version ( BàA"² +CreateBackupPlanRequest9 +parent ( B)àAúA# +!locations.googleapis.com/Location? + backup_plan ( 2%.google.cloud.gkebackup.v1.BackupPlanBàA +backup_plan_id ( BàA"œ +ListBackupPlansRequest9 +parent ( B)àAúA# +!locations.googleapis.com/Location + page_size ( + +page_token (  +filter (  +order_by ( "„ +ListBackupPlansResponse; + backup_plans ( 2%.google.cloud.gkebackup.v1.BackupPlan +next_page_token (  + unreachable ( "Q +GetBackupPlanRequest9 +name ( B+àAúA% +#gkebackup.googleapis.com/BackupPlan"‹ +UpdateBackupPlanRequest? + backup_plan ( 2%.google.cloud.gkebackup.v1.BackupPlanBàA/ + update_mask ( 2.google.protobuf.FieldMask"b +DeleteBackupPlanRequest9 +name ( B+àAúA% +#gkebackup.googleapis.com/BackupPlan +etag ( "˜ +CreateBackupRequest; +parent ( B+àAúA% +#gkebackup.googleapis.com/BackupPlan1 +backup ( 2!.google.cloud.gkebackup.v1.Backup + backup_id ( "š +ListBackupsRequest; +parent ( B+àAúA% +#gkebackup.googleapis.com/BackupPlan + page_size ( + +page_token (  +filter (  +order_by ( "b +ListBackupsResponse2 +backups ( 2!.google.cloud.gkebackup.v1.Backup +next_page_token ( "I +GetBackupRequest5 +name ( B\'àAúA! +gkebackup.googleapis.com/Backup"~ +UpdateBackupRequest6 +backup ( 2!.google.cloud.gkebackup.v1.BackupBàA/ + update_mask ( 2.google.protobuf.FieldMask"i +DeleteBackupRequest5 +name ( B\'àAúA! +gkebackup.googleapis.com/Backup +etag (  +force ("œ +ListVolumeBackupsRequest7 +parent ( B\'àAúA! +gkebackup.googleapis.com/Backup + page_size ( + +page_token (  +filter (  +order_by ( "u +ListVolumeBackupsResponse? +volume_backups ( 2\'.google.cloud.gkebackup.v1.VolumeBackup +next_page_token ( "U +GetVolumeBackupRequest; +name ( B-àAúA\' +%gkebackup.googleapis.com/VolumeBackup"¶ +CreateRestorePlanRequest9 +parent ( B)àAúA# +!locations.googleapis.com/LocationA + restore_plan ( 2&.google.cloud.gkebackup.v1.RestorePlanBàA +restore_plan_id ( BàA" +ListRestorePlansRequest9 +parent ( B)àAúA# +!locations.googleapis.com/Location + page_size ( + +page_token (  +filter (  +order_by ( "‡ +ListRestorePlansResponse= + restore_plans ( 2&.google.cloud.gkebackup.v1.RestorePlan +next_page_token (  + unreachable ( "S +GetRestorePlanRequest: +name ( B,àAúA& +$gkebackup.googleapis.com/RestorePlan"Ž +UpdateRestorePlanRequestA + restore_plan ( 2&.google.cloud.gkebackup.v1.RestorePlanBàA/ + update_mask ( 2.google.protobuf.FieldMask"s +DeleteRestorePlanRequest: +name ( B,àAúA& +$gkebackup.googleapis.com/RestorePlan +etag (  +force ("§ +CreateRestoreRequest< +parent ( B,àAúA& +$gkebackup.googleapis.com/RestorePlan8 +restore ( 2".google.cloud.gkebackup.v1.RestoreBàA + +restore_id ( BàA"œ +ListRestoresRequest< +parent ( B,àAúA& +$gkebackup.googleapis.com/RestorePlan + page_size ( + +page_token (  +filter (  +order_by ( "z +ListRestoresResponse4 +restores ( 2".google.cloud.gkebackup.v1.Restore +next_page_token (  + unreachable ( "K +GetRestoreRequest6 +name ( B(àAúA" + gkebackup.googleapis.com/Restore" +UpdateRestoreRequest8 +restore ( 2".google.cloud.gkebackup.v1.RestoreBàA/ + update_mask ( 2.google.protobuf.FieldMask"k +DeleteRestoreRequest6 +name ( B(àAúA" + gkebackup.googleapis.com/Restore +etag (  +force ("ž +ListVolumeRestoresRequest8 +parent ( B(àAúA" + gkebackup.googleapis.com/Restore + page_size ( + +page_token (  +filter (  +order_by ( "x +ListVolumeRestoresResponseA +volume_restores ( 2(.google.cloud.gkebackup.v1.VolumeRestore +next_page_token ( "W +GetVolumeRestoreRequest< +name ( B.àAúA( +&gkebackup.googleapis.com/VolumeRestore2Å( + BackupForGKEò +CreateBackupPlan2.google.cloud.gkebackup.v1.CreateBackupPlanRequest.google.longrunning.Operation"Š‚Óä“>"//v1/{parent=projects/*/locations/*}/backupPlans: backup_planÚA!parent,backup_plan,backup_plan_idÊA + +BackupPlanOperationMetadataº +ListBackupPlans1.google.cloud.gkebackup.v1.ListBackupPlansRequest2.google.cloud.gkebackup.v1.ListBackupPlansResponse"@‚Óä“1//v1/{parent=projects/*/locations/*}/backupPlansÚAparent§ + GetBackupPlan/.google.cloud.gkebackup.v1.GetBackupPlanRequest%.google.cloud.gkebackup.v1.BackupPlan">‚Óä“1//v1/{name=projects/*/locations/*/backupPlans/*}ÚAnameô +UpdateBackupPlan2.google.cloud.gkebackup.v1.UpdateBackupPlanRequest.google.longrunning.Operation"Œ‚Óä“J2;/v1/{backup_plan.name=projects/*/locations/*/backupPlans/*}: backup_planÚAbackup_plan,update_maskÊA + +BackupPlanOperationMetadataÒ +DeleteBackupPlan2.google.cloud.gkebackup.v1.DeleteBackupPlanRequest.google.longrunning.Operation"k‚Óä“1*//v1/{name=projects/*/locations/*/backupPlans/*}ÚAnameÊA* +google.protobuf.EmptyOperationMetadataá + CreateBackup..google.cloud.gkebackup.v1.CreateBackupRequest.google.longrunning.Operation"‚Óä“C"9/v1/{parent=projects/*/locations/*/backupPlans/*}/backups:backupÚAparent,backup,backup_idÊA +BackupOperationMetadata¸ + ListBackups-.google.cloud.gkebackup.v1.ListBackupsRequest..google.cloud.gkebackup.v1.ListBackupsResponse"J‚Óä“;9/v1/{parent=projects/*/locations/*/backupPlans/*}/backupsÚAparent¥ + GetBackup+.google.cloud.gkebackup.v1.GetBackupRequest!.google.cloud.gkebackup.v1.Backup"H‚Óä“;9/v1/{name=projects/*/locations/*/backupPlans/*/backups/*}ÚAnameã + UpdateBackup..google.cloud.gkebackup.v1.UpdateBackupRequest.google.longrunning.Operation"ƒ‚Óä“J2@/v1/{backup.name=projects/*/locations/*/backupPlans/*/backups/*}:backupÚAbackup,update_maskÊA +BackupOperationMetadataÔ + DeleteBackup..google.cloud.gkebackup.v1.DeleteBackupRequest.google.longrunning.Operation"u‚Óä“;*9/v1/{name=projects/*/locations/*/backupPlans/*/backups/*}ÚAnameÊA* +google.protobuf.EmptyOperationMetadataÚ +ListVolumeBackups3.google.cloud.gkebackup.v1.ListVolumeBackupsRequest4.google.cloud.gkebackup.v1.ListVolumeBackupsResponse"Z‚Óä“KI/v1/{parent=projects/*/locations/*/backupPlans/*/backups/*}/volumeBackupsÚAparentÇ +GetVolumeBackup1.google.cloud.gkebackup.v1.GetVolumeBackupRequest\'.google.cloud.gkebackup.v1.VolumeBackup"X‚Óä“KI/v1/{name=projects/*/locations/*/backupPlans/*/backups/*/volumeBackups/*}ÚAnameù +CreateRestorePlan3.google.cloud.gkebackup.v1.CreateRestorePlanRequest.google.longrunning.Operation"‚Óä“@"0/v1/{parent=projects/*/locations/*}/restorePlans: restore_planÚA#parent,restore_plan,restore_plan_idÊA + RestorePlanOperationMetadata¾ +ListRestorePlans2.google.cloud.gkebackup.v1.ListRestorePlansRequest3.google.cloud.gkebackup.v1.ListRestorePlansResponse"A‚Óä“20/v1/{parent=projects/*/locations/*}/restorePlansÚAparent« +GetRestorePlan0.google.cloud.gkebackup.v1.GetRestorePlanRequest&.google.cloud.gkebackup.v1.RestorePlan"?‚Óä“20/v1/{name=projects/*/locations/*/restorePlans/*}ÚAnameû +UpdateRestorePlan3.google.cloud.gkebackup.v1.UpdateRestorePlanRequest.google.longrunning.Operation"‘‚Óä“M2=/v1/{restore_plan.name=projects/*/locations/*/restorePlans/*}: restore_planÚArestore_plan,update_maskÊA + RestorePlanOperationMetadataÕ +DeleteRestorePlan3.google.cloud.gkebackup.v1.DeleteRestorePlanRequest.google.longrunning.Operation"l‚Óä“2*0/v1/{name=projects/*/locations/*/restorePlans/*}ÚAnameÊA* +google.protobuf.EmptyOperationMetadataé + CreateRestore/.google.cloud.gkebackup.v1.CreateRestoreRequest.google.longrunning.Operation"‡‚Óä“F";/v1/{parent=projects/*/locations/*/restorePlans/*}/restores:restoreÚAparent,restore,restore_idÊA +RestoreOperationMetadata½ + ListRestores..google.cloud.gkebackup.v1.ListRestoresRequest/.google.cloud.gkebackup.v1.ListRestoresResponse"L‚Óä“=;/v1/{parent=projects/*/locations/*/restorePlans/*}/restoresÚAparentª + +GetRestore,.google.cloud.gkebackup.v1.GetRestoreRequest".google.cloud.gkebackup.v1.Restore"J‚Óä“=;/v1/{name=projects/*/locations/*/restorePlans/*/restores/*}ÚAnameë + UpdateRestore/.google.cloud.gkebackup.v1.UpdateRestoreRequest.google.longrunning.Operation"‰‚Óä“N2C/v1/{restore.name=projects/*/locations/*/restorePlans/*/restores/*}:restoreÚArestore,update_maskÊA +RestoreOperationMetadataØ + DeleteRestore/.google.cloud.gkebackup.v1.DeleteRestoreRequest.google.longrunning.Operation"w‚Óä“=*;/v1/{name=projects/*/locations/*/restorePlans/*/restores/*}ÚAnameÊA* +google.protobuf.EmptyOperationMetadataà +ListVolumeRestores4.google.cloud.gkebackup.v1.ListVolumeRestoresRequest5.google.cloud.gkebackup.v1.ListVolumeRestoresResponse"]‚Óä“NL/v1/{parent=projects/*/locations/*/restorePlans/*/restores/*}/volumeRestoresÚAparentÍ +GetVolumeRestore2.google.cloud.gkebackup.v1.GetVolumeRestoreRequest(.google.cloud.gkebackup.v1.VolumeRestore"[‚Óä“NL/v1/{name=projects/*/locations/*/restorePlans/*/restores/*/volumeRestores/*}ÚAnameLÊAgkebackup.googleapis.comÒA.https://www.googleapis.com/auth/cloud-platformB¡ +com.google.cloud.gkebackup.v1BGKEBackupProtoPZ;cloud.google.com/go/gkebackup/apiv1/gkebackuppb;gkebackuppbªGoogle.Cloud.GkeBackup.V1ÊGoogle\\Cloud\\GkeBackup\\V1êGoogle::Cloud::GkeBackup::V1êA^ + container.googleapis.com/Cluster:projects/{project}/locations/{location}/clusters/{cluster}êAx +!cloudkms.googleapis.com/CryptoKeySprojects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}bproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/owl-bot-staging/GkeBackup/v1/proto/src/GPBMetadata/Google/Cloud/Gkebackup/V1/Restore.php b/owl-bot-staging/GkeBackup/v1/proto/src/GPBMetadata/Google/Cloud/Gkebackup/V1/Restore.php new file mode 100644 index 000000000000..345088cfe68d Binary files /dev/null and b/owl-bot-staging/GkeBackup/v1/proto/src/GPBMetadata/Google/Cloud/Gkebackup/V1/Restore.php differ diff --git a/owl-bot-staging/GkeBackup/v1/proto/src/GPBMetadata/Google/Cloud/Gkebackup/V1/RestorePlan.php b/owl-bot-staging/GkeBackup/v1/proto/src/GPBMetadata/Google/Cloud/Gkebackup/V1/RestorePlan.php new file mode 100644 index 000000000000..4817b7104c27 --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/proto/src/GPBMetadata/Google/Cloud/Gkebackup/V1/RestorePlan.php @@ -0,0 +1,49 @@ +internalAddGeneratedFile( + ' +ö +,google/cloud/gkebackup/v1/restore_plan.protogoogle.cloud.gkebackup.v1google/api/resource.proto\'google/cloud/gkebackup/v1/restore.protogoogle/protobuf/timestamp.proto"ó + RestorePlan +name ( BàA +uid ( BàA4 + create_time ( 2.google.protobuf.TimestampBàA4 + update_time ( 2.google.protobuf.TimestampBàA + description ( C + backup_plan ( B.àAàAúA% +#gkebackup.googleapis.com/BackupPlan< +cluster ( B+àAàAúA" + container.googleapis.com/ClusterE +restore_config ( 2(.google.cloud.gkebackup.v1.RestoreConfigBàAB +labels ( 22.google.cloud.gkebackup.v1.RestorePlan.LabelsEntry +etag + ( BàA- + LabelsEntry +key (  +value ( :8:nêAk +$gkebackup.googleapis.com/RestorePlanCprojects/{project}/locations/{location}/restorePlans/{restore_plan}BÇ +com.google.cloud.gkebackup.v1BRestorePlanProtoPZ;cloud.google.com/go/gkebackup/apiv1/gkebackuppb;gkebackuppbªGoogle.Cloud.GkeBackup.V1ÊGoogle\\Cloud\\GkeBackup\\V1êGoogle::Cloud::GkeBackup::V1bproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/owl-bot-staging/GkeBackup/v1/proto/src/GPBMetadata/Google/Cloud/Gkebackup/V1/Volume.php b/owl-bot-staging/GkeBackup/v1/proto/src/GPBMetadata/Google/Cloud/Gkebackup/V1/Volume.php new file mode 100644 index 000000000000..d1f6ce1a5d21 Binary files /dev/null and b/owl-bot-staging/GkeBackup/v1/proto/src/GPBMetadata/Google/Cloud/Gkebackup/V1/Volume.php differ diff --git a/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/Backup.php b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/Backup.php new file mode 100644 index 000000000000..62ff711d0ae5 --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/Backup.php @@ -0,0 +1,1170 @@ +google.cloud.gkebackup.v1.Backup + */ +class Backup extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The fully qualified name of the Backup. + * projects/*/locations/*/backupPlans/*/backups/* + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $name = ''; + /** + * Output only. Server generated global unique identifier of + * [UUID4](https://en.wikipedia.org/wiki/Universally_unique_identifier) + * + * Generated from protobuf field string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $uid = ''; + /** + * Output only. The timestamp when this Backup resource was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. The timestamp when this Backup resource was last updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * Output only. This flag indicates whether this Backup resource was created manually + * by a user or via a schedule in the BackupPlan. A value of True means that + * the Backup was created manually. + * + * Generated from protobuf field bool manual = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $manual = false; + /** + * A set of custom labels supplied by user. + * + * Generated from protobuf field map labels = 6; + */ + private $labels; + /** + * Minimum age for this Backup (in days). If this field is set to a non-zero + * value, the Backup will be "locked" against deletion (either manual or + * automatic deletion) for the number of days provided (measured from the + * creation time of the Backup). MUST be an integer value between 0-90 + * (inclusive). + * Defaults to parent BackupPlan's + * [backup_delete_lock_days][google.cloud.gkebackup.v1.BackupPlan.RetentionPolicy.backup_delete_lock_days] + * setting and may only be increased + * (either at creation time or in a subsequent update). + * + * Generated from protobuf field int32 delete_lock_days = 7; + */ + protected $delete_lock_days = 0; + /** + * Output only. The time at which an existing delete lock will expire for this backup + * (calculated from create_time + [delete_lock_days][google.cloud.gkebackup.v1.Backup.delete_lock_days]). + * + * Generated from protobuf field .google.protobuf.Timestamp delete_lock_expire_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $delete_lock_expire_time = null; + /** + * The age (in days) after which this Backup will be automatically deleted. + * Must be an integer value >= 0: + * - If 0, no automatic deletion will occur for this Backup. + * - If not 0, this must be >= [delete_lock_days][google.cloud.gkebackup.v1.Backup.delete_lock_days]. + * Once a Backup is created, this value may only be increased. + * Defaults to the parent BackupPlan's + * [backup_retain_days][google.cloud.gkebackup.v1.BackupPlan.RetentionPolicy.backup_retain_days] value. + * + * Generated from protobuf field int32 retain_days = 9; + */ + protected $retain_days = 0; + /** + * Output only. The time at which this Backup will be automatically deleted (calculated + * from create_time + [retain_days][google.cloud.gkebackup.v1.Backup.retain_days]). + * + * Generated from protobuf field .google.protobuf.Timestamp retain_expire_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $retain_expire_time = null; + /** + * Output only. The customer managed encryption key that was used to encrypt the Backup's + * artifacts. Inherited from the parent BackupPlan's + * [encryption_key][google.cloud.gkebackup.v1.BackupPlan.BackupConfig.encryption_key] value. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.EncryptionKey encryption_key = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $encryption_key = null; + /** + * Output only. Whether or not the Backup contains volume data. Controlled by the parent + * BackupPlan's + * [include_volume_data][google.cloud.gkebackup.v1.BackupPlan.BackupConfig.include_volume_data] value. + * + * Generated from protobuf field bool contains_volume_data = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $contains_volume_data = false; + /** + * Output only. Whether or not the Backup contains Kubernetes Secrets. Controlled by the + * parent BackupPlan's + * [include_secrets][google.cloud.gkebackup.v1.BackupPlan.BackupConfig.include_secrets] value. + * + * Generated from protobuf field bool contains_secrets = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $contains_secrets = false; + /** + * Output only. Information about the GKE cluster from which this Backup was created. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.Backup.ClusterMetadata cluster_metadata = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $cluster_metadata = null; + /** + * Output only. Current state of the Backup + * + * Generated from protobuf field .google.cloud.gkebackup.v1.Backup.State state = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Output only. Human-readable description of why the backup is in the current `state`. + * + * Generated from protobuf field string state_reason = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state_reason = ''; + /** + * Output only. Completion time of the Backup + * + * Generated from protobuf field .google.protobuf.Timestamp complete_time = 20 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $complete_time = null; + /** + * Output only. The total number of Kubernetes resources included in the Backup. + * + * Generated from protobuf field int32 resource_count = 21 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $resource_count = 0; + /** + * Output only. The total number of volume backups contained in the Backup. + * + * Generated from protobuf field int32 volume_count = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $volume_count = 0; + /** + * Output only. The total size of the Backup in bytes = config backup size + sum(volume + * backup sizes) + * + * Generated from protobuf field int64 size_bytes = 23 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $size_bytes = 0; + /** + * Output only. `etag` is used for optimistic concurrency control as a way to help + * prevent simultaneous updates of a backup from overwriting each other. + * It is strongly suggested that systems make use of the `etag` in the + * read-modify-write cycle to perform backup updates in order to avoid + * race conditions: An `etag` is returned in the response to `GetBackup`, + * and systems are expected to put that etag in the request to + * `UpdateBackup` or `DeleteBackup` to ensure that their change will be + * applied to the same version of the resource. + * + * Generated from protobuf field string etag = 24 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $etag = ''; + /** + * User specified descriptive string for this Backup. + * + * Generated from protobuf field string description = 25; + */ + protected $description = ''; + /** + * Output only. The total number of Kubernetes Pods contained in the Backup. + * + * Generated from protobuf field int32 pod_count = 26 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $pod_count = 0; + /** + * Output only. The size of the config backup in bytes. + * + * Generated from protobuf field int64 config_backup_size_bytes = 27 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $config_backup_size_bytes = 0; + protected $backup_scope; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Output only. The fully qualified name of the Backup. + * projects/*/locations/*/backupPlans/*/backups/* + * @type string $uid + * Output only. Server generated global unique identifier of + * [UUID4](https://en.wikipedia.org/wiki/Universally_unique_identifier) + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The timestamp when this Backup resource was created. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. The timestamp when this Backup resource was last updated. + * @type bool $manual + * Output only. This flag indicates whether this Backup resource was created manually + * by a user or via a schedule in the BackupPlan. A value of True means that + * the Backup was created manually. + * @type array|\Google\Protobuf\Internal\MapField $labels + * A set of custom labels supplied by user. + * @type int $delete_lock_days + * Minimum age for this Backup (in days). If this field is set to a non-zero + * value, the Backup will be "locked" against deletion (either manual or + * automatic deletion) for the number of days provided (measured from the + * creation time of the Backup). MUST be an integer value between 0-90 + * (inclusive). + * Defaults to parent BackupPlan's + * [backup_delete_lock_days][google.cloud.gkebackup.v1.BackupPlan.RetentionPolicy.backup_delete_lock_days] + * setting and may only be increased + * (either at creation time or in a subsequent update). + * @type \Google\Protobuf\Timestamp $delete_lock_expire_time + * Output only. The time at which an existing delete lock will expire for this backup + * (calculated from create_time + [delete_lock_days][google.cloud.gkebackup.v1.Backup.delete_lock_days]). + * @type int $retain_days + * The age (in days) after which this Backup will be automatically deleted. + * Must be an integer value >= 0: + * - If 0, no automatic deletion will occur for this Backup. + * - If not 0, this must be >= [delete_lock_days][google.cloud.gkebackup.v1.Backup.delete_lock_days]. + * Once a Backup is created, this value may only be increased. + * Defaults to the parent BackupPlan's + * [backup_retain_days][google.cloud.gkebackup.v1.BackupPlan.RetentionPolicy.backup_retain_days] value. + * @type \Google\Protobuf\Timestamp $retain_expire_time + * Output only. The time at which this Backup will be automatically deleted (calculated + * from create_time + [retain_days][google.cloud.gkebackup.v1.Backup.retain_days]). + * @type \Google\Cloud\GkeBackup\V1\EncryptionKey $encryption_key + * Output only. The customer managed encryption key that was used to encrypt the Backup's + * artifacts. Inherited from the parent BackupPlan's + * [encryption_key][google.cloud.gkebackup.v1.BackupPlan.BackupConfig.encryption_key] value. + * @type bool $all_namespaces + * Output only. If True, all namespaces were included in the Backup. + * @type \Google\Cloud\GkeBackup\V1\Namespaces $selected_namespaces + * Output only. If set, the list of namespaces that were included in the Backup. + * @type \Google\Cloud\GkeBackup\V1\NamespacedNames $selected_applications + * Output only. If set, the list of ProtectedApplications whose resources were included + * in the Backup. + * @type bool $contains_volume_data + * Output only. Whether or not the Backup contains volume data. Controlled by the parent + * BackupPlan's + * [include_volume_data][google.cloud.gkebackup.v1.BackupPlan.BackupConfig.include_volume_data] value. + * @type bool $contains_secrets + * Output only. Whether or not the Backup contains Kubernetes Secrets. Controlled by the + * parent BackupPlan's + * [include_secrets][google.cloud.gkebackup.v1.BackupPlan.BackupConfig.include_secrets] value. + * @type \Google\Cloud\GkeBackup\V1\Backup\ClusterMetadata $cluster_metadata + * Output only. Information about the GKE cluster from which this Backup was created. + * @type int $state + * Output only. Current state of the Backup + * @type string $state_reason + * Output only. Human-readable description of why the backup is in the current `state`. + * @type \Google\Protobuf\Timestamp $complete_time + * Output only. Completion time of the Backup + * @type int $resource_count + * Output only. The total number of Kubernetes resources included in the Backup. + * @type int $volume_count + * Output only. The total number of volume backups contained in the Backup. + * @type int|string $size_bytes + * Output only. The total size of the Backup in bytes = config backup size + sum(volume + * backup sizes) + * @type string $etag + * Output only. `etag` is used for optimistic concurrency control as a way to help + * prevent simultaneous updates of a backup from overwriting each other. + * It is strongly suggested that systems make use of the `etag` in the + * read-modify-write cycle to perform backup updates in order to avoid + * race conditions: An `etag` is returned in the response to `GetBackup`, + * and systems are expected to put that etag in the request to + * `UpdateBackup` or `DeleteBackup` to ensure that their change will be + * applied to the same version of the resource. + * @type string $description + * User specified descriptive string for this Backup. + * @type int $pod_count + * Output only. The total number of Kubernetes Pods contained in the Backup. + * @type int|string $config_backup_size_bytes + * Output only. The size of the config backup in bytes. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkebackup\V1\Backup::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The fully qualified name of the Backup. + * projects/*/locations/*/backupPlans/*/backups/* + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Output only. The fully qualified name of the Backup. + * projects/*/locations/*/backupPlans/*/backups/* + * + * 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. Server generated global unique identifier of + * [UUID4](https://en.wikipedia.org/wiki/Universally_unique_identifier) + * + * Generated from protobuf field string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getUid() + { + return $this->uid; + } + + /** + * Output only. Server generated global unique identifier of + * [UUID4](https://en.wikipedia.org/wiki/Universally_unique_identifier) + * + * Generated from protobuf field string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setUid($var) + { + GPBUtil::checkString($var, True); + $this->uid = $var; + + return $this; + } + + /** + * Output only. The timestamp when this Backup resource was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 3 [(.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 timestamp when this Backup resource was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 3 [(.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 timestamp when this Backup resource was last updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 4 [(.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 timestamp when this Backup resource was last updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 4 [(.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. This flag indicates whether this Backup resource was created manually + * by a user or via a schedule in the BackupPlan. A value of True means that + * the Backup was created manually. + * + * Generated from protobuf field bool manual = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return bool + */ + public function getManual() + { + return $this->manual; + } + + /** + * Output only. This flag indicates whether this Backup resource was created manually + * by a user or via a schedule in the BackupPlan. A value of True means that + * the Backup was created manually. + * + * Generated from protobuf field bool manual = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param bool $var + * @return $this + */ + public function setManual($var) + { + GPBUtil::checkBool($var); + $this->manual = $var; + + return $this; + } + + /** + * A set of custom labels supplied by user. + * + * Generated from protobuf field map labels = 6; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * A set of custom labels supplied by user. + * + * Generated from protobuf field map labels = 6; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + + /** + * Minimum age for this Backup (in days). If this field is set to a non-zero + * value, the Backup will be "locked" against deletion (either manual or + * automatic deletion) for the number of days provided (measured from the + * creation time of the Backup). MUST be an integer value between 0-90 + * (inclusive). + * Defaults to parent BackupPlan's + * [backup_delete_lock_days][google.cloud.gkebackup.v1.BackupPlan.RetentionPolicy.backup_delete_lock_days] + * setting and may only be increased + * (either at creation time or in a subsequent update). + * + * Generated from protobuf field int32 delete_lock_days = 7; + * @return int + */ + public function getDeleteLockDays() + { + return $this->delete_lock_days; + } + + /** + * Minimum age for this Backup (in days). If this field is set to a non-zero + * value, the Backup will be "locked" against deletion (either manual or + * automatic deletion) for the number of days provided (measured from the + * creation time of the Backup). MUST be an integer value between 0-90 + * (inclusive). + * Defaults to parent BackupPlan's + * [backup_delete_lock_days][google.cloud.gkebackup.v1.BackupPlan.RetentionPolicy.backup_delete_lock_days] + * setting and may only be increased + * (either at creation time or in a subsequent update). + * + * Generated from protobuf field int32 delete_lock_days = 7; + * @param int $var + * @return $this + */ + public function setDeleteLockDays($var) + { + GPBUtil::checkInt32($var); + $this->delete_lock_days = $var; + + return $this; + } + + /** + * Output only. The time at which an existing delete lock will expire for this backup + * (calculated from create_time + [delete_lock_days][google.cloud.gkebackup.v1.Backup.delete_lock_days]). + * + * Generated from protobuf field .google.protobuf.Timestamp delete_lock_expire_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getDeleteLockExpireTime() + { + return $this->delete_lock_expire_time; + } + + public function hasDeleteLockExpireTime() + { + return isset($this->delete_lock_expire_time); + } + + public function clearDeleteLockExpireTime() + { + unset($this->delete_lock_expire_time); + } + + /** + * Output only. The time at which an existing delete lock will expire for this backup + * (calculated from create_time + [delete_lock_days][google.cloud.gkebackup.v1.Backup.delete_lock_days]). + * + * Generated from protobuf field .google.protobuf.Timestamp delete_lock_expire_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setDeleteLockExpireTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->delete_lock_expire_time = $var; + + return $this; + } + + /** + * The age (in days) after which this Backup will be automatically deleted. + * Must be an integer value >= 0: + * - If 0, no automatic deletion will occur for this Backup. + * - If not 0, this must be >= [delete_lock_days][google.cloud.gkebackup.v1.Backup.delete_lock_days]. + * Once a Backup is created, this value may only be increased. + * Defaults to the parent BackupPlan's + * [backup_retain_days][google.cloud.gkebackup.v1.BackupPlan.RetentionPolicy.backup_retain_days] value. + * + * Generated from protobuf field int32 retain_days = 9; + * @return int + */ + public function getRetainDays() + { + return $this->retain_days; + } + + /** + * The age (in days) after which this Backup will be automatically deleted. + * Must be an integer value >= 0: + * - If 0, no automatic deletion will occur for this Backup. + * - If not 0, this must be >= [delete_lock_days][google.cloud.gkebackup.v1.Backup.delete_lock_days]. + * Once a Backup is created, this value may only be increased. + * Defaults to the parent BackupPlan's + * [backup_retain_days][google.cloud.gkebackup.v1.BackupPlan.RetentionPolicy.backup_retain_days] value. + * + * Generated from protobuf field int32 retain_days = 9; + * @param int $var + * @return $this + */ + public function setRetainDays($var) + { + GPBUtil::checkInt32($var); + $this->retain_days = $var; + + return $this; + } + + /** + * Output only. The time at which this Backup will be automatically deleted (calculated + * from create_time + [retain_days][google.cloud.gkebackup.v1.Backup.retain_days]). + * + * Generated from protobuf field .google.protobuf.Timestamp retain_expire_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getRetainExpireTime() + { + return $this->retain_expire_time; + } + + public function hasRetainExpireTime() + { + return isset($this->retain_expire_time); + } + + public function clearRetainExpireTime() + { + unset($this->retain_expire_time); + } + + /** + * Output only. The time at which this Backup will be automatically deleted (calculated + * from create_time + [retain_days][google.cloud.gkebackup.v1.Backup.retain_days]). + * + * Generated from protobuf field .google.protobuf.Timestamp retain_expire_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setRetainExpireTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->retain_expire_time = $var; + + return $this; + } + + /** + * Output only. The customer managed encryption key that was used to encrypt the Backup's + * artifacts. Inherited from the parent BackupPlan's + * [encryption_key][google.cloud.gkebackup.v1.BackupPlan.BackupConfig.encryption_key] value. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.EncryptionKey encryption_key = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\GkeBackup\V1\EncryptionKey|null + */ + public function getEncryptionKey() + { + return $this->encryption_key; + } + + public function hasEncryptionKey() + { + return isset($this->encryption_key); + } + + public function clearEncryptionKey() + { + unset($this->encryption_key); + } + + /** + * Output only. The customer managed encryption key that was used to encrypt the Backup's + * artifacts. Inherited from the parent BackupPlan's + * [encryption_key][google.cloud.gkebackup.v1.BackupPlan.BackupConfig.encryption_key] value. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.EncryptionKey encryption_key = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\GkeBackup\V1\EncryptionKey $var + * @return $this + */ + public function setEncryptionKey($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeBackup\V1\EncryptionKey::class); + $this->encryption_key = $var; + + return $this; + } + + /** + * Output only. If True, all namespaces were included in the Backup. + * + * Generated from protobuf field bool all_namespaces = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return bool + */ + public function getAllNamespaces() + { + return $this->readOneof(12); + } + + public function hasAllNamespaces() + { + return $this->hasOneof(12); + } + + /** + * Output only. If True, all namespaces were included in the Backup. + * + * Generated from protobuf field bool all_namespaces = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param bool $var + * @return $this + */ + public function setAllNamespaces($var) + { + GPBUtil::checkBool($var); + $this->writeOneof(12, $var); + + return $this; + } + + /** + * Output only. If set, the list of namespaces that were included in the Backup. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.Namespaces selected_namespaces = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\GkeBackup\V1\Namespaces|null + */ + public function getSelectedNamespaces() + { + return $this->readOneof(13); + } + + public function hasSelectedNamespaces() + { + return $this->hasOneof(13); + } + + /** + * Output only. If set, the list of namespaces that were included in the Backup. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.Namespaces selected_namespaces = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\GkeBackup\V1\Namespaces $var + * @return $this + */ + public function setSelectedNamespaces($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeBackup\V1\Namespaces::class); + $this->writeOneof(13, $var); + + return $this; + } + + /** + * Output only. If set, the list of ProtectedApplications whose resources were included + * in the Backup. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.NamespacedNames selected_applications = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\GkeBackup\V1\NamespacedNames|null + */ + public function getSelectedApplications() + { + return $this->readOneof(14); + } + + public function hasSelectedApplications() + { + return $this->hasOneof(14); + } + + /** + * Output only. If set, the list of ProtectedApplications whose resources were included + * in the Backup. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.NamespacedNames selected_applications = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\GkeBackup\V1\NamespacedNames $var + * @return $this + */ + public function setSelectedApplications($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeBackup\V1\NamespacedNames::class); + $this->writeOneof(14, $var); + + return $this; + } + + /** + * Output only. Whether or not the Backup contains volume data. Controlled by the parent + * BackupPlan's + * [include_volume_data][google.cloud.gkebackup.v1.BackupPlan.BackupConfig.include_volume_data] value. + * + * Generated from protobuf field bool contains_volume_data = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return bool + */ + public function getContainsVolumeData() + { + return $this->contains_volume_data; + } + + /** + * Output only. Whether or not the Backup contains volume data. Controlled by the parent + * BackupPlan's + * [include_volume_data][google.cloud.gkebackup.v1.BackupPlan.BackupConfig.include_volume_data] value. + * + * Generated from protobuf field bool contains_volume_data = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param bool $var + * @return $this + */ + public function setContainsVolumeData($var) + { + GPBUtil::checkBool($var); + $this->contains_volume_data = $var; + + return $this; + } + + /** + * Output only. Whether or not the Backup contains Kubernetes Secrets. Controlled by the + * parent BackupPlan's + * [include_secrets][google.cloud.gkebackup.v1.BackupPlan.BackupConfig.include_secrets] value. + * + * Generated from protobuf field bool contains_secrets = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return bool + */ + public function getContainsSecrets() + { + return $this->contains_secrets; + } + + /** + * Output only. Whether or not the Backup contains Kubernetes Secrets. Controlled by the + * parent BackupPlan's + * [include_secrets][google.cloud.gkebackup.v1.BackupPlan.BackupConfig.include_secrets] value. + * + * Generated from protobuf field bool contains_secrets = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param bool $var + * @return $this + */ + public function setContainsSecrets($var) + { + GPBUtil::checkBool($var); + $this->contains_secrets = $var; + + return $this; + } + + /** + * Output only. Information about the GKE cluster from which this Backup was created. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.Backup.ClusterMetadata cluster_metadata = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\GkeBackup\V1\Backup\ClusterMetadata|null + */ + public function getClusterMetadata() + { + return $this->cluster_metadata; + } + + public function hasClusterMetadata() + { + return isset($this->cluster_metadata); + } + + public function clearClusterMetadata() + { + unset($this->cluster_metadata); + } + + /** + * Output only. Information about the GKE cluster from which this Backup was created. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.Backup.ClusterMetadata cluster_metadata = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\GkeBackup\V1\Backup\ClusterMetadata $var + * @return $this + */ + public function setClusterMetadata($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeBackup\V1\Backup\ClusterMetadata::class); + $this->cluster_metadata = $var; + + return $this; + } + + /** + * Output only. Current state of the Backup + * + * Generated from protobuf field .google.cloud.gkebackup.v1.Backup.State state = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. Current state of the Backup + * + * Generated from protobuf field .google.cloud.gkebackup.v1.Backup.State state = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\GkeBackup\V1\Backup\State::class); + $this->state = $var; + + return $this; + } + + /** + * Output only. Human-readable description of why the backup is in the current `state`. + * + * Generated from protobuf field string state_reason = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getStateReason() + { + return $this->state_reason; + } + + /** + * Output only. Human-readable description of why the backup is in the current `state`. + * + * Generated from protobuf field string state_reason = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setStateReason($var) + { + GPBUtil::checkString($var, True); + $this->state_reason = $var; + + return $this; + } + + /** + * Output only. Completion time of the Backup + * + * Generated from protobuf field .google.protobuf.Timestamp complete_time = 20 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCompleteTime() + { + return $this->complete_time; + } + + public function hasCompleteTime() + { + return isset($this->complete_time); + } + + public function clearCompleteTime() + { + unset($this->complete_time); + } + + /** + * Output only. Completion time of the Backup + * + * Generated from protobuf field .google.protobuf.Timestamp complete_time = 20 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCompleteTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->complete_time = $var; + + return $this; + } + + /** + * Output only. The total number of Kubernetes resources included in the Backup. + * + * Generated from protobuf field int32 resource_count = 21 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getResourceCount() + { + return $this->resource_count; + } + + /** + * Output only. The total number of Kubernetes resources included in the Backup. + * + * Generated from protobuf field int32 resource_count = 21 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setResourceCount($var) + { + GPBUtil::checkInt32($var); + $this->resource_count = $var; + + return $this; + } + + /** + * Output only. The total number of volume backups contained in the Backup. + * + * Generated from protobuf field int32 volume_count = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getVolumeCount() + { + return $this->volume_count; + } + + /** + * Output only. The total number of volume backups contained in the Backup. + * + * Generated from protobuf field int32 volume_count = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setVolumeCount($var) + { + GPBUtil::checkInt32($var); + $this->volume_count = $var; + + return $this; + } + + /** + * Output only. The total size of the Backup in bytes = config backup size + sum(volume + * backup sizes) + * + * Generated from protobuf field int64 size_bytes = 23 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int|string + */ + public function getSizeBytes() + { + return $this->size_bytes; + } + + /** + * Output only. The total size of the Backup in bytes = config backup size + sum(volume + * backup sizes) + * + * Generated from protobuf field int64 size_bytes = 23 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int|string $var + * @return $this + */ + public function setSizeBytes($var) + { + GPBUtil::checkInt64($var); + $this->size_bytes = $var; + + return $this; + } + + /** + * Output only. `etag` is used for optimistic concurrency control as a way to help + * prevent simultaneous updates of a backup from overwriting each other. + * It is strongly suggested that systems make use of the `etag` in the + * read-modify-write cycle to perform backup updates in order to avoid + * race conditions: An `etag` is returned in the response to `GetBackup`, + * and systems are expected to put that etag in the request to + * `UpdateBackup` or `DeleteBackup` to ensure that their change will be + * applied to the same version of the resource. + * + * Generated from protobuf field string etag = 24 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * Output only. `etag` is used for optimistic concurrency control as a way to help + * prevent simultaneous updates of a backup from overwriting each other. + * It is strongly suggested that systems make use of the `etag` in the + * read-modify-write cycle to perform backup updates in order to avoid + * race conditions: An `etag` is returned in the response to `GetBackup`, + * and systems are expected to put that etag in the request to + * `UpdateBackup` or `DeleteBackup` to ensure that their change will be + * applied to the same version of the resource. + * + * Generated from protobuf field string etag = 24 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, True); + $this->etag = $var; + + return $this; + } + + /** + * User specified descriptive string for this Backup. + * + * Generated from protobuf field string description = 25; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * User specified descriptive string for this Backup. + * + * Generated from protobuf field string description = 25; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * Output only. The total number of Kubernetes Pods contained in the Backup. + * + * Generated from protobuf field int32 pod_count = 26 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getPodCount() + { + return $this->pod_count; + } + + /** + * Output only. The total number of Kubernetes Pods contained in the Backup. + * + * Generated from protobuf field int32 pod_count = 26 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setPodCount($var) + { + GPBUtil::checkInt32($var); + $this->pod_count = $var; + + return $this; + } + + /** + * Output only. The size of the config backup in bytes. + * + * Generated from protobuf field int64 config_backup_size_bytes = 27 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int|string + */ + public function getConfigBackupSizeBytes() + { + return $this->config_backup_size_bytes; + } + + /** + * Output only. The size of the config backup in bytes. + * + * Generated from protobuf field int64 config_backup_size_bytes = 27 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int|string $var + * @return $this + */ + public function setConfigBackupSizeBytes($var) + { + GPBUtil::checkInt64($var); + $this->config_backup_size_bytes = $var; + + return $this; + } + + /** + * @return string + */ + public function getBackupScope() + { + return $this->whichOneof("backup_scope"); + } + +} + diff --git a/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/Backup/ClusterMetadata.php b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/Backup/ClusterMetadata.php new file mode 100644 index 000000000000..7f7fbdbae16b --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/Backup/ClusterMetadata.php @@ -0,0 +1,233 @@ +google.cloud.gkebackup.v1.Backup.ClusterMetadata + */ +class ClusterMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * The source cluster from which this Backup was created. + * Valid formats: + * - projects/*/locations/*/clusters/* + * - projects/*/zones/*/clusters/* + * This is inherited from the parent BackupPlan's + * [cluster][google.cloud.gkebackup.v1.BackupPlan.cluster] field. + * + * Generated from protobuf field string cluster = 1; + */ + protected $cluster = ''; + /** + * The Kubernetes server version of the source cluster. + * + * Generated from protobuf field string k8s_version = 2; + */ + protected $k8s_version = ''; + /** + * A list of the Backup for GKE CRD versions found in the cluster. + * + * Generated from protobuf field map backup_crd_versions = 3; + */ + private $backup_crd_versions; + protected $platform_version; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $cluster + * The source cluster from which this Backup was created. + * Valid formats: + * - projects/*/locations/*/clusters/* + * - projects/*/zones/*/clusters/* + * This is inherited from the parent BackupPlan's + * [cluster][google.cloud.gkebackup.v1.BackupPlan.cluster] field. + * @type string $k8s_version + * The Kubernetes server version of the source cluster. + * @type array|\Google\Protobuf\Internal\MapField $backup_crd_versions + * A list of the Backup for GKE CRD versions found in the cluster. + * @type string $gke_version + * GKE version + * @type string $anthos_version + * Anthos version + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkebackup\V1\Backup::initOnce(); + parent::__construct($data); + } + + /** + * The source cluster from which this Backup was created. + * Valid formats: + * - projects/*/locations/*/clusters/* + * - projects/*/zones/*/clusters/* + * This is inherited from the parent BackupPlan's + * [cluster][google.cloud.gkebackup.v1.BackupPlan.cluster] field. + * + * Generated from protobuf field string cluster = 1; + * @return string + */ + public function getCluster() + { + return $this->cluster; + } + + /** + * The source cluster from which this Backup was created. + * Valid formats: + * - projects/*/locations/*/clusters/* + * - projects/*/zones/*/clusters/* + * This is inherited from the parent BackupPlan's + * [cluster][google.cloud.gkebackup.v1.BackupPlan.cluster] field. + * + * Generated from protobuf field string cluster = 1; + * @param string $var + * @return $this + */ + public function setCluster($var) + { + GPBUtil::checkString($var, True); + $this->cluster = $var; + + return $this; + } + + /** + * The Kubernetes server version of the source cluster. + * + * Generated from protobuf field string k8s_version = 2; + * @return string + */ + public function getK8SVersion() + { + return $this->k8s_version; + } + + /** + * The Kubernetes server version of the source cluster. + * + * Generated from protobuf field string k8s_version = 2; + * @param string $var + * @return $this + */ + public function setK8SVersion($var) + { + GPBUtil::checkString($var, True); + $this->k8s_version = $var; + + return $this; + } + + /** + * A list of the Backup for GKE CRD versions found in the cluster. + * + * Generated from protobuf field map backup_crd_versions = 3; + * @return \Google\Protobuf\Internal\MapField + */ + public function getBackupCrdVersions() + { + return $this->backup_crd_versions; + } + + /** + * A list of the Backup for GKE CRD versions found in the cluster. + * + * Generated from protobuf field map backup_crd_versions = 3; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setBackupCrdVersions($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->backup_crd_versions = $arr; + + return $this; + } + + /** + * GKE version + * + * Generated from protobuf field string gke_version = 4; + * @return string + */ + public function getGkeVersion() + { + return $this->readOneof(4); + } + + public function hasGkeVersion() + { + return $this->hasOneof(4); + } + + /** + * GKE version + * + * Generated from protobuf field string gke_version = 4; + * @param string $var + * @return $this + */ + public function setGkeVersion($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * Anthos version + * + * Generated from protobuf field string anthos_version = 5; + * @return string + */ + public function getAnthosVersion() + { + return $this->readOneof(5); + } + + public function hasAnthosVersion() + { + return $this->hasOneof(5); + } + + /** + * Anthos version + * + * Generated from protobuf field string anthos_version = 5; + * @param string $var + * @return $this + */ + public function setAnthosVersion($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(5, $var); + + return $this; + } + + /** + * @return string + */ + public function getPlatformVersion() + { + return $this->whichOneof("platform_version"); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ClusterMetadata::class, \Google\Cloud\GkeBackup\V1\Backup_ClusterMetadata::class); + diff --git a/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/Backup/State.php b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/Backup/State.php new file mode 100644 index 000000000000..d3f3a57ba825 --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/Backup/State.php @@ -0,0 +1,88 @@ +google.cloud.gkebackup.v1.Backup.State + */ +class State +{ + /** + * The Backup resource is in the process of being created. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The Backup resource has been created and the associated BackupJob + * Kubernetes resource has been injected into the source cluster. + * + * Generated from protobuf enum CREATING = 1; + */ + const CREATING = 1; + /** + * The gkebackup agent in the cluster has begun executing the backup + * operation. + * + * Generated from protobuf enum IN_PROGRESS = 2; + */ + const IN_PROGRESS = 2; + /** + * The backup operation has completed successfully. + * + * Generated from protobuf enum SUCCEEDED = 3; + */ + const SUCCEEDED = 3; + /** + * The backup operation has failed. + * + * Generated from protobuf enum FAILED = 4; + */ + const FAILED = 4; + /** + * This Backup resource (and its associated artifacts) is in the process + * of being deleted. + * + * Generated from protobuf enum DELETING = 5; + */ + const DELETING = 5; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::CREATING => 'CREATING', + self::IN_PROGRESS => 'IN_PROGRESS', + self::SUCCEEDED => 'SUCCEEDED', + self::FAILED => 'FAILED', + self::DELETING => 'DELETING', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\GkeBackup\V1\Backup_State::class); + diff --git a/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/BackupForGKEGrpcClient.php b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/BackupForGKEGrpcClient.php new file mode 100644 index 000000000000..3e4636e07576 --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/BackupForGKEGrpcClient.php @@ -0,0 +1,396 @@ +_simpleRequest('/google.cloud.gkebackup.v1.BackupForGKE/CreateBackupPlan', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Lists BackupPlans in a given location. + * @param \Google\Cloud\GkeBackup\V1\ListBackupPlansRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function ListBackupPlans(\Google\Cloud\GkeBackup\V1\ListBackupPlansRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.gkebackup.v1.BackupForGKE/ListBackupPlans', + $argument, + ['\Google\Cloud\GkeBackup\V1\ListBackupPlansResponse', 'decode'], + $metadata, $options); + } + + /** + * Retrieve the details of a single BackupPlan. + * @param \Google\Cloud\GkeBackup\V1\GetBackupPlanRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function GetBackupPlan(\Google\Cloud\GkeBackup\V1\GetBackupPlanRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.gkebackup.v1.BackupForGKE/GetBackupPlan', + $argument, + ['\Google\Cloud\GkeBackup\V1\BackupPlan', 'decode'], + $metadata, $options); + } + + /** + * Update a BackupPlan. + * @param \Google\Cloud\GkeBackup\V1\UpdateBackupPlanRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function UpdateBackupPlan(\Google\Cloud\GkeBackup\V1\UpdateBackupPlanRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.gkebackup.v1.BackupForGKE/UpdateBackupPlan', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Deletes an existing BackupPlan. + * @param \Google\Cloud\GkeBackup\V1\DeleteBackupPlanRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function DeleteBackupPlan(\Google\Cloud\GkeBackup\V1\DeleteBackupPlanRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.gkebackup.v1.BackupForGKE/DeleteBackupPlan', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Creates a Backup for the given BackupPlan. + * @param \Google\Cloud\GkeBackup\V1\CreateBackupRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function CreateBackup(\Google\Cloud\GkeBackup\V1\CreateBackupRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.gkebackup.v1.BackupForGKE/CreateBackup', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Lists the Backups for a given BackupPlan. + * @param \Google\Cloud\GkeBackup\V1\ListBackupsRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function ListBackups(\Google\Cloud\GkeBackup\V1\ListBackupsRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.gkebackup.v1.BackupForGKE/ListBackups', + $argument, + ['\Google\Cloud\GkeBackup\V1\ListBackupsResponse', 'decode'], + $metadata, $options); + } + + /** + * Retrieve the details of a single Backup. + * @param \Google\Cloud\GkeBackup\V1\GetBackupRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function GetBackup(\Google\Cloud\GkeBackup\V1\GetBackupRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.gkebackup.v1.BackupForGKE/GetBackup', + $argument, + ['\Google\Cloud\GkeBackup\V1\Backup', 'decode'], + $metadata, $options); + } + + /** + * Update a Backup. + * @param \Google\Cloud\GkeBackup\V1\UpdateBackupRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function UpdateBackup(\Google\Cloud\GkeBackup\V1\UpdateBackupRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.gkebackup.v1.BackupForGKE/UpdateBackup', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Deletes an existing Backup. + * @param \Google\Cloud\GkeBackup\V1\DeleteBackupRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function DeleteBackup(\Google\Cloud\GkeBackup\V1\DeleteBackupRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.gkebackup.v1.BackupForGKE/DeleteBackup', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Lists the VolumeBackups for a given Backup. + * @param \Google\Cloud\GkeBackup\V1\ListVolumeBackupsRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function ListVolumeBackups(\Google\Cloud\GkeBackup\V1\ListVolumeBackupsRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.gkebackup.v1.BackupForGKE/ListVolumeBackups', + $argument, + ['\Google\Cloud\GkeBackup\V1\ListVolumeBackupsResponse', 'decode'], + $metadata, $options); + } + + /** + * Retrieve the details of a single VolumeBackup. + * @param \Google\Cloud\GkeBackup\V1\GetVolumeBackupRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function GetVolumeBackup(\Google\Cloud\GkeBackup\V1\GetVolumeBackupRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.gkebackup.v1.BackupForGKE/GetVolumeBackup', + $argument, + ['\Google\Cloud\GkeBackup\V1\VolumeBackup', 'decode'], + $metadata, $options); + } + + /** + * Creates a new RestorePlan in a given location. + * @param \Google\Cloud\GkeBackup\V1\CreateRestorePlanRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function CreateRestorePlan(\Google\Cloud\GkeBackup\V1\CreateRestorePlanRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.gkebackup.v1.BackupForGKE/CreateRestorePlan', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Lists RestorePlans in a given location. + * @param \Google\Cloud\GkeBackup\V1\ListRestorePlansRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function ListRestorePlans(\Google\Cloud\GkeBackup\V1\ListRestorePlansRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.gkebackup.v1.BackupForGKE/ListRestorePlans', + $argument, + ['\Google\Cloud\GkeBackup\V1\ListRestorePlansResponse', 'decode'], + $metadata, $options); + } + + /** + * Retrieve the details of a single RestorePlan. + * @param \Google\Cloud\GkeBackup\V1\GetRestorePlanRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function GetRestorePlan(\Google\Cloud\GkeBackup\V1\GetRestorePlanRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.gkebackup.v1.BackupForGKE/GetRestorePlan', + $argument, + ['\Google\Cloud\GkeBackup\V1\RestorePlan', 'decode'], + $metadata, $options); + } + + /** + * Update a RestorePlan. + * @param \Google\Cloud\GkeBackup\V1\UpdateRestorePlanRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function UpdateRestorePlan(\Google\Cloud\GkeBackup\V1\UpdateRestorePlanRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.gkebackup.v1.BackupForGKE/UpdateRestorePlan', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Deletes an existing RestorePlan. + * @param \Google\Cloud\GkeBackup\V1\DeleteRestorePlanRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function DeleteRestorePlan(\Google\Cloud\GkeBackup\V1\DeleteRestorePlanRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.gkebackup.v1.BackupForGKE/DeleteRestorePlan', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Creates a new Restore for the given RestorePlan. + * @param \Google\Cloud\GkeBackup\V1\CreateRestoreRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function CreateRestore(\Google\Cloud\GkeBackup\V1\CreateRestoreRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.gkebackup.v1.BackupForGKE/CreateRestore', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Lists the Restores for a given RestorePlan. + * @param \Google\Cloud\GkeBackup\V1\ListRestoresRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function ListRestores(\Google\Cloud\GkeBackup\V1\ListRestoresRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.gkebackup.v1.BackupForGKE/ListRestores', + $argument, + ['\Google\Cloud\GkeBackup\V1\ListRestoresResponse', 'decode'], + $metadata, $options); + } + + /** + * Retrieves the details of a single Restore. + * @param \Google\Cloud\GkeBackup\V1\GetRestoreRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function GetRestore(\Google\Cloud\GkeBackup\V1\GetRestoreRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.gkebackup.v1.BackupForGKE/GetRestore', + $argument, + ['\Google\Cloud\GkeBackup\V1\Restore', 'decode'], + $metadata, $options); + } + + /** + * Update a Restore. + * @param \Google\Cloud\GkeBackup\V1\UpdateRestoreRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function UpdateRestore(\Google\Cloud\GkeBackup\V1\UpdateRestoreRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.gkebackup.v1.BackupForGKE/UpdateRestore', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Deletes an existing Restore. + * @param \Google\Cloud\GkeBackup\V1\DeleteRestoreRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function DeleteRestore(\Google\Cloud\GkeBackup\V1\DeleteRestoreRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.gkebackup.v1.BackupForGKE/DeleteRestore', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Lists the VolumeRestores for a given Restore. + * @param \Google\Cloud\GkeBackup\V1\ListVolumeRestoresRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function ListVolumeRestores(\Google\Cloud\GkeBackup\V1\ListVolumeRestoresRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.gkebackup.v1.BackupForGKE/ListVolumeRestores', + $argument, + ['\Google\Cloud\GkeBackup\V1\ListVolumeRestoresResponse', 'decode'], + $metadata, $options); + } + + /** + * Retrieve the details of a single VolumeRestore. + * @param \Google\Cloud\GkeBackup\V1\GetVolumeRestoreRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function GetVolumeRestore(\Google\Cloud\GkeBackup\V1\GetVolumeRestoreRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.gkebackup.v1.BackupForGKE/GetVolumeRestore', + $argument, + ['\Google\Cloud\GkeBackup\V1\VolumeRestore', 'decode'], + $metadata, $options); + } + +} diff --git a/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/BackupPlan.php b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/BackupPlan.php new file mode 100644 index 000000000000..cc832b5239e8 --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/BackupPlan.php @@ -0,0 +1,605 @@ +google.cloud.gkebackup.v1.BackupPlan + */ +class BackupPlan extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The full name of the BackupPlan resource. + * Format: projects/*/locations/*/backupPlans/* + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $name = ''; + /** + * Output only. Server generated global unique identifier of + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier) format. + * + * Generated from protobuf field string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $uid = ''; + /** + * Output only. The timestamp when this BackupPlan resource was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. The timestamp when this BackupPlan resource was last + * updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * User specified descriptive string for this BackupPlan. + * + * Generated from protobuf field string description = 5; + */ + protected $description = ''; + /** + * Required. Immutable. The source cluster from which Backups will be created via + * this BackupPlan. + * Valid formats: + * - projects/*/locations/*/clusters/* + * - projects/*/zones/*/clusters/* + * + * Generated from protobuf field string cluster = 6 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $cluster = ''; + /** + * RetentionPolicy governs lifecycle of Backups created under this plan. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.BackupPlan.RetentionPolicy retention_policy = 7; + */ + protected $retention_policy = null; + /** + * A set of custom labels supplied by user. + * + * Generated from protobuf field map labels = 8; + */ + private $labels; + /** + * Defines a schedule for automatic Backup creation via this BackupPlan. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.BackupPlan.Schedule backup_schedule = 9; + */ + protected $backup_schedule = null; + /** + * Output only. `etag` is used for optimistic concurrency control as a way to help + * prevent simultaneous updates of a backup plan from overwriting each other. + * It is strongly suggested that systems make use of the 'etag' in the + * read-modify-write cycle to perform BackupPlan updates in order to avoid + * race conditions: An `etag` is returned in the response to `GetBackupPlan`, + * and systems are expected to put that etag in the request to + * `UpdateBackupPlan` or `DeleteBackupPlan` to ensure that their change + * will be applied to the same version of the resource. + * + * Generated from protobuf field string etag = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $etag = ''; + /** + * This flag indicates whether this BackupPlan has been deactivated. + * Setting this field to True locks the BackupPlan such that no further + * updates will be allowed (except deletes), including the deactivated field + * itself. It also prevents any new Backups from being created via this + * BackupPlan (including scheduled Backups). + * Default: False + * + * Generated from protobuf field bool deactivated = 11; + */ + protected $deactivated = false; + /** + * Defines the configuration of Backups created via this BackupPlan. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.BackupPlan.BackupConfig backup_config = 12; + */ + protected $backup_config = null; + /** + * Output only. The number of Kubernetes Pods backed up in the + * last successful Backup created via this BackupPlan. + * + * Generated from protobuf field int32 protected_pod_count = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $protected_pod_count = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Output only. The full name of the BackupPlan resource. + * Format: projects/*/locations/*/backupPlans/* + * @type string $uid + * Output only. Server generated global unique identifier of + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier) format. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The timestamp when this BackupPlan resource was created. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. The timestamp when this BackupPlan resource was last + * updated. + * @type string $description + * User specified descriptive string for this BackupPlan. + * @type string $cluster + * Required. Immutable. The source cluster from which Backups will be created via + * this BackupPlan. + * Valid formats: + * - projects/*/locations/*/clusters/* + * - projects/*/zones/*/clusters/* + * @type \Google\Cloud\GkeBackup\V1\BackupPlan\RetentionPolicy $retention_policy + * RetentionPolicy governs lifecycle of Backups created under this plan. + * @type array|\Google\Protobuf\Internal\MapField $labels + * A set of custom labels supplied by user. + * @type \Google\Cloud\GkeBackup\V1\BackupPlan\Schedule $backup_schedule + * Defines a schedule for automatic Backup creation via this BackupPlan. + * @type string $etag + * Output only. `etag` is used for optimistic concurrency control as a way to help + * prevent simultaneous updates of a backup plan from overwriting each other. + * It is strongly suggested that systems make use of the 'etag' in the + * read-modify-write cycle to perform BackupPlan updates in order to avoid + * race conditions: An `etag` is returned in the response to `GetBackupPlan`, + * and systems are expected to put that etag in the request to + * `UpdateBackupPlan` or `DeleteBackupPlan` to ensure that their change + * will be applied to the same version of the resource. + * @type bool $deactivated + * This flag indicates whether this BackupPlan has been deactivated. + * Setting this field to True locks the BackupPlan such that no further + * updates will be allowed (except deletes), including the deactivated field + * itself. It also prevents any new Backups from being created via this + * BackupPlan (including scheduled Backups). + * Default: False + * @type \Google\Cloud\GkeBackup\V1\BackupPlan\BackupConfig $backup_config + * Defines the configuration of Backups created via this BackupPlan. + * @type int $protected_pod_count + * Output only. The number of Kubernetes Pods backed up in the + * last successful Backup created via this BackupPlan. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkebackup\V1\BackupPlan::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The full name of the BackupPlan resource. + * Format: projects/*/locations/*/backupPlans/* + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Output only. The full name of the BackupPlan resource. + * Format: projects/*/locations/*/backupPlans/* + * + * 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. Server generated global unique identifier of + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier) format. + * + * Generated from protobuf field string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getUid() + { + return $this->uid; + } + + /** + * Output only. Server generated global unique identifier of + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier) format. + * + * Generated from protobuf field string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setUid($var) + { + GPBUtil::checkString($var, True); + $this->uid = $var; + + return $this; + } + + /** + * Output only. The timestamp when this BackupPlan resource was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 3 [(.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 timestamp when this BackupPlan resource was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 3 [(.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 timestamp when this BackupPlan resource was last + * updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 4 [(.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 timestamp when this BackupPlan resource was last + * updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 4 [(.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; + } + + /** + * User specified descriptive string for this BackupPlan. + * + * Generated from protobuf field string description = 5; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * User specified descriptive string for this BackupPlan. + * + * Generated from protobuf field string description = 5; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * Required. Immutable. The source cluster from which Backups will be created via + * this BackupPlan. + * Valid formats: + * - projects/*/locations/*/clusters/* + * - projects/*/zones/*/clusters/* + * + * Generated from protobuf field string cluster = 6 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getCluster() + { + return $this->cluster; + } + + /** + * Required. Immutable. The source cluster from which Backups will be created via + * this BackupPlan. + * Valid formats: + * - projects/*/locations/*/clusters/* + * - projects/*/zones/*/clusters/* + * + * Generated from protobuf field string cluster = 6 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setCluster($var) + { + GPBUtil::checkString($var, True); + $this->cluster = $var; + + return $this; + } + + /** + * RetentionPolicy governs lifecycle of Backups created under this plan. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.BackupPlan.RetentionPolicy retention_policy = 7; + * @return \Google\Cloud\GkeBackup\V1\BackupPlan\RetentionPolicy|null + */ + public function getRetentionPolicy() + { + return $this->retention_policy; + } + + public function hasRetentionPolicy() + { + return isset($this->retention_policy); + } + + public function clearRetentionPolicy() + { + unset($this->retention_policy); + } + + /** + * RetentionPolicy governs lifecycle of Backups created under this plan. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.BackupPlan.RetentionPolicy retention_policy = 7; + * @param \Google\Cloud\GkeBackup\V1\BackupPlan\RetentionPolicy $var + * @return $this + */ + public function setRetentionPolicy($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeBackup\V1\BackupPlan\RetentionPolicy::class); + $this->retention_policy = $var; + + return $this; + } + + /** + * A set of custom labels supplied by user. + * + * Generated from protobuf field map labels = 8; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * A set of custom labels supplied by user. + * + * Generated from protobuf field map labels = 8; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + + /** + * Defines a schedule for automatic Backup creation via this BackupPlan. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.BackupPlan.Schedule backup_schedule = 9; + * @return \Google\Cloud\GkeBackup\V1\BackupPlan\Schedule|null + */ + public function getBackupSchedule() + { + return $this->backup_schedule; + } + + public function hasBackupSchedule() + { + return isset($this->backup_schedule); + } + + public function clearBackupSchedule() + { + unset($this->backup_schedule); + } + + /** + * Defines a schedule for automatic Backup creation via this BackupPlan. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.BackupPlan.Schedule backup_schedule = 9; + * @param \Google\Cloud\GkeBackup\V1\BackupPlan\Schedule $var + * @return $this + */ + public function setBackupSchedule($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeBackup\V1\BackupPlan\Schedule::class); + $this->backup_schedule = $var; + + return $this; + } + + /** + * Output only. `etag` is used for optimistic concurrency control as a way to help + * prevent simultaneous updates of a backup plan from overwriting each other. + * It is strongly suggested that systems make use of the 'etag' in the + * read-modify-write cycle to perform BackupPlan updates in order to avoid + * race conditions: An `etag` is returned in the response to `GetBackupPlan`, + * and systems are expected to put that etag in the request to + * `UpdateBackupPlan` or `DeleteBackupPlan` to ensure that their change + * will be applied to the same version of the resource. + * + * Generated from protobuf field string etag = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * Output only. `etag` is used for optimistic concurrency control as a way to help + * prevent simultaneous updates of a backup plan from overwriting each other. + * It is strongly suggested that systems make use of the 'etag' in the + * read-modify-write cycle to perform BackupPlan updates in order to avoid + * race conditions: An `etag` is returned in the response to `GetBackupPlan`, + * and systems are expected to put that etag in the request to + * `UpdateBackupPlan` or `DeleteBackupPlan` to ensure that their change + * will be applied to the same version of the resource. + * + * Generated from protobuf field string etag = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, True); + $this->etag = $var; + + return $this; + } + + /** + * This flag indicates whether this BackupPlan has been deactivated. + * Setting this field to True locks the BackupPlan such that no further + * updates will be allowed (except deletes), including the deactivated field + * itself. It also prevents any new Backups from being created via this + * BackupPlan (including scheduled Backups). + * Default: False + * + * Generated from protobuf field bool deactivated = 11; + * @return bool + */ + public function getDeactivated() + { + return $this->deactivated; + } + + /** + * This flag indicates whether this BackupPlan has been deactivated. + * Setting this field to True locks the BackupPlan such that no further + * updates will be allowed (except deletes), including the deactivated field + * itself. It also prevents any new Backups from being created via this + * BackupPlan (including scheduled Backups). + * Default: False + * + * Generated from protobuf field bool deactivated = 11; + * @param bool $var + * @return $this + */ + public function setDeactivated($var) + { + GPBUtil::checkBool($var); + $this->deactivated = $var; + + return $this; + } + + /** + * Defines the configuration of Backups created via this BackupPlan. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.BackupPlan.BackupConfig backup_config = 12; + * @return \Google\Cloud\GkeBackup\V1\BackupPlan\BackupConfig|null + */ + public function getBackupConfig() + { + return $this->backup_config; + } + + public function hasBackupConfig() + { + return isset($this->backup_config); + } + + public function clearBackupConfig() + { + unset($this->backup_config); + } + + /** + * Defines the configuration of Backups created via this BackupPlan. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.BackupPlan.BackupConfig backup_config = 12; + * @param \Google\Cloud\GkeBackup\V1\BackupPlan\BackupConfig $var + * @return $this + */ + public function setBackupConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeBackup\V1\BackupPlan\BackupConfig::class); + $this->backup_config = $var; + + return $this; + } + + /** + * Output only. The number of Kubernetes Pods backed up in the + * last successful Backup created via this BackupPlan. + * + * Generated from protobuf field int32 protected_pod_count = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getProtectedPodCount() + { + return $this->protected_pod_count; + } + + /** + * Output only. The number of Kubernetes Pods backed up in the + * last successful Backup created via this BackupPlan. + * + * Generated from protobuf field int32 protected_pod_count = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setProtectedPodCount($var) + { + GPBUtil::checkInt32($var); + $this->protected_pod_count = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/BackupPlan/BackupConfig.php b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/BackupPlan/BackupConfig.php new file mode 100644 index 000000000000..23ab8ab2ec06 --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/BackupPlan/BackupConfig.php @@ -0,0 +1,288 @@ +google.cloud.gkebackup.v1.BackupPlan.BackupConfig + */ +class BackupConfig extends \Google\Protobuf\Internal\Message +{ + /** + * This flag specifies whether volume data should be backed up when + * PVCs are included in the scope of a Backup. + * Default: False + * + * Generated from protobuf field bool include_volume_data = 4; + */ + protected $include_volume_data = false; + /** + * This flag specifies whether Kubernetes Secret resources should be + * included when they fall into the scope of Backups. + * Default: False + * + * Generated from protobuf field bool include_secrets = 5; + */ + protected $include_secrets = false; + /** + * This defines a customer managed encryption key that will be used to + * encrypt the "config" portion (the Kubernetes resources) of Backups + * created via this plan. + * Default (empty): Config backup artifacts will not be encrypted. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.EncryptionKey encryption_key = 6; + */ + protected $encryption_key = null; + protected $backup_scope; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $all_namespaces + * If True, include all namespaced resources + * @type \Google\Cloud\GkeBackup\V1\Namespaces $selected_namespaces + * If set, include just the resources in the listed namespaces. + * @type \Google\Cloud\GkeBackup\V1\NamespacedNames $selected_applications + * If set, include just the resources referenced by the listed + * ProtectedApplications. + * @type bool $include_volume_data + * This flag specifies whether volume data should be backed up when + * PVCs are included in the scope of a Backup. + * Default: False + * @type bool $include_secrets + * This flag specifies whether Kubernetes Secret resources should be + * included when they fall into the scope of Backups. + * Default: False + * @type \Google\Cloud\GkeBackup\V1\EncryptionKey $encryption_key + * This defines a customer managed encryption key that will be used to + * encrypt the "config" portion (the Kubernetes resources) of Backups + * created via this plan. + * Default (empty): Config backup artifacts will not be encrypted. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkebackup\V1\BackupPlan::initOnce(); + parent::__construct($data); + } + + /** + * If True, include all namespaced resources + * + * Generated from protobuf field bool all_namespaces = 1; + * @return bool + */ + public function getAllNamespaces() + { + return $this->readOneof(1); + } + + public function hasAllNamespaces() + { + return $this->hasOneof(1); + } + + /** + * If True, include all namespaced resources + * + * Generated from protobuf field bool all_namespaces = 1; + * @param bool $var + * @return $this + */ + public function setAllNamespaces($var) + { + GPBUtil::checkBool($var); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * If set, include just the resources in the listed namespaces. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.Namespaces selected_namespaces = 2; + * @return \Google\Cloud\GkeBackup\V1\Namespaces|null + */ + public function getSelectedNamespaces() + { + return $this->readOneof(2); + } + + public function hasSelectedNamespaces() + { + return $this->hasOneof(2); + } + + /** + * If set, include just the resources in the listed namespaces. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.Namespaces selected_namespaces = 2; + * @param \Google\Cloud\GkeBackup\V1\Namespaces $var + * @return $this + */ + public function setSelectedNamespaces($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeBackup\V1\Namespaces::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * If set, include just the resources referenced by the listed + * ProtectedApplications. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.NamespacedNames selected_applications = 3; + * @return \Google\Cloud\GkeBackup\V1\NamespacedNames|null + */ + public function getSelectedApplications() + { + return $this->readOneof(3); + } + + public function hasSelectedApplications() + { + return $this->hasOneof(3); + } + + /** + * If set, include just the resources referenced by the listed + * ProtectedApplications. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.NamespacedNames selected_applications = 3; + * @param \Google\Cloud\GkeBackup\V1\NamespacedNames $var + * @return $this + */ + public function setSelectedApplications($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeBackup\V1\NamespacedNames::class); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * This flag specifies whether volume data should be backed up when + * PVCs are included in the scope of a Backup. + * Default: False + * + * Generated from protobuf field bool include_volume_data = 4; + * @return bool + */ + public function getIncludeVolumeData() + { + return $this->include_volume_data; + } + + /** + * This flag specifies whether volume data should be backed up when + * PVCs are included in the scope of a Backup. + * Default: False + * + * Generated from protobuf field bool include_volume_data = 4; + * @param bool $var + * @return $this + */ + public function setIncludeVolumeData($var) + { + GPBUtil::checkBool($var); + $this->include_volume_data = $var; + + return $this; + } + + /** + * This flag specifies whether Kubernetes Secret resources should be + * included when they fall into the scope of Backups. + * Default: False + * + * Generated from protobuf field bool include_secrets = 5; + * @return bool + */ + public function getIncludeSecrets() + { + return $this->include_secrets; + } + + /** + * This flag specifies whether Kubernetes Secret resources should be + * included when they fall into the scope of Backups. + * Default: False + * + * Generated from protobuf field bool include_secrets = 5; + * @param bool $var + * @return $this + */ + public function setIncludeSecrets($var) + { + GPBUtil::checkBool($var); + $this->include_secrets = $var; + + return $this; + } + + /** + * This defines a customer managed encryption key that will be used to + * encrypt the "config" portion (the Kubernetes resources) of Backups + * created via this plan. + * Default (empty): Config backup artifacts will not be encrypted. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.EncryptionKey encryption_key = 6; + * @return \Google\Cloud\GkeBackup\V1\EncryptionKey|null + */ + public function getEncryptionKey() + { + return $this->encryption_key; + } + + public function hasEncryptionKey() + { + return isset($this->encryption_key); + } + + public function clearEncryptionKey() + { + unset($this->encryption_key); + } + + /** + * This defines a customer managed encryption key that will be used to + * encrypt the "config" portion (the Kubernetes resources) of Backups + * created via this plan. + * Default (empty): Config backup artifacts will not be encrypted. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.EncryptionKey encryption_key = 6; + * @param \Google\Cloud\GkeBackup\V1\EncryptionKey $var + * @return $this + */ + public function setEncryptionKey($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeBackup\V1\EncryptionKey::class); + $this->encryption_key = $var; + + return $this; + } + + /** + * @return string + */ + public function getBackupScope() + { + return $this->whichOneof("backup_scope"); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(BackupConfig::class, \Google\Cloud\GkeBackup\V1\BackupPlan_BackupConfig::class); + diff --git a/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/BackupPlan/RetentionPolicy.php b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/BackupPlan/RetentionPolicy.php new file mode 100644 index 000000000000..c675595bb3a9 --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/BackupPlan/RetentionPolicy.php @@ -0,0 +1,222 @@ +google.cloud.gkebackup.v1.BackupPlan.RetentionPolicy + */ +class RetentionPolicy extends \Google\Protobuf\Internal\Message +{ + /** + * Minimum age for Backups created via this BackupPlan (in days). + * This field MUST be an integer value between 0-90 (inclusive). + * A Backup created under this BackupPlan will NOT be deletable until it + * reaches Backup's (create_time + backup_delete_lock_days). + * Updating this field of a BackupPlan does NOT affect existing Backups + * under it. Backups created AFTER a successful update will inherit + * the new value. + * Default: 0 (no delete blocking) + * + * Generated from protobuf field int32 backup_delete_lock_days = 1; + */ + protected $backup_delete_lock_days = 0; + /** + * The default maximum age of a Backup created via this BackupPlan. + * This field MUST be an integer value >= 0. + * If specified, a Backup created under this BackupPlan will be + * automatically deleted after its age reaches (create_time + + * backup_retain_days). + * If not specified, Backups created under this BackupPlan will NOT be + * subject to automatic deletion. + * Updating this field does NOT affect existing Backups under it. Backups + * created AFTER a successful update will automatically pick up the new + * value. + * NOTE: backup_retain_days must be >= [backup_delete_lock_days][google.cloud.gkebackup.v1.BackupPlan.RetentionPolicy.backup_delete_lock_days]. + * Default: 0 (no automatic deletion) + * + * Generated from protobuf field int32 backup_retain_days = 2; + */ + protected $backup_retain_days = 0; + /** + * This flag denotes whether the retention policy of this BackupPlan is + * locked. If set to True, no further update is allowed on this policy, + * including the `locked` field itself. + * Default: False + * + * Generated from protobuf field bool locked = 3; + */ + protected $locked = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $backup_delete_lock_days + * Minimum age for Backups created via this BackupPlan (in days). + * This field MUST be an integer value between 0-90 (inclusive). + * A Backup created under this BackupPlan will NOT be deletable until it + * reaches Backup's (create_time + backup_delete_lock_days). + * Updating this field of a BackupPlan does NOT affect existing Backups + * under it. Backups created AFTER a successful update will inherit + * the new value. + * Default: 0 (no delete blocking) + * @type int $backup_retain_days + * The default maximum age of a Backup created via this BackupPlan. + * This field MUST be an integer value >= 0. + * If specified, a Backup created under this BackupPlan will be + * automatically deleted after its age reaches (create_time + + * backup_retain_days). + * If not specified, Backups created under this BackupPlan will NOT be + * subject to automatic deletion. + * Updating this field does NOT affect existing Backups under it. Backups + * created AFTER a successful update will automatically pick up the new + * value. + * NOTE: backup_retain_days must be >= [backup_delete_lock_days][google.cloud.gkebackup.v1.BackupPlan.RetentionPolicy.backup_delete_lock_days]. + * Default: 0 (no automatic deletion) + * @type bool $locked + * This flag denotes whether the retention policy of this BackupPlan is + * locked. If set to True, no further update is allowed on this policy, + * including the `locked` field itself. + * Default: False + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkebackup\V1\BackupPlan::initOnce(); + parent::__construct($data); + } + + /** + * Minimum age for Backups created via this BackupPlan (in days). + * This field MUST be an integer value between 0-90 (inclusive). + * A Backup created under this BackupPlan will NOT be deletable until it + * reaches Backup's (create_time + backup_delete_lock_days). + * Updating this field of a BackupPlan does NOT affect existing Backups + * under it. Backups created AFTER a successful update will inherit + * the new value. + * Default: 0 (no delete blocking) + * + * Generated from protobuf field int32 backup_delete_lock_days = 1; + * @return int + */ + public function getBackupDeleteLockDays() + { + return $this->backup_delete_lock_days; + } + + /** + * Minimum age for Backups created via this BackupPlan (in days). + * This field MUST be an integer value between 0-90 (inclusive). + * A Backup created under this BackupPlan will NOT be deletable until it + * reaches Backup's (create_time + backup_delete_lock_days). + * Updating this field of a BackupPlan does NOT affect existing Backups + * under it. Backups created AFTER a successful update will inherit + * the new value. + * Default: 0 (no delete blocking) + * + * Generated from protobuf field int32 backup_delete_lock_days = 1; + * @param int $var + * @return $this + */ + public function setBackupDeleteLockDays($var) + { + GPBUtil::checkInt32($var); + $this->backup_delete_lock_days = $var; + + return $this; + } + + /** + * The default maximum age of a Backup created via this BackupPlan. + * This field MUST be an integer value >= 0. + * If specified, a Backup created under this BackupPlan will be + * automatically deleted after its age reaches (create_time + + * backup_retain_days). + * If not specified, Backups created under this BackupPlan will NOT be + * subject to automatic deletion. + * Updating this field does NOT affect existing Backups under it. Backups + * created AFTER a successful update will automatically pick up the new + * value. + * NOTE: backup_retain_days must be >= [backup_delete_lock_days][google.cloud.gkebackup.v1.BackupPlan.RetentionPolicy.backup_delete_lock_days]. + * Default: 0 (no automatic deletion) + * + * Generated from protobuf field int32 backup_retain_days = 2; + * @return int + */ + public function getBackupRetainDays() + { + return $this->backup_retain_days; + } + + /** + * The default maximum age of a Backup created via this BackupPlan. + * This field MUST be an integer value >= 0. + * If specified, a Backup created under this BackupPlan will be + * automatically deleted after its age reaches (create_time + + * backup_retain_days). + * If not specified, Backups created under this BackupPlan will NOT be + * subject to automatic deletion. + * Updating this field does NOT affect existing Backups under it. Backups + * created AFTER a successful update will automatically pick up the new + * value. + * NOTE: backup_retain_days must be >= [backup_delete_lock_days][google.cloud.gkebackup.v1.BackupPlan.RetentionPolicy.backup_delete_lock_days]. + * Default: 0 (no automatic deletion) + * + * Generated from protobuf field int32 backup_retain_days = 2; + * @param int $var + * @return $this + */ + public function setBackupRetainDays($var) + { + GPBUtil::checkInt32($var); + $this->backup_retain_days = $var; + + return $this; + } + + /** + * This flag denotes whether the retention policy of this BackupPlan is + * locked. If set to True, no further update is allowed on this policy, + * including the `locked` field itself. + * Default: False + * + * Generated from protobuf field bool locked = 3; + * @return bool + */ + public function getLocked() + { + return $this->locked; + } + + /** + * This flag denotes whether the retention policy of this BackupPlan is + * locked. If set to True, no further update is allowed on this policy, + * including the `locked` field itself. + * Default: False + * + * Generated from protobuf field bool locked = 3; + * @param bool $var + * @return $this + */ + public function setLocked($var) + { + GPBUtil::checkBool($var); + $this->locked = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(RetentionPolicy::class, \Google\Cloud\GkeBackup\V1\BackupPlan_RetentionPolicy::class); + diff --git a/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/BackupPlan/Schedule.php b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/BackupPlan/Schedule.php new file mode 100644 index 000000000000..94215c3b9286 --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/BackupPlan/Schedule.php @@ -0,0 +1,121 @@ +google.cloud.gkebackup.v1.BackupPlan.Schedule + */ +class Schedule extends \Google\Protobuf\Internal\Message +{ + /** + * A standard [cron](https://wikipedia.com/wiki/cron) string that defines a + * repeating schedule for creating Backups via this BackupPlan. + * Default (empty): no automatic backup creation will occur. + * + * Generated from protobuf field string cron_schedule = 1; + */ + protected $cron_schedule = ''; + /** + * This flag denotes whether automatic Backup creation is paused for this + * BackupPlan. + * Default: False + * + * Generated from protobuf field bool paused = 2; + */ + protected $paused = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $cron_schedule + * A standard [cron](https://wikipedia.com/wiki/cron) string that defines a + * repeating schedule for creating Backups via this BackupPlan. + * Default (empty): no automatic backup creation will occur. + * @type bool $paused + * This flag denotes whether automatic Backup creation is paused for this + * BackupPlan. + * Default: False + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkebackup\V1\BackupPlan::initOnce(); + parent::__construct($data); + } + + /** + * A standard [cron](https://wikipedia.com/wiki/cron) string that defines a + * repeating schedule for creating Backups via this BackupPlan. + * Default (empty): no automatic backup creation will occur. + * + * Generated from protobuf field string cron_schedule = 1; + * @return string + */ + public function getCronSchedule() + { + return $this->cron_schedule; + } + + /** + * A standard [cron](https://wikipedia.com/wiki/cron) string that defines a + * repeating schedule for creating Backups via this BackupPlan. + * Default (empty): no automatic backup creation will occur. + * + * Generated from protobuf field string cron_schedule = 1; + * @param string $var + * @return $this + */ + public function setCronSchedule($var) + { + GPBUtil::checkString($var, True); + $this->cron_schedule = $var; + + return $this; + } + + /** + * This flag denotes whether automatic Backup creation is paused for this + * BackupPlan. + * Default: False + * + * Generated from protobuf field bool paused = 2; + * @return bool + */ + public function getPaused() + { + return $this->paused; + } + + /** + * This flag denotes whether automatic Backup creation is paused for this + * BackupPlan. + * Default: False + * + * Generated from protobuf field bool paused = 2; + * @param bool $var + * @return $this + */ + public function setPaused($var) + { + GPBUtil::checkBool($var); + $this->paused = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Schedule::class, \Google\Cloud\GkeBackup\V1\BackupPlan_Schedule::class); + diff --git a/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/BackupPlan_BackupConfig.php b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/BackupPlan_BackupConfig.php new file mode 100644 index 000000000000..7daaae24bb48 --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/BackupPlan_BackupConfig.php @@ -0,0 +1,16 @@ +google.cloud.gkebackup.v1.CreateBackupPlanRequest + */ +class CreateBackupPlanRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The location within which to create the BackupPlan. + * Format: projects/*/locations/* + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The BackupPlan resource object to create. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.BackupPlan backup_plan = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $backup_plan = null; + /** + * Required. The client-provided short name for the BackupPlan resource. + * This name must: + * - be between 1 and 63 characters long (inclusive) + * - consist of only lower-case ASCII letters, numbers, and dashes + * - start with a lower-case letter + * - end with a lower-case letter or number + * - be unique within the set of BackupPlans in this location + * + * Generated from protobuf field string backup_plan_id = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $backup_plan_id = ''; + + /** + * @param string $parent Required. The location within which to create the BackupPlan. + * Format: projects/*/locations/* + * Please see {@see BackupForGKEClient::locationName()} for help formatting this field. + * @param \Google\Cloud\GkeBackup\V1\BackupPlan $backupPlan Required. The BackupPlan resource object to create. + * @param string $backupPlanId Required. The client-provided short name for the BackupPlan resource. + * This name must: + * + * - be between 1 and 63 characters long (inclusive) + * - consist of only lower-case ASCII letters, numbers, and dashes + * - start with a lower-case letter + * - end with a lower-case letter or number + * - be unique within the set of BackupPlans in this location + * + * @return \Google\Cloud\GkeBackup\V1\CreateBackupPlanRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\GkeBackup\V1\BackupPlan $backupPlan, string $backupPlanId): self + { + return (new self()) + ->setParent($parent) + ->setBackupPlan($backupPlan) + ->setBackupPlanId($backupPlanId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The location within which to create the BackupPlan. + * Format: projects/*/locations/* + * @type \Google\Cloud\GkeBackup\V1\BackupPlan $backup_plan + * Required. The BackupPlan resource object to create. + * @type string $backup_plan_id + * Required. The client-provided short name for the BackupPlan resource. + * This name must: + * - be between 1 and 63 characters long (inclusive) + * - consist of only lower-case ASCII letters, numbers, and dashes + * - start with a lower-case letter + * - end with a lower-case letter or number + * - be unique within the set of BackupPlans in this location + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkebackup\V1\Gkebackup::initOnce(); + parent::__construct($data); + } + + /** + * Required. The location within which to create the BackupPlan. + * Format: projects/*/locations/* + * + * 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. The location within which to create the BackupPlan. + * Format: projects/*/locations/* + * + * 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. The BackupPlan resource object to create. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.BackupPlan backup_plan = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\GkeBackup\V1\BackupPlan|null + */ + public function getBackupPlan() + { + return $this->backup_plan; + } + + public function hasBackupPlan() + { + return isset($this->backup_plan); + } + + public function clearBackupPlan() + { + unset($this->backup_plan); + } + + /** + * Required. The BackupPlan resource object to create. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.BackupPlan backup_plan = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\GkeBackup\V1\BackupPlan $var + * @return $this + */ + public function setBackupPlan($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeBackup\V1\BackupPlan::class); + $this->backup_plan = $var; + + return $this; + } + + /** + * Required. The client-provided short name for the BackupPlan resource. + * This name must: + * - be between 1 and 63 characters long (inclusive) + * - consist of only lower-case ASCII letters, numbers, and dashes + * - start with a lower-case letter + * - end with a lower-case letter or number + * - be unique within the set of BackupPlans in this location + * + * Generated from protobuf field string backup_plan_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getBackupPlanId() + { + return $this->backup_plan_id; + } + + /** + * Required. The client-provided short name for the BackupPlan resource. + * This name must: + * - be between 1 and 63 characters long (inclusive) + * - consist of only lower-case ASCII letters, numbers, and dashes + * - start with a lower-case letter + * - end with a lower-case letter or number + * - be unique within the set of BackupPlans in this location + * + * Generated from protobuf field string backup_plan_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setBackupPlanId($var) + { + GPBUtil::checkString($var, True); + $this->backup_plan_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/CreateBackupRequest.php b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/CreateBackupRequest.php new file mode 100644 index 000000000000..fee456a2d158 --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/CreateBackupRequest.php @@ -0,0 +1,199 @@ +google.cloud.gkebackup.v1.CreateBackupRequest + */ +class CreateBackupRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The BackupPlan within which to create the Backup. + * Format: projects/*/locations/*/backupPlans/* + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The Backup resource to create. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.Backup backup = 2; + */ + protected $backup = null; + /** + * The client-provided short name for the Backup resource. + * This name must: + * - be between 1 and 63 characters long (inclusive) + * - consist of only lower-case ASCII letters, numbers, and dashes + * - start with a lower-case letter + * - end with a lower-case letter or number + * - be unique within the set of Backups in this BackupPlan + * + * Generated from protobuf field string backup_id = 3; + */ + protected $backup_id = ''; + + /** + * @param string $parent Required. The BackupPlan within which to create the Backup. + * Format: projects/*/locations/*/backupPlans/* + * Please see {@see BackupForGKEClient::backupPlanName()} for help formatting this field. + * @param \Google\Cloud\GkeBackup\V1\Backup $backup The Backup resource to create. + * @param string $backupId The client-provided short name for the Backup resource. + * This name must: + * + * - be between 1 and 63 characters long (inclusive) + * - consist of only lower-case ASCII letters, numbers, and dashes + * - start with a lower-case letter + * - end with a lower-case letter or number + * - be unique within the set of Backups in this BackupPlan + * + * @return \Google\Cloud\GkeBackup\V1\CreateBackupRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\GkeBackup\V1\Backup $backup, string $backupId): self + { + return (new self()) + ->setParent($parent) + ->setBackup($backup) + ->setBackupId($backupId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The BackupPlan within which to create the Backup. + * Format: projects/*/locations/*/backupPlans/* + * @type \Google\Cloud\GkeBackup\V1\Backup $backup + * The Backup resource to create. + * @type string $backup_id + * The client-provided short name for the Backup resource. + * This name must: + * - be between 1 and 63 characters long (inclusive) + * - consist of only lower-case ASCII letters, numbers, and dashes + * - start with a lower-case letter + * - end with a lower-case letter or number + * - be unique within the set of Backups in this BackupPlan + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkebackup\V1\Gkebackup::initOnce(); + parent::__construct($data); + } + + /** + * Required. The BackupPlan within which to create the Backup. + * Format: projects/*/locations/*/backupPlans/* + * + * 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. The BackupPlan within which to create the Backup. + * Format: projects/*/locations/*/backupPlans/* + * + * 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; + } + + /** + * The Backup resource to create. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.Backup backup = 2; + * @return \Google\Cloud\GkeBackup\V1\Backup|null + */ + public function getBackup() + { + return $this->backup; + } + + public function hasBackup() + { + return isset($this->backup); + } + + public function clearBackup() + { + unset($this->backup); + } + + /** + * The Backup resource to create. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.Backup backup = 2; + * @param \Google\Cloud\GkeBackup\V1\Backup $var + * @return $this + */ + public function setBackup($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeBackup\V1\Backup::class); + $this->backup = $var; + + return $this; + } + + /** + * The client-provided short name for the Backup resource. + * This name must: + * - be between 1 and 63 characters long (inclusive) + * - consist of only lower-case ASCII letters, numbers, and dashes + * - start with a lower-case letter + * - end with a lower-case letter or number + * - be unique within the set of Backups in this BackupPlan + * + * Generated from protobuf field string backup_id = 3; + * @return string + */ + public function getBackupId() + { + return $this->backup_id; + } + + /** + * The client-provided short name for the Backup resource. + * This name must: + * - be between 1 and 63 characters long (inclusive) + * - consist of only lower-case ASCII letters, numbers, and dashes + * - start with a lower-case letter + * - end with a lower-case letter or number + * - be unique within the set of Backups in this BackupPlan + * + * Generated from protobuf field string backup_id = 3; + * @param string $var + * @return $this + */ + public function setBackupId($var) + { + GPBUtil::checkString($var, True); + $this->backup_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/CreateRestorePlanRequest.php b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/CreateRestorePlanRequest.php new file mode 100644 index 000000000000..953dc2a0f280 --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/CreateRestorePlanRequest.php @@ -0,0 +1,199 @@ +google.cloud.gkebackup.v1.CreateRestorePlanRequest + */ +class CreateRestorePlanRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The location within which to create the RestorePlan. + * Format: projects/*/locations/* + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The RestorePlan resource object to create. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.RestorePlan restore_plan = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $restore_plan = null; + /** + * Required. The client-provided short name for the RestorePlan resource. + * This name must: + * - be between 1 and 63 characters long (inclusive) + * - consist of only lower-case ASCII letters, numbers, and dashes + * - start with a lower-case letter + * - end with a lower-case letter or number + * - be unique within the set of RestorePlans in this location + * + * Generated from protobuf field string restore_plan_id = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $restore_plan_id = ''; + + /** + * @param string $parent Required. The location within which to create the RestorePlan. + * Format: projects/*/locations/* + * Please see {@see BackupForGKEClient::locationName()} for help formatting this field. + * @param \Google\Cloud\GkeBackup\V1\RestorePlan $restorePlan Required. The RestorePlan resource object to create. + * @param string $restorePlanId Required. The client-provided short name for the RestorePlan resource. + * This name must: + * + * - be between 1 and 63 characters long (inclusive) + * - consist of only lower-case ASCII letters, numbers, and dashes + * - start with a lower-case letter + * - end with a lower-case letter or number + * - be unique within the set of RestorePlans in this location + * + * @return \Google\Cloud\GkeBackup\V1\CreateRestorePlanRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\GkeBackup\V1\RestorePlan $restorePlan, string $restorePlanId): self + { + return (new self()) + ->setParent($parent) + ->setRestorePlan($restorePlan) + ->setRestorePlanId($restorePlanId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The location within which to create the RestorePlan. + * Format: projects/*/locations/* + * @type \Google\Cloud\GkeBackup\V1\RestorePlan $restore_plan + * Required. The RestorePlan resource object to create. + * @type string $restore_plan_id + * Required. The client-provided short name for the RestorePlan resource. + * This name must: + * - be between 1 and 63 characters long (inclusive) + * - consist of only lower-case ASCII letters, numbers, and dashes + * - start with a lower-case letter + * - end with a lower-case letter or number + * - be unique within the set of RestorePlans in this location + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkebackup\V1\Gkebackup::initOnce(); + parent::__construct($data); + } + + /** + * Required. The location within which to create the RestorePlan. + * Format: projects/*/locations/* + * + * 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. The location within which to create the RestorePlan. + * Format: projects/*/locations/* + * + * 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. The RestorePlan resource object to create. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.RestorePlan restore_plan = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\GkeBackup\V1\RestorePlan|null + */ + public function getRestorePlan() + { + return $this->restore_plan; + } + + public function hasRestorePlan() + { + return isset($this->restore_plan); + } + + public function clearRestorePlan() + { + unset($this->restore_plan); + } + + /** + * Required. The RestorePlan resource object to create. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.RestorePlan restore_plan = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\GkeBackup\V1\RestorePlan $var + * @return $this + */ + public function setRestorePlan($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeBackup\V1\RestorePlan::class); + $this->restore_plan = $var; + + return $this; + } + + /** + * Required. The client-provided short name for the RestorePlan resource. + * This name must: + * - be between 1 and 63 characters long (inclusive) + * - consist of only lower-case ASCII letters, numbers, and dashes + * - start with a lower-case letter + * - end with a lower-case letter or number + * - be unique within the set of RestorePlans in this location + * + * Generated from protobuf field string restore_plan_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getRestorePlanId() + { + return $this->restore_plan_id; + } + + /** + * Required. The client-provided short name for the RestorePlan resource. + * This name must: + * - be between 1 and 63 characters long (inclusive) + * - consist of only lower-case ASCII letters, numbers, and dashes + * - start with a lower-case letter + * - end with a lower-case letter or number + * - be unique within the set of RestorePlans in this location + * + * Generated from protobuf field string restore_plan_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setRestorePlanId($var) + { + GPBUtil::checkString($var, True); + $this->restore_plan_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/CreateRestoreRequest.php b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/CreateRestoreRequest.php new file mode 100644 index 000000000000..010692c617eb --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/CreateRestoreRequest.php @@ -0,0 +1,199 @@ +google.cloud.gkebackup.v1.CreateRestoreRequest + */ +class CreateRestoreRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The RestorePlan within which to create the Restore. + * Format: projects/*/locations/*/restorePlans/* + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The restore resource to create. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.Restore restore = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $restore = null; + /** + * Required. The client-provided short name for the Restore resource. + * This name must: + * - be between 1 and 63 characters long (inclusive) + * - consist of only lower-case ASCII letters, numbers, and dashes + * - start with a lower-case letter + * - end with a lower-case letter or number + * - be unique within the set of Restores in this RestorePlan. + * + * Generated from protobuf field string restore_id = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $restore_id = ''; + + /** + * @param string $parent Required. The RestorePlan within which to create the Restore. + * Format: projects/*/locations/*/restorePlans/* + * Please see {@see BackupForGKEClient::restorePlanName()} for help formatting this field. + * @param \Google\Cloud\GkeBackup\V1\Restore $restore Required. The restore resource to create. + * @param string $restoreId Required. The client-provided short name for the Restore resource. + * This name must: + * + * - be between 1 and 63 characters long (inclusive) + * - consist of only lower-case ASCII letters, numbers, and dashes + * - start with a lower-case letter + * - end with a lower-case letter or number + * - be unique within the set of Restores in this RestorePlan. + * + * @return \Google\Cloud\GkeBackup\V1\CreateRestoreRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\GkeBackup\V1\Restore $restore, string $restoreId): self + { + return (new self()) + ->setParent($parent) + ->setRestore($restore) + ->setRestoreId($restoreId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The RestorePlan within which to create the Restore. + * Format: projects/*/locations/*/restorePlans/* + * @type \Google\Cloud\GkeBackup\V1\Restore $restore + * Required. The restore resource to create. + * @type string $restore_id + * Required. The client-provided short name for the Restore resource. + * This name must: + * - be between 1 and 63 characters long (inclusive) + * - consist of only lower-case ASCII letters, numbers, and dashes + * - start with a lower-case letter + * - end with a lower-case letter or number + * - be unique within the set of Restores in this RestorePlan. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkebackup\V1\Gkebackup::initOnce(); + parent::__construct($data); + } + + /** + * Required. The RestorePlan within which to create the Restore. + * Format: projects/*/locations/*/restorePlans/* + * + * 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. The RestorePlan within which to create the Restore. + * Format: projects/*/locations/*/restorePlans/* + * + * 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. The restore resource to create. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.Restore restore = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\GkeBackup\V1\Restore|null + */ + public function getRestore() + { + return $this->restore; + } + + public function hasRestore() + { + return isset($this->restore); + } + + public function clearRestore() + { + unset($this->restore); + } + + /** + * Required. The restore resource to create. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.Restore restore = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\GkeBackup\V1\Restore $var + * @return $this + */ + public function setRestore($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeBackup\V1\Restore::class); + $this->restore = $var; + + return $this; + } + + /** + * Required. The client-provided short name for the Restore resource. + * This name must: + * - be between 1 and 63 characters long (inclusive) + * - consist of only lower-case ASCII letters, numbers, and dashes + * - start with a lower-case letter + * - end with a lower-case letter or number + * - be unique within the set of Restores in this RestorePlan. + * + * Generated from protobuf field string restore_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getRestoreId() + { + return $this->restore_id; + } + + /** + * Required. The client-provided short name for the Restore resource. + * This name must: + * - be between 1 and 63 characters long (inclusive) + * - consist of only lower-case ASCII letters, numbers, and dashes + * - start with a lower-case letter + * - end with a lower-case letter or number + * - be unique within the set of Restores in this RestorePlan. + * + * Generated from protobuf field string restore_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setRestoreId($var) + { + GPBUtil::checkString($var, True); + $this->restore_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/DeleteBackupPlanRequest.php b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/DeleteBackupPlanRequest.php new file mode 100644 index 000000000000..077724c67210 --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/DeleteBackupPlanRequest.php @@ -0,0 +1,128 @@ +google.cloud.gkebackup.v1.DeleteBackupPlanRequest + */ +class DeleteBackupPlanRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Fully qualified BackupPlan name. + * Format: projects/*/locations/*/backupPlans/* + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * If provided, this value must match the current value of the + * target BackupPlan's [etag][google.cloud.gkebackup.v1.BackupPlan.etag] field or the request is + * rejected. + * + * Generated from protobuf field string etag = 2; + */ + protected $etag = ''; + + /** + * @param string $name Required. Fully qualified BackupPlan name. + * Format: projects/*/locations/*/backupPlans/* + * Please see {@see BackupForGKEClient::backupPlanName()} for help formatting this field. + * + * @return \Google\Cloud\GkeBackup\V1\DeleteBackupPlanRequest + * + * @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. Fully qualified BackupPlan name. + * Format: projects/*/locations/*/backupPlans/* + * @type string $etag + * If provided, this value must match the current value of the + * target BackupPlan's [etag][google.cloud.gkebackup.v1.BackupPlan.etag] field or the request is + * rejected. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkebackup\V1\Gkebackup::initOnce(); + parent::__construct($data); + } + + /** + * Required. Fully qualified BackupPlan name. + * Format: projects/*/locations/*/backupPlans/* + * + * 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. Fully qualified BackupPlan name. + * Format: projects/*/locations/*/backupPlans/* + * + * 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; + } + + /** + * If provided, this value must match the current value of the + * target BackupPlan's [etag][google.cloud.gkebackup.v1.BackupPlan.etag] field or the request is + * rejected. + * + * Generated from protobuf field string etag = 2; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * If provided, this value must match the current value of the + * target BackupPlan's [etag][google.cloud.gkebackup.v1.BackupPlan.etag] field or the request is + * rejected. + * + * Generated from protobuf field string etag = 2; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, True); + $this->etag = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/DeleteBackupRequest.php b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/DeleteBackupRequest.php new file mode 100644 index 000000000000..df7bdd05ca38 --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/DeleteBackupRequest.php @@ -0,0 +1,170 @@ +google.cloud.gkebackup.v1.DeleteBackupRequest + */ +class DeleteBackupRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the Backup resource. + * Format: projects/*/locations/*/backupPlans/*/backups/* + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * If provided, this value must match the current value of the + * target Backup's [etag][google.cloud.gkebackup.v1.Backup.etag] field or the request is + * rejected. + * + * Generated from protobuf field string etag = 2; + */ + protected $etag = ''; + /** + * If set to true, any VolumeBackups below this Backup will also be deleted. + * Otherwise, the request will only succeed if the Backup has no + * VolumeBackups. + * + * Generated from protobuf field bool force = 3; + */ + protected $force = false; + + /** + * @param string $name Required. Name of the Backup resource. + * Format: projects/*/locations/*/backupPlans/*/backups/* + * Please see {@see BackupForGKEClient::backupName()} for help formatting this field. + * + * @return \Google\Cloud\GkeBackup\V1\DeleteBackupRequest + * + * @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 Backup resource. + * Format: projects/*/locations/*/backupPlans/*/backups/* + * @type string $etag + * If provided, this value must match the current value of the + * target Backup's [etag][google.cloud.gkebackup.v1.Backup.etag] field or the request is + * rejected. + * @type bool $force + * If set to true, any VolumeBackups below this Backup will also be deleted. + * Otherwise, the request will only succeed if the Backup has no + * VolumeBackups. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkebackup\V1\Gkebackup::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the Backup resource. + * Format: projects/*/locations/*/backupPlans/*/backups/* + * + * 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. Name of the Backup resource. + * Format: projects/*/locations/*/backupPlans/*/backups/* + * + * 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; + } + + /** + * If provided, this value must match the current value of the + * target Backup's [etag][google.cloud.gkebackup.v1.Backup.etag] field or the request is + * rejected. + * + * Generated from protobuf field string etag = 2; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * If provided, this value must match the current value of the + * target Backup's [etag][google.cloud.gkebackup.v1.Backup.etag] field or the request is + * rejected. + * + * Generated from protobuf field string etag = 2; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, True); + $this->etag = $var; + + return $this; + } + + /** + * If set to true, any VolumeBackups below this Backup will also be deleted. + * Otherwise, the request will only succeed if the Backup has no + * VolumeBackups. + * + * Generated from protobuf field bool force = 3; + * @return bool + */ + public function getForce() + { + return $this->force; + } + + /** + * If set to true, any VolumeBackups below this Backup will also be deleted. + * Otherwise, the request will only succeed if the Backup has no + * VolumeBackups. + * + * Generated from protobuf field bool force = 3; + * @param bool $var + * @return $this + */ + public function setForce($var) + { + GPBUtil::checkBool($var); + $this->force = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/DeleteRestorePlanRequest.php b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/DeleteRestorePlanRequest.php new file mode 100644 index 000000000000..2e9f93b3f6c0 --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/DeleteRestorePlanRequest.php @@ -0,0 +1,170 @@ +google.cloud.gkebackup.v1.DeleteRestorePlanRequest + */ +class DeleteRestorePlanRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Fully qualified RestorePlan name. + * Format: projects/*/locations/*/restorePlans/* + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * If provided, this value must match the current value of the + * target RestorePlan's [etag][google.cloud.gkebackup.v1.RestorePlan.etag] field or the request is + * rejected. + * + * Generated from protobuf field string etag = 2; + */ + protected $etag = ''; + /** + * If set to true, any Restores below this RestorePlan will also be deleted. + * Otherwise, the request will only succeed if the RestorePlan has no + * Restores. + * + * Generated from protobuf field bool force = 3; + */ + protected $force = false; + + /** + * @param string $name Required. Fully qualified RestorePlan name. + * Format: projects/*/locations/*/restorePlans/* + * Please see {@see BackupForGKEClient::restorePlanName()} for help formatting this field. + * + * @return \Google\Cloud\GkeBackup\V1\DeleteRestorePlanRequest + * + * @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. Fully qualified RestorePlan name. + * Format: projects/*/locations/*/restorePlans/* + * @type string $etag + * If provided, this value must match the current value of the + * target RestorePlan's [etag][google.cloud.gkebackup.v1.RestorePlan.etag] field or the request is + * rejected. + * @type bool $force + * If set to true, any Restores below this RestorePlan will also be deleted. + * Otherwise, the request will only succeed if the RestorePlan has no + * Restores. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkebackup\V1\Gkebackup::initOnce(); + parent::__construct($data); + } + + /** + * Required. Fully qualified RestorePlan name. + * Format: projects/*/locations/*/restorePlans/* + * + * 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. Fully qualified RestorePlan name. + * Format: projects/*/locations/*/restorePlans/* + * + * 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; + } + + /** + * If provided, this value must match the current value of the + * target RestorePlan's [etag][google.cloud.gkebackup.v1.RestorePlan.etag] field or the request is + * rejected. + * + * Generated from protobuf field string etag = 2; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * If provided, this value must match the current value of the + * target RestorePlan's [etag][google.cloud.gkebackup.v1.RestorePlan.etag] field or the request is + * rejected. + * + * Generated from protobuf field string etag = 2; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, True); + $this->etag = $var; + + return $this; + } + + /** + * If set to true, any Restores below this RestorePlan will also be deleted. + * Otherwise, the request will only succeed if the RestorePlan has no + * Restores. + * + * Generated from protobuf field bool force = 3; + * @return bool + */ + public function getForce() + { + return $this->force; + } + + /** + * If set to true, any Restores below this RestorePlan will also be deleted. + * Otherwise, the request will only succeed if the RestorePlan has no + * Restores. + * + * Generated from protobuf field bool force = 3; + * @param bool $var + * @return $this + */ + public function setForce($var) + { + GPBUtil::checkBool($var); + $this->force = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/DeleteRestoreRequest.php b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/DeleteRestoreRequest.php new file mode 100644 index 000000000000..0ce36d11e8fb --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/DeleteRestoreRequest.php @@ -0,0 +1,170 @@ +google.cloud.gkebackup.v1.DeleteRestoreRequest + */ +class DeleteRestoreRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Full name of the Restore + * Format: projects/*/locations/*/restorePlans/*/restores/* + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * If provided, this value must match the current value of the + * target Restore's [etag][google.cloud.gkebackup.v1.Restore.etag] field or the request is + * rejected. + * + * Generated from protobuf field string etag = 2; + */ + protected $etag = ''; + /** + * If set to true, any VolumeRestores below this restore will also be deleted. + * Otherwise, the request will only succeed if the restore has no + * VolumeRestores. + * + * Generated from protobuf field bool force = 3; + */ + protected $force = false; + + /** + * @param string $name Required. Full name of the Restore + * Format: projects/*/locations/*/restorePlans/*/restores/* + * Please see {@see BackupForGKEClient::restoreName()} for help formatting this field. + * + * @return \Google\Cloud\GkeBackup\V1\DeleteRestoreRequest + * + * @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. Full name of the Restore + * Format: projects/*/locations/*/restorePlans/*/restores/* + * @type string $etag + * If provided, this value must match the current value of the + * target Restore's [etag][google.cloud.gkebackup.v1.Restore.etag] field or the request is + * rejected. + * @type bool $force + * If set to true, any VolumeRestores below this restore will also be deleted. + * Otherwise, the request will only succeed if the restore has no + * VolumeRestores. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkebackup\V1\Gkebackup::initOnce(); + parent::__construct($data); + } + + /** + * Required. Full name of the Restore + * Format: projects/*/locations/*/restorePlans/*/restores/* + * + * 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. Full name of the Restore + * Format: projects/*/locations/*/restorePlans/*/restores/* + * + * 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; + } + + /** + * If provided, this value must match the current value of the + * target Restore's [etag][google.cloud.gkebackup.v1.Restore.etag] field or the request is + * rejected. + * + * Generated from protobuf field string etag = 2; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * If provided, this value must match the current value of the + * target Restore's [etag][google.cloud.gkebackup.v1.Restore.etag] field or the request is + * rejected. + * + * Generated from protobuf field string etag = 2; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, True); + $this->etag = $var; + + return $this; + } + + /** + * If set to true, any VolumeRestores below this restore will also be deleted. + * Otherwise, the request will only succeed if the restore has no + * VolumeRestores. + * + * Generated from protobuf field bool force = 3; + * @return bool + */ + public function getForce() + { + return $this->force; + } + + /** + * If set to true, any VolumeRestores below this restore will also be deleted. + * Otherwise, the request will only succeed if the restore has no + * VolumeRestores. + * + * Generated from protobuf field bool force = 3; + * @param bool $var + * @return $this + */ + public function setForce($var) + { + GPBUtil::checkBool($var); + $this->force = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/EncryptionKey.php b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/EncryptionKey.php new file mode 100644 index 000000000000..ffbe421a5e81 --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/EncryptionKey.php @@ -0,0 +1,72 @@ +google.cloud.gkebackup.v1.EncryptionKey + */ +class EncryptionKey extends \Google\Protobuf\Internal\Message +{ + /** + * Google Cloud KMS encryption key. Format: + * projects/*/locations/*/keyRings/*/cryptoKeys/* + * + * Generated from protobuf field string gcp_kms_encryption_key = 1 [(.google.api.resource_reference) = { + */ + protected $gcp_kms_encryption_key = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $gcp_kms_encryption_key + * Google Cloud KMS encryption key. Format: + * projects/*/locations/*/keyRings/*/cryptoKeys/* + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkebackup\V1\Common::initOnce(); + parent::__construct($data); + } + + /** + * Google Cloud KMS encryption key. Format: + * projects/*/locations/*/keyRings/*/cryptoKeys/* + * + * Generated from protobuf field string gcp_kms_encryption_key = 1 [(.google.api.resource_reference) = { + * @return string + */ + public function getGcpKmsEncryptionKey() + { + return $this->gcp_kms_encryption_key; + } + + /** + * Google Cloud KMS encryption key. Format: + * projects/*/locations/*/keyRings/*/cryptoKeys/* + * + * Generated from protobuf field string gcp_kms_encryption_key = 1 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setGcpKmsEncryptionKey($var) + { + GPBUtil::checkString($var, True); + $this->gcp_kms_encryption_key = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/GetBackupPlanRequest.php b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/GetBackupPlanRequest.php new file mode 100644 index 000000000000..b0a495a37acc --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/GetBackupPlanRequest.php @@ -0,0 +1,86 @@ +google.cloud.gkebackup.v1.GetBackupPlanRequest + */ +class GetBackupPlanRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Fully qualified BackupPlan name. + * Format: projects/*/locations/*/backupPlans/* + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. Fully qualified BackupPlan name. + * Format: projects/*/locations/*/backupPlans/* + * Please see {@see BackupForGKEClient::backupPlanName()} for help formatting this field. + * + * @return \Google\Cloud\GkeBackup\V1\GetBackupPlanRequest + * + * @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. Fully qualified BackupPlan name. + * Format: projects/*/locations/*/backupPlans/* + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkebackup\V1\Gkebackup::initOnce(); + parent::__construct($data); + } + + /** + * Required. Fully qualified BackupPlan name. + * Format: projects/*/locations/*/backupPlans/* + * + * 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. Fully qualified BackupPlan name. + * Format: projects/*/locations/*/backupPlans/* + * + * 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; + } + +} + diff --git a/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/GetBackupRequest.php b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/GetBackupRequest.php new file mode 100644 index 000000000000..35e1c32e5073 --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/GetBackupRequest.php @@ -0,0 +1,86 @@ +google.cloud.gkebackup.v1.GetBackupRequest + */ +class GetBackupRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Full name of the Backup resource. + * Format: projects/*/locations/*/backupPlans/*/backups/* + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. Full name of the Backup resource. + * Format: projects/*/locations/*/backupPlans/*/backups/* + * Please see {@see BackupForGKEClient::backupName()} for help formatting this field. + * + * @return \Google\Cloud\GkeBackup\V1\GetBackupRequest + * + * @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. Full name of the Backup resource. + * Format: projects/*/locations/*/backupPlans/*/backups/* + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkebackup\V1\Gkebackup::initOnce(); + parent::__construct($data); + } + + /** + * Required. Full name of the Backup resource. + * Format: projects/*/locations/*/backupPlans/*/backups/* + * + * 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. Full name of the Backup resource. + * Format: projects/*/locations/*/backupPlans/*/backups/* + * + * 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; + } + +} + diff --git a/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/GetRestorePlanRequest.php b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/GetRestorePlanRequest.php new file mode 100644 index 000000000000..389200c2c6c2 --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/GetRestorePlanRequest.php @@ -0,0 +1,86 @@ +google.cloud.gkebackup.v1.GetRestorePlanRequest + */ +class GetRestorePlanRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Fully qualified RestorePlan name. + * Format: projects/*/locations/*/restorePlans/* + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. Fully qualified RestorePlan name. + * Format: projects/*/locations/*/restorePlans/* + * Please see {@see BackupForGKEClient::restorePlanName()} for help formatting this field. + * + * @return \Google\Cloud\GkeBackup\V1\GetRestorePlanRequest + * + * @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. Fully qualified RestorePlan name. + * Format: projects/*/locations/*/restorePlans/* + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkebackup\V1\Gkebackup::initOnce(); + parent::__construct($data); + } + + /** + * Required. Fully qualified RestorePlan name. + * Format: projects/*/locations/*/restorePlans/* + * + * 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. Fully qualified RestorePlan name. + * Format: projects/*/locations/*/restorePlans/* + * + * 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; + } + +} + diff --git a/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/GetRestoreRequest.php b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/GetRestoreRequest.php new file mode 100644 index 000000000000..e46ce93835d3 --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/GetRestoreRequest.php @@ -0,0 +1,86 @@ +google.cloud.gkebackup.v1.GetRestoreRequest + */ +class GetRestoreRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the restore resource. + * Format: projects/*/locations/*/restorePlans/*/restores/* + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. Name of the restore resource. + * Format: projects/*/locations/*/restorePlans/*/restores/* + * Please see {@see BackupForGKEClient::restoreName()} for help formatting this field. + * + * @return \Google\Cloud\GkeBackup\V1\GetRestoreRequest + * + * @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 restore resource. + * Format: projects/*/locations/*/restorePlans/*/restores/* + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkebackup\V1\Gkebackup::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the restore resource. + * Format: projects/*/locations/*/restorePlans/*/restores/* + * + * 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. Name of the restore resource. + * Format: projects/*/locations/*/restorePlans/*/restores/* + * + * 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; + } + +} + diff --git a/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/GetVolumeBackupRequest.php b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/GetVolumeBackupRequest.php new file mode 100644 index 000000000000..38d559b29bc2 --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/GetVolumeBackupRequest.php @@ -0,0 +1,86 @@ +google.cloud.gkebackup.v1.GetVolumeBackupRequest + */ +class GetVolumeBackupRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Full name of the VolumeBackup resource. + * Format: projects/*/locations/*/backupPlans/*/backups/*/volumeBackups/* + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. Full name of the VolumeBackup resource. + * Format: projects/*/locations/*/backupPlans/*/backups/*/volumeBackups/* + * Please see {@see BackupForGKEClient::volumeBackupName()} for help formatting this field. + * + * @return \Google\Cloud\GkeBackup\V1\GetVolumeBackupRequest + * + * @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. Full name of the VolumeBackup resource. + * Format: projects/*/locations/*/backupPlans/*/backups/*/volumeBackups/* + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkebackup\V1\Gkebackup::initOnce(); + parent::__construct($data); + } + + /** + * Required. Full name of the VolumeBackup resource. + * Format: projects/*/locations/*/backupPlans/*/backups/*/volumeBackups/* + * + * 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. Full name of the VolumeBackup resource. + * Format: projects/*/locations/*/backupPlans/*/backups/*/volumeBackups/* + * + * 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; + } + +} + diff --git a/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/GetVolumeRestoreRequest.php b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/GetVolumeRestoreRequest.php new file mode 100644 index 000000000000..4099b09aeb77 --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/GetVolumeRestoreRequest.php @@ -0,0 +1,86 @@ +google.cloud.gkebackup.v1.GetVolumeRestoreRequest + */ +class GetVolumeRestoreRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Full name of the VolumeRestore resource. + * Format: projects/*/locations/*/restorePlans/*/restores/*/volumeRestores/* + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. Full name of the VolumeRestore resource. + * Format: projects/*/locations/*/restorePlans/*/restores/*/volumeRestores/* + * Please see {@see BackupForGKEClient::volumeRestoreName()} for help formatting this field. + * + * @return \Google\Cloud\GkeBackup\V1\GetVolumeRestoreRequest + * + * @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. Full name of the VolumeRestore resource. + * Format: projects/*/locations/*/restorePlans/*/restores/*/volumeRestores/* + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkebackup\V1\Gkebackup::initOnce(); + parent::__construct($data); + } + + /** + * Required. Full name of the VolumeRestore resource. + * Format: projects/*/locations/*/restorePlans/*/restores/*/volumeRestores/* + * + * 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. Full name of the VolumeRestore resource. + * Format: projects/*/locations/*/restorePlans/*/restores/*/volumeRestores/* + * + * 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; + } + +} + diff --git a/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/ListBackupPlansRequest.php b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/ListBackupPlansRequest.php new file mode 100644 index 000000000000..ceb3fc5b5a64 --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/ListBackupPlansRequest.php @@ -0,0 +1,262 @@ +google.cloud.gkebackup.v1.ListBackupPlansRequest + */ +class ListBackupPlansRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The location that contains the BackupPlans to list. + * Format: projects/*/locations/* + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The target number of results to return in a single response. + * If not specified, a default value will be chosen by the service. + * Note that the response may inclue a partial list and a caller should + * only rely on the response's + * [next_page_token][google.cloud.gkebackup.v1.ListBackupPlansResponse.next_page_token] + * to determine if there are more instances left to be queried. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * The value of + * [next_page_token][google.cloud.gkebackup.v1.ListBackupPlansResponse.next_page_token] + * received from a previous `ListBackupPlans` call. + * Provide this to retrieve the subsequent page in a multi-page list of + * results. When paginating, all other parameters provided to + * `ListBackupPlans` must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + /** + * Field match expression used to filter the results. + * + * Generated from protobuf field string filter = 4; + */ + protected $filter = ''; + /** + * Field by which to sort the results. + * + * Generated from protobuf field string order_by = 5; + */ + protected $order_by = ''; + + /** + * @param string $parent Required. The location that contains the BackupPlans to list. + * Format: projects/*/locations/* + * Please see {@see BackupForGKEClient::locationName()} for help formatting this field. + * + * @return \Google\Cloud\GkeBackup\V1\ListBackupPlansRequest + * + * @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. The location that contains the BackupPlans to list. + * Format: projects/*/locations/* + * @type int $page_size + * The target number of results to return in a single response. + * If not specified, a default value will be chosen by the service. + * Note that the response may inclue a partial list and a caller should + * only rely on the response's + * [next_page_token][google.cloud.gkebackup.v1.ListBackupPlansResponse.next_page_token] + * to determine if there are more instances left to be queried. + * @type string $page_token + * The value of + * [next_page_token][google.cloud.gkebackup.v1.ListBackupPlansResponse.next_page_token] + * received from a previous `ListBackupPlans` call. + * Provide this to retrieve the subsequent page in a multi-page list of + * results. When paginating, all other parameters provided to + * `ListBackupPlans` must match the call that provided the page token. + * @type string $filter + * Field match expression used to filter the results. + * @type string $order_by + * Field by which to sort the results. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkebackup\V1\Gkebackup::initOnce(); + parent::__construct($data); + } + + /** + * Required. The location that contains the BackupPlans to list. + * Format: projects/*/locations/* + * + * 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. The location that contains the BackupPlans to list. + * Format: projects/*/locations/* + * + * 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; + } + + /** + * The target number of results to return in a single response. + * If not specified, a default value will be chosen by the service. + * Note that the response may inclue a partial list and a caller should + * only rely on the response's + * [next_page_token][google.cloud.gkebackup.v1.ListBackupPlansResponse.next_page_token] + * to determine if there are more instances left to be queried. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The target number of results to return in a single response. + * If not specified, a default value will be chosen by the service. + * Note that the response may inclue a partial list and a caller should + * only rely on the response's + * [next_page_token][google.cloud.gkebackup.v1.ListBackupPlansResponse.next_page_token] + * to determine if there are more instances left to be queried. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * The value of + * [next_page_token][google.cloud.gkebackup.v1.ListBackupPlansResponse.next_page_token] + * received from a previous `ListBackupPlans` call. + * Provide this to retrieve the subsequent page in a multi-page list of + * results. When paginating, all other parameters provided to + * `ListBackupPlans` must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * The value of + * [next_page_token][google.cloud.gkebackup.v1.ListBackupPlansResponse.next_page_token] + * received from a previous `ListBackupPlans` call. + * Provide this to retrieve the subsequent page in a multi-page list of + * results. When paginating, all other parameters provided to + * `ListBackupPlans` must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * Field match expression used to filter the results. + * + * Generated from protobuf field string filter = 4; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Field match expression used to filter the results. + * + * Generated from protobuf field string filter = 4; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Field by which to sort the results. + * + * Generated from protobuf field string order_by = 5; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Field by which to sort the results. + * + * Generated from protobuf field string order_by = 5; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/ListBackupPlansResponse.php b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/ListBackupPlansResponse.php new file mode 100644 index 000000000000..951c36e1be05 --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/ListBackupPlansResponse.php @@ -0,0 +1,151 @@ +google.cloud.gkebackup.v1.ListBackupPlansResponse + */ +class ListBackupPlansResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of BackupPlans matching the given criteria. + * + * Generated from protobuf field repeated .google.cloud.gkebackup.v1.BackupPlan backup_plans = 1; + */ + private $backup_plans; + /** + * A token which may be sent as + * [page_token][google.cloud.gkebackup.v1.ListBackupPlansRequest.page_token] in a subsequent + * `ListBackupPlans` call to retrieve the next page of results. + * If this field is omitted or empty, then there are no more results to + * return. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + */ + private $unreachable; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\GkeBackup\V1\BackupPlan>|\Google\Protobuf\Internal\RepeatedField $backup_plans + * The list of BackupPlans matching the given criteria. + * @type string $next_page_token + * A token which may be sent as + * [page_token][google.cloud.gkebackup.v1.ListBackupPlansRequest.page_token] in a subsequent + * `ListBackupPlans` call to retrieve the next page of results. + * If this field is omitted or empty, then there are no more results to + * return. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Locations that could not be reached. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkebackup\V1\Gkebackup::initOnce(); + parent::__construct($data); + } + + /** + * The list of BackupPlans matching the given criteria. + * + * Generated from protobuf field repeated .google.cloud.gkebackup.v1.BackupPlan backup_plans = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getBackupPlans() + { + return $this->backup_plans; + } + + /** + * The list of BackupPlans matching the given criteria. + * + * Generated from protobuf field repeated .google.cloud.gkebackup.v1.BackupPlan backup_plans = 1; + * @param array<\Google\Cloud\GkeBackup\V1\BackupPlan>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setBackupPlans($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\GkeBackup\V1\BackupPlan::class); + $this->backup_plans = $arr; + + return $this; + } + + /** + * A token which may be sent as + * [page_token][google.cloud.gkebackup.v1.ListBackupPlansRequest.page_token] in a subsequent + * `ListBackupPlans` call to retrieve the next page of results. + * If this field is omitted or empty, then there are no more results to + * return. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token which may be sent as + * [page_token][google.cloud.gkebackup.v1.ListBackupPlansRequest.page_token] in a subsequent + * `ListBackupPlans` call to retrieve the next page of results. + * If this field is omitted or empty, then there are no more results to + * return. + * + * 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; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUnreachable($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->unreachable = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/ListBackupsRequest.php b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/ListBackupsRequest.php new file mode 100644 index 000000000000..690d9175215e --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/ListBackupsRequest.php @@ -0,0 +1,262 @@ +google.cloud.gkebackup.v1.ListBackupsRequest + */ +class ListBackupsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The BackupPlan that contains the Backups to list. + * Format: projects/*/locations/*/backupPlans/* + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The target number of results to return in a single response. + * If not specified, a default value will be chosen by the service. + * Note that the response may inclue a partial list and a caller should + * only rely on the response's + * [next_page_token][google.cloud.gkebackup.v1.ListBackupsResponse.next_page_token] + * to determine if there are more instances left to be queried. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * The value of + * [next_page_token][google.cloud.gkebackup.v1.ListBackupsResponse.next_page_token] + * received from a previous `ListBackups` call. + * Provide this to retrieve the subsequent page in a multi-page list of + * results. When paginating, all other parameters provided to + * `ListBackups` must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + /** + * Field match expression used to filter the results. + * + * Generated from protobuf field string filter = 4; + */ + protected $filter = ''; + /** + * Field by which to sort the results. + * + * Generated from protobuf field string order_by = 5; + */ + protected $order_by = ''; + + /** + * @param string $parent Required. The BackupPlan that contains the Backups to list. + * Format: projects/*/locations/*/backupPlans/* + * Please see {@see BackupForGKEClient::backupPlanName()} for help formatting this field. + * + * @return \Google\Cloud\GkeBackup\V1\ListBackupsRequest + * + * @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. The BackupPlan that contains the Backups to list. + * Format: projects/*/locations/*/backupPlans/* + * @type int $page_size + * The target number of results to return in a single response. + * If not specified, a default value will be chosen by the service. + * Note that the response may inclue a partial list and a caller should + * only rely on the response's + * [next_page_token][google.cloud.gkebackup.v1.ListBackupsResponse.next_page_token] + * to determine if there are more instances left to be queried. + * @type string $page_token + * The value of + * [next_page_token][google.cloud.gkebackup.v1.ListBackupsResponse.next_page_token] + * received from a previous `ListBackups` call. + * Provide this to retrieve the subsequent page in a multi-page list of + * results. When paginating, all other parameters provided to + * `ListBackups` must match the call that provided the page token. + * @type string $filter + * Field match expression used to filter the results. + * @type string $order_by + * Field by which to sort the results. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkebackup\V1\Gkebackup::initOnce(); + parent::__construct($data); + } + + /** + * Required. The BackupPlan that contains the Backups to list. + * Format: projects/*/locations/*/backupPlans/* + * + * 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. The BackupPlan that contains the Backups to list. + * Format: projects/*/locations/*/backupPlans/* + * + * 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; + } + + /** + * The target number of results to return in a single response. + * If not specified, a default value will be chosen by the service. + * Note that the response may inclue a partial list and a caller should + * only rely on the response's + * [next_page_token][google.cloud.gkebackup.v1.ListBackupsResponse.next_page_token] + * to determine if there are more instances left to be queried. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The target number of results to return in a single response. + * If not specified, a default value will be chosen by the service. + * Note that the response may inclue a partial list and a caller should + * only rely on the response's + * [next_page_token][google.cloud.gkebackup.v1.ListBackupsResponse.next_page_token] + * to determine if there are more instances left to be queried. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * The value of + * [next_page_token][google.cloud.gkebackup.v1.ListBackupsResponse.next_page_token] + * received from a previous `ListBackups` call. + * Provide this to retrieve the subsequent page in a multi-page list of + * results. When paginating, all other parameters provided to + * `ListBackups` must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * The value of + * [next_page_token][google.cloud.gkebackup.v1.ListBackupsResponse.next_page_token] + * received from a previous `ListBackups` call. + * Provide this to retrieve the subsequent page in a multi-page list of + * results. When paginating, all other parameters provided to + * `ListBackups` must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * Field match expression used to filter the results. + * + * Generated from protobuf field string filter = 4; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Field match expression used to filter the results. + * + * Generated from protobuf field string filter = 4; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Field by which to sort the results. + * + * Generated from protobuf field string order_by = 5; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Field by which to sort the results. + * + * Generated from protobuf field string order_by = 5; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/ListBackupsResponse.php b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/ListBackupsResponse.php new file mode 100644 index 000000000000..4ec0191e89e9 --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/ListBackupsResponse.php @@ -0,0 +1,109 @@ +google.cloud.gkebackup.v1.ListBackupsResponse + */ +class ListBackupsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of Backups matching the given criteria. + * + * Generated from protobuf field repeated .google.cloud.gkebackup.v1.Backup backups = 1; + */ + private $backups; + /** + * A token which may be sent as [page_token][google.cloud.gkebackup.v1.ListBackupsRequest.page_token] in + * a subsequent `ListBackups` call to retrieve the next page of results. If + * this field is omitted or empty, then there are no more results to return. + * + * 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\GkeBackup\V1\Backup>|\Google\Protobuf\Internal\RepeatedField $backups + * The list of Backups matching the given criteria. + * @type string $next_page_token + * A token which may be sent as [page_token][google.cloud.gkebackup.v1.ListBackupsRequest.page_token] in + * a subsequent `ListBackups` call to retrieve the next page of results. If + * this field is omitted or empty, then there are no more results to return. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkebackup\V1\Gkebackup::initOnce(); + parent::__construct($data); + } + + /** + * The list of Backups matching the given criteria. + * + * Generated from protobuf field repeated .google.cloud.gkebackup.v1.Backup backups = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getBackups() + { + return $this->backups; + } + + /** + * The list of Backups matching the given criteria. + * + * Generated from protobuf field repeated .google.cloud.gkebackup.v1.Backup backups = 1; + * @param array<\Google\Cloud\GkeBackup\V1\Backup>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setBackups($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\GkeBackup\V1\Backup::class); + $this->backups = $arr; + + return $this; + } + + /** + * A token which may be sent as [page_token][google.cloud.gkebackup.v1.ListBackupsRequest.page_token] in + * a subsequent `ListBackups` call to retrieve the next page of results. If + * this field is omitted or empty, then there are no more results to return. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token which may be sent as [page_token][google.cloud.gkebackup.v1.ListBackupsRequest.page_token] in + * a subsequent `ListBackups` call to retrieve the next page of results. If + * this field is omitted or empty, then there are no more results to return. + * + * 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/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/ListRestorePlansRequest.php b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/ListRestorePlansRequest.php new file mode 100644 index 000000000000..443ef9230df2 --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/ListRestorePlansRequest.php @@ -0,0 +1,262 @@ +google.cloud.gkebackup.v1.ListRestorePlansRequest + */ +class ListRestorePlansRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The location that contains the RestorePlans to list. + * Format: projects/*/locations/* + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The target number of results to return in a single response. + * If not specified, a default value will be chosen by the service. + * Note that the response may inclue a partial list and a caller should + * only rely on the response's + * [next_page_token][google.cloud.gkebackup.v1.ListRestorePlansResponse.next_page_token] + * to determine if there are more instances left to be queried. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * The value of + * [next_page_token][google.cloud.gkebackup.v1.ListRestorePlansResponse.next_page_token] + * received from a previous `ListRestorePlans` call. + * Provide this to retrieve the subsequent page in a multi-page list of + * results. When paginating, all other parameters provided to + * `ListRestorePlans` must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + /** + * Field match expression used to filter the results. + * + * Generated from protobuf field string filter = 4; + */ + protected $filter = ''; + /** + * Field by which to sort the results. + * + * Generated from protobuf field string order_by = 5; + */ + protected $order_by = ''; + + /** + * @param string $parent Required. The location that contains the RestorePlans to list. + * Format: projects/*/locations/* + * Please see {@see BackupForGKEClient::locationName()} for help formatting this field. + * + * @return \Google\Cloud\GkeBackup\V1\ListRestorePlansRequest + * + * @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. The location that contains the RestorePlans to list. + * Format: projects/*/locations/* + * @type int $page_size + * The target number of results to return in a single response. + * If not specified, a default value will be chosen by the service. + * Note that the response may inclue a partial list and a caller should + * only rely on the response's + * [next_page_token][google.cloud.gkebackup.v1.ListRestorePlansResponse.next_page_token] + * to determine if there are more instances left to be queried. + * @type string $page_token + * The value of + * [next_page_token][google.cloud.gkebackup.v1.ListRestorePlansResponse.next_page_token] + * received from a previous `ListRestorePlans` call. + * Provide this to retrieve the subsequent page in a multi-page list of + * results. When paginating, all other parameters provided to + * `ListRestorePlans` must match the call that provided the page token. + * @type string $filter + * Field match expression used to filter the results. + * @type string $order_by + * Field by which to sort the results. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkebackup\V1\Gkebackup::initOnce(); + parent::__construct($data); + } + + /** + * Required. The location that contains the RestorePlans to list. + * Format: projects/*/locations/* + * + * 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. The location that contains the RestorePlans to list. + * Format: projects/*/locations/* + * + * 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; + } + + /** + * The target number of results to return in a single response. + * If not specified, a default value will be chosen by the service. + * Note that the response may inclue a partial list and a caller should + * only rely on the response's + * [next_page_token][google.cloud.gkebackup.v1.ListRestorePlansResponse.next_page_token] + * to determine if there are more instances left to be queried. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The target number of results to return in a single response. + * If not specified, a default value will be chosen by the service. + * Note that the response may inclue a partial list and a caller should + * only rely on the response's + * [next_page_token][google.cloud.gkebackup.v1.ListRestorePlansResponse.next_page_token] + * to determine if there are more instances left to be queried. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * The value of + * [next_page_token][google.cloud.gkebackup.v1.ListRestorePlansResponse.next_page_token] + * received from a previous `ListRestorePlans` call. + * Provide this to retrieve the subsequent page in a multi-page list of + * results. When paginating, all other parameters provided to + * `ListRestorePlans` must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * The value of + * [next_page_token][google.cloud.gkebackup.v1.ListRestorePlansResponse.next_page_token] + * received from a previous `ListRestorePlans` call. + * Provide this to retrieve the subsequent page in a multi-page list of + * results. When paginating, all other parameters provided to + * `ListRestorePlans` must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * Field match expression used to filter the results. + * + * Generated from protobuf field string filter = 4; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Field match expression used to filter the results. + * + * Generated from protobuf field string filter = 4; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Field by which to sort the results. + * + * Generated from protobuf field string order_by = 5; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Field by which to sort the results. + * + * Generated from protobuf field string order_by = 5; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/ListRestorePlansResponse.php b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/ListRestorePlansResponse.php new file mode 100644 index 000000000000..49e9e0e72d2d --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/ListRestorePlansResponse.php @@ -0,0 +1,151 @@ +google.cloud.gkebackup.v1.ListRestorePlansResponse + */ +class ListRestorePlansResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of RestorePlans matching the given criteria. + * + * Generated from protobuf field repeated .google.cloud.gkebackup.v1.RestorePlan restore_plans = 1; + */ + private $restore_plans; + /** + * A token which may be sent as + * [page_token][google.cloud.gkebackup.v1.ListRestorePlansRequest.page_token] in a subsequent + * `ListRestorePlans` call to retrieve the next page of results. + * If this field is omitted or empty, then there are no more results to + * return. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + */ + private $unreachable; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\GkeBackup\V1\RestorePlan>|\Google\Protobuf\Internal\RepeatedField $restore_plans + * The list of RestorePlans matching the given criteria. + * @type string $next_page_token + * A token which may be sent as + * [page_token][google.cloud.gkebackup.v1.ListRestorePlansRequest.page_token] in a subsequent + * `ListRestorePlans` call to retrieve the next page of results. + * If this field is omitted or empty, then there are no more results to + * return. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Locations that could not be reached. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkebackup\V1\Gkebackup::initOnce(); + parent::__construct($data); + } + + /** + * The list of RestorePlans matching the given criteria. + * + * Generated from protobuf field repeated .google.cloud.gkebackup.v1.RestorePlan restore_plans = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRestorePlans() + { + return $this->restore_plans; + } + + /** + * The list of RestorePlans matching the given criteria. + * + * Generated from protobuf field repeated .google.cloud.gkebackup.v1.RestorePlan restore_plans = 1; + * @param array<\Google\Cloud\GkeBackup\V1\RestorePlan>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRestorePlans($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\GkeBackup\V1\RestorePlan::class); + $this->restore_plans = $arr; + + return $this; + } + + /** + * A token which may be sent as + * [page_token][google.cloud.gkebackup.v1.ListRestorePlansRequest.page_token] in a subsequent + * `ListRestorePlans` call to retrieve the next page of results. + * If this field is omitted or empty, then there are no more results to + * return. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token which may be sent as + * [page_token][google.cloud.gkebackup.v1.ListRestorePlansRequest.page_token] in a subsequent + * `ListRestorePlans` call to retrieve the next page of results. + * If this field is omitted or empty, then there are no more results to + * return. + * + * 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; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUnreachable($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->unreachable = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/ListRestoresRequest.php b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/ListRestoresRequest.php new file mode 100644 index 000000000000..ef38d795bc37 --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/ListRestoresRequest.php @@ -0,0 +1,262 @@ +google.cloud.gkebackup.v1.ListRestoresRequest + */ +class ListRestoresRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The RestorePlan that contains the Restores to list. + * Format: projects/*/locations/*/restorePlans/* + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The target number of results to return in a single response. + * If not specified, a default value will be chosen by the service. + * Note that the response may inclue a partial list and a caller should + * only rely on the response's + * [next_page_token][google.cloud.gkebackup.v1.ListRestoresResponse.next_page_token] + * to determine if there are more instances left to be queried. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * The value of + * [next_page_token][google.cloud.gkebackup.v1.ListRestoresResponse.next_page_token] + * received from a previous `ListRestores` call. + * Provide this to retrieve the subsequent page in a multi-page list of + * results. When paginating, all other parameters provided to `ListRestores` + * must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + /** + * Field match expression used to filter the results. + * + * Generated from protobuf field string filter = 4; + */ + protected $filter = ''; + /** + * Field by which to sort the results. + * + * Generated from protobuf field string order_by = 5; + */ + protected $order_by = ''; + + /** + * @param string $parent Required. The RestorePlan that contains the Restores to list. + * Format: projects/*/locations/*/restorePlans/* + * Please see {@see BackupForGKEClient::restorePlanName()} for help formatting this field. + * + * @return \Google\Cloud\GkeBackup\V1\ListRestoresRequest + * + * @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. The RestorePlan that contains the Restores to list. + * Format: projects/*/locations/*/restorePlans/* + * @type int $page_size + * The target number of results to return in a single response. + * If not specified, a default value will be chosen by the service. + * Note that the response may inclue a partial list and a caller should + * only rely on the response's + * [next_page_token][google.cloud.gkebackup.v1.ListRestoresResponse.next_page_token] + * to determine if there are more instances left to be queried. + * @type string $page_token + * The value of + * [next_page_token][google.cloud.gkebackup.v1.ListRestoresResponse.next_page_token] + * received from a previous `ListRestores` call. + * Provide this to retrieve the subsequent page in a multi-page list of + * results. When paginating, all other parameters provided to `ListRestores` + * must match the call that provided the page token. + * @type string $filter + * Field match expression used to filter the results. + * @type string $order_by + * Field by which to sort the results. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkebackup\V1\Gkebackup::initOnce(); + parent::__construct($data); + } + + /** + * Required. The RestorePlan that contains the Restores to list. + * Format: projects/*/locations/*/restorePlans/* + * + * 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. The RestorePlan that contains the Restores to list. + * Format: projects/*/locations/*/restorePlans/* + * + * 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; + } + + /** + * The target number of results to return in a single response. + * If not specified, a default value will be chosen by the service. + * Note that the response may inclue a partial list and a caller should + * only rely on the response's + * [next_page_token][google.cloud.gkebackup.v1.ListRestoresResponse.next_page_token] + * to determine if there are more instances left to be queried. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The target number of results to return in a single response. + * If not specified, a default value will be chosen by the service. + * Note that the response may inclue a partial list and a caller should + * only rely on the response's + * [next_page_token][google.cloud.gkebackup.v1.ListRestoresResponse.next_page_token] + * to determine if there are more instances left to be queried. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * The value of + * [next_page_token][google.cloud.gkebackup.v1.ListRestoresResponse.next_page_token] + * received from a previous `ListRestores` call. + * Provide this to retrieve the subsequent page in a multi-page list of + * results. When paginating, all other parameters provided to `ListRestores` + * must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * The value of + * [next_page_token][google.cloud.gkebackup.v1.ListRestoresResponse.next_page_token] + * received from a previous `ListRestores` call. + * Provide this to retrieve the subsequent page in a multi-page list of + * results. When paginating, all other parameters provided to `ListRestores` + * must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * Field match expression used to filter the results. + * + * Generated from protobuf field string filter = 4; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Field match expression used to filter the results. + * + * Generated from protobuf field string filter = 4; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Field by which to sort the results. + * + * Generated from protobuf field string order_by = 5; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Field by which to sort the results. + * + * Generated from protobuf field string order_by = 5; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/ListRestoresResponse.php b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/ListRestoresResponse.php new file mode 100644 index 000000000000..d549a212fd85 --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/ListRestoresResponse.php @@ -0,0 +1,147 @@ +google.cloud.gkebackup.v1.ListRestoresResponse + */ +class ListRestoresResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of Restores matching the given criteria. + * + * Generated from protobuf field repeated .google.cloud.gkebackup.v1.Restore restores = 1; + */ + private $restores; + /** + * A token which may be sent as [page_token][google.cloud.gkebackup.v1.ListRestoresRequest.page_token] + * in a subsequent `ListRestores` call to retrieve the next page of results. + * If this field is omitted or empty, then there are no more results to + * return. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + */ + private $unreachable; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\GkeBackup\V1\Restore>|\Google\Protobuf\Internal\RepeatedField $restores + * The list of Restores matching the given criteria. + * @type string $next_page_token + * A token which may be sent as [page_token][google.cloud.gkebackup.v1.ListRestoresRequest.page_token] + * in a subsequent `ListRestores` call to retrieve the next page of results. + * If this field is omitted or empty, then there are no more results to + * return. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Locations that could not be reached. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkebackup\V1\Gkebackup::initOnce(); + parent::__construct($data); + } + + /** + * The list of Restores matching the given criteria. + * + * Generated from protobuf field repeated .google.cloud.gkebackup.v1.Restore restores = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRestores() + { + return $this->restores; + } + + /** + * The list of Restores matching the given criteria. + * + * Generated from protobuf field repeated .google.cloud.gkebackup.v1.Restore restores = 1; + * @param array<\Google\Cloud\GkeBackup\V1\Restore>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRestores($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\GkeBackup\V1\Restore::class); + $this->restores = $arr; + + return $this; + } + + /** + * A token which may be sent as [page_token][google.cloud.gkebackup.v1.ListRestoresRequest.page_token] + * in a subsequent `ListRestores` call to retrieve the next page of results. + * If this field is omitted or empty, then there are no more results to + * return. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token which may be sent as [page_token][google.cloud.gkebackup.v1.ListRestoresRequest.page_token] + * in a subsequent `ListRestores` call to retrieve the next page of results. + * If this field is omitted or empty, then there are no more results to + * return. + * + * 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; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUnreachable($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->unreachable = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/ListVolumeBackupsRequest.php b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/ListVolumeBackupsRequest.php new file mode 100644 index 000000000000..2ae22e6a2bdb --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/ListVolumeBackupsRequest.php @@ -0,0 +1,262 @@ +google.cloud.gkebackup.v1.ListVolumeBackupsRequest + */ +class ListVolumeBackupsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The Backup that contains the VolumeBackups to list. + * Format: projects/*/locations/*/backupPlans/*/backups/* + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The target number of results to return in a single response. + * If not specified, a default value will be chosen by the service. + * Note that the response may inclue a partial list and a caller should + * only rely on the response's + * [next_page_token][google.cloud.gkebackup.v1.ListVolumeBackupsResponse.next_page_token] + * to determine if there are more instances left to be queried. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * The value of + * [next_page_token][google.cloud.gkebackup.v1.ListVolumeBackupsResponse.next_page_token] + * received from a previous `ListVolumeBackups` call. + * Provide this to retrieve the subsequent page in a multi-page list of + * results. When paginating, all other parameters provided to + * `ListVolumeBackups` must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + /** + * Field match expression used to filter the results. + * + * Generated from protobuf field string filter = 4; + */ + protected $filter = ''; + /** + * Field by which to sort the results. + * + * Generated from protobuf field string order_by = 5; + */ + protected $order_by = ''; + + /** + * @param string $parent Required. The Backup that contains the VolumeBackups to list. + * Format: projects/*/locations/*/backupPlans/*/backups/* + * Please see {@see BackupForGKEClient::backupName()} for help formatting this field. + * + * @return \Google\Cloud\GkeBackup\V1\ListVolumeBackupsRequest + * + * @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. The Backup that contains the VolumeBackups to list. + * Format: projects/*/locations/*/backupPlans/*/backups/* + * @type int $page_size + * The target number of results to return in a single response. + * If not specified, a default value will be chosen by the service. + * Note that the response may inclue a partial list and a caller should + * only rely on the response's + * [next_page_token][google.cloud.gkebackup.v1.ListVolumeBackupsResponse.next_page_token] + * to determine if there are more instances left to be queried. + * @type string $page_token + * The value of + * [next_page_token][google.cloud.gkebackup.v1.ListVolumeBackupsResponse.next_page_token] + * received from a previous `ListVolumeBackups` call. + * Provide this to retrieve the subsequent page in a multi-page list of + * results. When paginating, all other parameters provided to + * `ListVolumeBackups` must match the call that provided the page token. + * @type string $filter + * Field match expression used to filter the results. + * @type string $order_by + * Field by which to sort the results. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkebackup\V1\Gkebackup::initOnce(); + parent::__construct($data); + } + + /** + * Required. The Backup that contains the VolumeBackups to list. + * Format: projects/*/locations/*/backupPlans/*/backups/* + * + * 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. The Backup that contains the VolumeBackups to list. + * Format: projects/*/locations/*/backupPlans/*/backups/* + * + * 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; + } + + /** + * The target number of results to return in a single response. + * If not specified, a default value will be chosen by the service. + * Note that the response may inclue a partial list and a caller should + * only rely on the response's + * [next_page_token][google.cloud.gkebackup.v1.ListVolumeBackupsResponse.next_page_token] + * to determine if there are more instances left to be queried. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The target number of results to return in a single response. + * If not specified, a default value will be chosen by the service. + * Note that the response may inclue a partial list and a caller should + * only rely on the response's + * [next_page_token][google.cloud.gkebackup.v1.ListVolumeBackupsResponse.next_page_token] + * to determine if there are more instances left to be queried. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * The value of + * [next_page_token][google.cloud.gkebackup.v1.ListVolumeBackupsResponse.next_page_token] + * received from a previous `ListVolumeBackups` call. + * Provide this to retrieve the subsequent page in a multi-page list of + * results. When paginating, all other parameters provided to + * `ListVolumeBackups` must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * The value of + * [next_page_token][google.cloud.gkebackup.v1.ListVolumeBackupsResponse.next_page_token] + * received from a previous `ListVolumeBackups` call. + * Provide this to retrieve the subsequent page in a multi-page list of + * results. When paginating, all other parameters provided to + * `ListVolumeBackups` must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * Field match expression used to filter the results. + * + * Generated from protobuf field string filter = 4; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Field match expression used to filter the results. + * + * Generated from protobuf field string filter = 4; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Field by which to sort the results. + * + * Generated from protobuf field string order_by = 5; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Field by which to sort the results. + * + * Generated from protobuf field string order_by = 5; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/ListVolumeBackupsResponse.php b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/ListVolumeBackupsResponse.php new file mode 100644 index 000000000000..77f443d70e93 --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/ListVolumeBackupsResponse.php @@ -0,0 +1,117 @@ +google.cloud.gkebackup.v1.ListVolumeBackupsResponse + */ +class ListVolumeBackupsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of VolumeBackups matching the given criteria. + * + * Generated from protobuf field repeated .google.cloud.gkebackup.v1.VolumeBackup volume_backups = 1; + */ + private $volume_backups; + /** + * A token which may be sent as + * [page_token][google.cloud.gkebackup.v1.ListVolumeBackupsRequest.page_token] in a subsequent + * `ListVolumeBackups` call to retrieve the next page of results. + * If this field is omitted or empty, then there are no more results to + * return. + * + * 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\GkeBackup\V1\VolumeBackup>|\Google\Protobuf\Internal\RepeatedField $volume_backups + * The list of VolumeBackups matching the given criteria. + * @type string $next_page_token + * A token which may be sent as + * [page_token][google.cloud.gkebackup.v1.ListVolumeBackupsRequest.page_token] in a subsequent + * `ListVolumeBackups` call to retrieve the next page of results. + * If this field is omitted or empty, then there are no more results to + * return. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkebackup\V1\Gkebackup::initOnce(); + parent::__construct($data); + } + + /** + * The list of VolumeBackups matching the given criteria. + * + * Generated from protobuf field repeated .google.cloud.gkebackup.v1.VolumeBackup volume_backups = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getVolumeBackups() + { + return $this->volume_backups; + } + + /** + * The list of VolumeBackups matching the given criteria. + * + * Generated from protobuf field repeated .google.cloud.gkebackup.v1.VolumeBackup volume_backups = 1; + * @param array<\Google\Cloud\GkeBackup\V1\VolumeBackup>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setVolumeBackups($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\GkeBackup\V1\VolumeBackup::class); + $this->volume_backups = $arr; + + return $this; + } + + /** + * A token which may be sent as + * [page_token][google.cloud.gkebackup.v1.ListVolumeBackupsRequest.page_token] in a subsequent + * `ListVolumeBackups` call to retrieve the next page of results. + * If this field is omitted or empty, then there are no more results to + * return. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token which may be sent as + * [page_token][google.cloud.gkebackup.v1.ListVolumeBackupsRequest.page_token] in a subsequent + * `ListVolumeBackups` call to retrieve the next page of results. + * If this field is omitted or empty, then there are no more results to + * return. + * + * 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/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/ListVolumeRestoresRequest.php b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/ListVolumeRestoresRequest.php new file mode 100644 index 000000000000..fc7b89d95c96 --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/ListVolumeRestoresRequest.php @@ -0,0 +1,262 @@ +google.cloud.gkebackup.v1.ListVolumeRestoresRequest + */ +class ListVolumeRestoresRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The Restore that contains the VolumeRestores to list. + * Format: projects/*/locations/*/restorePlans/*/restores/* + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The target number of results to return in a single response. + * If not specified, a default value will be chosen by the service. + * Note that the response may inclue a partial list and a caller should + * only rely on the response's + * [next_page_token][google.cloud.gkebackup.v1.ListVolumeRestoresResponse.next_page_token] + * to determine if there are more instances left to be queried. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * The value of + * [next_page_token][google.cloud.gkebackup.v1.ListVolumeRestoresResponse.next_page_token] + * received from a previous `ListVolumeRestores` call. + * Provide this to retrieve the subsequent page in a multi-page list of + * results. When paginating, all other parameters provided to + * `ListVolumeRestores` must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + /** + * Field match expression used to filter the results. + * + * Generated from protobuf field string filter = 4; + */ + protected $filter = ''; + /** + * Field by which to sort the results. + * + * Generated from protobuf field string order_by = 5; + */ + protected $order_by = ''; + + /** + * @param string $parent Required. The Restore that contains the VolumeRestores to list. + * Format: projects/*/locations/*/restorePlans/*/restores/* + * Please see {@see BackupForGKEClient::restoreName()} for help formatting this field. + * + * @return \Google\Cloud\GkeBackup\V1\ListVolumeRestoresRequest + * + * @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. The Restore that contains the VolumeRestores to list. + * Format: projects/*/locations/*/restorePlans/*/restores/* + * @type int $page_size + * The target number of results to return in a single response. + * If not specified, a default value will be chosen by the service. + * Note that the response may inclue a partial list and a caller should + * only rely on the response's + * [next_page_token][google.cloud.gkebackup.v1.ListVolumeRestoresResponse.next_page_token] + * to determine if there are more instances left to be queried. + * @type string $page_token + * The value of + * [next_page_token][google.cloud.gkebackup.v1.ListVolumeRestoresResponse.next_page_token] + * received from a previous `ListVolumeRestores` call. + * Provide this to retrieve the subsequent page in a multi-page list of + * results. When paginating, all other parameters provided to + * `ListVolumeRestores` must match the call that provided the page token. + * @type string $filter + * Field match expression used to filter the results. + * @type string $order_by + * Field by which to sort the results. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkebackup\V1\Gkebackup::initOnce(); + parent::__construct($data); + } + + /** + * Required. The Restore that contains the VolumeRestores to list. + * Format: projects/*/locations/*/restorePlans/*/restores/* + * + * 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. The Restore that contains the VolumeRestores to list. + * Format: projects/*/locations/*/restorePlans/*/restores/* + * + * 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; + } + + /** + * The target number of results to return in a single response. + * If not specified, a default value will be chosen by the service. + * Note that the response may inclue a partial list and a caller should + * only rely on the response's + * [next_page_token][google.cloud.gkebackup.v1.ListVolumeRestoresResponse.next_page_token] + * to determine if there are more instances left to be queried. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The target number of results to return in a single response. + * If not specified, a default value will be chosen by the service. + * Note that the response may inclue a partial list and a caller should + * only rely on the response's + * [next_page_token][google.cloud.gkebackup.v1.ListVolumeRestoresResponse.next_page_token] + * to determine if there are more instances left to be queried. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * The value of + * [next_page_token][google.cloud.gkebackup.v1.ListVolumeRestoresResponse.next_page_token] + * received from a previous `ListVolumeRestores` call. + * Provide this to retrieve the subsequent page in a multi-page list of + * results. When paginating, all other parameters provided to + * `ListVolumeRestores` must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * The value of + * [next_page_token][google.cloud.gkebackup.v1.ListVolumeRestoresResponse.next_page_token] + * received from a previous `ListVolumeRestores` call. + * Provide this to retrieve the subsequent page in a multi-page list of + * results. When paginating, all other parameters provided to + * `ListVolumeRestores` must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * Field match expression used to filter the results. + * + * Generated from protobuf field string filter = 4; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Field match expression used to filter the results. + * + * Generated from protobuf field string filter = 4; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Field by which to sort the results. + * + * Generated from protobuf field string order_by = 5; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Field by which to sort the results. + * + * Generated from protobuf field string order_by = 5; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/ListVolumeRestoresResponse.php b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/ListVolumeRestoresResponse.php new file mode 100644 index 000000000000..6338ff4bc361 --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/ListVolumeRestoresResponse.php @@ -0,0 +1,117 @@ +google.cloud.gkebackup.v1.ListVolumeRestoresResponse + */ +class ListVolumeRestoresResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of VolumeRestores matching the given criteria. + * + * Generated from protobuf field repeated .google.cloud.gkebackup.v1.VolumeRestore volume_restores = 1; + */ + private $volume_restores; + /** + * A token which may be sent as + * [page_token][google.cloud.gkebackup.v1.ListVolumeRestoresRequest.page_token] in a subsequent + * `ListVolumeRestores` call to retrieve the next page of results. + * If this field is omitted or empty, then there are no more results to + * return. + * + * 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\GkeBackup\V1\VolumeRestore>|\Google\Protobuf\Internal\RepeatedField $volume_restores + * The list of VolumeRestores matching the given criteria. + * @type string $next_page_token + * A token which may be sent as + * [page_token][google.cloud.gkebackup.v1.ListVolumeRestoresRequest.page_token] in a subsequent + * `ListVolumeRestores` call to retrieve the next page of results. + * If this field is omitted or empty, then there are no more results to + * return. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkebackup\V1\Gkebackup::initOnce(); + parent::__construct($data); + } + + /** + * The list of VolumeRestores matching the given criteria. + * + * Generated from protobuf field repeated .google.cloud.gkebackup.v1.VolumeRestore volume_restores = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getVolumeRestores() + { + return $this->volume_restores; + } + + /** + * The list of VolumeRestores matching the given criteria. + * + * Generated from protobuf field repeated .google.cloud.gkebackup.v1.VolumeRestore volume_restores = 1; + * @param array<\Google\Cloud\GkeBackup\V1\VolumeRestore>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setVolumeRestores($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\GkeBackup\V1\VolumeRestore::class); + $this->volume_restores = $arr; + + return $this; + } + + /** + * A token which may be sent as + * [page_token][google.cloud.gkebackup.v1.ListVolumeRestoresRequest.page_token] in a subsequent + * `ListVolumeRestores` call to retrieve the next page of results. + * If this field is omitted or empty, then there are no more results to + * return. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token which may be sent as + * [page_token][google.cloud.gkebackup.v1.ListVolumeRestoresRequest.page_token] in a subsequent + * `ListVolumeRestores` call to retrieve the next page of results. + * If this field is omitted or empty, then there are no more results to + * return. + * + * 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/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/NamespacedName.php b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/NamespacedName.php new file mode 100644 index 000000000000..3b3e1b70b41a --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/NamespacedName.php @@ -0,0 +1,101 @@ +google.cloud.gkebackup.v1.NamespacedName + */ +class NamespacedName extends \Google\Protobuf\Internal\Message +{ + /** + * The Namespace of the Kubernetes resource. + * + * Generated from protobuf field string namespace = 1; + */ + protected $namespace = ''; + /** + * The name of the Kubernetes resource. + * + * Generated from protobuf field string name = 2; + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $namespace + * The Namespace of the Kubernetes resource. + * @type string $name + * The name of the Kubernetes resource. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkebackup\V1\Common::initOnce(); + parent::__construct($data); + } + + /** + * The Namespace of the Kubernetes resource. + * + * Generated from protobuf field string namespace = 1; + * @return string + */ + public function getNamespace() + { + return $this->namespace; + } + + /** + * The Namespace of the Kubernetes resource. + * + * Generated from protobuf field string namespace = 1; + * @param string $var + * @return $this + */ + public function setNamespace($var) + { + GPBUtil::checkString($var, True); + $this->namespace = $var; + + return $this; + } + + /** + * The name of the Kubernetes resource. + * + * Generated from protobuf field string name = 2; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The name of the Kubernetes resource. + * + * Generated from protobuf field string name = 2; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/NamespacedNames.php b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/NamespacedNames.php new file mode 100644 index 000000000000..89a860984ac8 --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/NamespacedNames.php @@ -0,0 +1,67 @@ +google.cloud.gkebackup.v1.NamespacedNames + */ +class NamespacedNames extends \Google\Protobuf\Internal\Message +{ + /** + * A list of namespaced Kubernetes resources. + * + * Generated from protobuf field repeated .google.cloud.gkebackup.v1.NamespacedName namespaced_names = 1; + */ + private $namespaced_names; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\GkeBackup\V1\NamespacedName>|\Google\Protobuf\Internal\RepeatedField $namespaced_names + * A list of namespaced Kubernetes resources. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkebackup\V1\Common::initOnce(); + parent::__construct($data); + } + + /** + * A list of namespaced Kubernetes resources. + * + * Generated from protobuf field repeated .google.cloud.gkebackup.v1.NamespacedName namespaced_names = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getNamespacedNames() + { + return $this->namespaced_names; + } + + /** + * A list of namespaced Kubernetes resources. + * + * Generated from protobuf field repeated .google.cloud.gkebackup.v1.NamespacedName namespaced_names = 1; + * @param array<\Google\Cloud\GkeBackup\V1\NamespacedName>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setNamespacedNames($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\GkeBackup\V1\NamespacedName::class); + $this->namespaced_names = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/Namespaces.php b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/Namespaces.php new file mode 100644 index 000000000000..641c9e3e1187 --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/Namespaces.php @@ -0,0 +1,67 @@ +google.cloud.gkebackup.v1.Namespaces + */ +class Namespaces extends \Google\Protobuf\Internal\Message +{ + /** + * A list of Kubernetes Namespaces + * + * Generated from protobuf field repeated string namespaces = 1; + */ + private $namespaces; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $namespaces + * A list of Kubernetes Namespaces + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkebackup\V1\Common::initOnce(); + parent::__construct($data); + } + + /** + * A list of Kubernetes Namespaces + * + * Generated from protobuf field repeated string namespaces = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getNamespaces() + { + return $this->namespaces; + } + + /** + * A list of Kubernetes Namespaces + * + * Generated from protobuf field repeated string namespaces = 1; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setNamespaces($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->namespaces = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/OperationMetadata.php b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/OperationMetadata.php new file mode 100644 index 000000000000..c002b5b2034c --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/OperationMetadata.php @@ -0,0 +1,303 @@ +google.cloud.gkebackup.v1.OperationMetadata + */ +class OperationMetadata 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. Server-defined resource path for the target of the operation. + * + * Generated from protobuf field string target = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $target = ''; + /** + * Output only. Name of the verb executed by the operation. + * + * Generated from protobuf field string verb = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $verb = ''; + /** + * Output only. Human-readable status of the operation, if any. + * + * Generated from protobuf field string status_message = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $status_message = ''; + /** + * Output only. Identifies whether the user has requested cancellation + * of the operation. Operations that have successfully been cancelled + * have [Operation.error][] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, + * corresponding to `Code.CANCELLED`. + * + * Generated from protobuf field bool requested_cancellation = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $requested_cancellation = false; + /** + * Output only. API version used to start the operation. + * + * Generated from protobuf field string api_version = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $api_version = ''; + + /** + * 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 string $target + * Output only. Server-defined resource path for the target of the operation. + * @type string $verb + * Output only. Name of the verb executed by the operation. + * @type string $status_message + * Output only. Human-readable status of the operation, if any. + * @type bool $requested_cancellation + * Output only. Identifies whether the user has requested cancellation + * of the operation. Operations that have successfully been cancelled + * have [Operation.error][] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, + * corresponding to `Code.CANCELLED`. + * @type string $api_version + * Output only. API version used to start the operation. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkebackup\V1\Gkebackup::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. Server-defined resource path for the target of the operation. + * + * Generated from protobuf field string target = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getTarget() + { + return $this->target; + } + + /** + * Output only. Server-defined resource path for the target of the operation. + * + * Generated from protobuf field string target = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setTarget($var) + { + GPBUtil::checkString($var, True); + $this->target = $var; + + return $this; + } + + /** + * Output only. Name of the verb executed by the operation. + * + * Generated from protobuf field string verb = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getVerb() + { + return $this->verb; + } + + /** + * Output only. Name of the verb executed by the operation. + * + * Generated from protobuf field string verb = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setVerb($var) + { + GPBUtil::checkString($var, True); + $this->verb = $var; + + return $this; + } + + /** + * Output only. Human-readable status of the operation, if any. + * + * Generated from protobuf field string status_message = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getStatusMessage() + { + return $this->status_message; + } + + /** + * Output only. Human-readable status of the operation, if any. + * + * Generated from protobuf field string status_message = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setStatusMessage($var) + { + GPBUtil::checkString($var, True); + $this->status_message = $var; + + return $this; + } + + /** + * Output only. Identifies whether the user has requested cancellation + * of the operation. Operations that have successfully been cancelled + * have [Operation.error][] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, + * corresponding to `Code.CANCELLED`. + * + * Generated from protobuf field bool requested_cancellation = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return bool + */ + public function getRequestedCancellation() + { + return $this->requested_cancellation; + } + + /** + * Output only. Identifies whether the user has requested cancellation + * of the operation. Operations that have successfully been cancelled + * have [Operation.error][] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, + * corresponding to `Code.CANCELLED`. + * + * Generated from protobuf field bool requested_cancellation = 6 [(.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. API version used to start the operation. + * + * Generated from protobuf field string api_version = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getApiVersion() + { + return $this->api_version; + } + + /** + * Output only. API version used to start the operation. + * + * Generated from protobuf field string api_version = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setApiVersion($var) + { + GPBUtil::checkString($var, True); + $this->api_version = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/Restore.php b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/Restore.php new file mode 100644 index 000000000000..f2ace637bfa5 --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/Restore.php @@ -0,0 +1,729 @@ +google.cloud.gkebackup.v1.Restore + */ +class Restore extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The full name of the Restore resource. + * Format: projects/*/locations/*/restorePlans/*/restores/* + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $name = ''; + /** + * Output only. Server generated global unique identifier of + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier) format. + * + * Generated from protobuf field string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $uid = ''; + /** + * Output only. The timestamp when this Restore resource was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. The timestamp when this Restore resource was last + * updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * User specified descriptive string for this Restore. + * + * Generated from protobuf field string description = 5; + */ + protected $description = ''; + /** + * Required. Immutable. A reference to the [Backup][google.cloud.gkebackup.v1.Backup] used as the source from which this Restore + * will restore. Note that this Backup must be a sub-resource of the + * RestorePlan's [backup_plan][google.cloud.gkebackup.v1.RestorePlan.backup_plan]. + * Format: projects/*/locations/*/backupPlans/*/backups/*. + * + * Generated from protobuf field string backup = 6 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $backup = ''; + /** + * Output only. The target cluster into which this Restore will restore data. + * Valid formats: + * - projects/*/locations/*/clusters/* + * - projects/*/zones/*/clusters/* + * Inherited from parent RestorePlan's [cluster][google.cloud.gkebackup.v1.RestorePlan.cluster] value. + * + * Generated from protobuf field string cluster = 7 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + */ + protected $cluster = ''; + /** + * Output only. Configuration of the Restore. Inherited from parent RestorePlan's + * [restore_config][google.cloud.gkebackup.v1.RestorePlan.restore_config]. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.RestoreConfig restore_config = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $restore_config = null; + /** + * A set of custom labels supplied by user. + * + * Generated from protobuf field map labels = 9; + */ + private $labels; + /** + * Output only. The current state of the Restore. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.Restore.State state = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Output only. Human-readable description of why the Restore is in its current state. + * + * Generated from protobuf field string state_reason = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state_reason = ''; + /** + * Output only. Timestamp of when the restore operation completed. + * + * Generated from protobuf field .google.protobuf.Timestamp complete_time = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $complete_time = null; + /** + * Output only. Number of resources restored during the restore execution. + * + * Generated from protobuf field int32 resources_restored_count = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $resources_restored_count = 0; + /** + * Output only. Number of resources excluded during the restore execution. + * + * Generated from protobuf field int32 resources_excluded_count = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $resources_excluded_count = 0; + /** + * Output only. Number of resources that failed to be restored during the restore + * execution. + * + * Generated from protobuf field int32 resources_failed_count = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $resources_failed_count = 0; + /** + * Output only. Number of volumes restored during the restore execution. + * + * Generated from protobuf field int32 volumes_restored_count = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $volumes_restored_count = 0; + /** + * Output only. `etag` is used for optimistic concurrency control as a way to help + * prevent simultaneous updates of a restore from overwriting each other. + * It is strongly suggested that systems make use of the `etag` in the + * read-modify-write cycle to perform restore updates in order to avoid + * race conditions: An `etag` is returned in the response to `GetRestore`, + * and systems are expected to put that etag in the request to + * `UpdateRestore` or `DeleteRestore` to ensure that their change will be + * applied to the same version of the resource. + * + * Generated from protobuf field string etag = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $etag = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Output only. The full name of the Restore resource. + * Format: projects/*/locations/*/restorePlans/*/restores/* + * @type string $uid + * Output only. Server generated global unique identifier of + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier) format. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The timestamp when this Restore resource was created. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. The timestamp when this Restore resource was last + * updated. + * @type string $description + * User specified descriptive string for this Restore. + * @type string $backup + * Required. Immutable. A reference to the [Backup][google.cloud.gkebackup.v1.Backup] used as the source from which this Restore + * will restore. Note that this Backup must be a sub-resource of the + * RestorePlan's [backup_plan][google.cloud.gkebackup.v1.RestorePlan.backup_plan]. + * Format: projects/*/locations/*/backupPlans/*/backups/*. + * @type string $cluster + * Output only. The target cluster into which this Restore will restore data. + * Valid formats: + * - projects/*/locations/*/clusters/* + * - projects/*/zones/*/clusters/* + * Inherited from parent RestorePlan's [cluster][google.cloud.gkebackup.v1.RestorePlan.cluster] value. + * @type \Google\Cloud\GkeBackup\V1\RestoreConfig $restore_config + * Output only. Configuration of the Restore. Inherited from parent RestorePlan's + * [restore_config][google.cloud.gkebackup.v1.RestorePlan.restore_config]. + * @type array|\Google\Protobuf\Internal\MapField $labels + * A set of custom labels supplied by user. + * @type int $state + * Output only. The current state of the Restore. + * @type string $state_reason + * Output only. Human-readable description of why the Restore is in its current state. + * @type \Google\Protobuf\Timestamp $complete_time + * Output only. Timestamp of when the restore operation completed. + * @type int $resources_restored_count + * Output only. Number of resources restored during the restore execution. + * @type int $resources_excluded_count + * Output only. Number of resources excluded during the restore execution. + * @type int $resources_failed_count + * Output only. Number of resources that failed to be restored during the restore + * execution. + * @type int $volumes_restored_count + * Output only. Number of volumes restored during the restore execution. + * @type string $etag + * Output only. `etag` is used for optimistic concurrency control as a way to help + * prevent simultaneous updates of a restore from overwriting each other. + * It is strongly suggested that systems make use of the `etag` in the + * read-modify-write cycle to perform restore updates in order to avoid + * race conditions: An `etag` is returned in the response to `GetRestore`, + * and systems are expected to put that etag in the request to + * `UpdateRestore` or `DeleteRestore` to ensure that their change will be + * applied to the same version of the resource. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkebackup\V1\Restore::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The full name of the Restore resource. + * Format: projects/*/locations/*/restorePlans/*/restores/* + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Output only. The full name of the Restore resource. + * Format: projects/*/locations/*/restorePlans/*/restores/* + * + * 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. Server generated global unique identifier of + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier) format. + * + * Generated from protobuf field string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getUid() + { + return $this->uid; + } + + /** + * Output only. Server generated global unique identifier of + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier) format. + * + * Generated from protobuf field string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setUid($var) + { + GPBUtil::checkString($var, True); + $this->uid = $var; + + return $this; + } + + /** + * Output only. The timestamp when this Restore resource was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 3 [(.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 timestamp when this Restore resource was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 3 [(.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 timestamp when this Restore resource was last + * updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 4 [(.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 timestamp when this Restore resource was last + * updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 4 [(.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; + } + + /** + * User specified descriptive string for this Restore. + * + * Generated from protobuf field string description = 5; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * User specified descriptive string for this Restore. + * + * Generated from protobuf field string description = 5; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * Required. Immutable. A reference to the [Backup][google.cloud.gkebackup.v1.Backup] used as the source from which this Restore + * will restore. Note that this Backup must be a sub-resource of the + * RestorePlan's [backup_plan][google.cloud.gkebackup.v1.RestorePlan.backup_plan]. + * Format: projects/*/locations/*/backupPlans/*/backups/*. + * + * Generated from protobuf field string backup = 6 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getBackup() + { + return $this->backup; + } + + /** + * Required. Immutable. A reference to the [Backup][google.cloud.gkebackup.v1.Backup] used as the source from which this Restore + * will restore. Note that this Backup must be a sub-resource of the + * RestorePlan's [backup_plan][google.cloud.gkebackup.v1.RestorePlan.backup_plan]. + * Format: projects/*/locations/*/backupPlans/*/backups/*. + * + * Generated from protobuf field string backup = 6 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setBackup($var) + { + GPBUtil::checkString($var, True); + $this->backup = $var; + + return $this; + } + + /** + * Output only. The target cluster into which this Restore will restore data. + * Valid formats: + * - projects/*/locations/*/clusters/* + * - projects/*/zones/*/clusters/* + * Inherited from parent RestorePlan's [cluster][google.cloud.gkebackup.v1.RestorePlan.cluster] value. + * + * Generated from protobuf field string cluster = 7 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + * @return string + */ + public function getCluster() + { + return $this->cluster; + } + + /** + * Output only. The target cluster into which this Restore will restore data. + * Valid formats: + * - projects/*/locations/*/clusters/* + * - projects/*/zones/*/clusters/* + * Inherited from parent RestorePlan's [cluster][google.cloud.gkebackup.v1.RestorePlan.cluster] value. + * + * Generated from protobuf field string cluster = 7 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setCluster($var) + { + GPBUtil::checkString($var, True); + $this->cluster = $var; + + return $this; + } + + /** + * Output only. Configuration of the Restore. Inherited from parent RestorePlan's + * [restore_config][google.cloud.gkebackup.v1.RestorePlan.restore_config]. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.RestoreConfig restore_config = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\GkeBackup\V1\RestoreConfig|null + */ + public function getRestoreConfig() + { + return $this->restore_config; + } + + public function hasRestoreConfig() + { + return isset($this->restore_config); + } + + public function clearRestoreConfig() + { + unset($this->restore_config); + } + + /** + * Output only. Configuration of the Restore. Inherited from parent RestorePlan's + * [restore_config][google.cloud.gkebackup.v1.RestorePlan.restore_config]. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.RestoreConfig restore_config = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\GkeBackup\V1\RestoreConfig $var + * @return $this + */ + public function setRestoreConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeBackup\V1\RestoreConfig::class); + $this->restore_config = $var; + + return $this; + } + + /** + * A set of custom labels supplied by user. + * + * Generated from protobuf field map labels = 9; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * A set of custom labels supplied by user. + * + * Generated from protobuf field map labels = 9; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + + /** + * Output only. The current state of the Restore. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.Restore.State state = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. The current state of the Restore. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.Restore.State state = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\GkeBackup\V1\Restore\State::class); + $this->state = $var; + + return $this; + } + + /** + * Output only. Human-readable description of why the Restore is in its current state. + * + * Generated from protobuf field string state_reason = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getStateReason() + { + return $this->state_reason; + } + + /** + * Output only. Human-readable description of why the Restore is in its current state. + * + * Generated from protobuf field string state_reason = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setStateReason($var) + { + GPBUtil::checkString($var, True); + $this->state_reason = $var; + + return $this; + } + + /** + * Output only. Timestamp of when the restore operation completed. + * + * Generated from protobuf field .google.protobuf.Timestamp complete_time = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCompleteTime() + { + return $this->complete_time; + } + + public function hasCompleteTime() + { + return isset($this->complete_time); + } + + public function clearCompleteTime() + { + unset($this->complete_time); + } + + /** + * Output only. Timestamp of when the restore operation completed. + * + * Generated from protobuf field .google.protobuf.Timestamp complete_time = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCompleteTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->complete_time = $var; + + return $this; + } + + /** + * Output only. Number of resources restored during the restore execution. + * + * Generated from protobuf field int32 resources_restored_count = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getResourcesRestoredCount() + { + return $this->resources_restored_count; + } + + /** + * Output only. Number of resources restored during the restore execution. + * + * Generated from protobuf field int32 resources_restored_count = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setResourcesRestoredCount($var) + { + GPBUtil::checkInt32($var); + $this->resources_restored_count = $var; + + return $this; + } + + /** + * Output only. Number of resources excluded during the restore execution. + * + * Generated from protobuf field int32 resources_excluded_count = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getResourcesExcludedCount() + { + return $this->resources_excluded_count; + } + + /** + * Output only. Number of resources excluded during the restore execution. + * + * Generated from protobuf field int32 resources_excluded_count = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setResourcesExcludedCount($var) + { + GPBUtil::checkInt32($var); + $this->resources_excluded_count = $var; + + return $this; + } + + /** + * Output only. Number of resources that failed to be restored during the restore + * execution. + * + * Generated from protobuf field int32 resources_failed_count = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getResourcesFailedCount() + { + return $this->resources_failed_count; + } + + /** + * Output only. Number of resources that failed to be restored during the restore + * execution. + * + * Generated from protobuf field int32 resources_failed_count = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setResourcesFailedCount($var) + { + GPBUtil::checkInt32($var); + $this->resources_failed_count = $var; + + return $this; + } + + /** + * Output only. Number of volumes restored during the restore execution. + * + * Generated from protobuf field int32 volumes_restored_count = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getVolumesRestoredCount() + { + return $this->volumes_restored_count; + } + + /** + * Output only. Number of volumes restored during the restore execution. + * + * Generated from protobuf field int32 volumes_restored_count = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setVolumesRestoredCount($var) + { + GPBUtil::checkInt32($var); + $this->volumes_restored_count = $var; + + return $this; + } + + /** + * Output only. `etag` is used for optimistic concurrency control as a way to help + * prevent simultaneous updates of a restore from overwriting each other. + * It is strongly suggested that systems make use of the `etag` in the + * read-modify-write cycle to perform restore updates in order to avoid + * race conditions: An `etag` is returned in the response to `GetRestore`, + * and systems are expected to put that etag in the request to + * `UpdateRestore` or `DeleteRestore` to ensure that their change will be + * applied to the same version of the resource. + * + * Generated from protobuf field string etag = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * Output only. `etag` is used for optimistic concurrency control as a way to help + * prevent simultaneous updates of a restore from overwriting each other. + * It is strongly suggested that systems make use of the `etag` in the + * read-modify-write cycle to perform restore updates in order to avoid + * race conditions: An `etag` is returned in the response to `GetRestore`, + * and systems are expected to put that etag in the request to + * `UpdateRestore` or `DeleteRestore` to ensure that their change will be + * applied to the same version of the resource. + * + * Generated from protobuf field string etag = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, True); + $this->etag = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/Restore/State.php b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/Restore/State.php new file mode 100644 index 000000000000..3c28235bc7c4 --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/Restore/State.php @@ -0,0 +1,88 @@ +google.cloud.gkebackup.v1.Restore.State + */ +class State +{ + /** + * The Restore resource is in the process of being created. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The Restore resource has been created and the associated RestoreJob + * Kubernetes resource has been injected into target cluster. + * + * Generated from protobuf enum CREATING = 1; + */ + const CREATING = 1; + /** + * The gkebackup agent in the cluster has begun executing the restore + * operation. + * + * Generated from protobuf enum IN_PROGRESS = 2; + */ + const IN_PROGRESS = 2; + /** + * The restore operation has completed successfully. Restored workloads may + * not yet be operational. + * + * Generated from protobuf enum SUCCEEDED = 3; + */ + const SUCCEEDED = 3; + /** + * The restore operation has failed. + * + * Generated from protobuf enum FAILED = 4; + */ + const FAILED = 4; + /** + * This Restore resource is in the process of being deleted. + * + * Generated from protobuf enum DELETING = 5; + */ + const DELETING = 5; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::CREATING => 'CREATING', + self::IN_PROGRESS => 'IN_PROGRESS', + self::SUCCEEDED => 'SUCCEEDED', + self::FAILED => 'FAILED', + self::DELETING => 'DELETING', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\GkeBackup\V1\Restore_State::class); + diff --git a/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/RestoreConfig.php b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/RestoreConfig.php new file mode 100644 index 000000000000..46cc7d0c8404 --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/RestoreConfig.php @@ -0,0 +1,382 @@ +google.cloud.gkebackup.v1.RestoreConfig + */ +class RestoreConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Specifies the mechanism to be used to restore volume data. + * Default: VOLUME_DATA_RESTORE_POLICY_UNSPECIFIED (will be treated as + * NO_VOLUME_DATA_RESTORATION). + * + * Generated from protobuf field .google.cloud.gkebackup.v1.RestoreConfig.VolumeDataRestorePolicy volume_data_restore_policy = 1; + */ + protected $volume_data_restore_policy = 0; + /** + * Defines the behavior for handling the situation where cluster-scoped + * resources being restored already exist in the target cluster. This MUST be + * set to a value other than CLUSTER_RESOURCE_CONFLICT_POLICY_UNSPECIFIED if + * [cluster_resource_restore_scope][google.cloud.gkebackup.v1.RestoreConfig.cluster_resource_restore_scope] is not empty. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.RestoreConfig.ClusterResourceConflictPolicy cluster_resource_conflict_policy = 2; + */ + protected $cluster_resource_conflict_policy = 0; + /** + * Defines the behavior for handling the situation where sets of namespaced + * resources being restored already exist in the target cluster. This MUST be + * set to a value other than NAMESPACED_RESOURCE_RESTORE_MODE_UNSPECIFIED. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.RestoreConfig.NamespacedResourceRestoreMode namespaced_resource_restore_mode = 3; + */ + protected $namespaced_resource_restore_mode = 0; + /** + * Identifies the cluster-scoped resources to restore from the Backup. + * Not specifying it means NO cluster resource will be restored. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.RestoreConfig.ClusterResourceRestoreScope cluster_resource_restore_scope = 4; + */ + protected $cluster_resource_restore_scope = null; + /** + * A list of transformation rules to be applied against Kubernetes resources + * as they are selected for restoration from a Backup. Rules are executed in + * order defined - this order matters, as changes made by a rule may impact + * the filtering logic of subsequent rules. An empty list means no + * substitution will occur. + * + * Generated from protobuf field repeated .google.cloud.gkebackup.v1.RestoreConfig.SubstitutionRule substitution_rules = 8; + */ + private $substitution_rules; + protected $namespaced_resource_restore_scope; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $volume_data_restore_policy + * Specifies the mechanism to be used to restore volume data. + * Default: VOLUME_DATA_RESTORE_POLICY_UNSPECIFIED (will be treated as + * NO_VOLUME_DATA_RESTORATION). + * @type int $cluster_resource_conflict_policy + * Defines the behavior for handling the situation where cluster-scoped + * resources being restored already exist in the target cluster. This MUST be + * set to a value other than CLUSTER_RESOURCE_CONFLICT_POLICY_UNSPECIFIED if + * [cluster_resource_restore_scope][google.cloud.gkebackup.v1.RestoreConfig.cluster_resource_restore_scope] is not empty. + * @type int $namespaced_resource_restore_mode + * Defines the behavior for handling the situation where sets of namespaced + * resources being restored already exist in the target cluster. This MUST be + * set to a value other than NAMESPACED_RESOURCE_RESTORE_MODE_UNSPECIFIED. + * @type \Google\Cloud\GkeBackup\V1\RestoreConfig\ClusterResourceRestoreScope $cluster_resource_restore_scope + * Identifies the cluster-scoped resources to restore from the Backup. + * Not specifying it means NO cluster resource will be restored. + * @type bool $all_namespaces + * Restore all namespaced resources in the Backup if set to "True". + * Specifying this field to "False" is an error. + * @type \Google\Cloud\GkeBackup\V1\Namespaces $selected_namespaces + * A list of selected Namespaces to restore from the Backup. The listed + * Namespaces and all resources contained in them will be restored. + * @type \Google\Cloud\GkeBackup\V1\NamespacedNames $selected_applications + * A list of selected ProtectedApplications to restore. The listed + * ProtectedApplications and all the resources to which they refer will be + * restored. + * @type array<\Google\Cloud\GkeBackup\V1\RestoreConfig\SubstitutionRule>|\Google\Protobuf\Internal\RepeatedField $substitution_rules + * A list of transformation rules to be applied against Kubernetes resources + * as they are selected for restoration from a Backup. Rules are executed in + * order defined - this order matters, as changes made by a rule may impact + * the filtering logic of subsequent rules. An empty list means no + * substitution will occur. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkebackup\V1\Restore::initOnce(); + parent::__construct($data); + } + + /** + * Specifies the mechanism to be used to restore volume data. + * Default: VOLUME_DATA_RESTORE_POLICY_UNSPECIFIED (will be treated as + * NO_VOLUME_DATA_RESTORATION). + * + * Generated from protobuf field .google.cloud.gkebackup.v1.RestoreConfig.VolumeDataRestorePolicy volume_data_restore_policy = 1; + * @return int + */ + public function getVolumeDataRestorePolicy() + { + return $this->volume_data_restore_policy; + } + + /** + * Specifies the mechanism to be used to restore volume data. + * Default: VOLUME_DATA_RESTORE_POLICY_UNSPECIFIED (will be treated as + * NO_VOLUME_DATA_RESTORATION). + * + * Generated from protobuf field .google.cloud.gkebackup.v1.RestoreConfig.VolumeDataRestorePolicy volume_data_restore_policy = 1; + * @param int $var + * @return $this + */ + public function setVolumeDataRestorePolicy($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\GkeBackup\V1\RestoreConfig\VolumeDataRestorePolicy::class); + $this->volume_data_restore_policy = $var; + + return $this; + } + + /** + * Defines the behavior for handling the situation where cluster-scoped + * resources being restored already exist in the target cluster. This MUST be + * set to a value other than CLUSTER_RESOURCE_CONFLICT_POLICY_UNSPECIFIED if + * [cluster_resource_restore_scope][google.cloud.gkebackup.v1.RestoreConfig.cluster_resource_restore_scope] is not empty. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.RestoreConfig.ClusterResourceConflictPolicy cluster_resource_conflict_policy = 2; + * @return int + */ + public function getClusterResourceConflictPolicy() + { + return $this->cluster_resource_conflict_policy; + } + + /** + * Defines the behavior for handling the situation where cluster-scoped + * resources being restored already exist in the target cluster. This MUST be + * set to a value other than CLUSTER_RESOURCE_CONFLICT_POLICY_UNSPECIFIED if + * [cluster_resource_restore_scope][google.cloud.gkebackup.v1.RestoreConfig.cluster_resource_restore_scope] is not empty. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.RestoreConfig.ClusterResourceConflictPolicy cluster_resource_conflict_policy = 2; + * @param int $var + * @return $this + */ + public function setClusterResourceConflictPolicy($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\GkeBackup\V1\RestoreConfig\ClusterResourceConflictPolicy::class); + $this->cluster_resource_conflict_policy = $var; + + return $this; + } + + /** + * Defines the behavior for handling the situation where sets of namespaced + * resources being restored already exist in the target cluster. This MUST be + * set to a value other than NAMESPACED_RESOURCE_RESTORE_MODE_UNSPECIFIED. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.RestoreConfig.NamespacedResourceRestoreMode namespaced_resource_restore_mode = 3; + * @return int + */ + public function getNamespacedResourceRestoreMode() + { + return $this->namespaced_resource_restore_mode; + } + + /** + * Defines the behavior for handling the situation where sets of namespaced + * resources being restored already exist in the target cluster. This MUST be + * set to a value other than NAMESPACED_RESOURCE_RESTORE_MODE_UNSPECIFIED. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.RestoreConfig.NamespacedResourceRestoreMode namespaced_resource_restore_mode = 3; + * @param int $var + * @return $this + */ + public function setNamespacedResourceRestoreMode($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\GkeBackup\V1\RestoreConfig\NamespacedResourceRestoreMode::class); + $this->namespaced_resource_restore_mode = $var; + + return $this; + } + + /** + * Identifies the cluster-scoped resources to restore from the Backup. + * Not specifying it means NO cluster resource will be restored. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.RestoreConfig.ClusterResourceRestoreScope cluster_resource_restore_scope = 4; + * @return \Google\Cloud\GkeBackup\V1\RestoreConfig\ClusterResourceRestoreScope|null + */ + public function getClusterResourceRestoreScope() + { + return $this->cluster_resource_restore_scope; + } + + public function hasClusterResourceRestoreScope() + { + return isset($this->cluster_resource_restore_scope); + } + + public function clearClusterResourceRestoreScope() + { + unset($this->cluster_resource_restore_scope); + } + + /** + * Identifies the cluster-scoped resources to restore from the Backup. + * Not specifying it means NO cluster resource will be restored. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.RestoreConfig.ClusterResourceRestoreScope cluster_resource_restore_scope = 4; + * @param \Google\Cloud\GkeBackup\V1\RestoreConfig\ClusterResourceRestoreScope $var + * @return $this + */ + public function setClusterResourceRestoreScope($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeBackup\V1\RestoreConfig\ClusterResourceRestoreScope::class); + $this->cluster_resource_restore_scope = $var; + + return $this; + } + + /** + * Restore all namespaced resources in the Backup if set to "True". + * Specifying this field to "False" is an error. + * + * Generated from protobuf field bool all_namespaces = 5; + * @return bool + */ + public function getAllNamespaces() + { + return $this->readOneof(5); + } + + public function hasAllNamespaces() + { + return $this->hasOneof(5); + } + + /** + * Restore all namespaced resources in the Backup if set to "True". + * Specifying this field to "False" is an error. + * + * Generated from protobuf field bool all_namespaces = 5; + * @param bool $var + * @return $this + */ + public function setAllNamespaces($var) + { + GPBUtil::checkBool($var); + $this->writeOneof(5, $var); + + return $this; + } + + /** + * A list of selected Namespaces to restore from the Backup. The listed + * Namespaces and all resources contained in them will be restored. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.Namespaces selected_namespaces = 6; + * @return \Google\Cloud\GkeBackup\V1\Namespaces|null + */ + public function getSelectedNamespaces() + { + return $this->readOneof(6); + } + + public function hasSelectedNamespaces() + { + return $this->hasOneof(6); + } + + /** + * A list of selected Namespaces to restore from the Backup. The listed + * Namespaces and all resources contained in them will be restored. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.Namespaces selected_namespaces = 6; + * @param \Google\Cloud\GkeBackup\V1\Namespaces $var + * @return $this + */ + public function setSelectedNamespaces($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeBackup\V1\Namespaces::class); + $this->writeOneof(6, $var); + + return $this; + } + + /** + * A list of selected ProtectedApplications to restore. The listed + * ProtectedApplications and all the resources to which they refer will be + * restored. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.NamespacedNames selected_applications = 7; + * @return \Google\Cloud\GkeBackup\V1\NamespacedNames|null + */ + public function getSelectedApplications() + { + return $this->readOneof(7); + } + + public function hasSelectedApplications() + { + return $this->hasOneof(7); + } + + /** + * A list of selected ProtectedApplications to restore. The listed + * ProtectedApplications and all the resources to which they refer will be + * restored. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.NamespacedNames selected_applications = 7; + * @param \Google\Cloud\GkeBackup\V1\NamespacedNames $var + * @return $this + */ + public function setSelectedApplications($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeBackup\V1\NamespacedNames::class); + $this->writeOneof(7, $var); + + return $this; + } + + /** + * A list of transformation rules to be applied against Kubernetes resources + * as they are selected for restoration from a Backup. Rules are executed in + * order defined - this order matters, as changes made by a rule may impact + * the filtering logic of subsequent rules. An empty list means no + * substitution will occur. + * + * Generated from protobuf field repeated .google.cloud.gkebackup.v1.RestoreConfig.SubstitutionRule substitution_rules = 8; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSubstitutionRules() + { + return $this->substitution_rules; + } + + /** + * A list of transformation rules to be applied against Kubernetes resources + * as they are selected for restoration from a Backup. Rules are executed in + * order defined - this order matters, as changes made by a rule may impact + * the filtering logic of subsequent rules. An empty list means no + * substitution will occur. + * + * Generated from protobuf field repeated .google.cloud.gkebackup.v1.RestoreConfig.SubstitutionRule substitution_rules = 8; + * @param array<\Google\Cloud\GkeBackup\V1\RestoreConfig\SubstitutionRule>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSubstitutionRules($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\GkeBackup\V1\RestoreConfig\SubstitutionRule::class); + $this->substitution_rules = $arr; + + return $this; + } + + /** + * @return string + */ + public function getNamespacedResourceRestoreScope() + { + return $this->whichOneof("namespaced_resource_restore_scope"); + } + +} + diff --git a/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/RestoreConfig/ClusterResourceConflictPolicy.php b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/RestoreConfig/ClusterResourceConflictPolicy.php new file mode 100644 index 000000000000..2c370fe9b4a6 --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/RestoreConfig/ClusterResourceConflictPolicy.php @@ -0,0 +1,69 @@ +google.cloud.gkebackup.v1.RestoreConfig.ClusterResourceConflictPolicy + */ +class ClusterResourceConflictPolicy +{ + /** + * Unspecified. Only allowed if no cluster-scoped resources will be + * restored. + * + * Generated from protobuf enum CLUSTER_RESOURCE_CONFLICT_POLICY_UNSPECIFIED = 0; + */ + const CLUSTER_RESOURCE_CONFLICT_POLICY_UNSPECIFIED = 0; + /** + * Do not attempt to restore the conflicting resource. + * + * Generated from protobuf enum USE_EXISTING_VERSION = 1; + */ + const USE_EXISTING_VERSION = 1; + /** + * Delete the existing version before re-creating it from the Backup. + * Note that this is a dangerous option which could cause unintentional + * data loss if used inappropriately - for example, deleting a CRD will + * cause Kubernetes to delete all CRs of that type. + * + * Generated from protobuf enum USE_BACKUP_VERSION = 2; + */ + const USE_BACKUP_VERSION = 2; + + private static $valueToName = [ + self::CLUSTER_RESOURCE_CONFLICT_POLICY_UNSPECIFIED => 'CLUSTER_RESOURCE_CONFLICT_POLICY_UNSPECIFIED', + self::USE_EXISTING_VERSION => 'USE_EXISTING_VERSION', + self::USE_BACKUP_VERSION => 'USE_BACKUP_VERSION', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ClusterResourceConflictPolicy::class, \Google\Cloud\GkeBackup\V1\RestoreConfig_ClusterResourceConflictPolicy::class); + diff --git a/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/RestoreConfig/ClusterResourceRestoreScope.php b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/RestoreConfig/ClusterResourceRestoreScope.php new file mode 100644 index 000000000000..cddcdcd36ca3 --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/RestoreConfig/ClusterResourceRestoreScope.php @@ -0,0 +1,82 @@ +google.cloud.gkebackup.v1.RestoreConfig.ClusterResourceRestoreScope + */ +class ClusterResourceRestoreScope extends \Google\Protobuf\Internal\Message +{ + /** + * A list of "types" of cluster-scoped resources to be restored from the + * Backup. An empty list means that NO cluster-scoped resources will be + * restored. Note that Namespaces and PersistentVolume restoration is + * handled separately and is not governed by this field. + * + * Generated from protobuf field repeated .google.cloud.gkebackup.v1.RestoreConfig.GroupKind selected_group_kinds = 1; + */ + private $selected_group_kinds; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\GkeBackup\V1\RestoreConfig\GroupKind>|\Google\Protobuf\Internal\RepeatedField $selected_group_kinds + * A list of "types" of cluster-scoped resources to be restored from the + * Backup. An empty list means that NO cluster-scoped resources will be + * restored. Note that Namespaces and PersistentVolume restoration is + * handled separately and is not governed by this field. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkebackup\V1\Restore::initOnce(); + parent::__construct($data); + } + + /** + * A list of "types" of cluster-scoped resources to be restored from the + * Backup. An empty list means that NO cluster-scoped resources will be + * restored. Note that Namespaces and PersistentVolume restoration is + * handled separately and is not governed by this field. + * + * Generated from protobuf field repeated .google.cloud.gkebackup.v1.RestoreConfig.GroupKind selected_group_kinds = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSelectedGroupKinds() + { + return $this->selected_group_kinds; + } + + /** + * A list of "types" of cluster-scoped resources to be restored from the + * Backup. An empty list means that NO cluster-scoped resources will be + * restored. Note that Namespaces and PersistentVolume restoration is + * handled separately and is not governed by this field. + * + * Generated from protobuf field repeated .google.cloud.gkebackup.v1.RestoreConfig.GroupKind selected_group_kinds = 1; + * @param array<\Google\Cloud\GkeBackup\V1\RestoreConfig\GroupKind>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSelectedGroupKinds($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\GkeBackup\V1\RestoreConfig\GroupKind::class); + $this->selected_group_kinds = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ClusterResourceRestoreScope::class, \Google\Cloud\GkeBackup\V1\RestoreConfig_ClusterResourceRestoreScope::class); + diff --git a/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/RestoreConfig/GroupKind.php b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/RestoreConfig/GroupKind.php new file mode 100644 index 000000000000..bcef89eac771 --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/RestoreConfig/GroupKind.php @@ -0,0 +1,118 @@ +google.cloud.gkebackup.v1.RestoreConfig.GroupKind + */ +class GroupKind extends \Google\Protobuf\Internal\Message +{ + /** + * API group string of a Kubernetes resource, e.g. + * "apiextensions.k8s.io", "storage.k8s.io", etc. + * Note: use empty string for core API group + * + * Generated from protobuf field string resource_group = 1; + */ + protected $resource_group = ''; + /** + * Kind of a Kubernetes resource, e.g. + * "CustomResourceDefinition", "StorageClass", etc. + * + * Generated from protobuf field string resource_kind = 2; + */ + protected $resource_kind = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $resource_group + * API group string of a Kubernetes resource, e.g. + * "apiextensions.k8s.io", "storage.k8s.io", etc. + * Note: use empty string for core API group + * @type string $resource_kind + * Kind of a Kubernetes resource, e.g. + * "CustomResourceDefinition", "StorageClass", etc. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkebackup\V1\Restore::initOnce(); + parent::__construct($data); + } + + /** + * API group string of a Kubernetes resource, e.g. + * "apiextensions.k8s.io", "storage.k8s.io", etc. + * Note: use empty string for core API group + * + * Generated from protobuf field string resource_group = 1; + * @return string + */ + public function getResourceGroup() + { + return $this->resource_group; + } + + /** + * API group string of a Kubernetes resource, e.g. + * "apiextensions.k8s.io", "storage.k8s.io", etc. + * Note: use empty string for core API group + * + * Generated from protobuf field string resource_group = 1; + * @param string $var + * @return $this + */ + public function setResourceGroup($var) + { + GPBUtil::checkString($var, True); + $this->resource_group = $var; + + return $this; + } + + /** + * Kind of a Kubernetes resource, e.g. + * "CustomResourceDefinition", "StorageClass", etc. + * + * Generated from protobuf field string resource_kind = 2; + * @return string + */ + public function getResourceKind() + { + return $this->resource_kind; + } + + /** + * Kind of a Kubernetes resource, e.g. + * "CustomResourceDefinition", "StorageClass", etc. + * + * Generated from protobuf field string resource_kind = 2; + * @param string $var + * @return $this + */ + public function setResourceKind($var) + { + GPBUtil::checkString($var, True); + $this->resource_kind = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(GroupKind::class, \Google\Cloud\GkeBackup\V1\RestoreConfig_GroupKind::class); + diff --git a/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/RestoreConfig/NamespacedResourceRestoreMode.php b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/RestoreConfig/NamespacedResourceRestoreMode.php new file mode 100644 index 000000000000..d2d978281027 --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/RestoreConfig/NamespacedResourceRestoreMode.php @@ -0,0 +1,75 @@ +google.cloud.gkebackup.v1.RestoreConfig.NamespacedResourceRestoreMode + */ +class NamespacedResourceRestoreMode +{ + /** + * Unspecified (invalid). + * + * Generated from protobuf enum NAMESPACED_RESOURCE_RESTORE_MODE_UNSPECIFIED = 0; + */ + const NAMESPACED_RESOURCE_RESTORE_MODE_UNSPECIFIED = 0; + /** + * When conflicting top-level resources (either Namespaces or + * ProtectedApplications, depending upon the scope) are encountered, this + * will first trigger a delete of the conflicting resource AND ALL OF ITS + * REFERENCED RESOURCES (e.g., all resources in the Namespace or all + * resources referenced by the ProtectedApplication) before restoring the + * resources from the Backup. This mode should only be used when you are + * intending to revert some portion of a cluster to an earlier state. + * + * Generated from protobuf enum DELETE_AND_RESTORE = 1; + */ + const DELETE_AND_RESTORE = 1; + /** + * If conflicting top-level resources (either Namespaces or + * ProtectedApplications, depending upon the scope) are encountered at the + * beginning of a restore process, the Restore will fail. If a conflict + * occurs during the restore process itself (e.g., because an out of band + * process creates conflicting resources), a conflict will be reported. + * + * Generated from protobuf enum FAIL_ON_CONFLICT = 2; + */ + const FAIL_ON_CONFLICT = 2; + + private static $valueToName = [ + self::NAMESPACED_RESOURCE_RESTORE_MODE_UNSPECIFIED => 'NAMESPACED_RESOURCE_RESTORE_MODE_UNSPECIFIED', + self::DELETE_AND_RESTORE => 'DELETE_AND_RESTORE', + self::FAIL_ON_CONFLICT => 'FAIL_ON_CONFLICT', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(NamespacedResourceRestoreMode::class, \Google\Cloud\GkeBackup\V1\RestoreConfig_NamespacedResourceRestoreMode::class); + diff --git a/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/RestoreConfig/SubstitutionRule.php b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/RestoreConfig/SubstitutionRule.php new file mode 100644 index 000000000000..80c9bc843c57 --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/RestoreConfig/SubstitutionRule.php @@ -0,0 +1,312 @@ +google.cloud.gkebackup.v1.RestoreConfig.SubstitutionRule + */ +class SubstitutionRule extends \Google\Protobuf\Internal\Message +{ + /** + * (Filtering parameter) Any resource subject to substitution must be + * contained within one of the listed Kubernetes Namespace in the Backup. + * If this field is not provided, no namespace filtering will be performed + * (all resources in all Namespaces, including all cluster-scoped resources, + * will be candidates for substitution). + * To mix cluster-scoped and namespaced resources in the same rule, use an + * empty string ("") as one of the target namespaces. + * + * Generated from protobuf field repeated string target_namespaces = 1; + */ + private $target_namespaces; + /** + * (Filtering parameter) Any resource subject to substitution must belong to + * one of the listed "types". + * If this field is not provided, no type filtering will be performed (all + * resources of all types matching previous filtering parameters will be + * candidates for substitution). + * + * Generated from protobuf field repeated .google.cloud.gkebackup.v1.RestoreConfig.GroupKind target_group_kinds = 2; + */ + private $target_group_kinds; + /** + * Required. This is a [JSONPath] + * (https://kubernetes.io/docs/reference/kubectl/jsonpath/) + * expression that matches specific fields of candidate + * resources and it operates as both a filtering parameter (resources that + * are not matched with this expression will not be candidates for + * substitution) as well as a field identifier (identifies exactly which + * fields out of the candidate resources will be modified). + * + * Generated from protobuf field string target_json_path = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $target_json_path = ''; + /** + * (Filtering parameter) This is a [regular expression] + * (https://en.wikipedia.org/wiki/Regular_expression) + * that is compared against the fields matched by the target_json_path + * expression (and must also have passed the previous filters). + * Substitution will not be performed against fields whose + * value does not match this expression. If this field is NOT specified, + * then ALL fields matched by the target_json_path expression will undergo + * substitution. Note that an empty (e.g., "", rather than unspecified) + * value for for this field will only match empty fields. + * + * Generated from protobuf field string original_value_pattern = 4; + */ + protected $original_value_pattern = ''; + /** + * This is the new value to set for any fields that pass the filtering and + * selection criteria. To remove a value from a Kubernetes resource, either + * leave this field unspecified, or set it to the empty string (""). + * + * Generated from protobuf field string new_value = 5; + */ + protected $new_value = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $target_namespaces + * (Filtering parameter) Any resource subject to substitution must be + * contained within one of the listed Kubernetes Namespace in the Backup. + * If this field is not provided, no namespace filtering will be performed + * (all resources in all Namespaces, including all cluster-scoped resources, + * will be candidates for substitution). + * To mix cluster-scoped and namespaced resources in the same rule, use an + * empty string ("") as one of the target namespaces. + * @type array<\Google\Cloud\GkeBackup\V1\RestoreConfig\GroupKind>|\Google\Protobuf\Internal\RepeatedField $target_group_kinds + * (Filtering parameter) Any resource subject to substitution must belong to + * one of the listed "types". + * If this field is not provided, no type filtering will be performed (all + * resources of all types matching previous filtering parameters will be + * candidates for substitution). + * @type string $target_json_path + * Required. This is a [JSONPath] + * (https://kubernetes.io/docs/reference/kubectl/jsonpath/) + * expression that matches specific fields of candidate + * resources and it operates as both a filtering parameter (resources that + * are not matched with this expression will not be candidates for + * substitution) as well as a field identifier (identifies exactly which + * fields out of the candidate resources will be modified). + * @type string $original_value_pattern + * (Filtering parameter) This is a [regular expression] + * (https://en.wikipedia.org/wiki/Regular_expression) + * that is compared against the fields matched by the target_json_path + * expression (and must also have passed the previous filters). + * Substitution will not be performed against fields whose + * value does not match this expression. If this field is NOT specified, + * then ALL fields matched by the target_json_path expression will undergo + * substitution. Note that an empty (e.g., "", rather than unspecified) + * value for for this field will only match empty fields. + * @type string $new_value + * This is the new value to set for any fields that pass the filtering and + * selection criteria. To remove a value from a Kubernetes resource, either + * leave this field unspecified, or set it to the empty string (""). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkebackup\V1\Restore::initOnce(); + parent::__construct($data); + } + + /** + * (Filtering parameter) Any resource subject to substitution must be + * contained within one of the listed Kubernetes Namespace in the Backup. + * If this field is not provided, no namespace filtering will be performed + * (all resources in all Namespaces, including all cluster-scoped resources, + * will be candidates for substitution). + * To mix cluster-scoped and namespaced resources in the same rule, use an + * empty string ("") as one of the target namespaces. + * + * Generated from protobuf field repeated string target_namespaces = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTargetNamespaces() + { + return $this->target_namespaces; + } + + /** + * (Filtering parameter) Any resource subject to substitution must be + * contained within one of the listed Kubernetes Namespace in the Backup. + * If this field is not provided, no namespace filtering will be performed + * (all resources in all Namespaces, including all cluster-scoped resources, + * will be candidates for substitution). + * To mix cluster-scoped and namespaced resources in the same rule, use an + * empty string ("") as one of the target namespaces. + * + * Generated from protobuf field repeated string target_namespaces = 1; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTargetNamespaces($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->target_namespaces = $arr; + + return $this; + } + + /** + * (Filtering parameter) Any resource subject to substitution must belong to + * one of the listed "types". + * If this field is not provided, no type filtering will be performed (all + * resources of all types matching previous filtering parameters will be + * candidates for substitution). + * + * Generated from protobuf field repeated .google.cloud.gkebackup.v1.RestoreConfig.GroupKind target_group_kinds = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTargetGroupKinds() + { + return $this->target_group_kinds; + } + + /** + * (Filtering parameter) Any resource subject to substitution must belong to + * one of the listed "types". + * If this field is not provided, no type filtering will be performed (all + * resources of all types matching previous filtering parameters will be + * candidates for substitution). + * + * Generated from protobuf field repeated .google.cloud.gkebackup.v1.RestoreConfig.GroupKind target_group_kinds = 2; + * @param array<\Google\Cloud\GkeBackup\V1\RestoreConfig\GroupKind>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTargetGroupKinds($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\GkeBackup\V1\RestoreConfig\GroupKind::class); + $this->target_group_kinds = $arr; + + return $this; + } + + /** + * Required. This is a [JSONPath] + * (https://kubernetes.io/docs/reference/kubectl/jsonpath/) + * expression that matches specific fields of candidate + * resources and it operates as both a filtering parameter (resources that + * are not matched with this expression will not be candidates for + * substitution) as well as a field identifier (identifies exactly which + * fields out of the candidate resources will be modified). + * + * Generated from protobuf field string target_json_path = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getTargetJsonPath() + { + return $this->target_json_path; + } + + /** + * Required. This is a [JSONPath] + * (https://kubernetes.io/docs/reference/kubectl/jsonpath/) + * expression that matches specific fields of candidate + * resources and it operates as both a filtering parameter (resources that + * are not matched with this expression will not be candidates for + * substitution) as well as a field identifier (identifies exactly which + * fields out of the candidate resources will be modified). + * + * Generated from protobuf field string target_json_path = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setTargetJsonPath($var) + { + GPBUtil::checkString($var, True); + $this->target_json_path = $var; + + return $this; + } + + /** + * (Filtering parameter) This is a [regular expression] + * (https://en.wikipedia.org/wiki/Regular_expression) + * that is compared against the fields matched by the target_json_path + * expression (and must also have passed the previous filters). + * Substitution will not be performed against fields whose + * value does not match this expression. If this field is NOT specified, + * then ALL fields matched by the target_json_path expression will undergo + * substitution. Note that an empty (e.g., "", rather than unspecified) + * value for for this field will only match empty fields. + * + * Generated from protobuf field string original_value_pattern = 4; + * @return string + */ + public function getOriginalValuePattern() + { + return $this->original_value_pattern; + } + + /** + * (Filtering parameter) This is a [regular expression] + * (https://en.wikipedia.org/wiki/Regular_expression) + * that is compared against the fields matched by the target_json_path + * expression (and must also have passed the previous filters). + * Substitution will not be performed against fields whose + * value does not match this expression. If this field is NOT specified, + * then ALL fields matched by the target_json_path expression will undergo + * substitution. Note that an empty (e.g., "", rather than unspecified) + * value for for this field will only match empty fields. + * + * Generated from protobuf field string original_value_pattern = 4; + * @param string $var + * @return $this + */ + public function setOriginalValuePattern($var) + { + GPBUtil::checkString($var, True); + $this->original_value_pattern = $var; + + return $this; + } + + /** + * This is the new value to set for any fields that pass the filtering and + * selection criteria. To remove a value from a Kubernetes resource, either + * leave this field unspecified, or set it to the empty string (""). + * + * Generated from protobuf field string new_value = 5; + * @return string + */ + public function getNewValue() + { + return $this->new_value; + } + + /** + * This is the new value to set for any fields that pass the filtering and + * selection criteria. To remove a value from a Kubernetes resource, either + * leave this field unspecified, or set it to the empty string (""). + * + * Generated from protobuf field string new_value = 5; + * @param string $var + * @return $this + */ + public function setNewValue($var) + { + GPBUtil::checkString($var, True); + $this->new_value = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(SubstitutionRule::class, \Google\Cloud\GkeBackup\V1\RestoreConfig_SubstitutionRule::class); + diff --git a/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/RestoreConfig/VolumeDataRestorePolicy.php b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/RestoreConfig/VolumeDataRestorePolicy.php new file mode 100644 index 000000000000..26cc27e5aae1 --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/RestoreConfig/VolumeDataRestorePolicy.php @@ -0,0 +1,77 @@ +google.cloud.gkebackup.v1.RestoreConfig.VolumeDataRestorePolicy + */ +class VolumeDataRestorePolicy +{ + /** + * Unspecified (illegal). + * + * Generated from protobuf enum VOLUME_DATA_RESTORE_POLICY_UNSPECIFIED = 0; + */ + const VOLUME_DATA_RESTORE_POLICY_UNSPECIFIED = 0; + /** + * For each PVC to be restored, will create a new underlying volume (and PV) + * from the corresponding VolumeBackup contained within the Backup. + * + * Generated from protobuf enum RESTORE_VOLUME_DATA_FROM_BACKUP = 1; + */ + const RESTORE_VOLUME_DATA_FROM_BACKUP = 1; + /** + * For each PVC to be restored, attempt to reuse the original PV contained + * in the Backup (with its original underlying volume). Note that option + * is likely only usable when restoring a workload to its original cluster. + * + * Generated from protobuf enum REUSE_VOLUME_HANDLE_FROM_BACKUP = 2; + */ + const REUSE_VOLUME_HANDLE_FROM_BACKUP = 2; + /** + * For each PVC to be restored, PVCs will be created without any particular + * action to restore data. In this case, the normal Kubernetes provisioning + * logic would kick in, and this would likely result in either dynamically + * provisioning blank PVs or binding to statically provisioned PVs. + * + * Generated from protobuf enum NO_VOLUME_DATA_RESTORATION = 3; + */ + const NO_VOLUME_DATA_RESTORATION = 3; + + private static $valueToName = [ + self::VOLUME_DATA_RESTORE_POLICY_UNSPECIFIED => 'VOLUME_DATA_RESTORE_POLICY_UNSPECIFIED', + self::RESTORE_VOLUME_DATA_FROM_BACKUP => 'RESTORE_VOLUME_DATA_FROM_BACKUP', + self::REUSE_VOLUME_HANDLE_FROM_BACKUP => 'REUSE_VOLUME_HANDLE_FROM_BACKUP', + self::NO_VOLUME_DATA_RESTORATION => 'NO_VOLUME_DATA_RESTORATION', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(VolumeDataRestorePolicy::class, \Google\Cloud\GkeBackup\V1\RestoreConfig_VolumeDataRestorePolicy::class); + diff --git a/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/RestoreConfig_ClusterResourceConflictPolicy.php b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/RestoreConfig_ClusterResourceConflictPolicy.php new file mode 100644 index 000000000000..0dfbb30724a9 --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/RestoreConfig_ClusterResourceConflictPolicy.php @@ -0,0 +1,16 @@ +google.cloud.gkebackup.v1.RestorePlan + */ +class RestorePlan extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The full name of the RestorePlan resource. + * Format: projects/*/locations/*/restorePlans/*. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $name = ''; + /** + * Output only. Server generated global unique identifier of + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier) format. + * + * Generated from protobuf field string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $uid = ''; + /** + * Output only. The timestamp when this RestorePlan resource was + * created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. The timestamp when this RestorePlan resource was last + * updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * User specified descriptive string for this RestorePlan. + * + * Generated from protobuf field string description = 5; + */ + protected $description = ''; + /** + * Required. Immutable. A reference to the [BackupPlan][google.cloud.gkebackup.v1.BackupPlan] from which Backups may be used as the + * source for Restores created via this RestorePlan. + * Format: projects/*/locations/*/backupPlans/*. + * + * Generated from protobuf field string backup_plan = 6 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $backup_plan = ''; + /** + * Required. Immutable. The target cluster into which Restores created via this RestorePlan + * will restore data. NOTE: the cluster's region must be the same as the + * RestorePlan. + * Valid formats: + * - projects/*/locations/*/clusters/* + * - projects/*/zones/*/clusters/* + * + * Generated from protobuf field string cluster = 7 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $cluster = ''; + /** + * Required. Configuration of Restores created via this RestorePlan. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.RestoreConfig restore_config = 8 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $restore_config = null; + /** + * A set of custom labels supplied by user. + * + * Generated from protobuf field map labels = 9; + */ + private $labels; + /** + * Output only. `etag` is used for optimistic concurrency control as a way to help + * prevent simultaneous updates of a restore from overwriting each other. + * It is strongly suggested that systems make use of the `etag` in the + * read-modify-write cycle to perform restore updates in order to avoid + * race conditions: An `etag` is returned in the response to `GetRestorePlan`, + * and systems are expected to put that etag in the request to + * `UpdateRestorePlan` or `DeleteRestorePlan` to ensure that their change + * will be applied to the same version of the resource. + * + * Generated from protobuf field string etag = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $etag = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Output only. The full name of the RestorePlan resource. + * Format: projects/*/locations/*/restorePlans/*. + * @type string $uid + * Output only. Server generated global unique identifier of + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier) format. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The timestamp when this RestorePlan resource was + * created. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. The timestamp when this RestorePlan resource was last + * updated. + * @type string $description + * User specified descriptive string for this RestorePlan. + * @type string $backup_plan + * Required. Immutable. A reference to the [BackupPlan][google.cloud.gkebackup.v1.BackupPlan] from which Backups may be used as the + * source for Restores created via this RestorePlan. + * Format: projects/*/locations/*/backupPlans/*. + * @type string $cluster + * Required. Immutable. The target cluster into which Restores created via this RestorePlan + * will restore data. NOTE: the cluster's region must be the same as the + * RestorePlan. + * Valid formats: + * - projects/*/locations/*/clusters/* + * - projects/*/zones/*/clusters/* + * @type \Google\Cloud\GkeBackup\V1\RestoreConfig $restore_config + * Required. Configuration of Restores created via this RestorePlan. + * @type array|\Google\Protobuf\Internal\MapField $labels + * A set of custom labels supplied by user. + * @type string $etag + * Output only. `etag` is used for optimistic concurrency control as a way to help + * prevent simultaneous updates of a restore from overwriting each other. + * It is strongly suggested that systems make use of the `etag` in the + * read-modify-write cycle to perform restore updates in order to avoid + * race conditions: An `etag` is returned in the response to `GetRestorePlan`, + * and systems are expected to put that etag in the request to + * `UpdateRestorePlan` or `DeleteRestorePlan` to ensure that their change + * will be applied to the same version of the resource. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkebackup\V1\RestorePlan::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The full name of the RestorePlan resource. + * Format: projects/*/locations/*/restorePlans/*. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Output only. The full name of the RestorePlan resource. + * Format: projects/*/locations/*/restorePlans/*. + * + * 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. Server generated global unique identifier of + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier) format. + * + * Generated from protobuf field string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getUid() + { + return $this->uid; + } + + /** + * Output only. Server generated global unique identifier of + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier) format. + * + * Generated from protobuf field string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setUid($var) + { + GPBUtil::checkString($var, True); + $this->uid = $var; + + return $this; + } + + /** + * Output only. The timestamp when this RestorePlan resource was + * created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 3 [(.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 timestamp when this RestorePlan resource was + * created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 3 [(.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 timestamp when this RestorePlan resource was last + * updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 4 [(.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 timestamp when this RestorePlan resource was last + * updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 4 [(.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; + } + + /** + * User specified descriptive string for this RestorePlan. + * + * Generated from protobuf field string description = 5; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * User specified descriptive string for this RestorePlan. + * + * Generated from protobuf field string description = 5; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * Required. Immutable. A reference to the [BackupPlan][google.cloud.gkebackup.v1.BackupPlan] from which Backups may be used as the + * source for Restores created via this RestorePlan. + * Format: projects/*/locations/*/backupPlans/*. + * + * Generated from protobuf field string backup_plan = 6 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getBackupPlan() + { + return $this->backup_plan; + } + + /** + * Required. Immutable. A reference to the [BackupPlan][google.cloud.gkebackup.v1.BackupPlan] from which Backups may be used as the + * source for Restores created via this RestorePlan. + * Format: projects/*/locations/*/backupPlans/*. + * + * Generated from protobuf field string backup_plan = 6 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setBackupPlan($var) + { + GPBUtil::checkString($var, True); + $this->backup_plan = $var; + + return $this; + } + + /** + * Required. Immutable. The target cluster into which Restores created via this RestorePlan + * will restore data. NOTE: the cluster's region must be the same as the + * RestorePlan. + * Valid formats: + * - projects/*/locations/*/clusters/* + * - projects/*/zones/*/clusters/* + * + * Generated from protobuf field string cluster = 7 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getCluster() + { + return $this->cluster; + } + + /** + * Required. Immutable. The target cluster into which Restores created via this RestorePlan + * will restore data. NOTE: the cluster's region must be the same as the + * RestorePlan. + * Valid formats: + * - projects/*/locations/*/clusters/* + * - projects/*/zones/*/clusters/* + * + * Generated from protobuf field string cluster = 7 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setCluster($var) + { + GPBUtil::checkString($var, True); + $this->cluster = $var; + + return $this; + } + + /** + * Required. Configuration of Restores created via this RestorePlan. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.RestoreConfig restore_config = 8 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\GkeBackup\V1\RestoreConfig|null + */ + public function getRestoreConfig() + { + return $this->restore_config; + } + + public function hasRestoreConfig() + { + return isset($this->restore_config); + } + + public function clearRestoreConfig() + { + unset($this->restore_config); + } + + /** + * Required. Configuration of Restores created via this RestorePlan. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.RestoreConfig restore_config = 8 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\GkeBackup\V1\RestoreConfig $var + * @return $this + */ + public function setRestoreConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeBackup\V1\RestoreConfig::class); + $this->restore_config = $var; + + return $this; + } + + /** + * A set of custom labels supplied by user. + * + * Generated from protobuf field map labels = 9; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * A set of custom labels supplied by user. + * + * Generated from protobuf field map labels = 9; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + + /** + * Output only. `etag` is used for optimistic concurrency control as a way to help + * prevent simultaneous updates of a restore from overwriting each other. + * It is strongly suggested that systems make use of the `etag` in the + * read-modify-write cycle to perform restore updates in order to avoid + * race conditions: An `etag` is returned in the response to `GetRestorePlan`, + * and systems are expected to put that etag in the request to + * `UpdateRestorePlan` or `DeleteRestorePlan` to ensure that their change + * will be applied to the same version of the resource. + * + * Generated from protobuf field string etag = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * Output only. `etag` is used for optimistic concurrency control as a way to help + * prevent simultaneous updates of a restore from overwriting each other. + * It is strongly suggested that systems make use of the `etag` in the + * read-modify-write cycle to perform restore updates in order to avoid + * race conditions: An `etag` is returned in the response to `GetRestorePlan`, + * and systems are expected to put that etag in the request to + * `UpdateRestorePlan` or `DeleteRestorePlan` to ensure that their change + * will be applied to the same version of the resource. + * + * Generated from protobuf field string etag = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, True); + $this->etag = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/Restore_State.php b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/Restore_State.php new file mode 100644 index 000000000000..4ee0fe727249 --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/Restore_State.php @@ -0,0 +1,16 @@ +google.cloud.gkebackup.v1.UpdateBackupPlanRequest + */ +class UpdateBackupPlanRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. A new version of the BackupPlan resource that contains updated fields. + * This may be sparsely populated if an `update_mask` is provided. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.BackupPlan backup_plan = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $backup_plan = null; + /** + * This is used to specify the fields to be overwritten in the + * BackupPlan targeted for update. The values for each of these + * updated fields will be taken from the `backup_plan` provided + * with this request. Field names are relative to the root of the resource + * (e.g., `description`, `backup_config.include_volume_data`, etc.) + * If no `update_mask` is provided, all fields in `backup_plan` will be + * written to the target BackupPlan resource. + * Note that OUTPUT_ONLY and IMMUTABLE fields in `backup_plan` are ignored + * and are not used to update the target BackupPlan. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + */ + protected $update_mask = null; + + /** + * @param \Google\Cloud\GkeBackup\V1\BackupPlan $backupPlan Required. A new version of the BackupPlan resource that contains updated fields. + * This may be sparsely populated if an `update_mask` is provided. + * @param \Google\Protobuf\FieldMask $updateMask This is used to specify the fields to be overwritten in the + * BackupPlan targeted for update. The values for each of these + * updated fields will be taken from the `backup_plan` provided + * with this request. Field names are relative to the root of the resource + * (e.g., `description`, `backup_config.include_volume_data`, etc.) + * If no `update_mask` is provided, all fields in `backup_plan` will be + * written to the target BackupPlan resource. + * Note that OUTPUT_ONLY and IMMUTABLE fields in `backup_plan` are ignored + * and are not used to update the target BackupPlan. + * + * @return \Google\Cloud\GkeBackup\V1\UpdateBackupPlanRequest + * + * @experimental + */ + public static function build(\Google\Cloud\GkeBackup\V1\BackupPlan $backupPlan, \Google\Protobuf\FieldMask $updateMask): self + { + return (new self()) + ->setBackupPlan($backupPlan) + ->setUpdateMask($updateMask); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\GkeBackup\V1\BackupPlan $backup_plan + * Required. A new version of the BackupPlan resource that contains updated fields. + * This may be sparsely populated if an `update_mask` is provided. + * @type \Google\Protobuf\FieldMask $update_mask + * This is used to specify the fields to be overwritten in the + * BackupPlan targeted for update. The values for each of these + * updated fields will be taken from the `backup_plan` provided + * with this request. Field names are relative to the root of the resource + * (e.g., `description`, `backup_config.include_volume_data`, etc.) + * If no `update_mask` is provided, all fields in `backup_plan` will be + * written to the target BackupPlan resource. + * Note that OUTPUT_ONLY and IMMUTABLE fields in `backup_plan` are ignored + * and are not used to update the target BackupPlan. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkebackup\V1\Gkebackup::initOnce(); + parent::__construct($data); + } + + /** + * Required. A new version of the BackupPlan resource that contains updated fields. + * This may be sparsely populated if an `update_mask` is provided. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.BackupPlan backup_plan = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\GkeBackup\V1\BackupPlan|null + */ + public function getBackupPlan() + { + return $this->backup_plan; + } + + public function hasBackupPlan() + { + return isset($this->backup_plan); + } + + public function clearBackupPlan() + { + unset($this->backup_plan); + } + + /** + * Required. A new version of the BackupPlan resource that contains updated fields. + * This may be sparsely populated if an `update_mask` is provided. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.BackupPlan backup_plan = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\GkeBackup\V1\BackupPlan $var + * @return $this + */ + public function setBackupPlan($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeBackup\V1\BackupPlan::class); + $this->backup_plan = $var; + + return $this; + } + + /** + * This is used to specify the fields to be overwritten in the + * BackupPlan targeted for update. The values for each of these + * updated fields will be taken from the `backup_plan` provided + * with this request. Field names are relative to the root of the resource + * (e.g., `description`, `backup_config.include_volume_data`, etc.) + * If no `update_mask` is provided, all fields in `backup_plan` will be + * written to the target BackupPlan resource. + * Note that OUTPUT_ONLY and IMMUTABLE fields in `backup_plan` are ignored + * and are not used to update the target BackupPlan. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * This is used to specify the fields to be overwritten in the + * BackupPlan targeted for update. The values for each of these + * updated fields will be taken from the `backup_plan` provided + * with this request. Field names are relative to the root of the resource + * (e.g., `description`, `backup_config.include_volume_data`, etc.) + * If no `update_mask` is provided, all fields in `backup_plan` will be + * written to the target BackupPlan resource. + * Note that OUTPUT_ONLY and IMMUTABLE fields in `backup_plan` are ignored + * and are not used to update the target BackupPlan. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/UpdateBackupRequest.php b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/UpdateBackupRequest.php new file mode 100644 index 000000000000..5e449276fc9b --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/UpdateBackupRequest.php @@ -0,0 +1,176 @@ +google.cloud.gkebackup.v1.UpdateBackupRequest + */ +class UpdateBackupRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. A new version of the Backup resource that contains updated fields. + * This may be sparsely populated if an `update_mask` is provided. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.Backup backup = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $backup = null; + /** + * This is used to specify the fields to be overwritten in the + * Backup targeted for update. The values for each of these + * updated fields will be taken from the `backup_plan` provided + * with this request. Field names are relative to the root of the resource. + * If no `update_mask` is provided, all fields in `backup` will be + * written to the target Backup resource. + * Note that OUTPUT_ONLY and IMMUTABLE fields in `backup` are ignored + * and are not used to update the target Backup. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + */ + protected $update_mask = null; + + /** + * @param \Google\Cloud\GkeBackup\V1\Backup $backup Required. A new version of the Backup resource that contains updated fields. + * This may be sparsely populated if an `update_mask` is provided. + * @param \Google\Protobuf\FieldMask $updateMask This is used to specify the fields to be overwritten in the + * Backup targeted for update. The values for each of these + * updated fields will be taken from the `backup_plan` provided + * with this request. Field names are relative to the root of the resource. + * If no `update_mask` is provided, all fields in `backup` will be + * written to the target Backup resource. + * Note that OUTPUT_ONLY and IMMUTABLE fields in `backup` are ignored + * and are not used to update the target Backup. + * + * @return \Google\Cloud\GkeBackup\V1\UpdateBackupRequest + * + * @experimental + */ + public static function build(\Google\Cloud\GkeBackup\V1\Backup $backup, \Google\Protobuf\FieldMask $updateMask): self + { + return (new self()) + ->setBackup($backup) + ->setUpdateMask($updateMask); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\GkeBackup\V1\Backup $backup + * Required. A new version of the Backup resource that contains updated fields. + * This may be sparsely populated if an `update_mask` is provided. + * @type \Google\Protobuf\FieldMask $update_mask + * This is used to specify the fields to be overwritten in the + * Backup targeted for update. The values for each of these + * updated fields will be taken from the `backup_plan` provided + * with this request. Field names are relative to the root of the resource. + * If no `update_mask` is provided, all fields in `backup` will be + * written to the target Backup resource. + * Note that OUTPUT_ONLY and IMMUTABLE fields in `backup` are ignored + * and are not used to update the target Backup. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkebackup\V1\Gkebackup::initOnce(); + parent::__construct($data); + } + + /** + * Required. A new version of the Backup resource that contains updated fields. + * This may be sparsely populated if an `update_mask` is provided. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.Backup backup = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\GkeBackup\V1\Backup|null + */ + public function getBackup() + { + return $this->backup; + } + + public function hasBackup() + { + return isset($this->backup); + } + + public function clearBackup() + { + unset($this->backup); + } + + /** + * Required. A new version of the Backup resource that contains updated fields. + * This may be sparsely populated if an `update_mask` is provided. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.Backup backup = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\GkeBackup\V1\Backup $var + * @return $this + */ + public function setBackup($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeBackup\V1\Backup::class); + $this->backup = $var; + + return $this; + } + + /** + * This is used to specify the fields to be overwritten in the + * Backup targeted for update. The values for each of these + * updated fields will be taken from the `backup_plan` provided + * with this request. Field names are relative to the root of the resource. + * If no `update_mask` is provided, all fields in `backup` will be + * written to the target Backup resource. + * Note that OUTPUT_ONLY and IMMUTABLE fields in `backup` are ignored + * and are not used to update the target Backup. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * This is used to specify the fields to be overwritten in the + * Backup targeted for update. The values for each of these + * updated fields will be taken from the `backup_plan` provided + * with this request. Field names are relative to the root of the resource. + * If no `update_mask` is provided, all fields in `backup` will be + * written to the target Backup resource. + * Note that OUTPUT_ONLY and IMMUTABLE fields in `backup` are ignored + * and are not used to update the target Backup. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/UpdateRestorePlanRequest.php b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/UpdateRestorePlanRequest.php new file mode 100644 index 000000000000..8c91286ab0c4 --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/UpdateRestorePlanRequest.php @@ -0,0 +1,176 @@ +google.cloud.gkebackup.v1.UpdateRestorePlanRequest + */ +class UpdateRestorePlanRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. A new version of the RestorePlan resource that contains updated fields. + * This may be sparsely populated if an `update_mask` is provided. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.RestorePlan restore_plan = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $restore_plan = null; + /** + * This is used to specify the fields to be overwritten in the + * RestorePlan targeted for update. The values for each of these + * updated fields will be taken from the `restore_plan` provided + * with this request. Field names are relative to the root of the resource. + * If no `update_mask` is provided, all fields in `restore_plan` will be + * written to the target RestorePlan resource. + * Note that OUTPUT_ONLY and IMMUTABLE fields in `restore_plan` are ignored + * and are not used to update the target RestorePlan. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + */ + protected $update_mask = null; + + /** + * @param \Google\Cloud\GkeBackup\V1\RestorePlan $restorePlan Required. A new version of the RestorePlan resource that contains updated fields. + * This may be sparsely populated if an `update_mask` is provided. + * @param \Google\Protobuf\FieldMask $updateMask This is used to specify the fields to be overwritten in the + * RestorePlan targeted for update. The values for each of these + * updated fields will be taken from the `restore_plan` provided + * with this request. Field names are relative to the root of the resource. + * If no `update_mask` is provided, all fields in `restore_plan` will be + * written to the target RestorePlan resource. + * Note that OUTPUT_ONLY and IMMUTABLE fields in `restore_plan` are ignored + * and are not used to update the target RestorePlan. + * + * @return \Google\Cloud\GkeBackup\V1\UpdateRestorePlanRequest + * + * @experimental + */ + public static function build(\Google\Cloud\GkeBackup\V1\RestorePlan $restorePlan, \Google\Protobuf\FieldMask $updateMask): self + { + return (new self()) + ->setRestorePlan($restorePlan) + ->setUpdateMask($updateMask); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\GkeBackup\V1\RestorePlan $restore_plan + * Required. A new version of the RestorePlan resource that contains updated fields. + * This may be sparsely populated if an `update_mask` is provided. + * @type \Google\Protobuf\FieldMask $update_mask + * This is used to specify the fields to be overwritten in the + * RestorePlan targeted for update. The values for each of these + * updated fields will be taken from the `restore_plan` provided + * with this request. Field names are relative to the root of the resource. + * If no `update_mask` is provided, all fields in `restore_plan` will be + * written to the target RestorePlan resource. + * Note that OUTPUT_ONLY and IMMUTABLE fields in `restore_plan` are ignored + * and are not used to update the target RestorePlan. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkebackup\V1\Gkebackup::initOnce(); + parent::__construct($data); + } + + /** + * Required. A new version of the RestorePlan resource that contains updated fields. + * This may be sparsely populated if an `update_mask` is provided. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.RestorePlan restore_plan = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\GkeBackup\V1\RestorePlan|null + */ + public function getRestorePlan() + { + return $this->restore_plan; + } + + public function hasRestorePlan() + { + return isset($this->restore_plan); + } + + public function clearRestorePlan() + { + unset($this->restore_plan); + } + + /** + * Required. A new version of the RestorePlan resource that contains updated fields. + * This may be sparsely populated if an `update_mask` is provided. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.RestorePlan restore_plan = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\GkeBackup\V1\RestorePlan $var + * @return $this + */ + public function setRestorePlan($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeBackup\V1\RestorePlan::class); + $this->restore_plan = $var; + + return $this; + } + + /** + * This is used to specify the fields to be overwritten in the + * RestorePlan targeted for update. The values for each of these + * updated fields will be taken from the `restore_plan` provided + * with this request. Field names are relative to the root of the resource. + * If no `update_mask` is provided, all fields in `restore_plan` will be + * written to the target RestorePlan resource. + * Note that OUTPUT_ONLY and IMMUTABLE fields in `restore_plan` are ignored + * and are not used to update the target RestorePlan. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * This is used to specify the fields to be overwritten in the + * RestorePlan targeted for update. The values for each of these + * updated fields will be taken from the `restore_plan` provided + * with this request. Field names are relative to the root of the resource. + * If no `update_mask` is provided, all fields in `restore_plan` will be + * written to the target RestorePlan resource. + * Note that OUTPUT_ONLY and IMMUTABLE fields in `restore_plan` are ignored + * and are not used to update the target RestorePlan. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/UpdateRestoreRequest.php b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/UpdateRestoreRequest.php new file mode 100644 index 000000000000..8f2a9e41467f --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/UpdateRestoreRequest.php @@ -0,0 +1,176 @@ +google.cloud.gkebackup.v1.UpdateRestoreRequest + */ +class UpdateRestoreRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. A new version of the Restore resource that contains updated fields. + * This may be sparsely populated if an `update_mask` is provided. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.Restore restore = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $restore = null; + /** + * This is used to specify the fields to be overwritten in the + * Restore targeted for update. The values for each of these + * updated fields will be taken from the `restore` provided + * with this request. Field names are relative to the root of the resource. + * If no `update_mask` is provided, all fields in `restore` will be + * written to the target Restore resource. + * Note that OUTPUT_ONLY and IMMUTABLE fields in `restore` are ignored + * and are not used to update the target Restore. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + */ + protected $update_mask = null; + + /** + * @param \Google\Cloud\GkeBackup\V1\Restore $restore Required. A new version of the Restore resource that contains updated fields. + * This may be sparsely populated if an `update_mask` is provided. + * @param \Google\Protobuf\FieldMask $updateMask This is used to specify the fields to be overwritten in the + * Restore targeted for update. The values for each of these + * updated fields will be taken from the `restore` provided + * with this request. Field names are relative to the root of the resource. + * If no `update_mask` is provided, all fields in `restore` will be + * written to the target Restore resource. + * Note that OUTPUT_ONLY and IMMUTABLE fields in `restore` are ignored + * and are not used to update the target Restore. + * + * @return \Google\Cloud\GkeBackup\V1\UpdateRestoreRequest + * + * @experimental + */ + public static function build(\Google\Cloud\GkeBackup\V1\Restore $restore, \Google\Protobuf\FieldMask $updateMask): self + { + return (new self()) + ->setRestore($restore) + ->setUpdateMask($updateMask); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\GkeBackup\V1\Restore $restore + * Required. A new version of the Restore resource that contains updated fields. + * This may be sparsely populated if an `update_mask` is provided. + * @type \Google\Protobuf\FieldMask $update_mask + * This is used to specify the fields to be overwritten in the + * Restore targeted for update. The values for each of these + * updated fields will be taken from the `restore` provided + * with this request. Field names are relative to the root of the resource. + * If no `update_mask` is provided, all fields in `restore` will be + * written to the target Restore resource. + * Note that OUTPUT_ONLY and IMMUTABLE fields in `restore` are ignored + * and are not used to update the target Restore. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkebackup\V1\Gkebackup::initOnce(); + parent::__construct($data); + } + + /** + * Required. A new version of the Restore resource that contains updated fields. + * This may be sparsely populated if an `update_mask` is provided. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.Restore restore = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\GkeBackup\V1\Restore|null + */ + public function getRestore() + { + return $this->restore; + } + + public function hasRestore() + { + return isset($this->restore); + } + + public function clearRestore() + { + unset($this->restore); + } + + /** + * Required. A new version of the Restore resource that contains updated fields. + * This may be sparsely populated if an `update_mask` is provided. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.Restore restore = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\GkeBackup\V1\Restore $var + * @return $this + */ + public function setRestore($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeBackup\V1\Restore::class); + $this->restore = $var; + + return $this; + } + + /** + * This is used to specify the fields to be overwritten in the + * Restore targeted for update. The values for each of these + * updated fields will be taken from the `restore` provided + * with this request. Field names are relative to the root of the resource. + * If no `update_mask` is provided, all fields in `restore` will be + * written to the target Restore resource. + * Note that OUTPUT_ONLY and IMMUTABLE fields in `restore` are ignored + * and are not used to update the target Restore. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * This is used to specify the fields to be overwritten in the + * Restore targeted for update. The values for each of these + * updated fields will be taken from the `restore` provided + * with this request. Field names are relative to the root of the resource. + * If no `update_mask` is provided, all fields in `restore` will be + * written to the target Restore resource. + * Note that OUTPUT_ONLY and IMMUTABLE fields in `restore` are ignored + * and are not used to update the target Restore. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/VolumeBackup.php b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/VolumeBackup.php new file mode 100644 index 000000000000..63a4cb4fab60 --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/VolumeBackup.php @@ -0,0 +1,578 @@ +google.cloud.gkebackup.v1.VolumeBackup + */ +class VolumeBackup extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The full name of the VolumeBackup resource. + * Format: projects/*/locations/*/backupPlans/*/backups/*/volumeBackups/*. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $name = ''; + /** + * Output only. Server generated global unique identifier of + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier) format. + * + * Generated from protobuf field string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $uid = ''; + /** + * Output only. The timestamp when this VolumeBackup resource was + * created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. The timestamp when this VolumeBackup resource was last + * updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * Output only. A reference to the source Kubernetes PVC from which this VolumeBackup + * was created. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.NamespacedName source_pvc = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $source_pvc = null; + /** + * Output only. A storage system-specific opaque handle to the underlying volume backup. + * + * Generated from protobuf field string volume_backup_handle = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $volume_backup_handle = ''; + /** + * Output only. The format used for the volume backup. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.VolumeBackup.VolumeBackupFormat format = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $format = 0; + /** + * Output only. The aggregate size of the underlying artifacts associated with this + * VolumeBackup in the backup storage. This may change over time when + * multiple backups of the same volume share the same backup storage + * location. In particular, this is likely to increase in size when + * the immediately preceding backup of the same volume is deleted. + * + * Generated from protobuf field int64 storage_bytes = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $storage_bytes = 0; + /** + * Output only. The minimum size of the disk to which this VolumeBackup can be restored. + * + * Generated from protobuf field int64 disk_size_bytes = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $disk_size_bytes = 0; + /** + * Output only. The timestamp when the associated underlying volume backup + * operation completed. + * + * Generated from protobuf field .google.protobuf.Timestamp complete_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $complete_time = null; + /** + * Output only. The current state of this VolumeBackup. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.VolumeBackup.State state = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Output only. A human readable message explaining why the VolumeBackup is in its current + * state. + * + * Generated from protobuf field string state_message = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state_message = ''; + /** + * Output only. `etag` is used for optimistic concurrency control as a way to help + * prevent simultaneous updates of a volume backup from overwriting each + * other. It is strongly suggested that systems make use of the `etag` in the + * read-modify-write cycle to perform volume backup updates in order to avoid + * race conditions. + * + * Generated from protobuf field string etag = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $etag = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Output only. The full name of the VolumeBackup resource. + * Format: projects/*/locations/*/backupPlans/*/backups/*/volumeBackups/*. + * @type string $uid + * Output only. Server generated global unique identifier of + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier) format. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The timestamp when this VolumeBackup resource was + * created. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. The timestamp when this VolumeBackup resource was last + * updated. + * @type \Google\Cloud\GkeBackup\V1\NamespacedName $source_pvc + * Output only. A reference to the source Kubernetes PVC from which this VolumeBackup + * was created. + * @type string $volume_backup_handle + * Output only. A storage system-specific opaque handle to the underlying volume backup. + * @type int $format + * Output only. The format used for the volume backup. + * @type int|string $storage_bytes + * Output only. The aggregate size of the underlying artifacts associated with this + * VolumeBackup in the backup storage. This may change over time when + * multiple backups of the same volume share the same backup storage + * location. In particular, this is likely to increase in size when + * the immediately preceding backup of the same volume is deleted. + * @type int|string $disk_size_bytes + * Output only. The minimum size of the disk to which this VolumeBackup can be restored. + * @type \Google\Protobuf\Timestamp $complete_time + * Output only. The timestamp when the associated underlying volume backup + * operation completed. + * @type int $state + * Output only. The current state of this VolumeBackup. + * @type string $state_message + * Output only. A human readable message explaining why the VolumeBackup is in its current + * state. + * @type string $etag + * Output only. `etag` is used for optimistic concurrency control as a way to help + * prevent simultaneous updates of a volume backup from overwriting each + * other. It is strongly suggested that systems make use of the `etag` in the + * read-modify-write cycle to perform volume backup updates in order to avoid + * race conditions. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkebackup\V1\Volume::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The full name of the VolumeBackup resource. + * Format: projects/*/locations/*/backupPlans/*/backups/*/volumeBackups/*. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Output only. The full name of the VolumeBackup resource. + * Format: projects/*/locations/*/backupPlans/*/backups/*/volumeBackups/*. + * + * 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. Server generated global unique identifier of + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier) format. + * + * Generated from protobuf field string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getUid() + { + return $this->uid; + } + + /** + * Output only. Server generated global unique identifier of + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier) format. + * + * Generated from protobuf field string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setUid($var) + { + GPBUtil::checkString($var, True); + $this->uid = $var; + + return $this; + } + + /** + * Output only. The timestamp when this VolumeBackup resource was + * created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 3 [(.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 timestamp when this VolumeBackup resource was + * created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 3 [(.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 timestamp when this VolumeBackup resource was last + * updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 4 [(.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 timestamp when this VolumeBackup resource was last + * updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 4 [(.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. A reference to the source Kubernetes PVC from which this VolumeBackup + * was created. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.NamespacedName source_pvc = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\GkeBackup\V1\NamespacedName|null + */ + public function getSourcePvc() + { + return $this->source_pvc; + } + + public function hasSourcePvc() + { + return isset($this->source_pvc); + } + + public function clearSourcePvc() + { + unset($this->source_pvc); + } + + /** + * Output only. A reference to the source Kubernetes PVC from which this VolumeBackup + * was created. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.NamespacedName source_pvc = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\GkeBackup\V1\NamespacedName $var + * @return $this + */ + public function setSourcePvc($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeBackup\V1\NamespacedName::class); + $this->source_pvc = $var; + + return $this; + } + + /** + * Output only. A storage system-specific opaque handle to the underlying volume backup. + * + * Generated from protobuf field string volume_backup_handle = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getVolumeBackupHandle() + { + return $this->volume_backup_handle; + } + + /** + * Output only. A storage system-specific opaque handle to the underlying volume backup. + * + * Generated from protobuf field string volume_backup_handle = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setVolumeBackupHandle($var) + { + GPBUtil::checkString($var, True); + $this->volume_backup_handle = $var; + + return $this; + } + + /** + * Output only. The format used for the volume backup. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.VolumeBackup.VolumeBackupFormat format = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getFormat() + { + return $this->format; + } + + /** + * Output only. The format used for the volume backup. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.VolumeBackup.VolumeBackupFormat format = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setFormat($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\GkeBackup\V1\VolumeBackup\VolumeBackupFormat::class); + $this->format = $var; + + return $this; + } + + /** + * Output only. The aggregate size of the underlying artifacts associated with this + * VolumeBackup in the backup storage. This may change over time when + * multiple backups of the same volume share the same backup storage + * location. In particular, this is likely to increase in size when + * the immediately preceding backup of the same volume is deleted. + * + * Generated from protobuf field int64 storage_bytes = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int|string + */ + public function getStorageBytes() + { + return $this->storage_bytes; + } + + /** + * Output only. The aggregate size of the underlying artifacts associated with this + * VolumeBackup in the backup storage. This may change over time when + * multiple backups of the same volume share the same backup storage + * location. In particular, this is likely to increase in size when + * the immediately preceding backup of the same volume is deleted. + * + * Generated from protobuf field int64 storage_bytes = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int|string $var + * @return $this + */ + public function setStorageBytes($var) + { + GPBUtil::checkInt64($var); + $this->storage_bytes = $var; + + return $this; + } + + /** + * Output only. The minimum size of the disk to which this VolumeBackup can be restored. + * + * Generated from protobuf field int64 disk_size_bytes = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int|string + */ + public function getDiskSizeBytes() + { + return $this->disk_size_bytes; + } + + /** + * Output only. The minimum size of the disk to which this VolumeBackup can be restored. + * + * Generated from protobuf field int64 disk_size_bytes = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int|string $var + * @return $this + */ + public function setDiskSizeBytes($var) + { + GPBUtil::checkInt64($var); + $this->disk_size_bytes = $var; + + return $this; + } + + /** + * Output only. The timestamp when the associated underlying volume backup + * operation completed. + * + * Generated from protobuf field .google.protobuf.Timestamp complete_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCompleteTime() + { + return $this->complete_time; + } + + public function hasCompleteTime() + { + return isset($this->complete_time); + } + + public function clearCompleteTime() + { + unset($this->complete_time); + } + + /** + * Output only. The timestamp when the associated underlying volume backup + * operation completed. + * + * Generated from protobuf field .google.protobuf.Timestamp complete_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCompleteTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->complete_time = $var; + + return $this; + } + + /** + * Output only. The current state of this VolumeBackup. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.VolumeBackup.State state = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. The current state of this VolumeBackup. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.VolumeBackup.State state = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\GkeBackup\V1\VolumeBackup\State::class); + $this->state = $var; + + return $this; + } + + /** + * Output only. A human readable message explaining why the VolumeBackup is in its current + * state. + * + * Generated from protobuf field string state_message = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getStateMessage() + { + return $this->state_message; + } + + /** + * Output only. A human readable message explaining why the VolumeBackup is in its current + * state. + * + * Generated from protobuf field string state_message = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setStateMessage($var) + { + GPBUtil::checkString($var, True); + $this->state_message = $var; + + return $this; + } + + /** + * Output only. `etag` is used for optimistic concurrency control as a way to help + * prevent simultaneous updates of a volume backup from overwriting each + * other. It is strongly suggested that systems make use of the `etag` in the + * read-modify-write cycle to perform volume backup updates in order to avoid + * race conditions. + * + * Generated from protobuf field string etag = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * Output only. `etag` is used for optimistic concurrency control as a way to help + * prevent simultaneous updates of a volume backup from overwriting each + * other. It is strongly suggested that systems make use of the `etag` in the + * read-modify-write cycle to perform volume backup updates in order to avoid + * race conditions. + * + * Generated from protobuf field string etag = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, True); + $this->etag = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/VolumeBackup/State.php b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/VolumeBackup/State.php new file mode 100644 index 000000000000..fbe20d6856c2 --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/VolumeBackup/State.php @@ -0,0 +1,98 @@ +google.cloud.gkebackup.v1.VolumeBackup.State + */ +class State +{ + /** + * This is an illegal state and should not be encountered. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * A volume for the backup was identified and backup process is about to + * start. + * + * Generated from protobuf enum CREATING = 1; + */ + const CREATING = 1; + /** + * The volume backup operation has begun and is in the initial "snapshot" + * phase of the process. Any defined ProtectedApplication "pre" hooks will + * be executed before entering this state and "post" hooks will be executed + * upon leaving this state. + * + * Generated from protobuf enum SNAPSHOTTING = 2; + */ + const SNAPSHOTTING = 2; + /** + * The snapshot phase of the volume backup operation has completed and + * the snapshot is now being uploaded to backup storage. + * + * Generated from protobuf enum UPLOADING = 3; + */ + const UPLOADING = 3; + /** + * The volume backup operation has completed successfully. + * + * Generated from protobuf enum SUCCEEDED = 4; + */ + const SUCCEEDED = 4; + /** + * The volume backup operation has failed. + * + * Generated from protobuf enum FAILED = 5; + */ + const FAILED = 5; + /** + * This VolumeBackup resource (and its associated artifacts) is in the + * process of being deleted. + * + * Generated from protobuf enum DELETING = 6; + */ + const DELETING = 6; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::CREATING => 'CREATING', + self::SNAPSHOTTING => 'SNAPSHOTTING', + self::UPLOADING => 'UPLOADING', + self::SUCCEEDED => 'SUCCEEDED', + self::FAILED => 'FAILED', + self::DELETING => 'DELETING', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\GkeBackup\V1\VolumeBackup_State::class); + diff --git a/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/VolumeBackup/VolumeBackupFormat.php b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/VolumeBackup/VolumeBackupFormat.php new file mode 100644 index 000000000000..de6484fc4519 --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/VolumeBackup/VolumeBackupFormat.php @@ -0,0 +1,57 @@ +google.cloud.gkebackup.v1.VolumeBackup.VolumeBackupFormat + */ +class VolumeBackupFormat +{ + /** + * Default value, not specified. + * + * Generated from protobuf enum VOLUME_BACKUP_FORMAT_UNSPECIFIED = 0; + */ + const VOLUME_BACKUP_FORMAT_UNSPECIFIED = 0; + /** + * Compute Engine Persistent Disk snapshot based volume backup. + * + * Generated from protobuf enum GCE_PERSISTENT_DISK = 1; + */ + const GCE_PERSISTENT_DISK = 1; + + private static $valueToName = [ + self::VOLUME_BACKUP_FORMAT_UNSPECIFIED => 'VOLUME_BACKUP_FORMAT_UNSPECIFIED', + self::GCE_PERSISTENT_DISK => 'GCE_PERSISTENT_DISK', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(VolumeBackupFormat::class, \Google\Cloud\GkeBackup\V1\VolumeBackup_VolumeBackupFormat::class); + diff --git a/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/VolumeBackup_State.php b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/VolumeBackup_State.php new file mode 100644 index 000000000000..6f93d4cd336d --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/VolumeBackup_State.php @@ -0,0 +1,16 @@ +google.cloud.gkebackup.v1.VolumeRestore + */ +class VolumeRestore extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. Full name of the VolumeRestore resource. + * Format: projects/*/locations/*/restorePlans/*/restores/*/volumeRestores/*. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $name = ''; + /** + * Output only. Server generated global unique identifier of + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier) format. + * + * Generated from protobuf field string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $uid = ''; + /** + * Output only. The timestamp when this VolumeRestore resource was + * created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. The timestamp when this VolumeRestore resource was last + * updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * Output only. The full name of the VolumeBackup from which the volume will be restored. + * Format: projects/*/locations/*/backupPlans/*/backups/*/volumeBackups/*. + * + * Generated from protobuf field string volume_backup = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $volume_backup = ''; + /** + * Output only. The reference to the target Kubernetes PVC to be restored. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.NamespacedName target_pvc = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $target_pvc = null; + /** + * Output only. A storage system-specific opaque handler to the underlying volume created + * for the target PVC from the volume backup. + * + * Generated from protobuf field string volume_handle = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $volume_handle = ''; + /** + * Output only. The type of volume provisioned + * + * Generated from protobuf field .google.cloud.gkebackup.v1.VolumeRestore.VolumeType volume_type = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $volume_type = 0; + /** + * Output only. The timestamp when the associated underlying volume + * restoration completed. + * + * Generated from protobuf field .google.protobuf.Timestamp complete_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $complete_time = null; + /** + * Output only. The current state of this VolumeRestore. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.VolumeRestore.State state = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Output only. A human readable message explaining why the VolumeRestore is in its + * current state. + * + * Generated from protobuf field string state_message = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state_message = ''; + /** + * Output only. `etag` is used for optimistic concurrency control as a way to help + * prevent simultaneous updates of a volume restore from overwriting each + * other. It is strongly suggested that systems make use of the `etag` in the + * read-modify-write cycle to perform volume restore updates in order to avoid + * race conditions. + * + * Generated from protobuf field string etag = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $etag = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Output only. Full name of the VolumeRestore resource. + * Format: projects/*/locations/*/restorePlans/*/restores/*/volumeRestores/*. + * @type string $uid + * Output only. Server generated global unique identifier of + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier) format. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The timestamp when this VolumeRestore resource was + * created. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. The timestamp when this VolumeRestore resource was last + * updated. + * @type string $volume_backup + * Output only. The full name of the VolumeBackup from which the volume will be restored. + * Format: projects/*/locations/*/backupPlans/*/backups/*/volumeBackups/*. + * @type \Google\Cloud\GkeBackup\V1\NamespacedName $target_pvc + * Output only. The reference to the target Kubernetes PVC to be restored. + * @type string $volume_handle + * Output only. A storage system-specific opaque handler to the underlying volume created + * for the target PVC from the volume backup. + * @type int $volume_type + * Output only. The type of volume provisioned + * @type \Google\Protobuf\Timestamp $complete_time + * Output only. The timestamp when the associated underlying volume + * restoration completed. + * @type int $state + * Output only. The current state of this VolumeRestore. + * @type string $state_message + * Output only. A human readable message explaining why the VolumeRestore is in its + * current state. + * @type string $etag + * Output only. `etag` is used for optimistic concurrency control as a way to help + * prevent simultaneous updates of a volume restore from overwriting each + * other. It is strongly suggested that systems make use of the `etag` in the + * read-modify-write cycle to perform volume restore updates in order to avoid + * race conditions. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkebackup\V1\Volume::initOnce(); + parent::__construct($data); + } + + /** + * Output only. Full name of the VolumeRestore resource. + * Format: projects/*/locations/*/restorePlans/*/restores/*/volumeRestores/*. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Output only. Full name of the VolumeRestore resource. + * Format: projects/*/locations/*/restorePlans/*/restores/*/volumeRestores/*. + * + * 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. Server generated global unique identifier of + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier) format. + * + * Generated from protobuf field string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getUid() + { + return $this->uid; + } + + /** + * Output only. Server generated global unique identifier of + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier) format. + * + * Generated from protobuf field string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setUid($var) + { + GPBUtil::checkString($var, True); + $this->uid = $var; + + return $this; + } + + /** + * Output only. The timestamp when this VolumeRestore resource was + * created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 3 [(.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 timestamp when this VolumeRestore resource was + * created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 3 [(.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 timestamp when this VolumeRestore resource was last + * updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 4 [(.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 timestamp when this VolumeRestore resource was last + * updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 4 [(.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 full name of the VolumeBackup from which the volume will be restored. + * Format: projects/*/locations/*/backupPlans/*/backups/*/volumeBackups/*. + * + * Generated from protobuf field string volume_backup = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getVolumeBackup() + { + return $this->volume_backup; + } + + /** + * Output only. The full name of the VolumeBackup from which the volume will be restored. + * Format: projects/*/locations/*/backupPlans/*/backups/*/volumeBackups/*. + * + * Generated from protobuf field string volume_backup = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setVolumeBackup($var) + { + GPBUtil::checkString($var, True); + $this->volume_backup = $var; + + return $this; + } + + /** + * Output only. The reference to the target Kubernetes PVC to be restored. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.NamespacedName target_pvc = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\GkeBackup\V1\NamespacedName|null + */ + public function getTargetPvc() + { + return $this->target_pvc; + } + + public function hasTargetPvc() + { + return isset($this->target_pvc); + } + + public function clearTargetPvc() + { + unset($this->target_pvc); + } + + /** + * Output only. The reference to the target Kubernetes PVC to be restored. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.NamespacedName target_pvc = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\GkeBackup\V1\NamespacedName $var + * @return $this + */ + public function setTargetPvc($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeBackup\V1\NamespacedName::class); + $this->target_pvc = $var; + + return $this; + } + + /** + * Output only. A storage system-specific opaque handler to the underlying volume created + * for the target PVC from the volume backup. + * + * Generated from protobuf field string volume_handle = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getVolumeHandle() + { + return $this->volume_handle; + } + + /** + * Output only. A storage system-specific opaque handler to the underlying volume created + * for the target PVC from the volume backup. + * + * Generated from protobuf field string volume_handle = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setVolumeHandle($var) + { + GPBUtil::checkString($var, True); + $this->volume_handle = $var; + + return $this; + } + + /** + * Output only. The type of volume provisioned + * + * Generated from protobuf field .google.cloud.gkebackup.v1.VolumeRestore.VolumeType volume_type = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getVolumeType() + { + return $this->volume_type; + } + + /** + * Output only. The type of volume provisioned + * + * Generated from protobuf field .google.cloud.gkebackup.v1.VolumeRestore.VolumeType volume_type = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setVolumeType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\GkeBackup\V1\VolumeRestore\VolumeType::class); + $this->volume_type = $var; + + return $this; + } + + /** + * Output only. The timestamp when the associated underlying volume + * restoration completed. + * + * Generated from protobuf field .google.protobuf.Timestamp complete_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCompleteTime() + { + return $this->complete_time; + } + + public function hasCompleteTime() + { + return isset($this->complete_time); + } + + public function clearCompleteTime() + { + unset($this->complete_time); + } + + /** + * Output only. The timestamp when the associated underlying volume + * restoration completed. + * + * Generated from protobuf field .google.protobuf.Timestamp complete_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCompleteTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->complete_time = $var; + + return $this; + } + + /** + * Output only. The current state of this VolumeRestore. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.VolumeRestore.State state = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. The current state of this VolumeRestore. + * + * Generated from protobuf field .google.cloud.gkebackup.v1.VolumeRestore.State state = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\GkeBackup\V1\VolumeRestore\State::class); + $this->state = $var; + + return $this; + } + + /** + * Output only. A human readable message explaining why the VolumeRestore is in its + * current state. + * + * Generated from protobuf field string state_message = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getStateMessage() + { + return $this->state_message; + } + + /** + * Output only. A human readable message explaining why the VolumeRestore is in its + * current state. + * + * Generated from protobuf field string state_message = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setStateMessage($var) + { + GPBUtil::checkString($var, True); + $this->state_message = $var; + + return $this; + } + + /** + * Output only. `etag` is used for optimistic concurrency control as a way to help + * prevent simultaneous updates of a volume restore from overwriting each + * other. It is strongly suggested that systems make use of the `etag` in the + * read-modify-write cycle to perform volume restore updates in order to avoid + * race conditions. + * + * Generated from protobuf field string etag = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * Output only. `etag` is used for optimistic concurrency control as a way to help + * prevent simultaneous updates of a volume restore from overwriting each + * other. It is strongly suggested that systems make use of the `etag` in the + * read-modify-write cycle to perform volume restore updates in order to avoid + * race conditions. + * + * Generated from protobuf field string etag = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, True); + $this->etag = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/VolumeRestore/State.php b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/VolumeRestore/State.php new file mode 100644 index 000000000000..2528f29c845a --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/VolumeRestore/State.php @@ -0,0 +1,86 @@ +google.cloud.gkebackup.v1.VolumeRestore.State + */ +class State +{ + /** + * This is an illegal state and should not be encountered. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * A volume for the restore was identified and restore process is about to + * start. + * + * Generated from protobuf enum CREATING = 1; + */ + const CREATING = 1; + /** + * The volume is currently being restored. + * + * Generated from protobuf enum RESTORING = 2; + */ + const RESTORING = 2; + /** + * The volume has been successfully restored. + * + * Generated from protobuf enum SUCCEEDED = 3; + */ + const SUCCEEDED = 3; + /** + * The volume restoration process failed. + * + * Generated from protobuf enum FAILED = 4; + */ + const FAILED = 4; + /** + * This VolumeRestore resource is in the process of being deleted. + * + * Generated from protobuf enum DELETING = 5; + */ + const DELETING = 5; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::CREATING => 'CREATING', + self::RESTORING => 'RESTORING', + self::SUCCEEDED => 'SUCCEEDED', + self::FAILED => 'FAILED', + self::DELETING => 'DELETING', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\GkeBackup\V1\VolumeRestore_State::class); + diff --git a/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/VolumeRestore/VolumeType.php b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/VolumeRestore/VolumeType.php new file mode 100644 index 000000000000..460afb38ce7f --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/VolumeRestore/VolumeType.php @@ -0,0 +1,57 @@ +google.cloud.gkebackup.v1.VolumeRestore.VolumeType + */ +class VolumeType +{ + /** + * Default + * + * Generated from protobuf enum VOLUME_TYPE_UNSPECIFIED = 0; + */ + const VOLUME_TYPE_UNSPECIFIED = 0; + /** + * Compute Engine Persistent Disk volume + * + * Generated from protobuf enum GCE_PERSISTENT_DISK = 1; + */ + const GCE_PERSISTENT_DISK = 1; + + private static $valueToName = [ + self::VOLUME_TYPE_UNSPECIFIED => 'VOLUME_TYPE_UNSPECIFIED', + self::GCE_PERSISTENT_DISK => 'GCE_PERSISTENT_DISK', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(VolumeType::class, \Google\Cloud\GkeBackup\V1\VolumeRestore_VolumeType::class); + diff --git a/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/VolumeRestore_State.php b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/VolumeRestore_State.php new file mode 100644 index 000000000000..1ebbb83e2801 --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/proto/src/Google/Cloud/GkeBackup/V1/VolumeRestore_State.php @@ -0,0 +1,16 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $backupForGKEClient->createBackup($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Backup $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 +{ + $formattedParent = BackupForGKEClient::backupPlanName('[PROJECT]', '[LOCATION]', '[BACKUP_PLAN]'); + + create_backup_sample($formattedParent); +} +// [END gkebackup_v1_generated_BackupForGKE_CreateBackup_sync] diff --git a/owl-bot-staging/GkeBackup/v1/samples/V1/BackupForGKEClient/create_backup_plan.php b/owl-bot-staging/GkeBackup/v1/samples/V1/BackupForGKEClient/create_backup_plan.php new file mode 100644 index 000000000000..a1a19e4fe1c2 --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/samples/V1/BackupForGKEClient/create_backup_plan.php @@ -0,0 +1,112 @@ +setCluster($formattedBackupPlanCluster); + $request = (new CreateBackupPlanRequest()) + ->setParent($formattedParent) + ->setBackupPlan($backupPlan) + ->setBackupPlanId($backupPlanId); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $backupForGKEClient->createBackupPlan($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var BackupPlan $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 +{ + $formattedParent = BackupForGKEClient::locationName('[PROJECT]', '[LOCATION]'); + $formattedBackupPlanCluster = BackupForGKEClient::clusterName( + '[PROJECT]', + '[LOCATION]', + '[CLUSTER]' + ); + $backupPlanId = '[BACKUP_PLAN_ID]'; + + create_backup_plan_sample($formattedParent, $formattedBackupPlanCluster, $backupPlanId); +} +// [END gkebackup_v1_generated_BackupForGKE_CreateBackupPlan_sync] diff --git a/owl-bot-staging/GkeBackup/v1/samples/V1/BackupForGKEClient/create_restore.php b/owl-bot-staging/GkeBackup/v1/samples/V1/BackupForGKEClient/create_restore.php new file mode 100644 index 000000000000..fe6f407ac47d --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/samples/V1/BackupForGKEClient/create_restore.php @@ -0,0 +1,111 @@ +setBackup($formattedRestoreBackup); + $request = (new CreateRestoreRequest()) + ->setParent($formattedParent) + ->setRestore($restore) + ->setRestoreId($restoreId); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $backupForGKEClient->createRestore($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Restore $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 +{ + $formattedParent = BackupForGKEClient::restorePlanName('[PROJECT]', '[LOCATION]', '[RESTORE_PLAN]'); + $formattedRestoreBackup = BackupForGKEClient::backupName( + '[PROJECT]', + '[LOCATION]', + '[BACKUP_PLAN]', + '[BACKUP]' + ); + $restoreId = '[RESTORE_ID]'; + + create_restore_sample($formattedParent, $formattedRestoreBackup, $restoreId); +} +// [END gkebackup_v1_generated_BackupForGKE_CreateRestore_sync] diff --git a/owl-bot-staging/GkeBackup/v1/samples/V1/BackupForGKEClient/create_restore_plan.php b/owl-bot-staging/GkeBackup/v1/samples/V1/BackupForGKEClient/create_restore_plan.php new file mode 100644 index 000000000000..dcf71220c641 --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/samples/V1/BackupForGKEClient/create_restore_plan.php @@ -0,0 +1,132 @@ +setBackupPlan($formattedRestorePlanBackupPlan) + ->setCluster($formattedRestorePlanCluster) + ->setRestoreConfig($restorePlanRestoreConfig); + $request = (new CreateRestorePlanRequest()) + ->setParent($formattedParent) + ->setRestorePlan($restorePlan) + ->setRestorePlanId($restorePlanId); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $backupForGKEClient->createRestorePlan($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var RestorePlan $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 +{ + $formattedParent = BackupForGKEClient::locationName('[PROJECT]', '[LOCATION]'); + $formattedRestorePlanBackupPlan = BackupForGKEClient::backupPlanName( + '[PROJECT]', + '[LOCATION]', + '[BACKUP_PLAN]' + ); + $formattedRestorePlanCluster = BackupForGKEClient::clusterName( + '[PROJECT]', + '[LOCATION]', + '[CLUSTER]' + ); + $restorePlanId = '[RESTORE_PLAN_ID]'; + + create_restore_plan_sample( + $formattedParent, + $formattedRestorePlanBackupPlan, + $formattedRestorePlanCluster, + $restorePlanId + ); +} +// [END gkebackup_v1_generated_BackupForGKE_CreateRestorePlan_sync] diff --git a/owl-bot-staging/GkeBackup/v1/samples/V1/BackupForGKEClient/delete_backup.php b/owl-bot-staging/GkeBackup/v1/samples/V1/BackupForGKEClient/delete_backup.php new file mode 100644 index 000000000000..3cedcd0b5c4d --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/samples/V1/BackupForGKEClient/delete_backup.php @@ -0,0 +1,86 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $backupForGKEClient->deleteBackup($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + printf('Operation completed successfully.' . PHP_EOL); + } 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 = BackupForGKEClient::backupName( + '[PROJECT]', + '[LOCATION]', + '[BACKUP_PLAN]', + '[BACKUP]' + ); + + delete_backup_sample($formattedName); +} +// [END gkebackup_v1_generated_BackupForGKE_DeleteBackup_sync] diff --git a/owl-bot-staging/GkeBackup/v1/samples/V1/BackupForGKEClient/delete_backup_plan.php b/owl-bot-staging/GkeBackup/v1/samples/V1/BackupForGKEClient/delete_backup_plan.php new file mode 100644 index 000000000000..37402dbb5051 --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/samples/V1/BackupForGKEClient/delete_backup_plan.php @@ -0,0 +1,81 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $backupForGKEClient->deleteBackupPlan($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + printf('Operation completed successfully.' . PHP_EOL); + } 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 = BackupForGKEClient::backupPlanName('[PROJECT]', '[LOCATION]', '[BACKUP_PLAN]'); + + delete_backup_plan_sample($formattedName); +} +// [END gkebackup_v1_generated_BackupForGKE_DeleteBackupPlan_sync] diff --git a/owl-bot-staging/GkeBackup/v1/samples/V1/BackupForGKEClient/delete_restore.php b/owl-bot-staging/GkeBackup/v1/samples/V1/BackupForGKEClient/delete_restore.php new file mode 100644 index 000000000000..c42e5674e25e --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/samples/V1/BackupForGKEClient/delete_restore.php @@ -0,0 +1,86 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $backupForGKEClient->deleteRestore($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + printf('Operation completed successfully.' . PHP_EOL); + } 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 = BackupForGKEClient::restoreName( + '[PROJECT]', + '[LOCATION]', + '[RESTORE_PLAN]', + '[RESTORE]' + ); + + delete_restore_sample($formattedName); +} +// [END gkebackup_v1_generated_BackupForGKE_DeleteRestore_sync] diff --git a/owl-bot-staging/GkeBackup/v1/samples/V1/BackupForGKEClient/delete_restore_plan.php b/owl-bot-staging/GkeBackup/v1/samples/V1/BackupForGKEClient/delete_restore_plan.php new file mode 100644 index 000000000000..9dacc0e63c14 --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/samples/V1/BackupForGKEClient/delete_restore_plan.php @@ -0,0 +1,81 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $backupForGKEClient->deleteRestorePlan($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + printf('Operation completed successfully.' . PHP_EOL); + } 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 = BackupForGKEClient::restorePlanName('[PROJECT]', '[LOCATION]', '[RESTORE_PLAN]'); + + delete_restore_plan_sample($formattedName); +} +// [END gkebackup_v1_generated_BackupForGKE_DeleteRestorePlan_sync] diff --git a/owl-bot-staging/GkeBackup/v1/samples/V1/BackupForGKEClient/get_backup.php b/owl-bot-staging/GkeBackup/v1/samples/V1/BackupForGKEClient/get_backup.php new file mode 100644 index 000000000000..1ad6978ac1c8 --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/samples/V1/BackupForGKEClient/get_backup.php @@ -0,0 +1,77 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var Backup $response */ + $response = $backupForGKEClient->getBackup($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 = BackupForGKEClient::backupName( + '[PROJECT]', + '[LOCATION]', + '[BACKUP_PLAN]', + '[BACKUP]' + ); + + get_backup_sample($formattedName); +} +// [END gkebackup_v1_generated_BackupForGKE_GetBackup_sync] diff --git a/owl-bot-staging/GkeBackup/v1/samples/V1/BackupForGKEClient/get_backup_plan.php b/owl-bot-staging/GkeBackup/v1/samples/V1/BackupForGKEClient/get_backup_plan.php new file mode 100644 index 000000000000..ebe964b68a73 --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/samples/V1/BackupForGKEClient/get_backup_plan.php @@ -0,0 +1,72 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var BackupPlan $response */ + $response = $backupForGKEClient->getBackupPlan($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 = BackupForGKEClient::backupPlanName('[PROJECT]', '[LOCATION]', '[BACKUP_PLAN]'); + + get_backup_plan_sample($formattedName); +} +// [END gkebackup_v1_generated_BackupForGKE_GetBackupPlan_sync] diff --git a/owl-bot-staging/GkeBackup/v1/samples/V1/BackupForGKEClient/get_restore.php b/owl-bot-staging/GkeBackup/v1/samples/V1/BackupForGKEClient/get_restore.php new file mode 100644 index 000000000000..495167e32c0f --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/samples/V1/BackupForGKEClient/get_restore.php @@ -0,0 +1,77 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var Restore $response */ + $response = $backupForGKEClient->getRestore($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 = BackupForGKEClient::restoreName( + '[PROJECT]', + '[LOCATION]', + '[RESTORE_PLAN]', + '[RESTORE]' + ); + + get_restore_sample($formattedName); +} +// [END gkebackup_v1_generated_BackupForGKE_GetRestore_sync] diff --git a/owl-bot-staging/GkeBackup/v1/samples/V1/BackupForGKEClient/get_restore_plan.php b/owl-bot-staging/GkeBackup/v1/samples/V1/BackupForGKEClient/get_restore_plan.php new file mode 100644 index 000000000000..89d23c16a396 --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/samples/V1/BackupForGKEClient/get_restore_plan.php @@ -0,0 +1,72 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var RestorePlan $response */ + $response = $backupForGKEClient->getRestorePlan($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 = BackupForGKEClient::restorePlanName('[PROJECT]', '[LOCATION]', '[RESTORE_PLAN]'); + + get_restore_plan_sample($formattedName); +} +// [END gkebackup_v1_generated_BackupForGKE_GetRestorePlan_sync] diff --git a/owl-bot-staging/GkeBackup/v1/samples/V1/BackupForGKEClient/get_volume_backup.php b/owl-bot-staging/GkeBackup/v1/samples/V1/BackupForGKEClient/get_volume_backup.php new file mode 100644 index 000000000000..fcda5baa594f --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/samples/V1/BackupForGKEClient/get_volume_backup.php @@ -0,0 +1,78 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var VolumeBackup $response */ + $response = $backupForGKEClient->getVolumeBackup($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 = BackupForGKEClient::volumeBackupName( + '[PROJECT]', + '[LOCATION]', + '[BACKUP_PLAN]', + '[BACKUP]', + '[VOLUME_BACKUP]' + ); + + get_volume_backup_sample($formattedName); +} +// [END gkebackup_v1_generated_BackupForGKE_GetVolumeBackup_sync] diff --git a/owl-bot-staging/GkeBackup/v1/samples/V1/BackupForGKEClient/get_volume_restore.php b/owl-bot-staging/GkeBackup/v1/samples/V1/BackupForGKEClient/get_volume_restore.php new file mode 100644 index 000000000000..e80b80a362cd --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/samples/V1/BackupForGKEClient/get_volume_restore.php @@ -0,0 +1,78 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var VolumeRestore $response */ + $response = $backupForGKEClient->getVolumeRestore($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 = BackupForGKEClient::volumeRestoreName( + '[PROJECT]', + '[LOCATION]', + '[RESTORE_PLAN]', + '[RESTORE]', + '[VOLUME_RESTORE]' + ); + + get_volume_restore_sample($formattedName); +} +// [END gkebackup_v1_generated_BackupForGKE_GetVolumeRestore_sync] diff --git a/owl-bot-staging/GkeBackup/v1/samples/V1/BackupForGKEClient/list_backup_plans.php b/owl-bot-staging/GkeBackup/v1/samples/V1/BackupForGKEClient/list_backup_plans.php new file mode 100644 index 000000000000..1c7a75dd92ff --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/samples/V1/BackupForGKEClient/list_backup_plans.php @@ -0,0 +1,77 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $backupForGKEClient->listBackupPlans($request); + + /** @var BackupPlan $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 = BackupForGKEClient::locationName('[PROJECT]', '[LOCATION]'); + + list_backup_plans_sample($formattedParent); +} +// [END gkebackup_v1_generated_BackupForGKE_ListBackupPlans_sync] diff --git a/owl-bot-staging/GkeBackup/v1/samples/V1/BackupForGKEClient/list_backups.php b/owl-bot-staging/GkeBackup/v1/samples/V1/BackupForGKEClient/list_backups.php new file mode 100644 index 000000000000..eb59f596622a --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/samples/V1/BackupForGKEClient/list_backups.php @@ -0,0 +1,77 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $backupForGKEClient->listBackups($request); + + /** @var Backup $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 = BackupForGKEClient::backupPlanName('[PROJECT]', '[LOCATION]', '[BACKUP_PLAN]'); + + list_backups_sample($formattedParent); +} +// [END gkebackup_v1_generated_BackupForGKE_ListBackups_sync] diff --git a/owl-bot-staging/GkeBackup/v1/samples/V1/BackupForGKEClient/list_restore_plans.php b/owl-bot-staging/GkeBackup/v1/samples/V1/BackupForGKEClient/list_restore_plans.php new file mode 100644 index 000000000000..e4f451796d5e --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/samples/V1/BackupForGKEClient/list_restore_plans.php @@ -0,0 +1,77 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $backupForGKEClient->listRestorePlans($request); + + /** @var RestorePlan $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 = BackupForGKEClient::locationName('[PROJECT]', '[LOCATION]'); + + list_restore_plans_sample($formattedParent); +} +// [END gkebackup_v1_generated_BackupForGKE_ListRestorePlans_sync] diff --git a/owl-bot-staging/GkeBackup/v1/samples/V1/BackupForGKEClient/list_restores.php b/owl-bot-staging/GkeBackup/v1/samples/V1/BackupForGKEClient/list_restores.php new file mode 100644 index 000000000000..16fd309a702e --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/samples/V1/BackupForGKEClient/list_restores.php @@ -0,0 +1,77 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $backupForGKEClient->listRestores($request); + + /** @var Restore $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 = BackupForGKEClient::restorePlanName('[PROJECT]', '[LOCATION]', '[RESTORE_PLAN]'); + + list_restores_sample($formattedParent); +} +// [END gkebackup_v1_generated_BackupForGKE_ListRestores_sync] diff --git a/owl-bot-staging/GkeBackup/v1/samples/V1/BackupForGKEClient/list_volume_backups.php b/owl-bot-staging/GkeBackup/v1/samples/V1/BackupForGKEClient/list_volume_backups.php new file mode 100644 index 000000000000..9353a23415a3 --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/samples/V1/BackupForGKEClient/list_volume_backups.php @@ -0,0 +1,82 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $backupForGKEClient->listVolumeBackups($request); + + /** @var VolumeBackup $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 = BackupForGKEClient::backupName( + '[PROJECT]', + '[LOCATION]', + '[BACKUP_PLAN]', + '[BACKUP]' + ); + + list_volume_backups_sample($formattedParent); +} +// [END gkebackup_v1_generated_BackupForGKE_ListVolumeBackups_sync] diff --git a/owl-bot-staging/GkeBackup/v1/samples/V1/BackupForGKEClient/list_volume_restores.php b/owl-bot-staging/GkeBackup/v1/samples/V1/BackupForGKEClient/list_volume_restores.php new file mode 100644 index 000000000000..24ac35326759 --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/samples/V1/BackupForGKEClient/list_volume_restores.php @@ -0,0 +1,82 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $backupForGKEClient->listVolumeRestores($request); + + /** @var VolumeRestore $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 = BackupForGKEClient::restoreName( + '[PROJECT]', + '[LOCATION]', + '[RESTORE_PLAN]', + '[RESTORE]' + ); + + list_volume_restores_sample($formattedParent); +} +// [END gkebackup_v1_generated_BackupForGKE_ListVolumeRestores_sync] diff --git a/owl-bot-staging/GkeBackup/v1/samples/V1/BackupForGKEClient/update_backup.php b/owl-bot-staging/GkeBackup/v1/samples/V1/BackupForGKEClient/update_backup.php new file mode 100644 index 000000000000..6a28ab5ee7ff --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/samples/V1/BackupForGKEClient/update_backup.php @@ -0,0 +1,71 @@ +setBackup($backup); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $backupForGKEClient->updateBackup($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Backup $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()); + } +} +// [END gkebackup_v1_generated_BackupForGKE_UpdateBackup_sync] diff --git a/owl-bot-staging/GkeBackup/v1/samples/V1/BackupForGKEClient/update_backup_plan.php b/owl-bot-staging/GkeBackup/v1/samples/V1/BackupForGKEClient/update_backup_plan.php new file mode 100644 index 000000000000..62c3cc438146 --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/samples/V1/BackupForGKEClient/update_backup_plan.php @@ -0,0 +1,94 @@ +setCluster($formattedBackupPlanCluster); + $request = (new UpdateBackupPlanRequest()) + ->setBackupPlan($backupPlan); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $backupForGKEClient->updateBackupPlan($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var BackupPlan $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 +{ + $formattedBackupPlanCluster = BackupForGKEClient::clusterName( + '[PROJECT]', + '[LOCATION]', + '[CLUSTER]' + ); + + update_backup_plan_sample($formattedBackupPlanCluster); +} +// [END gkebackup_v1_generated_BackupForGKE_UpdateBackupPlan_sync] diff --git a/owl-bot-staging/GkeBackup/v1/samples/V1/BackupForGKEClient/update_restore.php b/owl-bot-staging/GkeBackup/v1/samples/V1/BackupForGKEClient/update_restore.php new file mode 100644 index 000000000000..f5a2ff0a498d --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/samples/V1/BackupForGKEClient/update_restore.php @@ -0,0 +1,93 @@ +setBackup($formattedRestoreBackup); + $request = (new UpdateRestoreRequest()) + ->setRestore($restore); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $backupForGKEClient->updateRestore($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Restore $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 +{ + $formattedRestoreBackup = BackupForGKEClient::backupName( + '[PROJECT]', + '[LOCATION]', + '[BACKUP_PLAN]', + '[BACKUP]' + ); + + update_restore_sample($formattedRestoreBackup); +} +// [END gkebackup_v1_generated_BackupForGKE_UpdateRestore_sync] diff --git a/owl-bot-staging/GkeBackup/v1/samples/V1/BackupForGKEClient/update_restore_plan.php b/owl-bot-staging/GkeBackup/v1/samples/V1/BackupForGKEClient/update_restore_plan.php new file mode 100644 index 000000000000..adecaaaee999 --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/samples/V1/BackupForGKEClient/update_restore_plan.php @@ -0,0 +1,110 @@ +setBackupPlan($formattedRestorePlanBackupPlan) + ->setCluster($formattedRestorePlanCluster) + ->setRestoreConfig($restorePlanRestoreConfig); + $request = (new UpdateRestorePlanRequest()) + ->setRestorePlan($restorePlan); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $backupForGKEClient->updateRestorePlan($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var RestorePlan $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 +{ + $formattedRestorePlanBackupPlan = BackupForGKEClient::backupPlanName( + '[PROJECT]', + '[LOCATION]', + '[BACKUP_PLAN]' + ); + $formattedRestorePlanCluster = BackupForGKEClient::clusterName( + '[PROJECT]', + '[LOCATION]', + '[CLUSTER]' + ); + + update_restore_plan_sample($formattedRestorePlanBackupPlan, $formattedRestorePlanCluster); +} +// [END gkebackup_v1_generated_BackupForGKE_UpdateRestorePlan_sync] diff --git a/owl-bot-staging/GkeBackup/v1/src/V1/BackupForGKEClient.php b/owl-bot-staging/GkeBackup/v1/src/V1/BackupForGKEClient.php new file mode 100644 index 000000000000..e5186c4c76bf --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/src/V1/BackupForGKEClient.php @@ -0,0 +1,34 @@ + self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../../resources/backup_for_gke_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../../resources/backup_for_gke_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../../resources/backup_for_gke_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../../resources/backup_for_gke_rest_client_config.php', + ], + ], + ]; + } + + /** + * 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 backup + * resource. + * + * @param string $project + * @param string $location + * @param string $backupPlan + * @param string $backup + * + * @return string The formatted backup resource. + */ + public static function backupName(string $project, string $location, string $backupPlan, string $backup): string + { + return self::getPathTemplate('backup')->render([ + 'project' => $project, + 'location' => $location, + 'backup_plan' => $backupPlan, + 'backup' => $backup, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a backup_plan + * resource. + * + * @param string $project + * @param string $location + * @param string $backupPlan + * + * @return string The formatted backup_plan resource. + */ + public static function backupPlanName(string $project, string $location, string $backupPlan): string + { + return self::getPathTemplate('backupPlan')->render([ + 'project' => $project, + 'location' => $location, + 'backup_plan' => $backupPlan, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a cluster + * resource. + * + * @param string $project + * @param string $location + * @param string $cluster + * + * @return string The formatted cluster resource. + */ + public static function clusterName(string $project, string $location, string $cluster): string + { + return self::getPathTemplate('cluster')->render([ + 'project' => $project, + 'location' => $location, + 'cluster' => $cluster, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a crypto_key + * resource. + * + * @param string $project + * @param string $location + * @param string $keyRing + * @param string $cryptoKey + * + * @return string The formatted crypto_key resource. + */ + public static function cryptoKeyName(string $project, string $location, string $keyRing, string $cryptoKey): string + { + return self::getPathTemplate('cryptoKey')->render([ + 'project' => $project, + 'location' => $location, + 'key_ring' => $keyRing, + 'crypto_key' => $cryptoKey, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a location + * resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted location resource. + */ + public static function locationName(string $project, string $location): string + { + return self::getPathTemplate('location')->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a restore + * resource. + * + * @param string $project + * @param string $location + * @param string $restorePlan + * @param string $restore + * + * @return string The formatted restore resource. + */ + public static function restoreName(string $project, string $location, string $restorePlan, string $restore): string + { + return self::getPathTemplate('restore')->render([ + 'project' => $project, + 'location' => $location, + 'restore_plan' => $restorePlan, + 'restore' => $restore, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a restore_plan + * resource. + * + * @param string $project + * @param string $location + * @param string $restorePlan + * + * @return string The formatted restore_plan resource. + */ + public static function restorePlanName(string $project, string $location, string $restorePlan): string + { + return self::getPathTemplate('restorePlan')->render([ + 'project' => $project, + 'location' => $location, + 'restore_plan' => $restorePlan, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * volume_backup resource. + * + * @param string $project + * @param string $location + * @param string $backupPlan + * @param string $backup + * @param string $volumeBackup + * + * @return string The formatted volume_backup resource. + */ + public static function volumeBackupName(string $project, string $location, string $backupPlan, string $backup, string $volumeBackup): string + { + return self::getPathTemplate('volumeBackup')->render([ + 'project' => $project, + 'location' => $location, + 'backup_plan' => $backupPlan, + 'backup' => $backup, + 'volume_backup' => $volumeBackup, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * volume_restore resource. + * + * @param string $project + * @param string $location + * @param string $restorePlan + * @param string $restore + * @param string $volumeRestore + * + * @return string The formatted volume_restore resource. + */ + public static function volumeRestoreName(string $project, string $location, string $restorePlan, string $restore, string $volumeRestore): string + { + return self::getPathTemplate('volumeRestore')->render([ + 'project' => $project, + 'location' => $location, + 'restore_plan' => $restorePlan, + 'restore' => $restore, + 'volume_restore' => $volumeRestore, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - backup: projects/{project}/locations/{location}/backupPlans/{backup_plan}/backups/{backup} + * - backupPlan: projects/{project}/locations/{location}/backupPlans/{backup_plan} + * - cluster: projects/{project}/locations/{location}/clusters/{cluster} + * - cryptoKey: projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key} + * - location: projects/{project}/locations/{location} + * - restore: projects/{project}/locations/{location}/restorePlans/{restore_plan}/restores/{restore} + * - restorePlan: projects/{project}/locations/{location}/restorePlans/{restore_plan} + * - volumeBackup: projects/{project}/locations/{location}/backupPlans/{backup_plan}/backups/{backup}/volumeBackups/{volume_backup} + * - volumeRestore: projects/{project}/locations/{location}/restorePlans/{restore_plan}/restores/{restore}/volumeRestores/{volume_restore} + * + * 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 'gkebackup.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. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *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' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods 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 Backup for the given BackupPlan. + * + * The async variant is {@see self::createBackupAsync()} . + * + * @param CreateBackupRequest $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 createBackup(CreateBackupRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('CreateBackup', $request, $callOptions)->wait(); + } + + /** + * Creates a new BackupPlan in a given location. + * + * The async variant is {@see self::createBackupPlanAsync()} . + * + * @param CreateBackupPlanRequest $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 createBackupPlan(CreateBackupPlanRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('CreateBackupPlan', $request, $callOptions)->wait(); + } + + /** + * Creates a new Restore for the given RestorePlan. + * + * The async variant is {@see self::createRestoreAsync()} . + * + * @param CreateRestoreRequest $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 createRestore(CreateRestoreRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('CreateRestore', $request, $callOptions)->wait(); + } + + /** + * Creates a new RestorePlan in a given location. + * + * The async variant is {@see self::createRestorePlanAsync()} . + * + * @param CreateRestorePlanRequest $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 createRestorePlan(CreateRestorePlanRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('CreateRestorePlan', $request, $callOptions)->wait(); + } + + /** + * Deletes an existing Backup. + * + * The async variant is {@see self::deleteBackupAsync()} . + * + * @param DeleteBackupRequest $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 deleteBackup(DeleteBackupRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('DeleteBackup', $request, $callOptions)->wait(); + } + + /** + * Deletes an existing BackupPlan. + * + * The async variant is {@see self::deleteBackupPlanAsync()} . + * + * @param DeleteBackupPlanRequest $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 deleteBackupPlan(DeleteBackupPlanRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('DeleteBackupPlan', $request, $callOptions)->wait(); + } + + /** + * Deletes an existing Restore. + * + * The async variant is {@see self::deleteRestoreAsync()} . + * + * @param DeleteRestoreRequest $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 deleteRestore(DeleteRestoreRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('DeleteRestore', $request, $callOptions)->wait(); + } + + /** + * Deletes an existing RestorePlan. + * + * The async variant is {@see self::deleteRestorePlanAsync()} . + * + * @param DeleteRestorePlanRequest $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 deleteRestorePlan(DeleteRestorePlanRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('DeleteRestorePlan', $request, $callOptions)->wait(); + } + + /** + * Retrieve the details of a single Backup. + * + * The async variant is {@see self::getBackupAsync()} . + * + * @param GetBackupRequest $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 Backup + * + * @throws ApiException Thrown if the API call fails. + */ + public function getBackup(GetBackupRequest $request, array $callOptions = []): Backup + { + return $this->startApiCall('GetBackup', $request, $callOptions)->wait(); + } + + /** + * Retrieve the details of a single BackupPlan. + * + * The async variant is {@see self::getBackupPlanAsync()} . + * + * @param GetBackupPlanRequest $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 BackupPlan + * + * @throws ApiException Thrown if the API call fails. + */ + public function getBackupPlan(GetBackupPlanRequest $request, array $callOptions = []): BackupPlan + { + return $this->startApiCall('GetBackupPlan', $request, $callOptions)->wait(); + } + + /** + * Retrieves the details of a single Restore. + * + * The async variant is {@see self::getRestoreAsync()} . + * + * @param GetRestoreRequest $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 Restore + * + * @throws ApiException Thrown if the API call fails. + */ + public function getRestore(GetRestoreRequest $request, array $callOptions = []): Restore + { + return $this->startApiCall('GetRestore', $request, $callOptions)->wait(); + } + + /** + * Retrieve the details of a single RestorePlan. + * + * The async variant is {@see self::getRestorePlanAsync()} . + * + * @param GetRestorePlanRequest $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 RestorePlan + * + * @throws ApiException Thrown if the API call fails. + */ + public function getRestorePlan(GetRestorePlanRequest $request, array $callOptions = []): RestorePlan + { + return $this->startApiCall('GetRestorePlan', $request, $callOptions)->wait(); + } + + /** + * Retrieve the details of a single VolumeBackup. + * + * The async variant is {@see self::getVolumeBackupAsync()} . + * + * @param GetVolumeBackupRequest $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 VolumeBackup + * + * @throws ApiException Thrown if the API call fails. + */ + public function getVolumeBackup(GetVolumeBackupRequest $request, array $callOptions = []): VolumeBackup + { + return $this->startApiCall('GetVolumeBackup', $request, $callOptions)->wait(); + } + + /** + * Retrieve the details of a single VolumeRestore. + * + * The async variant is {@see self::getVolumeRestoreAsync()} . + * + * @param GetVolumeRestoreRequest $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 VolumeRestore + * + * @throws ApiException Thrown if the API call fails. + */ + public function getVolumeRestore(GetVolumeRestoreRequest $request, array $callOptions = []): VolumeRestore + { + return $this->startApiCall('GetVolumeRestore', $request, $callOptions)->wait(); + } + + /** + * Lists BackupPlans in a given location. + * + * The async variant is {@see self::listBackupPlansAsync()} . + * + * @param ListBackupPlansRequest $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 listBackupPlans(ListBackupPlansRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListBackupPlans', $request, $callOptions); + } + + /** + * Lists the Backups for a given BackupPlan. + * + * The async variant is {@see self::listBackupsAsync()} . + * + * @param ListBackupsRequest $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 listBackups(ListBackupsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListBackups', $request, $callOptions); + } + + /** + * Lists RestorePlans in a given location. + * + * The async variant is {@see self::listRestorePlansAsync()} . + * + * @param ListRestorePlansRequest $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 listRestorePlans(ListRestorePlansRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListRestorePlans', $request, $callOptions); + } + + /** + * Lists the Restores for a given RestorePlan. + * + * The async variant is {@see self::listRestoresAsync()} . + * + * @param ListRestoresRequest $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 listRestores(ListRestoresRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListRestores', $request, $callOptions); + } + + /** + * Lists the VolumeBackups for a given Backup. + * + * The async variant is {@see self::listVolumeBackupsAsync()} . + * + * @param ListVolumeBackupsRequest $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 listVolumeBackups(ListVolumeBackupsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListVolumeBackups', $request, $callOptions); + } + + /** + * Lists the VolumeRestores for a given Restore. + * + * The async variant is {@see self::listVolumeRestoresAsync()} . + * + * @param ListVolumeRestoresRequest $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 listVolumeRestores(ListVolumeRestoresRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListVolumeRestores', $request, $callOptions); + } + + /** + * Update a Backup. + * + * The async variant is {@see self::updateBackupAsync()} . + * + * @param UpdateBackupRequest $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 updateBackup(UpdateBackupRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('UpdateBackup', $request, $callOptions)->wait(); + } + + /** + * Update a BackupPlan. + * + * The async variant is {@see self::updateBackupPlanAsync()} . + * + * @param UpdateBackupPlanRequest $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 updateBackupPlan(UpdateBackupPlanRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('UpdateBackupPlan', $request, $callOptions)->wait(); + } + + /** + * Update a Restore. + * + * The async variant is {@see self::updateRestoreAsync()} . + * + * @param UpdateRestoreRequest $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 updateRestore(UpdateRestoreRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('UpdateRestore', $request, $callOptions)->wait(); + } + + /** + * Update a RestorePlan. + * + * The async variant is {@see self::updateRestorePlanAsync()} . + * + * @param UpdateRestorePlanRequest $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 updateRestorePlan(UpdateRestorePlanRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('UpdateRestorePlan', $request, $callOptions)->wait(); + } +} diff --git a/owl-bot-staging/GkeBackup/v1/src/V1/Gapic/BackupForGKEGapicClient.php b/owl-bot-staging/GkeBackup/v1/src/V1/Gapic/BackupForGKEGapicClient.php new file mode 100644 index 000000000000..afa8e3e357e6 --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/src/V1/Gapic/BackupForGKEGapicClient.php @@ -0,0 +1,2272 @@ +backupPlanName('[PROJECT]', '[LOCATION]', '[BACKUP_PLAN]'); + * $operationResponse = $backupForGKEClient->createBackup($formattedParent); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $backupForGKEClient->createBackup($formattedParent); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $backupForGKEClient->resumeOperation($operationName, 'createBackup'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $backupForGKEClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + */ +class BackupForGKEGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.gkebackup.v1.BackupForGKE'; + + /** The default address of the service. */ + const SERVICE_ADDRESS = 'gkebackup.googleapis.com'; + + /** The default port of the service. */ + const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + ]; + + private static $backupNameTemplate; + + private static $backupPlanNameTemplate; + + private static $clusterNameTemplate; + + private static $cryptoKeyNameTemplate; + + private static $locationNameTemplate; + + private static $restoreNameTemplate; + + private static $restorePlanNameTemplate; + + private static $volumeBackupNameTemplate; + + private static $volumeRestoreNameTemplate; + + private static $pathTemplateMap; + + private $operationsClient; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/backup_for_gke_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/backup_for_gke_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/backup_for_gke_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/backup_for_gke_rest_client_config.php', + ], + ], + ]; + } + + private static function getBackupNameTemplate() + { + if (self::$backupNameTemplate == null) { + self::$backupNameTemplate = new PathTemplate('projects/{project}/locations/{location}/backupPlans/{backup_plan}/backups/{backup}'); + } + + return self::$backupNameTemplate; + } + + private static function getBackupPlanNameTemplate() + { + if (self::$backupPlanNameTemplate == null) { + self::$backupPlanNameTemplate = new PathTemplate('projects/{project}/locations/{location}/backupPlans/{backup_plan}'); + } + + return self::$backupPlanNameTemplate; + } + + private static function getClusterNameTemplate() + { + if (self::$clusterNameTemplate == null) { + self::$clusterNameTemplate = new PathTemplate('projects/{project}/locations/{location}/clusters/{cluster}'); + } + + return self::$clusterNameTemplate; + } + + private static function getCryptoKeyNameTemplate() + { + if (self::$cryptoKeyNameTemplate == null) { + self::$cryptoKeyNameTemplate = new PathTemplate('projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}'); + } + + return self::$cryptoKeyNameTemplate; + } + + private static function getLocationNameTemplate() + { + if (self::$locationNameTemplate == null) { + self::$locationNameTemplate = new PathTemplate('projects/{project}/locations/{location}'); + } + + return self::$locationNameTemplate; + } + + private static function getRestoreNameTemplate() + { + if (self::$restoreNameTemplate == null) { + self::$restoreNameTemplate = new PathTemplate('projects/{project}/locations/{location}/restorePlans/{restore_plan}/restores/{restore}'); + } + + return self::$restoreNameTemplate; + } + + private static function getRestorePlanNameTemplate() + { + if (self::$restorePlanNameTemplate == null) { + self::$restorePlanNameTemplate = new PathTemplate('projects/{project}/locations/{location}/restorePlans/{restore_plan}'); + } + + return self::$restorePlanNameTemplate; + } + + private static function getVolumeBackupNameTemplate() + { + if (self::$volumeBackupNameTemplate == null) { + self::$volumeBackupNameTemplate = new PathTemplate('projects/{project}/locations/{location}/backupPlans/{backup_plan}/backups/{backup}/volumeBackups/{volume_backup}'); + } + + return self::$volumeBackupNameTemplate; + } + + private static function getVolumeRestoreNameTemplate() + { + if (self::$volumeRestoreNameTemplate == null) { + self::$volumeRestoreNameTemplate = new PathTemplate('projects/{project}/locations/{location}/restorePlans/{restore_plan}/restores/{restore}/volumeRestores/{volume_restore}'); + } + + return self::$volumeRestoreNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'backup' => self::getBackupNameTemplate(), + 'backupPlan' => self::getBackupPlanNameTemplate(), + 'cluster' => self::getClusterNameTemplate(), + 'cryptoKey' => self::getCryptoKeyNameTemplate(), + 'location' => self::getLocationNameTemplate(), + 'restore' => self::getRestoreNameTemplate(), + 'restorePlan' => self::getRestorePlanNameTemplate(), + 'volumeBackup' => self::getVolumeBackupNameTemplate(), + 'volumeRestore' => self::getVolumeRestoreNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a backup + * resource. + * + * @param string $project + * @param string $location + * @param string $backupPlan + * @param string $backup + * + * @return string The formatted backup resource. + */ + public static function backupName($project, $location, $backupPlan, $backup) + { + return self::getBackupNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'backup_plan' => $backupPlan, + 'backup' => $backup, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a backup_plan + * resource. + * + * @param string $project + * @param string $location + * @param string $backupPlan + * + * @return string The formatted backup_plan resource. + */ + public static function backupPlanName($project, $location, $backupPlan) + { + return self::getBackupPlanNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'backup_plan' => $backupPlan, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a cluster + * resource. + * + * @param string $project + * @param string $location + * @param string $cluster + * + * @return string The formatted cluster resource. + */ + public static function clusterName($project, $location, $cluster) + { + return self::getClusterNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'cluster' => $cluster, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a crypto_key + * resource. + * + * @param string $project + * @param string $location + * @param string $keyRing + * @param string $cryptoKey + * + * @return string The formatted crypto_key resource. + */ + public static function cryptoKeyName($project, $location, $keyRing, $cryptoKey) + { + return self::getCryptoKeyNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'key_ring' => $keyRing, + 'crypto_key' => $cryptoKey, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a location + * resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted location resource. + */ + public static function locationName($project, $location) + { + return self::getLocationNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a restore + * resource. + * + * @param string $project + * @param string $location + * @param string $restorePlan + * @param string $restore + * + * @return string The formatted restore resource. + */ + public static function restoreName($project, $location, $restorePlan, $restore) + { + return self::getRestoreNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'restore_plan' => $restorePlan, + 'restore' => $restore, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a restore_plan + * resource. + * + * @param string $project + * @param string $location + * @param string $restorePlan + * + * @return string The formatted restore_plan resource. + */ + public static function restorePlanName($project, $location, $restorePlan) + { + return self::getRestorePlanNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'restore_plan' => $restorePlan, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * volume_backup resource. + * + * @param string $project + * @param string $location + * @param string $backupPlan + * @param string $backup + * @param string $volumeBackup + * + * @return string The formatted volume_backup resource. + */ + public static function volumeBackupName($project, $location, $backupPlan, $backup, $volumeBackup) + { + return self::getVolumeBackupNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'backup_plan' => $backupPlan, + 'backup' => $backup, + 'volume_backup' => $volumeBackup, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * volume_restore resource. + * + * @param string $project + * @param string $location + * @param string $restorePlan + * @param string $restore + * @param string $volumeRestore + * + * @return string The formatted volume_restore resource. + */ + public static function volumeRestoreName($project, $location, $restorePlan, $restore, $volumeRestore) + { + return self::getVolumeRestoreNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'restore_plan' => $restorePlan, + 'restore' => $restore, + 'volume_restore' => $volumeRestore, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - backup: projects/{project}/locations/{location}/backupPlans/{backup_plan}/backups/{backup} + * - backupPlan: projects/{project}/locations/{location}/backupPlans/{backup_plan} + * - cluster: projects/{project}/locations/{location}/clusters/{cluster} + * - cryptoKey: projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key} + * - location: projects/{project}/locations/{location} + * - restore: projects/{project}/locations/{location}/restorePlans/{restore_plan}/restores/{restore} + * - restorePlan: projects/{project}/locations/{location}/restorePlans/{restore_plan} + * - volumeBackup: projects/{project}/locations/{location}/backupPlans/{backup_plan}/backups/{backup}/volumeBackups/{volume_backup} + * - volumeRestore: projects/{project}/locations/{location}/restorePlans/{restore_plan}/restores/{restore}/volumeRestores/{volume_restore} + * + * 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($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * 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; + } + + /** + * 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 'gkebackup.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. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *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' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods 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); + } + + /** + * Creates a Backup for the given BackupPlan. + * + * Sample code: + * ``` + * $backupForGKEClient = new BackupForGKEClient(); + * try { + * $formattedParent = $backupForGKEClient->backupPlanName('[PROJECT]', '[LOCATION]', '[BACKUP_PLAN]'); + * $operationResponse = $backupForGKEClient->createBackup($formattedParent); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $backupForGKEClient->createBackup($formattedParent); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $backupForGKEClient->resumeOperation($operationName, 'createBackup'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $backupForGKEClient->close(); + * } + * ``` + * + * @param string $parent Required. The BackupPlan within which to create the Backup. + * Format: projects/*/locations/*/backupPlans/* + * @param array $optionalArgs { + * Optional. + * + * @type Backup $backup + * The Backup resource to create. + * @type string $backupId + * The client-provided short name for the Backup resource. + * This name must: + * + * - be between 1 and 63 characters long (inclusive) + * - consist of only lower-case ASCII letters, numbers, and dashes + * - start with a lower-case letter + * - end with a lower-case letter or number + * - be unique within the set of Backups in this BackupPlan + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function createBackup($parent, array $optionalArgs = []) + { + $request = new CreateBackupRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['backup'])) { + $request->setBackup($optionalArgs['backup']); + } + + if (isset($optionalArgs['backupId'])) { + $request->setBackupId($optionalArgs['backupId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateBackup', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Creates a new BackupPlan in a given location. + * + * Sample code: + * ``` + * $backupForGKEClient = new BackupForGKEClient(); + * try { + * $formattedParent = $backupForGKEClient->locationName('[PROJECT]', '[LOCATION]'); + * $backupPlan = new BackupPlan(); + * $backupPlanId = 'backup_plan_id'; + * $operationResponse = $backupForGKEClient->createBackupPlan($formattedParent, $backupPlan, $backupPlanId); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $backupForGKEClient->createBackupPlan($formattedParent, $backupPlan, $backupPlanId); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $backupForGKEClient->resumeOperation($operationName, 'createBackupPlan'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $backupForGKEClient->close(); + * } + * ``` + * + * @param string $parent Required. The location within which to create the BackupPlan. + * Format: projects/*/locations/* + * @param BackupPlan $backupPlan Required. The BackupPlan resource object to create. + * @param string $backupPlanId Required. The client-provided short name for the BackupPlan resource. + * This name must: + * + * - be between 1 and 63 characters long (inclusive) + * - consist of only lower-case ASCII letters, numbers, and dashes + * - start with a lower-case letter + * - end with a lower-case letter or number + * - be unique within the set of BackupPlans in this location + * @param array $optionalArgs { + * 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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function createBackupPlan($parent, $backupPlan, $backupPlanId, array $optionalArgs = []) + { + $request = new CreateBackupPlanRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setBackupPlan($backupPlan); + $request->setBackupPlanId($backupPlanId); + $requestParamHeaders['parent'] = $parent; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateBackupPlan', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Creates a new Restore for the given RestorePlan. + * + * Sample code: + * ``` + * $backupForGKEClient = new BackupForGKEClient(); + * try { + * $formattedParent = $backupForGKEClient->restorePlanName('[PROJECT]', '[LOCATION]', '[RESTORE_PLAN]'); + * $restore = new Restore(); + * $restoreId = 'restore_id'; + * $operationResponse = $backupForGKEClient->createRestore($formattedParent, $restore, $restoreId); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $backupForGKEClient->createRestore($formattedParent, $restore, $restoreId); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $backupForGKEClient->resumeOperation($operationName, 'createRestore'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $backupForGKEClient->close(); + * } + * ``` + * + * @param string $parent Required. The RestorePlan within which to create the Restore. + * Format: projects/*/locations/*/restorePlans/* + * @param Restore $restore Required. The restore resource to create. + * @param string $restoreId Required. The client-provided short name for the Restore resource. + * This name must: + * + * - be between 1 and 63 characters long (inclusive) + * - consist of only lower-case ASCII letters, numbers, and dashes + * - start with a lower-case letter + * - end with a lower-case letter or number + * - be unique within the set of Restores in this RestorePlan. + * @param array $optionalArgs { + * 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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function createRestore($parent, $restore, $restoreId, array $optionalArgs = []) + { + $request = new CreateRestoreRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setRestore($restore); + $request->setRestoreId($restoreId); + $requestParamHeaders['parent'] = $parent; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateRestore', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Creates a new RestorePlan in a given location. + * + * Sample code: + * ``` + * $backupForGKEClient = new BackupForGKEClient(); + * try { + * $formattedParent = $backupForGKEClient->locationName('[PROJECT]', '[LOCATION]'); + * $restorePlan = new RestorePlan(); + * $restorePlanId = 'restore_plan_id'; + * $operationResponse = $backupForGKEClient->createRestorePlan($formattedParent, $restorePlan, $restorePlanId); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $backupForGKEClient->createRestorePlan($formattedParent, $restorePlan, $restorePlanId); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $backupForGKEClient->resumeOperation($operationName, 'createRestorePlan'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $backupForGKEClient->close(); + * } + * ``` + * + * @param string $parent Required. The location within which to create the RestorePlan. + * Format: projects/*/locations/* + * @param RestorePlan $restorePlan Required. The RestorePlan resource object to create. + * @param string $restorePlanId Required. The client-provided short name for the RestorePlan resource. + * This name must: + * + * - be between 1 and 63 characters long (inclusive) + * - consist of only lower-case ASCII letters, numbers, and dashes + * - start with a lower-case letter + * - end with a lower-case letter or number + * - be unique within the set of RestorePlans in this location + * @param array $optionalArgs { + * 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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function createRestorePlan($parent, $restorePlan, $restorePlanId, array $optionalArgs = []) + { + $request = new CreateRestorePlanRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setRestorePlan($restorePlan); + $request->setRestorePlanId($restorePlanId); + $requestParamHeaders['parent'] = $parent; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateRestorePlan', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Deletes an existing Backup. + * + * Sample code: + * ``` + * $backupForGKEClient = new BackupForGKEClient(); + * try { + * $formattedName = $backupForGKEClient->backupName('[PROJECT]', '[LOCATION]', '[BACKUP_PLAN]', '[BACKUP]'); + * $operationResponse = $backupForGKEClient->deleteBackup($formattedName); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $backupForGKEClient->deleteBackup($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $backupForGKEClient->resumeOperation($operationName, 'deleteBackup'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $backupForGKEClient->close(); + * } + * ``` + * + * @param string $name Required. Name of the Backup resource. + * Format: projects/*/locations/*/backupPlans/*/backups/* + * @param array $optionalArgs { + * Optional. + * + * @type string $etag + * If provided, this value must match the current value of the + * target Backup's [etag][google.cloud.gkebackup.v1.Backup.etag] field or the request is + * rejected. + * @type bool $force + * If set to true, any VolumeBackups below this Backup will also be deleted. + * Otherwise, the request will only succeed if the Backup has no + * VolumeBackups. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function deleteBackup($name, array $optionalArgs = []) + { + $request = new DeleteBackupRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['etag'])) { + $request->setEtag($optionalArgs['etag']); + } + + if (isset($optionalArgs['force'])) { + $request->setForce($optionalArgs['force']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('DeleteBackup', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Deletes an existing BackupPlan. + * + * Sample code: + * ``` + * $backupForGKEClient = new BackupForGKEClient(); + * try { + * $formattedName = $backupForGKEClient->backupPlanName('[PROJECT]', '[LOCATION]', '[BACKUP_PLAN]'); + * $operationResponse = $backupForGKEClient->deleteBackupPlan($formattedName); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $backupForGKEClient->deleteBackupPlan($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $backupForGKEClient->resumeOperation($operationName, 'deleteBackupPlan'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $backupForGKEClient->close(); + * } + * ``` + * + * @param string $name Required. Fully qualified BackupPlan name. + * Format: projects/*/locations/*/backupPlans/* + * @param array $optionalArgs { + * Optional. + * + * @type string $etag + * If provided, this value must match the current value of the + * target BackupPlan's [etag][google.cloud.gkebackup.v1.BackupPlan.etag] field or the request is + * rejected. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function deleteBackupPlan($name, array $optionalArgs = []) + { + $request = new DeleteBackupPlanRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['etag'])) { + $request->setEtag($optionalArgs['etag']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('DeleteBackupPlan', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Deletes an existing Restore. + * + * Sample code: + * ``` + * $backupForGKEClient = new BackupForGKEClient(); + * try { + * $formattedName = $backupForGKEClient->restoreName('[PROJECT]', '[LOCATION]', '[RESTORE_PLAN]', '[RESTORE]'); + * $operationResponse = $backupForGKEClient->deleteRestore($formattedName); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $backupForGKEClient->deleteRestore($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $backupForGKEClient->resumeOperation($operationName, 'deleteRestore'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $backupForGKEClient->close(); + * } + * ``` + * + * @param string $name Required. Full name of the Restore + * Format: projects/*/locations/*/restorePlans/*/restores/* + * @param array $optionalArgs { + * Optional. + * + * @type string $etag + * If provided, this value must match the current value of the + * target Restore's [etag][google.cloud.gkebackup.v1.Restore.etag] field or the request is + * rejected. + * @type bool $force + * If set to true, any VolumeRestores below this restore will also be deleted. + * Otherwise, the request will only succeed if the restore has no + * VolumeRestores. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function deleteRestore($name, array $optionalArgs = []) + { + $request = new DeleteRestoreRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['etag'])) { + $request->setEtag($optionalArgs['etag']); + } + + if (isset($optionalArgs['force'])) { + $request->setForce($optionalArgs['force']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('DeleteRestore', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Deletes an existing RestorePlan. + * + * Sample code: + * ``` + * $backupForGKEClient = new BackupForGKEClient(); + * try { + * $formattedName = $backupForGKEClient->restorePlanName('[PROJECT]', '[LOCATION]', '[RESTORE_PLAN]'); + * $operationResponse = $backupForGKEClient->deleteRestorePlan($formattedName); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $backupForGKEClient->deleteRestorePlan($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $backupForGKEClient->resumeOperation($operationName, 'deleteRestorePlan'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $backupForGKEClient->close(); + * } + * ``` + * + * @param string $name Required. Fully qualified RestorePlan name. + * Format: projects/*/locations/*/restorePlans/* + * @param array $optionalArgs { + * Optional. + * + * @type string $etag + * If provided, this value must match the current value of the + * target RestorePlan's [etag][google.cloud.gkebackup.v1.RestorePlan.etag] field or the request is + * rejected. + * @type bool $force + * If set to true, any Restores below this RestorePlan will also be deleted. + * Otherwise, the request will only succeed if the RestorePlan has no + * Restores. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function deleteRestorePlan($name, array $optionalArgs = []) + { + $request = new DeleteRestorePlanRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['etag'])) { + $request->setEtag($optionalArgs['etag']); + } + + if (isset($optionalArgs['force'])) { + $request->setForce($optionalArgs['force']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('DeleteRestorePlan', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Retrieve the details of a single Backup. + * + * Sample code: + * ``` + * $backupForGKEClient = new BackupForGKEClient(); + * try { + * $formattedName = $backupForGKEClient->backupName('[PROJECT]', '[LOCATION]', '[BACKUP_PLAN]', '[BACKUP]'); + * $response = $backupForGKEClient->getBackup($formattedName); + * } finally { + * $backupForGKEClient->close(); + * } + * ``` + * + * @param string $name Required. Full name of the Backup resource. + * Format: projects/*/locations/*/backupPlans/*/backups/* + * @param array $optionalArgs { + * 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 \Google\Cloud\GkeBackup\V1\Backup + * + * @throws ApiException if the remote call fails + */ + public function getBackup($name, array $optionalArgs = []) + { + $request = new GetBackupRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetBackup', Backup::class, $optionalArgs, $request)->wait(); + } + + /** + * Retrieve the details of a single BackupPlan. + * + * Sample code: + * ``` + * $backupForGKEClient = new BackupForGKEClient(); + * try { + * $formattedName = $backupForGKEClient->backupPlanName('[PROJECT]', '[LOCATION]', '[BACKUP_PLAN]'); + * $response = $backupForGKEClient->getBackupPlan($formattedName); + * } finally { + * $backupForGKEClient->close(); + * } + * ``` + * + * @param string $name Required. Fully qualified BackupPlan name. + * Format: projects/*/locations/*/backupPlans/* + * @param array $optionalArgs { + * 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 \Google\Cloud\GkeBackup\V1\BackupPlan + * + * @throws ApiException if the remote call fails + */ + public function getBackupPlan($name, array $optionalArgs = []) + { + $request = new GetBackupPlanRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetBackupPlan', BackupPlan::class, $optionalArgs, $request)->wait(); + } + + /** + * Retrieves the details of a single Restore. + * + * Sample code: + * ``` + * $backupForGKEClient = new BackupForGKEClient(); + * try { + * $formattedName = $backupForGKEClient->restoreName('[PROJECT]', '[LOCATION]', '[RESTORE_PLAN]', '[RESTORE]'); + * $response = $backupForGKEClient->getRestore($formattedName); + * } finally { + * $backupForGKEClient->close(); + * } + * ``` + * + * @param string $name Required. Name of the restore resource. + * Format: projects/*/locations/*/restorePlans/*/restores/* + * @param array $optionalArgs { + * 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 \Google\Cloud\GkeBackup\V1\Restore + * + * @throws ApiException if the remote call fails + */ + public function getRestore($name, array $optionalArgs = []) + { + $request = new GetRestoreRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetRestore', Restore::class, $optionalArgs, $request)->wait(); + } + + /** + * Retrieve the details of a single RestorePlan. + * + * Sample code: + * ``` + * $backupForGKEClient = new BackupForGKEClient(); + * try { + * $formattedName = $backupForGKEClient->restorePlanName('[PROJECT]', '[LOCATION]', '[RESTORE_PLAN]'); + * $response = $backupForGKEClient->getRestorePlan($formattedName); + * } finally { + * $backupForGKEClient->close(); + * } + * ``` + * + * @param string $name Required. Fully qualified RestorePlan name. + * Format: projects/*/locations/*/restorePlans/* + * @param array $optionalArgs { + * 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 \Google\Cloud\GkeBackup\V1\RestorePlan + * + * @throws ApiException if the remote call fails + */ + public function getRestorePlan($name, array $optionalArgs = []) + { + $request = new GetRestorePlanRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetRestorePlan', RestorePlan::class, $optionalArgs, $request)->wait(); + } + + /** + * Retrieve the details of a single VolumeBackup. + * + * Sample code: + * ``` + * $backupForGKEClient = new BackupForGKEClient(); + * try { + * $formattedName = $backupForGKEClient->volumeBackupName('[PROJECT]', '[LOCATION]', '[BACKUP_PLAN]', '[BACKUP]', '[VOLUME_BACKUP]'); + * $response = $backupForGKEClient->getVolumeBackup($formattedName); + * } finally { + * $backupForGKEClient->close(); + * } + * ``` + * + * @param string $name Required. Full name of the VolumeBackup resource. + * Format: projects/*/locations/*/backupPlans/*/backups/*/volumeBackups/* + * @param array $optionalArgs { + * 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 \Google\Cloud\GkeBackup\V1\VolumeBackup + * + * @throws ApiException if the remote call fails + */ + public function getVolumeBackup($name, array $optionalArgs = []) + { + $request = new GetVolumeBackupRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetVolumeBackup', VolumeBackup::class, $optionalArgs, $request)->wait(); + } + + /** + * Retrieve the details of a single VolumeRestore. + * + * Sample code: + * ``` + * $backupForGKEClient = new BackupForGKEClient(); + * try { + * $formattedName = $backupForGKEClient->volumeRestoreName('[PROJECT]', '[LOCATION]', '[RESTORE_PLAN]', '[RESTORE]', '[VOLUME_RESTORE]'); + * $response = $backupForGKEClient->getVolumeRestore($formattedName); + * } finally { + * $backupForGKEClient->close(); + * } + * ``` + * + * @param string $name Required. Full name of the VolumeRestore resource. + * Format: projects/*/locations/*/restorePlans/*/restores/*/volumeRestores/* + * @param array $optionalArgs { + * 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 \Google\Cloud\GkeBackup\V1\VolumeRestore + * + * @throws ApiException if the remote call fails + */ + public function getVolumeRestore($name, array $optionalArgs = []) + { + $request = new GetVolumeRestoreRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetVolumeRestore', VolumeRestore::class, $optionalArgs, $request)->wait(); + } + + /** + * Lists BackupPlans in a given location. + * + * Sample code: + * ``` + * $backupForGKEClient = new BackupForGKEClient(); + * try { + * $formattedParent = $backupForGKEClient->locationName('[PROJECT]', '[LOCATION]'); + * // Iterate over pages of elements + * $pagedResponse = $backupForGKEClient->listBackupPlans($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $backupForGKEClient->listBackupPlans($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $backupForGKEClient->close(); + * } + * ``` + * + * @param string $parent Required. The location that contains the BackupPlans to list. + * Format: projects/*/locations/* + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type string $filter + * Field match expression used to filter the results. + * @type string $orderBy + * Field by which to sort the results. + * @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 \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listBackupPlans($parent, array $optionalArgs = []) + { + $request = new ListBackupPlansRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListBackupPlans', $optionalArgs, ListBackupPlansResponse::class, $request); + } + + /** + * Lists the Backups for a given BackupPlan. + * + * Sample code: + * ``` + * $backupForGKEClient = new BackupForGKEClient(); + * try { + * $formattedParent = $backupForGKEClient->backupPlanName('[PROJECT]', '[LOCATION]', '[BACKUP_PLAN]'); + * // Iterate over pages of elements + * $pagedResponse = $backupForGKEClient->listBackups($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $backupForGKEClient->listBackups($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $backupForGKEClient->close(); + * } + * ``` + * + * @param string $parent Required. The BackupPlan that contains the Backups to list. + * Format: projects/*/locations/*/backupPlans/* + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type string $filter + * Field match expression used to filter the results. + * @type string $orderBy + * Field by which to sort the results. + * @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 \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listBackups($parent, array $optionalArgs = []) + { + $request = new ListBackupsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListBackups', $optionalArgs, ListBackupsResponse::class, $request); + } + + /** + * Lists RestorePlans in a given location. + * + * Sample code: + * ``` + * $backupForGKEClient = new BackupForGKEClient(); + * try { + * $formattedParent = $backupForGKEClient->locationName('[PROJECT]', '[LOCATION]'); + * // Iterate over pages of elements + * $pagedResponse = $backupForGKEClient->listRestorePlans($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $backupForGKEClient->listRestorePlans($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $backupForGKEClient->close(); + * } + * ``` + * + * @param string $parent Required. The location that contains the RestorePlans to list. + * Format: projects/*/locations/* + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type string $filter + * Field match expression used to filter the results. + * @type string $orderBy + * Field by which to sort the results. + * @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 \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listRestorePlans($parent, array $optionalArgs = []) + { + $request = new ListRestorePlansRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListRestorePlans', $optionalArgs, ListRestorePlansResponse::class, $request); + } + + /** + * Lists the Restores for a given RestorePlan. + * + * Sample code: + * ``` + * $backupForGKEClient = new BackupForGKEClient(); + * try { + * $formattedParent = $backupForGKEClient->restorePlanName('[PROJECT]', '[LOCATION]', '[RESTORE_PLAN]'); + * // Iterate over pages of elements + * $pagedResponse = $backupForGKEClient->listRestores($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $backupForGKEClient->listRestores($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $backupForGKEClient->close(); + * } + * ``` + * + * @param string $parent Required. The RestorePlan that contains the Restores to list. + * Format: projects/*/locations/*/restorePlans/* + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type string $filter + * Field match expression used to filter the results. + * @type string $orderBy + * Field by which to sort the results. + * @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 \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listRestores($parent, array $optionalArgs = []) + { + $request = new ListRestoresRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListRestores', $optionalArgs, ListRestoresResponse::class, $request); + } + + /** + * Lists the VolumeBackups for a given Backup. + * + * Sample code: + * ``` + * $backupForGKEClient = new BackupForGKEClient(); + * try { + * $formattedParent = $backupForGKEClient->backupName('[PROJECT]', '[LOCATION]', '[BACKUP_PLAN]', '[BACKUP]'); + * // Iterate over pages of elements + * $pagedResponse = $backupForGKEClient->listVolumeBackups($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $backupForGKEClient->listVolumeBackups($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $backupForGKEClient->close(); + * } + * ``` + * + * @param string $parent Required. The Backup that contains the VolumeBackups to list. + * Format: projects/*/locations/*/backupPlans/*/backups/* + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type string $filter + * Field match expression used to filter the results. + * @type string $orderBy + * Field by which to sort the results. + * @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 \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listVolumeBackups($parent, array $optionalArgs = []) + { + $request = new ListVolumeBackupsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListVolumeBackups', $optionalArgs, ListVolumeBackupsResponse::class, $request); + } + + /** + * Lists the VolumeRestores for a given Restore. + * + * Sample code: + * ``` + * $backupForGKEClient = new BackupForGKEClient(); + * try { + * $formattedParent = $backupForGKEClient->restoreName('[PROJECT]', '[LOCATION]', '[RESTORE_PLAN]', '[RESTORE]'); + * // Iterate over pages of elements + * $pagedResponse = $backupForGKEClient->listVolumeRestores($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $backupForGKEClient->listVolumeRestores($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $backupForGKEClient->close(); + * } + * ``` + * + * @param string $parent Required. The Restore that contains the VolumeRestores to list. + * Format: projects/*/locations/*/restorePlans/*/restores/* + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type string $filter + * Field match expression used to filter the results. + * @type string $orderBy + * Field by which to sort the results. + * @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 \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listVolumeRestores($parent, array $optionalArgs = []) + { + $request = new ListVolumeRestoresRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListVolumeRestores', $optionalArgs, ListVolumeRestoresResponse::class, $request); + } + + /** + * Update a Backup. + * + * Sample code: + * ``` + * $backupForGKEClient = new BackupForGKEClient(); + * try { + * $backup = new Backup(); + * $operationResponse = $backupForGKEClient->updateBackup($backup); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $backupForGKEClient->updateBackup($backup); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $backupForGKEClient->resumeOperation($operationName, 'updateBackup'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $backupForGKEClient->close(); + * } + * ``` + * + * @param Backup $backup Required. A new version of the Backup resource that contains updated fields. + * This may be sparsely populated if an `update_mask` is provided. + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * This is used to specify the fields to be overwritten in the + * Backup targeted for update. The values for each of these + * updated fields will be taken from the `backup_plan` provided + * with this request. Field names are relative to the root of the resource. + * If no `update_mask` is provided, all fields in `backup` will be + * written to the target Backup resource. + * Note that OUTPUT_ONLY and IMMUTABLE fields in `backup` are ignored + * and are not used to update the target Backup. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function updateBackup($backup, array $optionalArgs = []) + { + $request = new UpdateBackupRequest(); + $requestParamHeaders = []; + $request->setBackup($backup); + $requestParamHeaders['backup.name'] = $backup->getName(); + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('UpdateBackup', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Update a BackupPlan. + * + * Sample code: + * ``` + * $backupForGKEClient = new BackupForGKEClient(); + * try { + * $backupPlan = new BackupPlan(); + * $operationResponse = $backupForGKEClient->updateBackupPlan($backupPlan); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $backupForGKEClient->updateBackupPlan($backupPlan); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $backupForGKEClient->resumeOperation($operationName, 'updateBackupPlan'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $backupForGKEClient->close(); + * } + * ``` + * + * @param BackupPlan $backupPlan Required. A new version of the BackupPlan resource that contains updated fields. + * This may be sparsely populated if an `update_mask` is provided. + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * This is used to specify the fields to be overwritten in the + * BackupPlan targeted for update. The values for each of these + * updated fields will be taken from the `backup_plan` provided + * with this request. Field names are relative to the root of the resource + * (e.g., `description`, `backup_config.include_volume_data`, etc.) + * If no `update_mask` is provided, all fields in `backup_plan` will be + * written to the target BackupPlan resource. + * Note that OUTPUT_ONLY and IMMUTABLE fields in `backup_plan` are ignored + * and are not used to update the target BackupPlan. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function updateBackupPlan($backupPlan, array $optionalArgs = []) + { + $request = new UpdateBackupPlanRequest(); + $requestParamHeaders = []; + $request->setBackupPlan($backupPlan); + $requestParamHeaders['backup_plan.name'] = $backupPlan->getName(); + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('UpdateBackupPlan', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Update a Restore. + * + * Sample code: + * ``` + * $backupForGKEClient = new BackupForGKEClient(); + * try { + * $restore = new Restore(); + * $operationResponse = $backupForGKEClient->updateRestore($restore); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $backupForGKEClient->updateRestore($restore); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $backupForGKEClient->resumeOperation($operationName, 'updateRestore'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $backupForGKEClient->close(); + * } + * ``` + * + * @param Restore $restore Required. A new version of the Restore resource that contains updated fields. + * This may be sparsely populated if an `update_mask` is provided. + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * This is used to specify the fields to be overwritten in the + * Restore targeted for update. The values for each of these + * updated fields will be taken from the `restore` provided + * with this request. Field names are relative to the root of the resource. + * If no `update_mask` is provided, all fields in `restore` will be + * written to the target Restore resource. + * Note that OUTPUT_ONLY and IMMUTABLE fields in `restore` are ignored + * and are not used to update the target Restore. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function updateRestore($restore, array $optionalArgs = []) + { + $request = new UpdateRestoreRequest(); + $requestParamHeaders = []; + $request->setRestore($restore); + $requestParamHeaders['restore.name'] = $restore->getName(); + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('UpdateRestore', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Update a RestorePlan. + * + * Sample code: + * ``` + * $backupForGKEClient = new BackupForGKEClient(); + * try { + * $restorePlan = new RestorePlan(); + * $operationResponse = $backupForGKEClient->updateRestorePlan($restorePlan); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $backupForGKEClient->updateRestorePlan($restorePlan); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $backupForGKEClient->resumeOperation($operationName, 'updateRestorePlan'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $backupForGKEClient->close(); + * } + * ``` + * + * @param RestorePlan $restorePlan Required. A new version of the RestorePlan resource that contains updated fields. + * This may be sparsely populated if an `update_mask` is provided. + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * This is used to specify the fields to be overwritten in the + * RestorePlan targeted for update. The values for each of these + * updated fields will be taken from the `restore_plan` provided + * with this request. Field names are relative to the root of the resource. + * If no `update_mask` is provided, all fields in `restore_plan` will be + * written to the target RestorePlan resource. + * Note that OUTPUT_ONLY and IMMUTABLE fields in `restore_plan` are ignored + * and are not used to update the target RestorePlan. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function updateRestorePlan($restorePlan, array $optionalArgs = []) + { + $request = new UpdateRestorePlanRequest(); + $requestParamHeaders = []; + $request->setRestorePlan($restorePlan); + $requestParamHeaders['restore_plan.name'] = $restorePlan->getName(); + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('UpdateRestorePlan', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } +} diff --git a/owl-bot-staging/GkeBackup/v1/src/V1/gapic_metadata.json b/owl-bot-staging/GkeBackup/v1/src/V1/gapic_metadata.json new file mode 100644 index 000000000000..cf8e54b5b4d3 --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/src/V1/gapic_metadata.json @@ -0,0 +1,138 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services\/RPCs to the corresponding library clients\/methods", + "language": "php", + "protoPackage": "google.cloud.gkebackup.v1", + "libraryPackage": "Google\\Cloud\\GkeBackup\\V1", + "services": { + "BackupForGKE": { + "clients": { + "grpc": { + "libraryClient": "BackupForGKEGapicClient", + "rpcs": { + "CreateBackup": { + "methods": [ + "createBackup" + ] + }, + "CreateBackupPlan": { + "methods": [ + "createBackupPlan" + ] + }, + "CreateRestore": { + "methods": [ + "createRestore" + ] + }, + "CreateRestorePlan": { + "methods": [ + "createRestorePlan" + ] + }, + "DeleteBackup": { + "methods": [ + "deleteBackup" + ] + }, + "DeleteBackupPlan": { + "methods": [ + "deleteBackupPlan" + ] + }, + "DeleteRestore": { + "methods": [ + "deleteRestore" + ] + }, + "DeleteRestorePlan": { + "methods": [ + "deleteRestorePlan" + ] + }, + "GetBackup": { + "methods": [ + "getBackup" + ] + }, + "GetBackupPlan": { + "methods": [ + "getBackupPlan" + ] + }, + "GetRestore": { + "methods": [ + "getRestore" + ] + }, + "GetRestorePlan": { + "methods": [ + "getRestorePlan" + ] + }, + "GetVolumeBackup": { + "methods": [ + "getVolumeBackup" + ] + }, + "GetVolumeRestore": { + "methods": [ + "getVolumeRestore" + ] + }, + "ListBackupPlans": { + "methods": [ + "listBackupPlans" + ] + }, + "ListBackups": { + "methods": [ + "listBackups" + ] + }, + "ListRestorePlans": { + "methods": [ + "listRestorePlans" + ] + }, + "ListRestores": { + "methods": [ + "listRestores" + ] + }, + "ListVolumeBackups": { + "methods": [ + "listVolumeBackups" + ] + }, + "ListVolumeRestores": { + "methods": [ + "listVolumeRestores" + ] + }, + "UpdateBackup": { + "methods": [ + "updateBackup" + ] + }, + "UpdateBackupPlan": { + "methods": [ + "updateBackupPlan" + ] + }, + "UpdateRestore": { + "methods": [ + "updateRestore" + ] + }, + "UpdateRestorePlan": { + "methods": [ + "updateRestorePlan" + ] + } + } + } + } + } + } +} \ No newline at end of file diff --git a/owl-bot-staging/GkeBackup/v1/src/V1/resources/backup_for_gke_client_config.json b/owl-bot-staging/GkeBackup/v1/src/V1/resources/backup_for_gke_client_config.json new file mode 100644 index 000000000000..7c86f570ac49 --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/src/V1/resources/backup_for_gke_client_config.json @@ -0,0 +1,184 @@ +{ + "interfaces": { + "google.cloud.gkebackup.v1.BackupForGKE": { + "retry_codes": { + "no_retry_codes": [], + "retry_policy_1_codes": [ + "UNAVAILABLE" + ], + "no_retry_1_codes": [], + "no_retry_2_codes": [], + "no_retry_3_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": 1.3, + "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 + }, + "no_retry_2_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 120000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 120000, + "total_timeout_millis": 120000 + }, + "no_retry_3_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 300000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 300000, + "total_timeout_millis": 300000 + } + }, + "methods": { + "CreateBackup": { + "timeout_millis": 120000, + "retry_codes_name": "no_retry_2_codes", + "retry_params_name": "no_retry_2_params" + }, + "CreateBackupPlan": { + "timeout_millis": 300000, + "retry_codes_name": "no_retry_3_codes", + "retry_params_name": "no_retry_3_params" + }, + "CreateRestore": { + "timeout_millis": 120000, + "retry_codes_name": "no_retry_2_codes", + "retry_params_name": "no_retry_2_params" + }, + "CreateRestorePlan": { + "timeout_millis": 120000, + "retry_codes_name": "no_retry_2_codes", + "retry_params_name": "no_retry_2_params" + }, + "DeleteBackup": { + "timeout_millis": 300000, + "retry_codes_name": "no_retry_3_codes", + "retry_params_name": "no_retry_3_params" + }, + "DeleteBackupPlan": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "DeleteRestore": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "DeleteRestorePlan": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "GetBackup": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetBackupPlan": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetRestore": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetRestorePlan": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetVolumeBackup": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetVolumeRestore": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListBackupPlans": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListBackups": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListRestorePlans": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListRestores": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListVolumeBackups": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListVolumeRestores": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "UpdateBackup": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "UpdateBackupPlan": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "UpdateRestore": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "UpdateRestorePlan": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + } + } + } + } +} diff --git a/owl-bot-staging/GkeBackup/v1/src/V1/resources/backup_for_gke_descriptor_config.php b/owl-bot-staging/GkeBackup/v1/src/V1/resources/backup_for_gke_descriptor_config.php new file mode 100644 index 000000000000..25eb5e1a1e17 --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/src/V1/resources/backup_for_gke_descriptor_config.php @@ -0,0 +1,443 @@ + [ + 'google.cloud.gkebackup.v1.BackupForGKE' => [ + 'CreateBackup' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\GkeBackup\V1\Backup', + 'metadataReturnType' => '\Google\Cloud\GkeBackup\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'CreateBackupPlan' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\GkeBackup\V1\BackupPlan', + 'metadataReturnType' => '\Google\Cloud\GkeBackup\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'CreateRestore' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\GkeBackup\V1\Restore', + 'metadataReturnType' => '\Google\Cloud\GkeBackup\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'CreateRestorePlan' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\GkeBackup\V1\RestorePlan', + 'metadataReturnType' => '\Google\Cloud\GkeBackup\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'DeleteBackup' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\GkeBackup\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'DeleteBackupPlan' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\GkeBackup\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'DeleteRestore' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\GkeBackup\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'DeleteRestorePlan' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\GkeBackup\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'UpdateBackup' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\GkeBackup\V1\Backup', + 'metadataReturnType' => '\Google\Cloud\GkeBackup\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'backup.name', + 'fieldAccessors' => [ + 'getBackup', + 'getName', + ], + ], + ], + ], + 'UpdateBackupPlan' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\GkeBackup\V1\BackupPlan', + 'metadataReturnType' => '\Google\Cloud\GkeBackup\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'backup_plan.name', + 'fieldAccessors' => [ + 'getBackupPlan', + 'getName', + ], + ], + ], + ], + 'UpdateRestore' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\GkeBackup\V1\Restore', + 'metadataReturnType' => '\Google\Cloud\GkeBackup\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'restore.name', + 'fieldAccessors' => [ + 'getRestore', + 'getName', + ], + ], + ], + ], + 'UpdateRestorePlan' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\GkeBackup\V1\RestorePlan', + 'metadataReturnType' => '\Google\Cloud\GkeBackup\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'restore_plan.name', + 'fieldAccessors' => [ + 'getRestorePlan', + 'getName', + ], + ], + ], + ], + 'GetBackup' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\GkeBackup\V1\Backup', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetBackupPlan' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\GkeBackup\V1\BackupPlan', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetRestore' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\GkeBackup\V1\Restore', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetRestorePlan' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\GkeBackup\V1\RestorePlan', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetVolumeBackup' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\GkeBackup\V1\VolumeBackup', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetVolumeRestore' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\GkeBackup\V1\VolumeRestore', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'ListBackupPlans' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getBackupPlans', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\GkeBackup\V1\ListBackupPlansResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListBackups' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getBackups', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\GkeBackup\V1\ListBackupsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListRestorePlans' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getRestorePlans', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\GkeBackup\V1\ListRestorePlansResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListRestores' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getRestores', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\GkeBackup\V1\ListRestoresResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListVolumeBackups' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getVolumeBackups', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\GkeBackup\V1\ListVolumeBackupsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListVolumeRestores' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getVolumeRestores', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\GkeBackup\V1\ListVolumeRestoresResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'templateMap' => [ + 'backup' => 'projects/{project}/locations/{location}/backupPlans/{backup_plan}/backups/{backup}', + 'backupPlan' => 'projects/{project}/locations/{location}/backupPlans/{backup_plan}', + 'cluster' => 'projects/{project}/locations/{location}/clusters/{cluster}', + 'cryptoKey' => 'projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}', + 'location' => 'projects/{project}/locations/{location}', + 'restore' => 'projects/{project}/locations/{location}/restorePlans/{restore_plan}/restores/{restore}', + 'restorePlan' => 'projects/{project}/locations/{location}/restorePlans/{restore_plan}', + 'volumeBackup' => 'projects/{project}/locations/{location}/backupPlans/{backup_plan}/backups/{backup}/volumeBackups/{volume_backup}', + 'volumeRestore' => 'projects/{project}/locations/{location}/restorePlans/{restore_plan}/restores/{restore}/volumeRestores/{volume_restore}', + ], + ], + ], +]; diff --git a/owl-bot-staging/GkeBackup/v1/src/V1/resources/backup_for_gke_rest_client_config.php b/owl-bot-staging/GkeBackup/v1/src/V1/resources/backup_for_gke_rest_client_config.php new file mode 100644 index 000000000000..043e32abae6d --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/src/V1/resources/backup_for_gke_rest_client_config.php @@ -0,0 +1,478 @@ + [ + 'google.cloud.gkebackup.v1.BackupForGKE' => [ + 'CreateBackup' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/backupPlans/*}/backups', + 'body' => 'backup', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'CreateBackupPlan' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/backupPlans', + 'body' => 'backup_plan', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'backup_plan_id', + ], + ], + 'CreateRestore' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/restorePlans/*}/restores', + 'body' => 'restore', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'restore_id', + ], + ], + 'CreateRestorePlan' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/restorePlans', + 'body' => 'restore_plan', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'restore_plan_id', + ], + ], + 'DeleteBackup' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/backupPlans/*/backups/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteBackupPlan' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/backupPlans/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteRestore' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/restorePlans/*/restores/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteRestorePlan' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/restorePlans/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetBackup' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/backupPlans/*/backups/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetBackupPlan' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/backupPlans/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetRestore' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/restorePlans/*/restores/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetRestorePlan' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/restorePlans/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetVolumeBackup' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/backupPlans/*/backups/*/volumeBackups/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetVolumeRestore' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/restorePlans/*/restores/*/volumeRestores/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListBackupPlans' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/backupPlans', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListBackups' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/backupPlans/*}/backups', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListRestorePlans' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/restorePlans', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListRestores' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/restorePlans/*}/restores', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListVolumeBackups' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/backupPlans/*/backups/*}/volumeBackups', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListVolumeRestores' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/restorePlans/*/restores/*}/volumeRestores', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'UpdateBackup' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{backup.name=projects/*/locations/*/backupPlans/*/backups/*}', + 'body' => 'backup', + 'placeholders' => [ + 'backup.name' => [ + 'getters' => [ + 'getBackup', + 'getName', + ], + ], + ], + ], + 'UpdateBackupPlan' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{backup_plan.name=projects/*/locations/*/backupPlans/*}', + 'body' => 'backup_plan', + 'placeholders' => [ + 'backup_plan.name' => [ + 'getters' => [ + 'getBackupPlan', + 'getName', + ], + ], + ], + ], + 'UpdateRestore' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{restore.name=projects/*/locations/*/restorePlans/*/restores/*}', + 'body' => 'restore', + 'placeholders' => [ + 'restore.name' => [ + 'getters' => [ + 'getRestore', + 'getName', + ], + ], + ], + ], + 'UpdateRestorePlan' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{restore_plan.name=projects/*/locations/*/restorePlans/*}', + 'body' => 'restore_plan', + 'placeholders' => [ + 'restore_plan.name' => [ + 'getters' => [ + 'getRestorePlan', + 'getName', + ], + ], + ], + ], + ], + 'google.cloud.location.Locations' => [ + 'GetLocation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListLocations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*}/locations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + 'google.iam.v1.IAMPolicy' => [ + 'GetIamPolicy' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/backupPlans/*}:getIamPolicy', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/backupPlans/*/backups/*}:getIamPolicy', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/backupPlans/*/backups/*/volumeBackups/*}:getIamPolicy', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/restorePlans/*}:getIamPolicy', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/restorePlans/*/restores/*}:getIamPolicy', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/restorePlans/*/restores/*/volumeRestores/*}:getIamPolicy', + ], + ], + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + 'SetIamPolicy' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/backupPlans/*}:setIamPolicy', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/backupPlans/*/backups/*}:setIamPolicy', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/backupPlans/*/backups/*/volumeBackups/*}:setIamPolicy', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/restorePlans/*}:setIamPolicy', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/restorePlans/*/restores/*}:setIamPolicy', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/restorePlans/*/restores/*/volumeRestores/*}:setIamPolicy', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + 'TestIamPermissions' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/backupPlans/*}:testIamPermissions', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/backupPlans/*/backups/*}:testIamPermissions', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/backupPlans/*/backups/*/volumeBackups/*}:testIamPermissions', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/restorePlans/*}:testIamPermissions', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/restorePlans/*/restores/*}:testIamPermissions', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/restorePlans/*/restores/*/volumeRestores/*}:testIamPermissions', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + ], + 'google.longrunning.Operations' => [ + 'CancelOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}:cancel', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteOperation' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*}/operations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetOperation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListOperations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*}/operations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/GkeBackup/v1/tests/Unit/V1/BackupForGKEClientTest.php b/owl-bot-staging/GkeBackup/v1/tests/Unit/V1/BackupForGKEClientTest.php new file mode 100644 index 000000000000..312423d11e4b --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/tests/Unit/V1/BackupForGKEClientTest.php @@ -0,0 +1,2568 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return BackupForGKEClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new BackupForGKEClient($options); + } + + /** @test */ + public function createBackupTest() + { + $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/createBackupTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $uid = 'uid115792'; + $manual = true; + $deleteLockDays = 1638724265; + $retainDays = 1380805807; + $allNamespaces = true; + $containsVolumeData = false; + $containsSecrets = false; + $stateReason = 'stateReason282113458'; + $resourceCount = 287552926; + $volumeCount = 1362665558; + $sizeBytes = 1796325715; + $etag = 'etag3123477'; + $description = 'description-1724546052'; + $podCount = 977657493; + $configBackupSizeBytes = 606785139; + $expectedResponse = new Backup(); + $expectedResponse->setName($name); + $expectedResponse->setUid($uid); + $expectedResponse->setManual($manual); + $expectedResponse->setDeleteLockDays($deleteLockDays); + $expectedResponse->setRetainDays($retainDays); + $expectedResponse->setAllNamespaces($allNamespaces); + $expectedResponse->setContainsVolumeData($containsVolumeData); + $expectedResponse->setContainsSecrets($containsSecrets); + $expectedResponse->setStateReason($stateReason); + $expectedResponse->setResourceCount($resourceCount); + $expectedResponse->setVolumeCount($volumeCount); + $expectedResponse->setSizeBytes($sizeBytes); + $expectedResponse->setEtag($etag); + $expectedResponse->setDescription($description); + $expectedResponse->setPodCount($podCount); + $expectedResponse->setConfigBackupSizeBytes($configBackupSizeBytes); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createBackupTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->backupPlanName('[PROJECT]', '[LOCATION]', '[BACKUP_PLAN]'); + $response = $gapicClient->createBackup($formattedParent); + $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.cloud.gkebackup.v1.BackupForGKE/CreateBackup', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createBackupTest'); + $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 createBackupExceptionTest() + { + $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/createBackupTest'); + $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 + $formattedParent = $gapicClient->backupPlanName('[PROJECT]', '[LOCATION]', '[BACKUP_PLAN]'); + $response = $gapicClient->createBackup($formattedParent); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createBackupTest'); + 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 createBackupPlanTest() + { + $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/createBackupPlanTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $uid = 'uid115792'; + $description = 'description-1724546052'; + $cluster = 'cluster872092154'; + $etag = 'etag3123477'; + $deactivated = true; + $protectedPodCount = 1494678716; + $expectedResponse = new BackupPlan(); + $expectedResponse->setName($name); + $expectedResponse->setUid($uid); + $expectedResponse->setDescription($description); + $expectedResponse->setCluster($cluster); + $expectedResponse->setEtag($etag); + $expectedResponse->setDeactivated($deactivated); + $expectedResponse->setProtectedPodCount($protectedPodCount); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createBackupPlanTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $backupPlan = new BackupPlan(); + $backupPlanCluster = $gapicClient->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + $backupPlan->setCluster($backupPlanCluster); + $backupPlanId = 'backupPlanId-25762700'; + $response = $gapicClient->createBackupPlan($formattedParent, $backupPlan, $backupPlanId); + $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.cloud.gkebackup.v1.BackupForGKE/CreateBackupPlan', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getBackupPlan(); + $this->assertProtobufEquals($backupPlan, $actualValue); + $actualValue = $actualApiRequestObject->getBackupPlanId(); + $this->assertProtobufEquals($backupPlanId, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createBackupPlanTest'); + $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 createBackupPlanExceptionTest() + { + $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/createBackupPlanTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $backupPlan = new BackupPlan(); + $backupPlanCluster = $gapicClient->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + $backupPlan->setCluster($backupPlanCluster); + $backupPlanId = 'backupPlanId-25762700'; + $response = $gapicClient->createBackupPlan($formattedParent, $backupPlan, $backupPlanId); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createBackupPlanTest'); + 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 createRestoreTest() + { + $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/createRestoreTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $uid = 'uid115792'; + $description = 'description-1724546052'; + $backup = 'backup-1396673086'; + $cluster = 'cluster872092154'; + $stateReason = 'stateReason282113458'; + $resourcesRestoredCount = 882879616; + $resourcesExcludedCount = 338652236; + $resourcesFailedCount = 217904743; + $volumesRestoredCount = 1005533068; + $etag = 'etag3123477'; + $expectedResponse = new Restore(); + $expectedResponse->setName($name); + $expectedResponse->setUid($uid); + $expectedResponse->setDescription($description); + $expectedResponse->setBackup($backup); + $expectedResponse->setCluster($cluster); + $expectedResponse->setStateReason($stateReason); + $expectedResponse->setResourcesRestoredCount($resourcesRestoredCount); + $expectedResponse->setResourcesExcludedCount($resourcesExcludedCount); + $expectedResponse->setResourcesFailedCount($resourcesFailedCount); + $expectedResponse->setVolumesRestoredCount($volumesRestoredCount); + $expectedResponse->setEtag($etag); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createRestoreTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->restorePlanName('[PROJECT]', '[LOCATION]', '[RESTORE_PLAN]'); + $restore = new Restore(); + $restoreBackup = $gapicClient->backupName('[PROJECT]', '[LOCATION]', '[BACKUP_PLAN]', '[BACKUP]'); + $restore->setBackup($restoreBackup); + $restoreId = 'restoreId-1374819220'; + $response = $gapicClient->createRestore($formattedParent, $restore, $restoreId); + $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.cloud.gkebackup.v1.BackupForGKE/CreateRestore', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getRestore(); + $this->assertProtobufEquals($restore, $actualValue); + $actualValue = $actualApiRequestObject->getRestoreId(); + $this->assertProtobufEquals($restoreId, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createRestoreTest'); + $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 createRestoreExceptionTest() + { + $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/createRestoreTest'); + $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 + $formattedParent = $gapicClient->restorePlanName('[PROJECT]', '[LOCATION]', '[RESTORE_PLAN]'); + $restore = new Restore(); + $restoreBackup = $gapicClient->backupName('[PROJECT]', '[LOCATION]', '[BACKUP_PLAN]', '[BACKUP]'); + $restore->setBackup($restoreBackup); + $restoreId = 'restoreId-1374819220'; + $response = $gapicClient->createRestore($formattedParent, $restore, $restoreId); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createRestoreTest'); + 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 createRestorePlanTest() + { + $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/createRestorePlanTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $uid = 'uid115792'; + $description = 'description-1724546052'; + $backupPlan = 'backupPlan1119623046'; + $cluster = 'cluster872092154'; + $etag = 'etag3123477'; + $expectedResponse = new RestorePlan(); + $expectedResponse->setName($name); + $expectedResponse->setUid($uid); + $expectedResponse->setDescription($description); + $expectedResponse->setBackupPlan($backupPlan); + $expectedResponse->setCluster($cluster); + $expectedResponse->setEtag($etag); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createRestorePlanTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $restorePlan = new RestorePlan(); + $restorePlanBackupPlan = $gapicClient->backupPlanName('[PROJECT]', '[LOCATION]', '[BACKUP_PLAN]'); + $restorePlan->setBackupPlan($restorePlanBackupPlan); + $restorePlanCluster = $gapicClient->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + $restorePlan->setCluster($restorePlanCluster); + $restorePlanRestoreConfig = new RestoreConfig(); + $restorePlan->setRestoreConfig($restorePlanRestoreConfig); + $restorePlanId = 'restorePlanId126727488'; + $response = $gapicClient->createRestorePlan($formattedParent, $restorePlan, $restorePlanId); + $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.cloud.gkebackup.v1.BackupForGKE/CreateRestorePlan', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getRestorePlan(); + $this->assertProtobufEquals($restorePlan, $actualValue); + $actualValue = $actualApiRequestObject->getRestorePlanId(); + $this->assertProtobufEquals($restorePlanId, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createRestorePlanTest'); + $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 createRestorePlanExceptionTest() + { + $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/createRestorePlanTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $restorePlan = new RestorePlan(); + $restorePlanBackupPlan = $gapicClient->backupPlanName('[PROJECT]', '[LOCATION]', '[BACKUP_PLAN]'); + $restorePlan->setBackupPlan($restorePlanBackupPlan); + $restorePlanCluster = $gapicClient->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + $restorePlan->setCluster($restorePlanCluster); + $restorePlanRestoreConfig = new RestoreConfig(); + $restorePlan->setRestoreConfig($restorePlanRestoreConfig); + $restorePlanId = 'restorePlanId126727488'; + $response = $gapicClient->createRestorePlan($formattedParent, $restorePlan, $restorePlanId); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createRestorePlanTest'); + 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 deleteBackupTest() + { + $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/deleteBackupTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteBackupTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->backupName('[PROJECT]', '[LOCATION]', '[BACKUP_PLAN]', '[BACKUP]'); + $response = $gapicClient->deleteBackup($formattedName); + $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.cloud.gkebackup.v1.BackupForGKE/DeleteBackup', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteBackupTest'); + $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 deleteBackupExceptionTest() + { + $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/deleteBackupTest'); + $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->backupName('[PROJECT]', '[LOCATION]', '[BACKUP_PLAN]', '[BACKUP]'); + $response = $gapicClient->deleteBackup($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteBackupTest'); + 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 deleteBackupPlanTest() + { + $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/deleteBackupPlanTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteBackupPlanTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->backupPlanName('[PROJECT]', '[LOCATION]', '[BACKUP_PLAN]'); + $response = $gapicClient->deleteBackupPlan($formattedName); + $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.cloud.gkebackup.v1.BackupForGKE/DeleteBackupPlan', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteBackupPlanTest'); + $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 deleteBackupPlanExceptionTest() + { + $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/deleteBackupPlanTest'); + $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->backupPlanName('[PROJECT]', '[LOCATION]', '[BACKUP_PLAN]'); + $response = $gapicClient->deleteBackupPlan($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteBackupPlanTest'); + 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 deleteRestoreTest() + { + $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/deleteRestoreTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteRestoreTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->restoreName('[PROJECT]', '[LOCATION]', '[RESTORE_PLAN]', '[RESTORE]'); + $response = $gapicClient->deleteRestore($formattedName); + $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.cloud.gkebackup.v1.BackupForGKE/DeleteRestore', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteRestoreTest'); + $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 deleteRestoreExceptionTest() + { + $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/deleteRestoreTest'); + $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->restoreName('[PROJECT]', '[LOCATION]', '[RESTORE_PLAN]', '[RESTORE]'); + $response = $gapicClient->deleteRestore($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteRestoreTest'); + 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 deleteRestorePlanTest() + { + $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/deleteRestorePlanTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteRestorePlanTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->restorePlanName('[PROJECT]', '[LOCATION]', '[RESTORE_PLAN]'); + $response = $gapicClient->deleteRestorePlan($formattedName); + $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.cloud.gkebackup.v1.BackupForGKE/DeleteRestorePlan', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteRestorePlanTest'); + $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 deleteRestorePlanExceptionTest() + { + $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/deleteRestorePlanTest'); + $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->restorePlanName('[PROJECT]', '[LOCATION]', '[RESTORE_PLAN]'); + $response = $gapicClient->deleteRestorePlan($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteRestorePlanTest'); + 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 getBackupTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $uid = 'uid115792'; + $manual = true; + $deleteLockDays = 1638724265; + $retainDays = 1380805807; + $allNamespaces = true; + $containsVolumeData = false; + $containsSecrets = false; + $stateReason = 'stateReason282113458'; + $resourceCount = 287552926; + $volumeCount = 1362665558; + $sizeBytes = 1796325715; + $etag = 'etag3123477'; + $description = 'description-1724546052'; + $podCount = 977657493; + $configBackupSizeBytes = 606785139; + $expectedResponse = new Backup(); + $expectedResponse->setName($name2); + $expectedResponse->setUid($uid); + $expectedResponse->setManual($manual); + $expectedResponse->setDeleteLockDays($deleteLockDays); + $expectedResponse->setRetainDays($retainDays); + $expectedResponse->setAllNamespaces($allNamespaces); + $expectedResponse->setContainsVolumeData($containsVolumeData); + $expectedResponse->setContainsSecrets($containsSecrets); + $expectedResponse->setStateReason($stateReason); + $expectedResponse->setResourceCount($resourceCount); + $expectedResponse->setVolumeCount($volumeCount); + $expectedResponse->setSizeBytes($sizeBytes); + $expectedResponse->setEtag($etag); + $expectedResponse->setDescription($description); + $expectedResponse->setPodCount($podCount); + $expectedResponse->setConfigBackupSizeBytes($configBackupSizeBytes); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->backupName('[PROJECT]', '[LOCATION]', '[BACKUP_PLAN]', '[BACKUP]'); + $response = $gapicClient->getBackup($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkebackup.v1.BackupForGKE/GetBackup', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getBackupExceptionTest() + { + $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->backupName('[PROJECT]', '[LOCATION]', '[BACKUP_PLAN]', '[BACKUP]'); + try { + $gapicClient->getBackup($formattedName); + // 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 getBackupPlanTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $uid = 'uid115792'; + $description = 'description-1724546052'; + $cluster = 'cluster872092154'; + $etag = 'etag3123477'; + $deactivated = true; + $protectedPodCount = 1494678716; + $expectedResponse = new BackupPlan(); + $expectedResponse->setName($name2); + $expectedResponse->setUid($uid); + $expectedResponse->setDescription($description); + $expectedResponse->setCluster($cluster); + $expectedResponse->setEtag($etag); + $expectedResponse->setDeactivated($deactivated); + $expectedResponse->setProtectedPodCount($protectedPodCount); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->backupPlanName('[PROJECT]', '[LOCATION]', '[BACKUP_PLAN]'); + $response = $gapicClient->getBackupPlan($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkebackup.v1.BackupForGKE/GetBackupPlan', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getBackupPlanExceptionTest() + { + $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->backupPlanName('[PROJECT]', '[LOCATION]', '[BACKUP_PLAN]'); + try { + $gapicClient->getBackupPlan($formattedName); + // 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 getRestoreTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $uid = 'uid115792'; + $description = 'description-1724546052'; + $backup = 'backup-1396673086'; + $cluster = 'cluster872092154'; + $stateReason = 'stateReason282113458'; + $resourcesRestoredCount = 882879616; + $resourcesExcludedCount = 338652236; + $resourcesFailedCount = 217904743; + $volumesRestoredCount = 1005533068; + $etag = 'etag3123477'; + $expectedResponse = new Restore(); + $expectedResponse->setName($name2); + $expectedResponse->setUid($uid); + $expectedResponse->setDescription($description); + $expectedResponse->setBackup($backup); + $expectedResponse->setCluster($cluster); + $expectedResponse->setStateReason($stateReason); + $expectedResponse->setResourcesRestoredCount($resourcesRestoredCount); + $expectedResponse->setResourcesExcludedCount($resourcesExcludedCount); + $expectedResponse->setResourcesFailedCount($resourcesFailedCount); + $expectedResponse->setVolumesRestoredCount($volumesRestoredCount); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->restoreName('[PROJECT]', '[LOCATION]', '[RESTORE_PLAN]', '[RESTORE]'); + $response = $gapicClient->getRestore($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkebackup.v1.BackupForGKE/GetRestore', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getRestoreExceptionTest() + { + $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->restoreName('[PROJECT]', '[LOCATION]', '[RESTORE_PLAN]', '[RESTORE]'); + try { + $gapicClient->getRestore($formattedName); + // 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 getRestorePlanTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $uid = 'uid115792'; + $description = 'description-1724546052'; + $backupPlan = 'backupPlan1119623046'; + $cluster = 'cluster872092154'; + $etag = 'etag3123477'; + $expectedResponse = new RestorePlan(); + $expectedResponse->setName($name2); + $expectedResponse->setUid($uid); + $expectedResponse->setDescription($description); + $expectedResponse->setBackupPlan($backupPlan); + $expectedResponse->setCluster($cluster); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->restorePlanName('[PROJECT]', '[LOCATION]', '[RESTORE_PLAN]'); + $response = $gapicClient->getRestorePlan($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkebackup.v1.BackupForGKE/GetRestorePlan', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getRestorePlanExceptionTest() + { + $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->restorePlanName('[PROJECT]', '[LOCATION]', '[RESTORE_PLAN]'); + try { + $gapicClient->getRestorePlan($formattedName); + // 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 getVolumeBackupTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $uid = 'uid115792'; + $volumeBackupHandle = 'volumeBackupHandle-2105959712'; + $storageBytes = 2035244455; + $diskSizeBytes = 275393905; + $stateMessage = 'stateMessage29641305'; + $etag = 'etag3123477'; + $expectedResponse = new VolumeBackup(); + $expectedResponse->setName($name2); + $expectedResponse->setUid($uid); + $expectedResponse->setVolumeBackupHandle($volumeBackupHandle); + $expectedResponse->setStorageBytes($storageBytes); + $expectedResponse->setDiskSizeBytes($diskSizeBytes); + $expectedResponse->setStateMessage($stateMessage); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->volumeBackupName('[PROJECT]', '[LOCATION]', '[BACKUP_PLAN]', '[BACKUP]', '[VOLUME_BACKUP]'); + $response = $gapicClient->getVolumeBackup($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkebackup.v1.BackupForGKE/GetVolumeBackup', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getVolumeBackupExceptionTest() + { + $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->volumeBackupName('[PROJECT]', '[LOCATION]', '[BACKUP_PLAN]', '[BACKUP]', '[VOLUME_BACKUP]'); + try { + $gapicClient->getVolumeBackup($formattedName); + // 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 getVolumeRestoreTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $uid = 'uid115792'; + $volumeBackup = 'volumeBackup664943239'; + $volumeHandle = 'volumeHandle837038829'; + $stateMessage = 'stateMessage29641305'; + $etag = 'etag3123477'; + $expectedResponse = new VolumeRestore(); + $expectedResponse->setName($name2); + $expectedResponse->setUid($uid); + $expectedResponse->setVolumeBackup($volumeBackup); + $expectedResponse->setVolumeHandle($volumeHandle); + $expectedResponse->setStateMessage($stateMessage); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->volumeRestoreName('[PROJECT]', '[LOCATION]', '[RESTORE_PLAN]', '[RESTORE]', '[VOLUME_RESTORE]'); + $response = $gapicClient->getVolumeRestore($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkebackup.v1.BackupForGKE/GetVolumeRestore', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getVolumeRestoreExceptionTest() + { + $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->volumeRestoreName('[PROJECT]', '[LOCATION]', '[RESTORE_PLAN]', '[RESTORE]', '[VOLUME_RESTORE]'); + try { + $gapicClient->getVolumeRestore($formattedName); + // 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 listBackupPlansTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $backupPlansElement = new BackupPlan(); + $backupPlans = [ + $backupPlansElement, + ]; + $expectedResponse = new ListBackupPlansResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setBackupPlans($backupPlans); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->listBackupPlans($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getBackupPlans()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkebackup.v1.BackupForGKE/ListBackupPlans', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listBackupPlansExceptionTest() + { + $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->locationName('[PROJECT]', '[LOCATION]'); + try { + $gapicClient->listBackupPlans($formattedParent); + // 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 listBackupsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $backupsElement = new Backup(); + $backups = [ + $backupsElement, + ]; + $expectedResponse = new ListBackupsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setBackups($backups); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->backupPlanName('[PROJECT]', '[LOCATION]', '[BACKUP_PLAN]'); + $response = $gapicClient->listBackups($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getBackups()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkebackup.v1.BackupForGKE/ListBackups', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listBackupsExceptionTest() + { + $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->backupPlanName('[PROJECT]', '[LOCATION]', '[BACKUP_PLAN]'); + try { + $gapicClient->listBackups($formattedParent); + // 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 listRestorePlansTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $restorePlansElement = new RestorePlan(); + $restorePlans = [ + $restorePlansElement, + ]; + $expectedResponse = new ListRestorePlansResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setRestorePlans($restorePlans); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->listRestorePlans($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getRestorePlans()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkebackup.v1.BackupForGKE/ListRestorePlans', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listRestorePlansExceptionTest() + { + $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->locationName('[PROJECT]', '[LOCATION]'); + try { + $gapicClient->listRestorePlans($formattedParent); + // 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 listRestoresTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $restoresElement = new Restore(); + $restores = [ + $restoresElement, + ]; + $expectedResponse = new ListRestoresResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setRestores($restores); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->restorePlanName('[PROJECT]', '[LOCATION]', '[RESTORE_PLAN]'); + $response = $gapicClient->listRestores($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getRestores()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkebackup.v1.BackupForGKE/ListRestores', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listRestoresExceptionTest() + { + $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->restorePlanName('[PROJECT]', '[LOCATION]', '[RESTORE_PLAN]'); + try { + $gapicClient->listRestores($formattedParent); + // 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 listVolumeBackupsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $volumeBackupsElement = new VolumeBackup(); + $volumeBackups = [ + $volumeBackupsElement, + ]; + $expectedResponse = new ListVolumeBackupsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setVolumeBackups($volumeBackups); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->backupName('[PROJECT]', '[LOCATION]', '[BACKUP_PLAN]', '[BACKUP]'); + $response = $gapicClient->listVolumeBackups($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getVolumeBackups()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkebackup.v1.BackupForGKE/ListVolumeBackups', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listVolumeBackupsExceptionTest() + { + $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->backupName('[PROJECT]', '[LOCATION]', '[BACKUP_PLAN]', '[BACKUP]'); + try { + $gapicClient->listVolumeBackups($formattedParent); + // 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 listVolumeRestoresTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $volumeRestoresElement = new VolumeRestore(); + $volumeRestores = [ + $volumeRestoresElement, + ]; + $expectedResponse = new ListVolumeRestoresResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setVolumeRestores($volumeRestores); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->restoreName('[PROJECT]', '[LOCATION]', '[RESTORE_PLAN]', '[RESTORE]'); + $response = $gapicClient->listVolumeRestores($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getVolumeRestores()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkebackup.v1.BackupForGKE/ListVolumeRestores', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listVolumeRestoresExceptionTest() + { + $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->restoreName('[PROJECT]', '[LOCATION]', '[RESTORE_PLAN]', '[RESTORE]'); + try { + $gapicClient->listVolumeRestores($formattedParent); + // 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 updateBackupTest() + { + $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/updateBackupTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $uid = 'uid115792'; + $manual = true; + $deleteLockDays = 1638724265; + $retainDays = 1380805807; + $allNamespaces = true; + $containsVolumeData = false; + $containsSecrets = false; + $stateReason = 'stateReason282113458'; + $resourceCount = 287552926; + $volumeCount = 1362665558; + $sizeBytes = 1796325715; + $etag = 'etag3123477'; + $description = 'description-1724546052'; + $podCount = 977657493; + $configBackupSizeBytes = 606785139; + $expectedResponse = new Backup(); + $expectedResponse->setName($name); + $expectedResponse->setUid($uid); + $expectedResponse->setManual($manual); + $expectedResponse->setDeleteLockDays($deleteLockDays); + $expectedResponse->setRetainDays($retainDays); + $expectedResponse->setAllNamespaces($allNamespaces); + $expectedResponse->setContainsVolumeData($containsVolumeData); + $expectedResponse->setContainsSecrets($containsSecrets); + $expectedResponse->setStateReason($stateReason); + $expectedResponse->setResourceCount($resourceCount); + $expectedResponse->setVolumeCount($volumeCount); + $expectedResponse->setSizeBytes($sizeBytes); + $expectedResponse->setEtag($etag); + $expectedResponse->setDescription($description); + $expectedResponse->setPodCount($podCount); + $expectedResponse->setConfigBackupSizeBytes($configBackupSizeBytes); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateBackupTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $backup = new Backup(); + $response = $gapicClient->updateBackup($backup); + $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.cloud.gkebackup.v1.BackupForGKE/UpdateBackup', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getBackup(); + $this->assertProtobufEquals($backup, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateBackupTest'); + $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 updateBackupExceptionTest() + { + $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/updateBackupTest'); + $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 + $backup = new Backup(); + $response = $gapicClient->updateBackup($backup); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateBackupTest'); + 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 updateBackupPlanTest() + { + $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/updateBackupPlanTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $uid = 'uid115792'; + $description = 'description-1724546052'; + $cluster = 'cluster872092154'; + $etag = 'etag3123477'; + $deactivated = true; + $protectedPodCount = 1494678716; + $expectedResponse = new BackupPlan(); + $expectedResponse->setName($name); + $expectedResponse->setUid($uid); + $expectedResponse->setDescription($description); + $expectedResponse->setCluster($cluster); + $expectedResponse->setEtag($etag); + $expectedResponse->setDeactivated($deactivated); + $expectedResponse->setProtectedPodCount($protectedPodCount); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateBackupPlanTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $backupPlan = new BackupPlan(); + $backupPlanCluster = $gapicClient->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + $backupPlan->setCluster($backupPlanCluster); + $response = $gapicClient->updateBackupPlan($backupPlan); + $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.cloud.gkebackup.v1.BackupForGKE/UpdateBackupPlan', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getBackupPlan(); + $this->assertProtobufEquals($backupPlan, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateBackupPlanTest'); + $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 updateBackupPlanExceptionTest() + { + $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/updateBackupPlanTest'); + $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 + $backupPlan = new BackupPlan(); + $backupPlanCluster = $gapicClient->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + $backupPlan->setCluster($backupPlanCluster); + $response = $gapicClient->updateBackupPlan($backupPlan); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateBackupPlanTest'); + 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 updateRestoreTest() + { + $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/updateRestoreTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $uid = 'uid115792'; + $description = 'description-1724546052'; + $backup = 'backup-1396673086'; + $cluster = 'cluster872092154'; + $stateReason = 'stateReason282113458'; + $resourcesRestoredCount = 882879616; + $resourcesExcludedCount = 338652236; + $resourcesFailedCount = 217904743; + $volumesRestoredCount = 1005533068; + $etag = 'etag3123477'; + $expectedResponse = new Restore(); + $expectedResponse->setName($name); + $expectedResponse->setUid($uid); + $expectedResponse->setDescription($description); + $expectedResponse->setBackup($backup); + $expectedResponse->setCluster($cluster); + $expectedResponse->setStateReason($stateReason); + $expectedResponse->setResourcesRestoredCount($resourcesRestoredCount); + $expectedResponse->setResourcesExcludedCount($resourcesExcludedCount); + $expectedResponse->setResourcesFailedCount($resourcesFailedCount); + $expectedResponse->setVolumesRestoredCount($volumesRestoredCount); + $expectedResponse->setEtag($etag); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateRestoreTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $restore = new Restore(); + $restoreBackup = $gapicClient->backupName('[PROJECT]', '[LOCATION]', '[BACKUP_PLAN]', '[BACKUP]'); + $restore->setBackup($restoreBackup); + $response = $gapicClient->updateRestore($restore); + $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.cloud.gkebackup.v1.BackupForGKE/UpdateRestore', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getRestore(); + $this->assertProtobufEquals($restore, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateRestoreTest'); + $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 updateRestoreExceptionTest() + { + $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/updateRestoreTest'); + $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 + $restore = new Restore(); + $restoreBackup = $gapicClient->backupName('[PROJECT]', '[LOCATION]', '[BACKUP_PLAN]', '[BACKUP]'); + $restore->setBackup($restoreBackup); + $response = $gapicClient->updateRestore($restore); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateRestoreTest'); + 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 updateRestorePlanTest() + { + $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/updateRestorePlanTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $uid = 'uid115792'; + $description = 'description-1724546052'; + $backupPlan = 'backupPlan1119623046'; + $cluster = 'cluster872092154'; + $etag = 'etag3123477'; + $expectedResponse = new RestorePlan(); + $expectedResponse->setName($name); + $expectedResponse->setUid($uid); + $expectedResponse->setDescription($description); + $expectedResponse->setBackupPlan($backupPlan); + $expectedResponse->setCluster($cluster); + $expectedResponse->setEtag($etag); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateRestorePlanTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $restorePlan = new RestorePlan(); + $restorePlanBackupPlan = $gapicClient->backupPlanName('[PROJECT]', '[LOCATION]', '[BACKUP_PLAN]'); + $restorePlan->setBackupPlan($restorePlanBackupPlan); + $restorePlanCluster = $gapicClient->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + $restorePlan->setCluster($restorePlanCluster); + $restorePlanRestoreConfig = new RestoreConfig(); + $restorePlan->setRestoreConfig($restorePlanRestoreConfig); + $response = $gapicClient->updateRestorePlan($restorePlan); + $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.cloud.gkebackup.v1.BackupForGKE/UpdateRestorePlan', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getRestorePlan(); + $this->assertProtobufEquals($restorePlan, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateRestorePlanTest'); + $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 updateRestorePlanExceptionTest() + { + $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/updateRestorePlanTest'); + $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 + $restorePlan = new RestorePlan(); + $restorePlanBackupPlan = $gapicClient->backupPlanName('[PROJECT]', '[LOCATION]', '[BACKUP_PLAN]'); + $restorePlan->setBackupPlan($restorePlanBackupPlan); + $restorePlanCluster = $gapicClient->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + $restorePlan->setCluster($restorePlanCluster); + $restorePlanRestoreConfig = new RestoreConfig(); + $restorePlan->setRestoreConfig($restorePlanRestoreConfig); + $response = $gapicClient->updateRestorePlan($restorePlan); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateRestorePlanTest'); + 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()); + } +} diff --git a/owl-bot-staging/GkeBackup/v1/tests/Unit/V1/Client/BackupForGKEClientTest.php b/owl-bot-staging/GkeBackup/v1/tests/Unit/V1/Client/BackupForGKEClientTest.php new file mode 100644 index 000000000000..238ee9c66858 --- /dev/null +++ b/owl-bot-staging/GkeBackup/v1/tests/Unit/V1/Client/BackupForGKEClientTest.php @@ -0,0 +1,2796 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return BackupForGKEClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new BackupForGKEClient($options); + } + + /** @test */ + public function createBackupTest() + { + $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/createBackupTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $uid = 'uid115792'; + $manual = true; + $deleteLockDays = 1638724265; + $retainDays = 1380805807; + $allNamespaces = true; + $containsVolumeData = false; + $containsSecrets = false; + $stateReason = 'stateReason282113458'; + $resourceCount = 287552926; + $volumeCount = 1362665558; + $sizeBytes = 1796325715; + $etag = 'etag3123477'; + $description = 'description-1724546052'; + $podCount = 977657493; + $configBackupSizeBytes = 606785139; + $expectedResponse = new Backup(); + $expectedResponse->setName($name); + $expectedResponse->setUid($uid); + $expectedResponse->setManual($manual); + $expectedResponse->setDeleteLockDays($deleteLockDays); + $expectedResponse->setRetainDays($retainDays); + $expectedResponse->setAllNamespaces($allNamespaces); + $expectedResponse->setContainsVolumeData($containsVolumeData); + $expectedResponse->setContainsSecrets($containsSecrets); + $expectedResponse->setStateReason($stateReason); + $expectedResponse->setResourceCount($resourceCount); + $expectedResponse->setVolumeCount($volumeCount); + $expectedResponse->setSizeBytes($sizeBytes); + $expectedResponse->setEtag($etag); + $expectedResponse->setDescription($description); + $expectedResponse->setPodCount($podCount); + $expectedResponse->setConfigBackupSizeBytes($configBackupSizeBytes); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createBackupTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->backupPlanName('[PROJECT]', '[LOCATION]', '[BACKUP_PLAN]'); + $request = (new CreateBackupRequest()) + ->setParent($formattedParent); + $response = $gapicClient->createBackup($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.cloud.gkebackup.v1.BackupForGKE/CreateBackup', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createBackupTest'); + $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 createBackupExceptionTest() + { + $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/createBackupTest'); + $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 + $formattedParent = $gapicClient->backupPlanName('[PROJECT]', '[LOCATION]', '[BACKUP_PLAN]'); + $request = (new CreateBackupRequest()) + ->setParent($formattedParent); + $response = $gapicClient->createBackup($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createBackupTest'); + 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 createBackupPlanTest() + { + $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/createBackupPlanTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $uid = 'uid115792'; + $description = 'description-1724546052'; + $cluster = 'cluster872092154'; + $etag = 'etag3123477'; + $deactivated = true; + $protectedPodCount = 1494678716; + $expectedResponse = new BackupPlan(); + $expectedResponse->setName($name); + $expectedResponse->setUid($uid); + $expectedResponse->setDescription($description); + $expectedResponse->setCluster($cluster); + $expectedResponse->setEtag($etag); + $expectedResponse->setDeactivated($deactivated); + $expectedResponse->setProtectedPodCount($protectedPodCount); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createBackupPlanTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $backupPlan = new BackupPlan(); + $backupPlanCluster = $gapicClient->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + $backupPlan->setCluster($backupPlanCluster); + $backupPlanId = 'backupPlanId-25762700'; + $request = (new CreateBackupPlanRequest()) + ->setParent($formattedParent) + ->setBackupPlan($backupPlan) + ->setBackupPlanId($backupPlanId); + $response = $gapicClient->createBackupPlan($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.cloud.gkebackup.v1.BackupForGKE/CreateBackupPlan', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getBackupPlan(); + $this->assertProtobufEquals($backupPlan, $actualValue); + $actualValue = $actualApiRequestObject->getBackupPlanId(); + $this->assertProtobufEquals($backupPlanId, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createBackupPlanTest'); + $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 createBackupPlanExceptionTest() + { + $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/createBackupPlanTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $backupPlan = new BackupPlan(); + $backupPlanCluster = $gapicClient->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + $backupPlan->setCluster($backupPlanCluster); + $backupPlanId = 'backupPlanId-25762700'; + $request = (new CreateBackupPlanRequest()) + ->setParent($formattedParent) + ->setBackupPlan($backupPlan) + ->setBackupPlanId($backupPlanId); + $response = $gapicClient->createBackupPlan($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createBackupPlanTest'); + 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 createRestoreTest() + { + $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/createRestoreTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $uid = 'uid115792'; + $description = 'description-1724546052'; + $backup = 'backup-1396673086'; + $cluster = 'cluster872092154'; + $stateReason = 'stateReason282113458'; + $resourcesRestoredCount = 882879616; + $resourcesExcludedCount = 338652236; + $resourcesFailedCount = 217904743; + $volumesRestoredCount = 1005533068; + $etag = 'etag3123477'; + $expectedResponse = new Restore(); + $expectedResponse->setName($name); + $expectedResponse->setUid($uid); + $expectedResponse->setDescription($description); + $expectedResponse->setBackup($backup); + $expectedResponse->setCluster($cluster); + $expectedResponse->setStateReason($stateReason); + $expectedResponse->setResourcesRestoredCount($resourcesRestoredCount); + $expectedResponse->setResourcesExcludedCount($resourcesExcludedCount); + $expectedResponse->setResourcesFailedCount($resourcesFailedCount); + $expectedResponse->setVolumesRestoredCount($volumesRestoredCount); + $expectedResponse->setEtag($etag); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createRestoreTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->restorePlanName('[PROJECT]', '[LOCATION]', '[RESTORE_PLAN]'); + $restore = new Restore(); + $restoreBackup = $gapicClient->backupName('[PROJECT]', '[LOCATION]', '[BACKUP_PLAN]', '[BACKUP]'); + $restore->setBackup($restoreBackup); + $restoreId = 'restoreId-1374819220'; + $request = (new CreateRestoreRequest()) + ->setParent($formattedParent) + ->setRestore($restore) + ->setRestoreId($restoreId); + $response = $gapicClient->createRestore($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.cloud.gkebackup.v1.BackupForGKE/CreateRestore', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getRestore(); + $this->assertProtobufEquals($restore, $actualValue); + $actualValue = $actualApiRequestObject->getRestoreId(); + $this->assertProtobufEquals($restoreId, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createRestoreTest'); + $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 createRestoreExceptionTest() + { + $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/createRestoreTest'); + $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 + $formattedParent = $gapicClient->restorePlanName('[PROJECT]', '[LOCATION]', '[RESTORE_PLAN]'); + $restore = new Restore(); + $restoreBackup = $gapicClient->backupName('[PROJECT]', '[LOCATION]', '[BACKUP_PLAN]', '[BACKUP]'); + $restore->setBackup($restoreBackup); + $restoreId = 'restoreId-1374819220'; + $request = (new CreateRestoreRequest()) + ->setParent($formattedParent) + ->setRestore($restore) + ->setRestoreId($restoreId); + $response = $gapicClient->createRestore($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createRestoreTest'); + 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 createRestorePlanTest() + { + $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/createRestorePlanTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $uid = 'uid115792'; + $description = 'description-1724546052'; + $backupPlan = 'backupPlan1119623046'; + $cluster = 'cluster872092154'; + $etag = 'etag3123477'; + $expectedResponse = new RestorePlan(); + $expectedResponse->setName($name); + $expectedResponse->setUid($uid); + $expectedResponse->setDescription($description); + $expectedResponse->setBackupPlan($backupPlan); + $expectedResponse->setCluster($cluster); + $expectedResponse->setEtag($etag); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createRestorePlanTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $restorePlan = new RestorePlan(); + $restorePlanBackupPlan = $gapicClient->backupPlanName('[PROJECT]', '[LOCATION]', '[BACKUP_PLAN]'); + $restorePlan->setBackupPlan($restorePlanBackupPlan); + $restorePlanCluster = $gapicClient->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + $restorePlan->setCluster($restorePlanCluster); + $restorePlanRestoreConfig = new RestoreConfig(); + $restorePlan->setRestoreConfig($restorePlanRestoreConfig); + $restorePlanId = 'restorePlanId126727488'; + $request = (new CreateRestorePlanRequest()) + ->setParent($formattedParent) + ->setRestorePlan($restorePlan) + ->setRestorePlanId($restorePlanId); + $response = $gapicClient->createRestorePlan($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.cloud.gkebackup.v1.BackupForGKE/CreateRestorePlan', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getRestorePlan(); + $this->assertProtobufEquals($restorePlan, $actualValue); + $actualValue = $actualApiRequestObject->getRestorePlanId(); + $this->assertProtobufEquals($restorePlanId, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createRestorePlanTest'); + $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 createRestorePlanExceptionTest() + { + $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/createRestorePlanTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $restorePlan = new RestorePlan(); + $restorePlanBackupPlan = $gapicClient->backupPlanName('[PROJECT]', '[LOCATION]', '[BACKUP_PLAN]'); + $restorePlan->setBackupPlan($restorePlanBackupPlan); + $restorePlanCluster = $gapicClient->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + $restorePlan->setCluster($restorePlanCluster); + $restorePlanRestoreConfig = new RestoreConfig(); + $restorePlan->setRestoreConfig($restorePlanRestoreConfig); + $restorePlanId = 'restorePlanId126727488'; + $request = (new CreateRestorePlanRequest()) + ->setParent($formattedParent) + ->setRestorePlan($restorePlan) + ->setRestorePlanId($restorePlanId); + $response = $gapicClient->createRestorePlan($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createRestorePlanTest'); + 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 deleteBackupTest() + { + $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/deleteBackupTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteBackupTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->backupName('[PROJECT]', '[LOCATION]', '[BACKUP_PLAN]', '[BACKUP]'); + $request = (new DeleteBackupRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteBackup($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.cloud.gkebackup.v1.BackupForGKE/DeleteBackup', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteBackupTest'); + $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 deleteBackupExceptionTest() + { + $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/deleteBackupTest'); + $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->backupName('[PROJECT]', '[LOCATION]', '[BACKUP_PLAN]', '[BACKUP]'); + $request = (new DeleteBackupRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteBackup($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteBackupTest'); + 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 deleteBackupPlanTest() + { + $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/deleteBackupPlanTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteBackupPlanTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->backupPlanName('[PROJECT]', '[LOCATION]', '[BACKUP_PLAN]'); + $request = (new DeleteBackupPlanRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteBackupPlan($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.cloud.gkebackup.v1.BackupForGKE/DeleteBackupPlan', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteBackupPlanTest'); + $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 deleteBackupPlanExceptionTest() + { + $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/deleteBackupPlanTest'); + $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->backupPlanName('[PROJECT]', '[LOCATION]', '[BACKUP_PLAN]'); + $request = (new DeleteBackupPlanRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteBackupPlan($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteBackupPlanTest'); + 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 deleteRestoreTest() + { + $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/deleteRestoreTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteRestoreTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->restoreName('[PROJECT]', '[LOCATION]', '[RESTORE_PLAN]', '[RESTORE]'); + $request = (new DeleteRestoreRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteRestore($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.cloud.gkebackup.v1.BackupForGKE/DeleteRestore', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteRestoreTest'); + $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 deleteRestoreExceptionTest() + { + $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/deleteRestoreTest'); + $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->restoreName('[PROJECT]', '[LOCATION]', '[RESTORE_PLAN]', '[RESTORE]'); + $request = (new DeleteRestoreRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteRestore($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteRestoreTest'); + 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 deleteRestorePlanTest() + { + $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/deleteRestorePlanTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteRestorePlanTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->restorePlanName('[PROJECT]', '[LOCATION]', '[RESTORE_PLAN]'); + $request = (new DeleteRestorePlanRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteRestorePlan($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.cloud.gkebackup.v1.BackupForGKE/DeleteRestorePlan', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteRestorePlanTest'); + $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 deleteRestorePlanExceptionTest() + { + $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/deleteRestorePlanTest'); + $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->restorePlanName('[PROJECT]', '[LOCATION]', '[RESTORE_PLAN]'); + $request = (new DeleteRestorePlanRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteRestorePlan($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteRestorePlanTest'); + 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 getBackupTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $uid = 'uid115792'; + $manual = true; + $deleteLockDays = 1638724265; + $retainDays = 1380805807; + $allNamespaces = true; + $containsVolumeData = false; + $containsSecrets = false; + $stateReason = 'stateReason282113458'; + $resourceCount = 287552926; + $volumeCount = 1362665558; + $sizeBytes = 1796325715; + $etag = 'etag3123477'; + $description = 'description-1724546052'; + $podCount = 977657493; + $configBackupSizeBytes = 606785139; + $expectedResponse = new Backup(); + $expectedResponse->setName($name2); + $expectedResponse->setUid($uid); + $expectedResponse->setManual($manual); + $expectedResponse->setDeleteLockDays($deleteLockDays); + $expectedResponse->setRetainDays($retainDays); + $expectedResponse->setAllNamespaces($allNamespaces); + $expectedResponse->setContainsVolumeData($containsVolumeData); + $expectedResponse->setContainsSecrets($containsSecrets); + $expectedResponse->setStateReason($stateReason); + $expectedResponse->setResourceCount($resourceCount); + $expectedResponse->setVolumeCount($volumeCount); + $expectedResponse->setSizeBytes($sizeBytes); + $expectedResponse->setEtag($etag); + $expectedResponse->setDescription($description); + $expectedResponse->setPodCount($podCount); + $expectedResponse->setConfigBackupSizeBytes($configBackupSizeBytes); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->backupName('[PROJECT]', '[LOCATION]', '[BACKUP_PLAN]', '[BACKUP]'); + $request = (new GetBackupRequest()) + ->setName($formattedName); + $response = $gapicClient->getBackup($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkebackup.v1.BackupForGKE/GetBackup', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getBackupExceptionTest() + { + $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->backupName('[PROJECT]', '[LOCATION]', '[BACKUP_PLAN]', '[BACKUP]'); + $request = (new GetBackupRequest()) + ->setName($formattedName); + try { + $gapicClient->getBackup($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 getBackupPlanTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $uid = 'uid115792'; + $description = 'description-1724546052'; + $cluster = 'cluster872092154'; + $etag = 'etag3123477'; + $deactivated = true; + $protectedPodCount = 1494678716; + $expectedResponse = new BackupPlan(); + $expectedResponse->setName($name2); + $expectedResponse->setUid($uid); + $expectedResponse->setDescription($description); + $expectedResponse->setCluster($cluster); + $expectedResponse->setEtag($etag); + $expectedResponse->setDeactivated($deactivated); + $expectedResponse->setProtectedPodCount($protectedPodCount); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->backupPlanName('[PROJECT]', '[LOCATION]', '[BACKUP_PLAN]'); + $request = (new GetBackupPlanRequest()) + ->setName($formattedName); + $response = $gapicClient->getBackupPlan($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkebackup.v1.BackupForGKE/GetBackupPlan', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getBackupPlanExceptionTest() + { + $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->backupPlanName('[PROJECT]', '[LOCATION]', '[BACKUP_PLAN]'); + $request = (new GetBackupPlanRequest()) + ->setName($formattedName); + try { + $gapicClient->getBackupPlan($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 getRestoreTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $uid = 'uid115792'; + $description = 'description-1724546052'; + $backup = 'backup-1396673086'; + $cluster = 'cluster872092154'; + $stateReason = 'stateReason282113458'; + $resourcesRestoredCount = 882879616; + $resourcesExcludedCount = 338652236; + $resourcesFailedCount = 217904743; + $volumesRestoredCount = 1005533068; + $etag = 'etag3123477'; + $expectedResponse = new Restore(); + $expectedResponse->setName($name2); + $expectedResponse->setUid($uid); + $expectedResponse->setDescription($description); + $expectedResponse->setBackup($backup); + $expectedResponse->setCluster($cluster); + $expectedResponse->setStateReason($stateReason); + $expectedResponse->setResourcesRestoredCount($resourcesRestoredCount); + $expectedResponse->setResourcesExcludedCount($resourcesExcludedCount); + $expectedResponse->setResourcesFailedCount($resourcesFailedCount); + $expectedResponse->setVolumesRestoredCount($volumesRestoredCount); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->restoreName('[PROJECT]', '[LOCATION]', '[RESTORE_PLAN]', '[RESTORE]'); + $request = (new GetRestoreRequest()) + ->setName($formattedName); + $response = $gapicClient->getRestore($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkebackup.v1.BackupForGKE/GetRestore', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getRestoreExceptionTest() + { + $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->restoreName('[PROJECT]', '[LOCATION]', '[RESTORE_PLAN]', '[RESTORE]'); + $request = (new GetRestoreRequest()) + ->setName($formattedName); + try { + $gapicClient->getRestore($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 getRestorePlanTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $uid = 'uid115792'; + $description = 'description-1724546052'; + $backupPlan = 'backupPlan1119623046'; + $cluster = 'cluster872092154'; + $etag = 'etag3123477'; + $expectedResponse = new RestorePlan(); + $expectedResponse->setName($name2); + $expectedResponse->setUid($uid); + $expectedResponse->setDescription($description); + $expectedResponse->setBackupPlan($backupPlan); + $expectedResponse->setCluster($cluster); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->restorePlanName('[PROJECT]', '[LOCATION]', '[RESTORE_PLAN]'); + $request = (new GetRestorePlanRequest()) + ->setName($formattedName); + $response = $gapicClient->getRestorePlan($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkebackup.v1.BackupForGKE/GetRestorePlan', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getRestorePlanExceptionTest() + { + $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->restorePlanName('[PROJECT]', '[LOCATION]', '[RESTORE_PLAN]'); + $request = (new GetRestorePlanRequest()) + ->setName($formattedName); + try { + $gapicClient->getRestorePlan($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 getVolumeBackupTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $uid = 'uid115792'; + $volumeBackupHandle = 'volumeBackupHandle-2105959712'; + $storageBytes = 2035244455; + $diskSizeBytes = 275393905; + $stateMessage = 'stateMessage29641305'; + $etag = 'etag3123477'; + $expectedResponse = new VolumeBackup(); + $expectedResponse->setName($name2); + $expectedResponse->setUid($uid); + $expectedResponse->setVolumeBackupHandle($volumeBackupHandle); + $expectedResponse->setStorageBytes($storageBytes); + $expectedResponse->setDiskSizeBytes($diskSizeBytes); + $expectedResponse->setStateMessage($stateMessage); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->volumeBackupName('[PROJECT]', '[LOCATION]', '[BACKUP_PLAN]', '[BACKUP]', '[VOLUME_BACKUP]'); + $request = (new GetVolumeBackupRequest()) + ->setName($formattedName); + $response = $gapicClient->getVolumeBackup($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkebackup.v1.BackupForGKE/GetVolumeBackup', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getVolumeBackupExceptionTest() + { + $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->volumeBackupName('[PROJECT]', '[LOCATION]', '[BACKUP_PLAN]', '[BACKUP]', '[VOLUME_BACKUP]'); + $request = (new GetVolumeBackupRequest()) + ->setName($formattedName); + try { + $gapicClient->getVolumeBackup($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 getVolumeRestoreTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $uid = 'uid115792'; + $volumeBackup = 'volumeBackup664943239'; + $volumeHandle = 'volumeHandle837038829'; + $stateMessage = 'stateMessage29641305'; + $etag = 'etag3123477'; + $expectedResponse = new VolumeRestore(); + $expectedResponse->setName($name2); + $expectedResponse->setUid($uid); + $expectedResponse->setVolumeBackup($volumeBackup); + $expectedResponse->setVolumeHandle($volumeHandle); + $expectedResponse->setStateMessage($stateMessage); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->volumeRestoreName('[PROJECT]', '[LOCATION]', '[RESTORE_PLAN]', '[RESTORE]', '[VOLUME_RESTORE]'); + $request = (new GetVolumeRestoreRequest()) + ->setName($formattedName); + $response = $gapicClient->getVolumeRestore($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkebackup.v1.BackupForGKE/GetVolumeRestore', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getVolumeRestoreExceptionTest() + { + $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->volumeRestoreName('[PROJECT]', '[LOCATION]', '[RESTORE_PLAN]', '[RESTORE]', '[VOLUME_RESTORE]'); + $request = (new GetVolumeRestoreRequest()) + ->setName($formattedName); + try { + $gapicClient->getVolumeRestore($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 listBackupPlansTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $backupPlansElement = new BackupPlan(); + $backupPlans = [ + $backupPlansElement, + ]; + $expectedResponse = new ListBackupPlansResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setBackupPlans($backupPlans); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListBackupPlansRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listBackupPlans($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getBackupPlans()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkebackup.v1.BackupForGKE/ListBackupPlans', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listBackupPlansExceptionTest() + { + $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->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListBackupPlansRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listBackupPlans($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 listBackupsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $backupsElement = new Backup(); + $backups = [ + $backupsElement, + ]; + $expectedResponse = new ListBackupsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setBackups($backups); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->backupPlanName('[PROJECT]', '[LOCATION]', '[BACKUP_PLAN]'); + $request = (new ListBackupsRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listBackups($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getBackups()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkebackup.v1.BackupForGKE/ListBackups', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listBackupsExceptionTest() + { + $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->backupPlanName('[PROJECT]', '[LOCATION]', '[BACKUP_PLAN]'); + $request = (new ListBackupsRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listBackups($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 listRestorePlansTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $restorePlansElement = new RestorePlan(); + $restorePlans = [ + $restorePlansElement, + ]; + $expectedResponse = new ListRestorePlansResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setRestorePlans($restorePlans); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListRestorePlansRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listRestorePlans($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getRestorePlans()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkebackup.v1.BackupForGKE/ListRestorePlans', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listRestorePlansExceptionTest() + { + $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->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListRestorePlansRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listRestorePlans($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 listRestoresTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $restoresElement = new Restore(); + $restores = [ + $restoresElement, + ]; + $expectedResponse = new ListRestoresResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setRestores($restores); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->restorePlanName('[PROJECT]', '[LOCATION]', '[RESTORE_PLAN]'); + $request = (new ListRestoresRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listRestores($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getRestores()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkebackup.v1.BackupForGKE/ListRestores', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listRestoresExceptionTest() + { + $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->restorePlanName('[PROJECT]', '[LOCATION]', '[RESTORE_PLAN]'); + $request = (new ListRestoresRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listRestores($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 listVolumeBackupsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $volumeBackupsElement = new VolumeBackup(); + $volumeBackups = [ + $volumeBackupsElement, + ]; + $expectedResponse = new ListVolumeBackupsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setVolumeBackups($volumeBackups); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->backupName('[PROJECT]', '[LOCATION]', '[BACKUP_PLAN]', '[BACKUP]'); + $request = (new ListVolumeBackupsRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listVolumeBackups($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getVolumeBackups()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkebackup.v1.BackupForGKE/ListVolumeBackups', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listVolumeBackupsExceptionTest() + { + $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->backupName('[PROJECT]', '[LOCATION]', '[BACKUP_PLAN]', '[BACKUP]'); + $request = (new ListVolumeBackupsRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listVolumeBackups($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 listVolumeRestoresTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $volumeRestoresElement = new VolumeRestore(); + $volumeRestores = [ + $volumeRestoresElement, + ]; + $expectedResponse = new ListVolumeRestoresResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setVolumeRestores($volumeRestores); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->restoreName('[PROJECT]', '[LOCATION]', '[RESTORE_PLAN]', '[RESTORE]'); + $request = (new ListVolumeRestoresRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listVolumeRestores($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getVolumeRestores()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkebackup.v1.BackupForGKE/ListVolumeRestores', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listVolumeRestoresExceptionTest() + { + $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->restoreName('[PROJECT]', '[LOCATION]', '[RESTORE_PLAN]', '[RESTORE]'); + $request = (new ListVolumeRestoresRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listVolumeRestores($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 updateBackupTest() + { + $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/updateBackupTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $uid = 'uid115792'; + $manual = true; + $deleteLockDays = 1638724265; + $retainDays = 1380805807; + $allNamespaces = true; + $containsVolumeData = false; + $containsSecrets = false; + $stateReason = 'stateReason282113458'; + $resourceCount = 287552926; + $volumeCount = 1362665558; + $sizeBytes = 1796325715; + $etag = 'etag3123477'; + $description = 'description-1724546052'; + $podCount = 977657493; + $configBackupSizeBytes = 606785139; + $expectedResponse = new Backup(); + $expectedResponse->setName($name); + $expectedResponse->setUid($uid); + $expectedResponse->setManual($manual); + $expectedResponse->setDeleteLockDays($deleteLockDays); + $expectedResponse->setRetainDays($retainDays); + $expectedResponse->setAllNamespaces($allNamespaces); + $expectedResponse->setContainsVolumeData($containsVolumeData); + $expectedResponse->setContainsSecrets($containsSecrets); + $expectedResponse->setStateReason($stateReason); + $expectedResponse->setResourceCount($resourceCount); + $expectedResponse->setVolumeCount($volumeCount); + $expectedResponse->setSizeBytes($sizeBytes); + $expectedResponse->setEtag($etag); + $expectedResponse->setDescription($description); + $expectedResponse->setPodCount($podCount); + $expectedResponse->setConfigBackupSizeBytes($configBackupSizeBytes); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateBackupTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $backup = new Backup(); + $request = (new UpdateBackupRequest()) + ->setBackup($backup); + $response = $gapicClient->updateBackup($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.cloud.gkebackup.v1.BackupForGKE/UpdateBackup', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getBackup(); + $this->assertProtobufEquals($backup, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateBackupTest'); + $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 updateBackupExceptionTest() + { + $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/updateBackupTest'); + $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 + $backup = new Backup(); + $request = (new UpdateBackupRequest()) + ->setBackup($backup); + $response = $gapicClient->updateBackup($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateBackupTest'); + 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 updateBackupPlanTest() + { + $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/updateBackupPlanTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $uid = 'uid115792'; + $description = 'description-1724546052'; + $cluster = 'cluster872092154'; + $etag = 'etag3123477'; + $deactivated = true; + $protectedPodCount = 1494678716; + $expectedResponse = new BackupPlan(); + $expectedResponse->setName($name); + $expectedResponse->setUid($uid); + $expectedResponse->setDescription($description); + $expectedResponse->setCluster($cluster); + $expectedResponse->setEtag($etag); + $expectedResponse->setDeactivated($deactivated); + $expectedResponse->setProtectedPodCount($protectedPodCount); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateBackupPlanTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $backupPlan = new BackupPlan(); + $backupPlanCluster = $gapicClient->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + $backupPlan->setCluster($backupPlanCluster); + $request = (new UpdateBackupPlanRequest()) + ->setBackupPlan($backupPlan); + $response = $gapicClient->updateBackupPlan($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.cloud.gkebackup.v1.BackupForGKE/UpdateBackupPlan', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getBackupPlan(); + $this->assertProtobufEquals($backupPlan, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateBackupPlanTest'); + $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 updateBackupPlanExceptionTest() + { + $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/updateBackupPlanTest'); + $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 + $backupPlan = new BackupPlan(); + $backupPlanCluster = $gapicClient->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + $backupPlan->setCluster($backupPlanCluster); + $request = (new UpdateBackupPlanRequest()) + ->setBackupPlan($backupPlan); + $response = $gapicClient->updateBackupPlan($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateBackupPlanTest'); + 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 updateRestoreTest() + { + $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/updateRestoreTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $uid = 'uid115792'; + $description = 'description-1724546052'; + $backup = 'backup-1396673086'; + $cluster = 'cluster872092154'; + $stateReason = 'stateReason282113458'; + $resourcesRestoredCount = 882879616; + $resourcesExcludedCount = 338652236; + $resourcesFailedCount = 217904743; + $volumesRestoredCount = 1005533068; + $etag = 'etag3123477'; + $expectedResponse = new Restore(); + $expectedResponse->setName($name); + $expectedResponse->setUid($uid); + $expectedResponse->setDescription($description); + $expectedResponse->setBackup($backup); + $expectedResponse->setCluster($cluster); + $expectedResponse->setStateReason($stateReason); + $expectedResponse->setResourcesRestoredCount($resourcesRestoredCount); + $expectedResponse->setResourcesExcludedCount($resourcesExcludedCount); + $expectedResponse->setResourcesFailedCount($resourcesFailedCount); + $expectedResponse->setVolumesRestoredCount($volumesRestoredCount); + $expectedResponse->setEtag($etag); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateRestoreTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $restore = new Restore(); + $restoreBackup = $gapicClient->backupName('[PROJECT]', '[LOCATION]', '[BACKUP_PLAN]', '[BACKUP]'); + $restore->setBackup($restoreBackup); + $request = (new UpdateRestoreRequest()) + ->setRestore($restore); + $response = $gapicClient->updateRestore($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.cloud.gkebackup.v1.BackupForGKE/UpdateRestore', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getRestore(); + $this->assertProtobufEquals($restore, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateRestoreTest'); + $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 updateRestoreExceptionTest() + { + $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/updateRestoreTest'); + $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 + $restore = new Restore(); + $restoreBackup = $gapicClient->backupName('[PROJECT]', '[LOCATION]', '[BACKUP_PLAN]', '[BACKUP]'); + $restore->setBackup($restoreBackup); + $request = (new UpdateRestoreRequest()) + ->setRestore($restore); + $response = $gapicClient->updateRestore($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateRestoreTest'); + 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 updateRestorePlanTest() + { + $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/updateRestorePlanTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $uid = 'uid115792'; + $description = 'description-1724546052'; + $backupPlan = 'backupPlan1119623046'; + $cluster = 'cluster872092154'; + $etag = 'etag3123477'; + $expectedResponse = new RestorePlan(); + $expectedResponse->setName($name); + $expectedResponse->setUid($uid); + $expectedResponse->setDescription($description); + $expectedResponse->setBackupPlan($backupPlan); + $expectedResponse->setCluster($cluster); + $expectedResponse->setEtag($etag); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateRestorePlanTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $restorePlan = new RestorePlan(); + $restorePlanBackupPlan = $gapicClient->backupPlanName('[PROJECT]', '[LOCATION]', '[BACKUP_PLAN]'); + $restorePlan->setBackupPlan($restorePlanBackupPlan); + $restorePlanCluster = $gapicClient->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + $restorePlan->setCluster($restorePlanCluster); + $restorePlanRestoreConfig = new RestoreConfig(); + $restorePlan->setRestoreConfig($restorePlanRestoreConfig); + $request = (new UpdateRestorePlanRequest()) + ->setRestorePlan($restorePlan); + $response = $gapicClient->updateRestorePlan($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.cloud.gkebackup.v1.BackupForGKE/UpdateRestorePlan', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getRestorePlan(); + $this->assertProtobufEquals($restorePlan, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateRestorePlanTest'); + $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 updateRestorePlanExceptionTest() + { + $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/updateRestorePlanTest'); + $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 + $restorePlan = new RestorePlan(); + $restorePlanBackupPlan = $gapicClient->backupPlanName('[PROJECT]', '[LOCATION]', '[BACKUP_PLAN]'); + $restorePlan->setBackupPlan($restorePlanBackupPlan); + $restorePlanCluster = $gapicClient->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + $restorePlan->setCluster($restorePlanCluster); + $restorePlanRestoreConfig = new RestoreConfig(); + $restorePlan->setRestoreConfig($restorePlanRestoreConfig); + $request = (new UpdateRestorePlanRequest()) + ->setRestorePlan($restorePlan); + $response = $gapicClient->updateRestorePlan($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateRestorePlanTest'); + 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 createBackupAsyncTest() + { + $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/createBackupTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $uid = 'uid115792'; + $manual = true; + $deleteLockDays = 1638724265; + $retainDays = 1380805807; + $allNamespaces = true; + $containsVolumeData = false; + $containsSecrets = false; + $stateReason = 'stateReason282113458'; + $resourceCount = 287552926; + $volumeCount = 1362665558; + $sizeBytes = 1796325715; + $etag = 'etag3123477'; + $description = 'description-1724546052'; + $podCount = 977657493; + $configBackupSizeBytes = 606785139; + $expectedResponse = new Backup(); + $expectedResponse->setName($name); + $expectedResponse->setUid($uid); + $expectedResponse->setManual($manual); + $expectedResponse->setDeleteLockDays($deleteLockDays); + $expectedResponse->setRetainDays($retainDays); + $expectedResponse->setAllNamespaces($allNamespaces); + $expectedResponse->setContainsVolumeData($containsVolumeData); + $expectedResponse->setContainsSecrets($containsSecrets); + $expectedResponse->setStateReason($stateReason); + $expectedResponse->setResourceCount($resourceCount); + $expectedResponse->setVolumeCount($volumeCount); + $expectedResponse->setSizeBytes($sizeBytes); + $expectedResponse->setEtag($etag); + $expectedResponse->setDescription($description); + $expectedResponse->setPodCount($podCount); + $expectedResponse->setConfigBackupSizeBytes($configBackupSizeBytes); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createBackupTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->backupPlanName('[PROJECT]', '[LOCATION]', '[BACKUP_PLAN]'); + $request = (new CreateBackupRequest()) + ->setParent($formattedParent); + $response = $gapicClient->createBackupAsync($request)->wait(); + $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.cloud.gkebackup.v1.BackupForGKE/CreateBackup', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createBackupTest'); + $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()); + } +} diff --git a/owl-bot-staging/GkeConnectGateway/v1beta1/proto/src/GPBMetadata/Google/Cloud/Gkeconnect/Gateway/V1Beta1/Gateway.php b/owl-bot-staging/GkeConnectGateway/v1beta1/proto/src/GPBMetadata/Google/Cloud/Gkeconnect/Gateway/V1Beta1/Gateway.php new file mode 100644 index 000000000000..f38c7f0914f6 --- /dev/null +++ b/owl-bot-staging/GkeConnectGateway/v1beta1/proto/src/GPBMetadata/Google/Cloud/Gkeconnect/Gateway/V1Beta1/Gateway.php @@ -0,0 +1,36 @@ +internalAddGeneratedFile( + ' +¡ +5google/cloud/gkeconnect/gateway/v1beta1/gateway.proto\'google.cloud.gkeconnect.gateway.v1beta1google/api/client.protogoogle/api/httpbody.proto2ù +GatewayServiceN + GetResource.google.api.HttpBody.google.api.HttpBody"‚Óä“  /v1beta1/**O + PostResource.google.api.HttpBody.google.api.HttpBody"‚Óä“ " /v1beta1/**Q +DeleteResource.google.api.HttpBody.google.api.HttpBody"‚Óä“ * /v1beta1/**N + PutResource.google.api.HttpBody.google.api.HttpBody"‚Óä“  /v1beta1/**P + PatchResource.google.api.HttpBody.google.api.HttpBody"‚Óä“ 2 /v1beta1/**QÊAconnectgateway.googleapis.comÒA.https://www.googleapis.com/auth/cloud-platformB† ++com.google.cloud.gkeconnect.gateway.v1beta1B GatewayProtoPZEcloud.google.com/go/gkeconnect/gateway/apiv1beta1/gatewaypb;gatewaypbª\'Google.Cloud.GkeConnect.Gateway.V1Beta1Ê\'Google\\Cloud\\GkeConnect\\Gateway\\V1beta1ê+Google::Cloud::GkeConnect::Gateway::V1beta1bproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/owl-bot-staging/GkeConnectGateway/v1beta1/proto/src/Google/Cloud/GkeConnect/Gateway/V1beta1/GatewayServiceGrpcClient.php b/owl-bot-staging/GkeConnectGateway/v1beta1/proto/src/Google/Cloud/GkeConnect/Gateway/V1beta1/GatewayServiceGrpcClient.php new file mode 100644 index 000000000000..3fa153bb13a4 --- /dev/null +++ b/owl-bot-staging/GkeConnectGateway/v1beta1/proto/src/Google/Cloud/GkeConnect/Gateway/V1beta1/GatewayServiceGrpcClient.php @@ -0,0 +1,114 @@ +_simpleRequest('/google.cloud.gkeconnect.gateway.v1beta1.GatewayService/GetResource', + $argument, + ['\Google\Api\HttpBody', 'decode'], + $metadata, $options); + } + + /** + * PostResource performs an HTTP POST on the Kubernetes API Server. + * @param \Google\Api\HttpBody $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function PostResource(\Google\Api\HttpBody $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.gkeconnect.gateway.v1beta1.GatewayService/PostResource', + $argument, + ['\Google\Api\HttpBody', 'decode'], + $metadata, $options); + } + + /** + * DeleteResource performs an HTTP DELETE on the Kubernetes API Server. + * @param \Google\Api\HttpBody $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function DeleteResource(\Google\Api\HttpBody $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.gkeconnect.gateway.v1beta1.GatewayService/DeleteResource', + $argument, + ['\Google\Api\HttpBody', 'decode'], + $metadata, $options); + } + + /** + * PutResource performs an HTTP PUT on the Kubernetes API Server. + * @param \Google\Api\HttpBody $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function PutResource(\Google\Api\HttpBody $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.gkeconnect.gateway.v1beta1.GatewayService/PutResource', + $argument, + ['\Google\Api\HttpBody', 'decode'], + $metadata, $options); + } + + /** + * PatchResource performs an HTTP PATCH on the Kubernetes API Server. + * @param \Google\Api\HttpBody $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function PatchResource(\Google\Api\HttpBody $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.gkeconnect.gateway.v1beta1.GatewayService/PatchResource', + $argument, + ['\Google\Api\HttpBody', 'decode'], + $metadata, $options); + } + +} diff --git a/owl-bot-staging/GkeConnectGateway/v1beta1/samples/V1beta1/GatewayServiceClient/delete_resource.php b/owl-bot-staging/GkeConnectGateway/v1beta1/samples/V1beta1/GatewayServiceClient/delete_resource.php new file mode 100644 index 000000000000..134a61c803bf --- /dev/null +++ b/owl-bot-staging/GkeConnectGateway/v1beta1/samples/V1beta1/GatewayServiceClient/delete_resource.php @@ -0,0 +1,56 @@ +deleteResource($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END connectgateway_v1beta1_generated_GatewayService_DeleteResource_sync] diff --git a/owl-bot-staging/GkeConnectGateway/v1beta1/samples/V1beta1/GatewayServiceClient/get_resource.php b/owl-bot-staging/GkeConnectGateway/v1beta1/samples/V1beta1/GatewayServiceClient/get_resource.php new file mode 100644 index 000000000000..4be32a63f2a1 --- /dev/null +++ b/owl-bot-staging/GkeConnectGateway/v1beta1/samples/V1beta1/GatewayServiceClient/get_resource.php @@ -0,0 +1,56 @@ +getResource($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END connectgateway_v1beta1_generated_GatewayService_GetResource_sync] diff --git a/owl-bot-staging/GkeConnectGateway/v1beta1/samples/V1beta1/GatewayServiceClient/patch_resource.php b/owl-bot-staging/GkeConnectGateway/v1beta1/samples/V1beta1/GatewayServiceClient/patch_resource.php new file mode 100644 index 000000000000..2f1f263defa9 --- /dev/null +++ b/owl-bot-staging/GkeConnectGateway/v1beta1/samples/V1beta1/GatewayServiceClient/patch_resource.php @@ -0,0 +1,56 @@ +patchResource($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END connectgateway_v1beta1_generated_GatewayService_PatchResource_sync] diff --git a/owl-bot-staging/GkeConnectGateway/v1beta1/samples/V1beta1/GatewayServiceClient/post_resource.php b/owl-bot-staging/GkeConnectGateway/v1beta1/samples/V1beta1/GatewayServiceClient/post_resource.php new file mode 100644 index 000000000000..0a7251a8f5cb --- /dev/null +++ b/owl-bot-staging/GkeConnectGateway/v1beta1/samples/V1beta1/GatewayServiceClient/post_resource.php @@ -0,0 +1,56 @@ +postResource($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END connectgateway_v1beta1_generated_GatewayService_PostResource_sync] diff --git a/owl-bot-staging/GkeConnectGateway/v1beta1/samples/V1beta1/GatewayServiceClient/put_resource.php b/owl-bot-staging/GkeConnectGateway/v1beta1/samples/V1beta1/GatewayServiceClient/put_resource.php new file mode 100644 index 000000000000..030c45f7f6f9 --- /dev/null +++ b/owl-bot-staging/GkeConnectGateway/v1beta1/samples/V1beta1/GatewayServiceClient/put_resource.php @@ -0,0 +1,56 @@ +putResource($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END connectgateway_v1beta1_generated_GatewayService_PutResource_sync] diff --git a/owl-bot-staging/GkeConnectGateway/v1beta1/src/V1beta1/Client/BaseClient/GatewayServiceBaseClient.php b/owl-bot-staging/GkeConnectGateway/v1beta1/src/V1beta1/Client/BaseClient/GatewayServiceBaseClient.php new file mode 100644 index 000000000000..0943657e4764 --- /dev/null +++ b/owl-bot-staging/GkeConnectGateway/v1beta1/src/V1beta1/Client/BaseClient/GatewayServiceBaseClient.php @@ -0,0 +1,304 @@ + self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../../resources/gateway_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../../resources/gateway_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../../resources/gateway_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../../resources/gateway_service_rest_client_config.php', + ], + ], + ]; + } + + /** + * 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 'connectgateway.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. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *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' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods 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 + * + * @experimental + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($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); + } + + /** + * DeleteResource performs an HTTP DELETE on the Kubernetes API Server. + * + * The async variant is {@see self::deleteResourceAsync()} . + * + * @param HttpBody $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 HttpBody + * + * @throws ApiException Thrown if the API call fails. + * + * @experimental + */ + public function deleteResource(HttpBody $request, array $callOptions = []): HttpBody + { + return $this->startApiCall('DeleteResource', $request, $callOptions)->wait(); + } + + /** + * GetResource performs an HTTP GET request on the Kubernetes API Server. + * + * The async variant is {@see self::getResourceAsync()} . + * + * @param HttpBody $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 HttpBody + * + * @throws ApiException Thrown if the API call fails. + * + * @experimental + */ + public function getResource(HttpBody $request, array $callOptions = []): HttpBody + { + return $this->startApiCall('GetResource', $request, $callOptions)->wait(); + } + + /** + * PatchResource performs an HTTP PATCH on the Kubernetes API Server. + * + * The async variant is {@see self::patchResourceAsync()} . + * + * @param HttpBody $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 HttpBody + * + * @throws ApiException Thrown if the API call fails. + * + * @experimental + */ + public function patchResource(HttpBody $request, array $callOptions = []): HttpBody + { + return $this->startApiCall('PatchResource', $request, $callOptions)->wait(); + } + + /** + * PostResource performs an HTTP POST on the Kubernetes API Server. + * + * The async variant is {@see self::postResourceAsync()} . + * + * @param HttpBody $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 HttpBody + * + * @throws ApiException Thrown if the API call fails. + * + * @experimental + */ + public function postResource(HttpBody $request, array $callOptions = []): HttpBody + { + return $this->startApiCall('PostResource', $request, $callOptions)->wait(); + } + + /** + * PutResource performs an HTTP PUT on the Kubernetes API Server. + * + * The async variant is {@see self::putResourceAsync()} . + * + * @param HttpBody $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 HttpBody + * + * @throws ApiException Thrown if the API call fails. + * + * @experimental + */ + public function putResource(HttpBody $request, array $callOptions = []): HttpBody + { + return $this->startApiCall('PutResource', $request, $callOptions)->wait(); + } +} diff --git a/owl-bot-staging/GkeConnectGateway/v1beta1/src/V1beta1/Client/GatewayServiceClient.php b/owl-bot-staging/GkeConnectGateway/v1beta1/src/V1beta1/Client/GatewayServiceClient.php new file mode 100644 index 000000000000..769dad76db63 --- /dev/null +++ b/owl-bot-staging/GkeConnectGateway/v1beta1/src/V1beta1/Client/GatewayServiceClient.php @@ -0,0 +1,42 @@ +deleteResource(); + * } finally { + * $gatewayServiceClient->close(); + * } + * ``` + * + * @experimental + */ +class GatewayServiceGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.gkeconnect.gateway.v1beta1.GatewayService'; + + /** The default address of the service. */ + const SERVICE_ADDRESS = 'connectgateway.googleapis.com'; + + /** The default port of the service. */ + const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + ]; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/gateway_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/gateway_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/gateway_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/gateway_service_rest_client_config.php', + ], + ], + ]; + } + + /** + * 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 'connectgateway.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. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *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' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods 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 + * + * @experimental + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + } + + /** + * DeleteResource performs an HTTP DELETE on the Kubernetes API Server. + * + * Sample code: + * ``` + * $gatewayServiceClient = new GatewayServiceClient(); + * try { + * $response = $gatewayServiceClient->deleteResource(); + * } finally { + * $gatewayServiceClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $contentType + * The HTTP Content-Type header value specifying the content type of the body. + * @type string $data + * The HTTP request/response body as raw binary. + * @type Any[] $extensions + * Application specific response metadata. Must be set in the first response + * for streaming APIs. + * @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 \Google\Api\HttpBody + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function deleteResource(array $optionalArgs = []) + { + $request = new HttpBody(); + if (isset($optionalArgs['contentType'])) { + $request->setContentType($optionalArgs['contentType']); + } + + if (isset($optionalArgs['data'])) { + $request->setData($optionalArgs['data']); + } + + if (isset($optionalArgs['extensions'])) { + $request->setExtensions($optionalArgs['extensions']); + } + + return $this->startCall('DeleteResource', HttpBody::class, $optionalArgs, $request)->wait(); + } + + /** + * GetResource performs an HTTP GET request on the Kubernetes API Server. + * + * Sample code: + * ``` + * $gatewayServiceClient = new GatewayServiceClient(); + * try { + * $response = $gatewayServiceClient->getResource(); + * } finally { + * $gatewayServiceClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $contentType + * The HTTP Content-Type header value specifying the content type of the body. + * @type string $data + * The HTTP request/response body as raw binary. + * @type Any[] $extensions + * Application specific response metadata. Must be set in the first response + * for streaming APIs. + * @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 \Google\Api\HttpBody + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function getResource(array $optionalArgs = []) + { + $request = new HttpBody(); + if (isset($optionalArgs['contentType'])) { + $request->setContentType($optionalArgs['contentType']); + } + + if (isset($optionalArgs['data'])) { + $request->setData($optionalArgs['data']); + } + + if (isset($optionalArgs['extensions'])) { + $request->setExtensions($optionalArgs['extensions']); + } + + return $this->startCall('GetResource', HttpBody::class, $optionalArgs, $request)->wait(); + } + + /** + * PatchResource performs an HTTP PATCH on the Kubernetes API Server. + * + * Sample code: + * ``` + * $gatewayServiceClient = new GatewayServiceClient(); + * try { + * $response = $gatewayServiceClient->patchResource(); + * } finally { + * $gatewayServiceClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $contentType + * The HTTP Content-Type header value specifying the content type of the body. + * @type string $data + * The HTTP request/response body as raw binary. + * @type Any[] $extensions + * Application specific response metadata. Must be set in the first response + * for streaming APIs. + * @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 \Google\Api\HttpBody + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function patchResource(array $optionalArgs = []) + { + $request = new HttpBody(); + if (isset($optionalArgs['contentType'])) { + $request->setContentType($optionalArgs['contentType']); + } + + if (isset($optionalArgs['data'])) { + $request->setData($optionalArgs['data']); + } + + if (isset($optionalArgs['extensions'])) { + $request->setExtensions($optionalArgs['extensions']); + } + + return $this->startCall('PatchResource', HttpBody::class, $optionalArgs, $request)->wait(); + } + + /** + * PostResource performs an HTTP POST on the Kubernetes API Server. + * + * Sample code: + * ``` + * $gatewayServiceClient = new GatewayServiceClient(); + * try { + * $response = $gatewayServiceClient->postResource(); + * } finally { + * $gatewayServiceClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $contentType + * The HTTP Content-Type header value specifying the content type of the body. + * @type string $data + * The HTTP request/response body as raw binary. + * @type Any[] $extensions + * Application specific response metadata. Must be set in the first response + * for streaming APIs. + * @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 \Google\Api\HttpBody + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function postResource(array $optionalArgs = []) + { + $request = new HttpBody(); + if (isset($optionalArgs['contentType'])) { + $request->setContentType($optionalArgs['contentType']); + } + + if (isset($optionalArgs['data'])) { + $request->setData($optionalArgs['data']); + } + + if (isset($optionalArgs['extensions'])) { + $request->setExtensions($optionalArgs['extensions']); + } + + return $this->startCall('PostResource', HttpBody::class, $optionalArgs, $request)->wait(); + } + + /** + * PutResource performs an HTTP PUT on the Kubernetes API Server. + * + * Sample code: + * ``` + * $gatewayServiceClient = new GatewayServiceClient(); + * try { + * $response = $gatewayServiceClient->putResource(); + * } finally { + * $gatewayServiceClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $contentType + * The HTTP Content-Type header value specifying the content type of the body. + * @type string $data + * The HTTP request/response body as raw binary. + * @type Any[] $extensions + * Application specific response metadata. Must be set in the first response + * for streaming APIs. + * @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 \Google\Api\HttpBody + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function putResource(array $optionalArgs = []) + { + $request = new HttpBody(); + if (isset($optionalArgs['contentType'])) { + $request->setContentType($optionalArgs['contentType']); + } + + if (isset($optionalArgs['data'])) { + $request->setData($optionalArgs['data']); + } + + if (isset($optionalArgs['extensions'])) { + $request->setExtensions($optionalArgs['extensions']); + } + + return $this->startCall('PutResource', HttpBody::class, $optionalArgs, $request)->wait(); + } +} diff --git a/owl-bot-staging/GkeConnectGateway/v1beta1/src/V1beta1/GatewayServiceClient.php b/owl-bot-staging/GkeConnectGateway/v1beta1/src/V1beta1/GatewayServiceClient.php new file mode 100644 index 000000000000..308dcb942365 --- /dev/null +++ b/owl-bot-staging/GkeConnectGateway/v1beta1/src/V1beta1/GatewayServiceClient.php @@ -0,0 +1,36 @@ + [ + 'google.cloud.gkeconnect.gateway.v1beta1.GatewayService' => [ + 'DeleteResource' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Api\HttpBody', + ], + 'GetResource' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Api\HttpBody', + ], + 'PatchResource' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Api\HttpBody', + ], + 'PostResource' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Api\HttpBody', + ], + 'PutResource' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Api\HttpBody', + ], + ], + ], +]; diff --git a/owl-bot-staging/GkeConnectGateway/v1beta1/src/V1beta1/resources/gateway_service_rest_client_config.php b/owl-bot-staging/GkeConnectGateway/v1beta1/src/V1beta1/resources/gateway_service_rest_client_config.php new file mode 100644 index 000000000000..ebf22f1abe05 --- /dev/null +++ b/owl-bot-staging/GkeConnectGateway/v1beta1/src/V1beta1/resources/gateway_service_rest_client_config.php @@ -0,0 +1,28 @@ + [ + 'google.cloud.gkeconnect.gateway.v1beta1.GatewayService' => [ + 'DeleteResource' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1beta1/**', + ], + 'GetResource' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta1/**', + ], + 'PatchResource' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1beta1/**', + ], + 'PostResource' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta1/**', + ], + 'PutResource' => [ + 'method' => 'put', + 'uriTemplate' => '/v1beta1/**', + ], + ], + ], +]; diff --git a/owl-bot-staging/GkeConnectGateway/v1beta1/tests/Unit/V1beta1/Client/GatewayServiceClientTest.php b/owl-bot-staging/GkeConnectGateway/v1beta1/tests/Unit/V1beta1/Client/GatewayServiceClientTest.php new file mode 100644 index 000000000000..ae83ba4026ac --- /dev/null +++ b/owl-bot-staging/GkeConnectGateway/v1beta1/tests/Unit/V1beta1/Client/GatewayServiceClientTest.php @@ -0,0 +1,377 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return GatewayServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new GatewayServiceClient($options); + } + + /** @test */ + public function deleteResourceTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $contentType2 = 'contentType2540291827'; + $data2 = '-35'; + $expectedResponse = new HttpBody(); + $expectedResponse->setContentType($contentType2); + $expectedResponse->setData($data2); + $transport->addResponse($expectedResponse); + $request = new HttpBody(); + $response = $gapicClient->deleteResource($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkeconnect.gateway.v1beta1.GatewayService/DeleteResource', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteResourceExceptionTest() + { + $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); + $request = new HttpBody(); + try { + $gapicClient->deleteResource($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 getResourceTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $contentType2 = 'contentType2540291827'; + $data2 = '-35'; + $expectedResponse = new HttpBody(); + $expectedResponse->setContentType($contentType2); + $expectedResponse->setData($data2); + $transport->addResponse($expectedResponse); + $request = new HttpBody(); + $response = $gapicClient->getResource($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkeconnect.gateway.v1beta1.GatewayService/GetResource', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getResourceExceptionTest() + { + $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); + $request = new HttpBody(); + try { + $gapicClient->getResource($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 patchResourceTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $contentType2 = 'contentType2540291827'; + $data2 = '-35'; + $expectedResponse = new HttpBody(); + $expectedResponse->setContentType($contentType2); + $expectedResponse->setData($data2); + $transport->addResponse($expectedResponse); + $request = new HttpBody(); + $response = $gapicClient->patchResource($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkeconnect.gateway.v1beta1.GatewayService/PatchResource', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function patchResourceExceptionTest() + { + $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); + $request = new HttpBody(); + try { + $gapicClient->patchResource($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 postResourceTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $contentType2 = 'contentType2540291827'; + $data2 = '-35'; + $expectedResponse = new HttpBody(); + $expectedResponse->setContentType($contentType2); + $expectedResponse->setData($data2); + $transport->addResponse($expectedResponse); + $request = new HttpBody(); + $response = $gapicClient->postResource($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkeconnect.gateway.v1beta1.GatewayService/PostResource', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function postResourceExceptionTest() + { + $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); + $request = new HttpBody(); + try { + $gapicClient->postResource($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 putResourceTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $contentType2 = 'contentType2540291827'; + $data2 = '-35'; + $expectedResponse = new HttpBody(); + $expectedResponse->setContentType($contentType2); + $expectedResponse->setData($data2); + $transport->addResponse($expectedResponse); + $request = new HttpBody(); + $response = $gapicClient->putResource($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkeconnect.gateway.v1beta1.GatewayService/PutResource', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function putResourceExceptionTest() + { + $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); + $request = new HttpBody(); + try { + $gapicClient->putResource($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 deleteResourceAsyncTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $contentType2 = 'contentType2540291827'; + $data2 = '-35'; + $expectedResponse = new HttpBody(); + $expectedResponse->setContentType($contentType2); + $expectedResponse->setData($data2); + $transport->addResponse($expectedResponse); + $request = new HttpBody(); + $response = $gapicClient->deleteResourceAsync($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.cloud.gkeconnect.gateway.v1beta1.GatewayService/DeleteResource', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/owl-bot-staging/GkeConnectGateway/v1beta1/tests/Unit/V1beta1/GatewayServiceClientTest.php b/owl-bot-staging/GkeConnectGateway/v1beta1/tests/Unit/V1beta1/GatewayServiceClientTest.php new file mode 100644 index 000000000000..ba0c79d1649f --- /dev/null +++ b/owl-bot-staging/GkeConnectGateway/v1beta1/tests/Unit/V1beta1/GatewayServiceClientTest.php @@ -0,0 +1,341 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return GatewayServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new GatewayServiceClient($options); + } + + /** @test */ + public function deleteResourceTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $contentType2 = 'contentType2540291827'; + $data2 = '-35'; + $expectedResponse = new HttpBody(); + $expectedResponse->setContentType($contentType2); + $expectedResponse->setData($data2); + $transport->addResponse($expectedResponse); + $response = $gapicClient->deleteResource(); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkeconnect.gateway.v1beta1.GatewayService/DeleteResource', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteResourceExceptionTest() + { + $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); + try { + $gapicClient->deleteResource(); + // 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 getResourceTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $contentType2 = 'contentType2540291827'; + $data2 = '-35'; + $expectedResponse = new HttpBody(); + $expectedResponse->setContentType($contentType2); + $expectedResponse->setData($data2); + $transport->addResponse($expectedResponse); + $response = $gapicClient->getResource(); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkeconnect.gateway.v1beta1.GatewayService/GetResource', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getResourceExceptionTest() + { + $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); + try { + $gapicClient->getResource(); + // 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 patchResourceTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $contentType2 = 'contentType2540291827'; + $data2 = '-35'; + $expectedResponse = new HttpBody(); + $expectedResponse->setContentType($contentType2); + $expectedResponse->setData($data2); + $transport->addResponse($expectedResponse); + $response = $gapicClient->patchResource(); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkeconnect.gateway.v1beta1.GatewayService/PatchResource', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function patchResourceExceptionTest() + { + $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); + try { + $gapicClient->patchResource(); + // 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 postResourceTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $contentType2 = 'contentType2540291827'; + $data2 = '-35'; + $expectedResponse = new HttpBody(); + $expectedResponse->setContentType($contentType2); + $expectedResponse->setData($data2); + $transport->addResponse($expectedResponse); + $response = $gapicClient->postResource(); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkeconnect.gateway.v1beta1.GatewayService/PostResource', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function postResourceExceptionTest() + { + $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); + try { + $gapicClient->postResource(); + // 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 putResourceTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $contentType2 = 'contentType2540291827'; + $data2 = '-35'; + $expectedResponse = new HttpBody(); + $expectedResponse->setContentType($contentType2); + $expectedResponse->setData($data2); + $transport->addResponse($expectedResponse); + $response = $gapicClient->putResource(); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkeconnect.gateway.v1beta1.GatewayService/PutResource', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function putResourceExceptionTest() + { + $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); + try { + $gapicClient->putResource(); + // 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()); + } +} diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/GPBMetadata/Google/Cloud/Gkemulticloud/V1/AttachedResources.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/GPBMetadata/Google/Cloud/Gkemulticloud/V1/AttachedResources.php new file mode 100644 index 000000000000..3692d8b622c8 Binary files /dev/null and b/owl-bot-staging/GkeMultiCloud/v1/proto/src/GPBMetadata/Google/Cloud/Gkemulticloud/V1/AttachedResources.php differ diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/GPBMetadata/Google/Cloud/Gkemulticloud/V1/AttachedService.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/GPBMetadata/Google/Cloud/Gkemulticloud/V1/AttachedService.php new file mode 100644 index 000000000000..78a2e7bbf8d2 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/GPBMetadata/Google/Cloud/Gkemulticloud/V1/AttachedService.php @@ -0,0 +1,89 @@ +internalAddGeneratedFile( + ' +é +4google/cloud/gkemulticloud/v1/attached_service.protogoogle.cloud.gkemulticloud.v1google/api/client.protogoogle/api/field_behavior.protogoogle/api/resource.proto6google/cloud/gkemulticloud/v1/attached_resources.proto#google/longrunning/operations.proto google/protobuf/field_mask.proto"¶ +-GenerateAttachedClusterInstallManifestRequestD +parent ( B4àAúA.,gkemulticloud.googleapis.com/AttachedCluster +attached_cluster_id ( BàA +platform_version ( BàA"B +.GenerateAttachedClusterInstallManifestResponse +manifest ( "ì +CreateAttachedClusterRequestD +parent ( B4àAúA.,gkemulticloud.googleapis.com/AttachedClusterM +attached_cluster ( 2..google.cloud.gkemulticloud.v1.AttachedClusterBàA +attached_cluster_id ( BàA + validate_only ("Ô +ImportAttachedClusterRequestD +parent ( B4àAúA.,gkemulticloud.googleapis.com/AttachedCluster + validate_only ( +fleet_membership ( BàA +platform_version ( BàA + distribution ( BàA"º +UpdateAttachedClusterRequestM +attached_cluster ( 2..google.cloud.gkemulticloud.v1.AttachedClusterBàA + validate_only (4 + update_mask ( 2.google.protobuf.FieldMaskBàA"_ +GetAttachedClusterRequestB +name ( B4àAúA. +,gkemulticloud.googleapis.com/AttachedCluster"Š +ListAttachedClustersRequestD +parent ( B4àAúA.,gkemulticloud.googleapis.com/AttachedCluster + page_size ( + +page_token ( "‚ +ListAttachedClustersResponseI +attached_clusters ( 2..google.cloud.gkemulticloud.v1.AttachedCluster +next_page_token ( "µ +DeleteAttachedClusterRequestB +name ( B4àAúA. +,gkemulticloud.googleapis.com/AttachedCluster + validate_only ( + allow_missing ( + ignore_errors ( +etag ( "i +GetAttachedServerConfigRequestG +name ( B9àAúA3 +1gkemulticloud.googleapis.com/AttachedServerConfig2µ +AttachedClusters™ +CreateAttachedCluster;.google.cloud.gkemulticloud.v1.CreateAttachedClusterRequest.google.longrunning.Operation"£‚Óä“H"4/v1/{parent=projects/*/locations/*}/attachedClusters:attached_clusterÚA+parent,attached_cluster,attached_cluster_idÊA$ +AttachedClusterOperationMetadata› +UpdateAttachedCluster;.google.cloud.gkemulticloud.v1.UpdateAttachedClusterRequest.google.longrunning.Operation"¥‚Óä“Y2E/v1/{attached_cluster.name=projects/*/locations/*/attachedClusters/*}:attached_clusterÚAattached_cluster,update_maskÊA$ +AttachedClusterOperationMetadataý +ImportAttachedCluster;.google.cloud.gkemulticloud.v1.ImportAttachedClusterRequest.google.longrunning.Operation"‡‚Óä“@";/v1/{parent=projects/*/locations/*}/attachedClusters:import:*ÚAparent,fleet_membershipÊA$ +AttachedClusterOperationMetadataà +GetAttachedCluster8.google.cloud.gkemulticloud.v1.GetAttachedClusterRequest..google.cloud.gkemulticloud.v1.AttachedCluster"C‚Óä“64/v1/{name=projects/*/locations/*/attachedClusters/*}ÚAnameÖ +ListAttachedClusters:.google.cloud.gkemulticloud.v1.ListAttachedClustersRequest;.google.cloud.gkemulticloud.v1.ListAttachedClustersResponse"E‚Óä“64/v1/{parent=projects/*/locations/*}/attachedClustersÚAparentå +DeleteAttachedCluster;.google.cloud.gkemulticloud.v1.DeleteAttachedClusterRequest.google.longrunning.Operation"p‚Óä“6*4/v1/{name=projects/*/locations/*/attachedClusters/*}ÚAnameÊA* +google.protobuf.EmptyOperationMetadataÔ +GetAttachedServerConfig=.google.cloud.gkemulticloud.v1.GetAttachedServerConfigRequest3.google.cloud.gkemulticloud.v1.AttachedServerConfig"E‚Óä“86/v1/{name=projects/*/locations/*/attachedServerConfig}ÚAname¶ +&GenerateAttachedClusterInstallManifestL.google.cloud.gkemulticloud.v1.GenerateAttachedClusterInstallManifestRequestM.google.cloud.gkemulticloud.v1.GenerateAttachedClusterInstallManifestResponse"o‚Óä“LJ/v1/{parent=projects/*/locations/*}:generateAttachedClusterInstallManifestÚAparent,attached_cluster_idPÊAgkemulticloud.googleapis.comÒA.https://www.googleapis.com/auth/cloud-platformBç +!com.google.cloud.gkemulticloud.v1BAttachedServiceProtoPZGcloud.google.com/go/gkemulticloud/apiv1/gkemulticloudpb;gkemulticloudpbªGoogle.Cloud.GkeMultiCloud.V1ÊGoogle\\Cloud\\GkeMultiCloud\\V1ê Google::Cloud::GkeMultiCloud::V1bproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/GPBMetadata/Google/Cloud/Gkemulticloud/V1/AwsResources.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/GPBMetadata/Google/Cloud/Gkemulticloud/V1/AwsResources.php new file mode 100644 index 000000000000..37d44a144b15 Binary files /dev/null and b/owl-bot-staging/GkeMultiCloud/v1/proto/src/GPBMetadata/Google/Cloud/Gkemulticloud/V1/AwsResources.php differ diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/GPBMetadata/Google/Cloud/Gkemulticloud/V1/AwsService.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/GPBMetadata/Google/Cloud/Gkemulticloud/V1/AwsService.php new file mode 100644 index 000000000000..0c6fd9724988 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/GPBMetadata/Google/Cloud/Gkemulticloud/V1/AwsService.php @@ -0,0 +1,117 @@ +internalAddGeneratedFile( + ' +Ö* +/google/cloud/gkemulticloud/v1/aws_service.protogoogle.cloud.gkemulticloud.v1google/api/client.protogoogle/api/field_behavior.protogoogle/api/resource.proto1google/cloud/gkemulticloud/v1/aws_resources.proto#google/longrunning/operations.proto google/protobuf/field_mask.protogoogle/protobuf/timestamp.proto"Ó +CreateAwsClusterRequest? +parent ( B/àAúA)\'gkemulticloud.googleapis.com/AwsClusterC + aws_cluster ( 2).google.cloud.gkemulticloud.v1.AwsClusterBàA +aws_cluster_id ( BàA + validate_only ("« +UpdateAwsClusterRequestC + aws_cluster ( 2).google.cloud.gkemulticloud.v1.AwsClusterBàA + validate_only (4 + update_mask ( 2.google.protobuf.FieldMaskBàA"U +GetAwsClusterRequest= +name ( B/àAúA) +\'gkemulticloud.googleapis.com/AwsCluster"€ +ListAwsClustersRequest? +parent ( B/àAúA)\'gkemulticloud.googleapis.com/AwsCluster + page_size ( + +page_token ( "s +ListAwsClustersResponse? + aws_clusters ( 2).google.cloud.gkemulticloud.v1.AwsCluster +next_page_token ( "” +DeleteAwsClusterRequest= +name ( B/àAúA) +\'gkemulticloud.googleapis.com/AwsCluster + validate_only ( + allow_missing ( +etag ( "Ú +CreateAwsNodePoolRequest@ +parent ( B0àAúA*(gkemulticloud.googleapis.com/AwsNodePoolF + aws_node_pool ( 2*.google.cloud.gkemulticloud.v1.AwsNodePoolBàA +aws_node_pool_id ( BàA + validate_only ("¯ +UpdateAwsNodePoolRequestF + aws_node_pool ( 2*.google.cloud.gkemulticloud.v1.AwsNodePoolBàA + validate_only (4 + update_mask ( 2.google.protobuf.FieldMaskBàA"W +GetAwsNodePoolRequest> +name ( B0àAúA* +(gkemulticloud.googleapis.com/AwsNodePool"‚ +ListAwsNodePoolsRequest@ +parent ( B0àAúA*(gkemulticloud.googleapis.com/AwsNodePool + page_size ( + +page_token ( "w +ListAwsNodePoolsResponseB +aws_node_pools ( 2*.google.cloud.gkemulticloud.v1.AwsNodePool +next_page_token ( "– +DeleteAwsNodePoolRequest> +name ( B0àAúA* +(gkemulticloud.googleapis.com/AwsNodePool + validate_only ( + allow_missing ( +etag ( "_ +GetAwsServerConfigRequestB +name ( B4àAúA. +,gkemulticloud.googleapis.com/AwsServerConfig"e +GenerateAwsAccessTokenRequestD + aws_cluster ( B/àAúA) +\'gkemulticloud.googleapis.com/AwsCluster"u +GenerateAwsAccessTokenResponse + access_token ( BàA8 +expiration_time ( 2.google.protobuf.TimestampBàA2þ + AwsClustersö +CreateAwsCluster6.google.cloud.gkemulticloud.v1.CreateAwsClusterRequest.google.longrunning.Operation"Š‚Óä“>"//v1/{parent=projects/*/locations/*}/awsClusters: aws_clusterÚA!parent,aws_cluster,aws_cluster_idÊA + +AwsClusterOperationMetadataø +UpdateAwsCluster6.google.cloud.gkemulticloud.v1.UpdateAwsClusterRequest.google.longrunning.Operation"Œ‚Óä“J2;/v1/{aws_cluster.name=projects/*/locations/*/awsClusters/*}: aws_clusterÚAaws_cluster,update_maskÊA + +AwsClusterOperationMetadata¯ + GetAwsCluster3.google.cloud.gkemulticloud.v1.GetAwsClusterRequest).google.cloud.gkemulticloud.v1.AwsCluster">‚Óä“1//v1/{name=projects/*/locations/*/awsClusters/*}ÚAname +ListAwsClusters5.google.cloud.gkemulticloud.v1.ListAwsClustersRequest6.google.cloud.gkemulticloud.v1.ListAwsClustersResponse"@‚Óä“1//v1/{parent=projects/*/locations/*}/awsClustersÚAparentÖ +DeleteAwsCluster6.google.cloud.gkemulticloud.v1.DeleteAwsClusterRequest.google.longrunning.Operation"k‚Óä“1*//v1/{name=projects/*/locations/*/awsClusters/*}ÚAnameÊA* +google.protobuf.EmptyOperationMetadataì +GenerateAwsAccessToken<.google.cloud.gkemulticloud.v1.GenerateAwsAccessTokenRequest=.google.cloud.gkemulticloud.v1.GenerateAwsAccessTokenResponse"U‚Óä“OM/v1/{aws_cluster=projects/*/locations/*/awsClusters/*}:generateAwsAccessTokenŽ +CreateAwsNodePool7.google.cloud.gkemulticloud.v1.CreateAwsNodePoolRequest.google.longrunning.Operation" ‚Óä“O">/v1/{parent=projects/*/locations/*/awsClusters/*}/awsNodePools: aws_node_poolÚA%parent,aws_node_pool,aws_node_pool_idÊA + AwsNodePoolOperationMetadata +UpdateAwsNodePool7.google.cloud.gkemulticloud.v1.UpdateAwsNodePoolRequest.google.longrunning.Operation"¢‚Óä“]2L/v1/{aws_node_pool.name=projects/*/locations/*/awsClusters/*/awsNodePools/*}: aws_node_poolÚAaws_node_pool,update_maskÊA + AwsNodePoolOperationMetadataÁ +GetAwsNodePool4.google.cloud.gkemulticloud.v1.GetAwsNodePoolRequest*.google.cloud.gkemulticloud.v1.AwsNodePool"M‚Óä“@>/v1/{name=projects/*/locations/*/awsClusters/*/awsNodePools/*}ÚAnameÔ +ListAwsNodePools6.google.cloud.gkemulticloud.v1.ListAwsNodePoolsRequest7.google.cloud.gkemulticloud.v1.ListAwsNodePoolsResponse"O‚Óä“@>/v1/{parent=projects/*/locations/*/awsClusters/*}/awsNodePoolsÚAparentç +DeleteAwsNodePool7.google.cloud.gkemulticloud.v1.DeleteAwsNodePoolRequest.google.longrunning.Operation"z‚Óä“@*>/v1/{name=projects/*/locations/*/awsClusters/*/awsNodePools/*}ÚAnameÊA* +google.protobuf.EmptyOperationMetadataÀ +GetAwsServerConfig8.google.cloud.gkemulticloud.v1.GetAwsServerConfigRequest..google.cloud.gkemulticloud.v1.AwsServerConfig"@‚Óä“31/v1/{name=projects/*/locations/*/awsServerConfig}ÚAnamePÊAgkemulticloud.googleapis.comÒA.https://www.googleapis.com/auth/cloud-platformBâ +!com.google.cloud.gkemulticloud.v1BAwsServiceProtoPZGcloud.google.com/go/gkemulticloud/apiv1/gkemulticloudpb;gkemulticloudpbªGoogle.Cloud.GkeMultiCloud.V1ÊGoogle\\Cloud\\GkeMultiCloud\\V1ê Google::Cloud::GkeMultiCloud::V1bproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/GPBMetadata/Google/Cloud/Gkemulticloud/V1/AzureResources.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/GPBMetadata/Google/Cloud/Gkemulticloud/V1/AzureResources.php new file mode 100644 index 000000000000..6f0c8cdc700a Binary files /dev/null and b/owl-bot-staging/GkeMultiCloud/v1/proto/src/GPBMetadata/Google/Cloud/Gkemulticloud/V1/AzureResources.php differ diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/GPBMetadata/Google/Cloud/Gkemulticloud/V1/AzureService.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/GPBMetadata/Google/Cloud/Gkemulticloud/V1/AzureService.php new file mode 100644 index 000000000000..138026bff0d4 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/GPBMetadata/Google/Cloud/Gkemulticloud/V1/AzureService.php @@ -0,0 +1,142 @@ +internalAddGeneratedFile( + ' +Ç8 +1google/cloud/gkemulticloud/v1/azure_service.protogoogle.cloud.gkemulticloud.v1google/api/client.protogoogle/api/field_behavior.protogoogle/api/resource.proto3google/cloud/gkemulticloud/v1/azure_resources.proto#google/longrunning/operations.proto google/protobuf/field_mask.protogoogle/protobuf/timestamp.proto"Ý +CreateAzureClusterRequestA +parent ( B1àAúA+)gkemulticloud.googleapis.com/AzureClusterG + azure_cluster ( 2+.google.cloud.gkemulticloud.v1.AzureClusterBàA +azure_cluster_id ( BàA + validate_only ("± +UpdateAzureClusterRequestG + azure_cluster ( 2+.google.cloud.gkemulticloud.v1.AzureClusterBàA + validate_only (4 + update_mask ( 2.google.protobuf.FieldMaskBàA"Y +GetAzureClusterRequest? +name ( B1àAúA+ +)gkemulticloud.googleapis.com/AzureCluster"„ +ListAzureClustersRequestA +parent ( B1àAúA+)gkemulticloud.googleapis.com/AzureCluster + page_size ( + +page_token ( "y +ListAzureClustersResponseC +azure_clusters ( 2+.google.cloud.gkemulticloud.v1.AzureCluster +next_page_token ( "˜ +DeleteAzureClusterRequest? +name ( B1àAúA+ +)gkemulticloud.googleapis.com/AzureCluster + allow_missing ( + validate_only ( +etag ( "ä +CreateAzureNodePoolRequestB +parent ( B2àAúA,*gkemulticloud.googleapis.com/AzureNodePoolJ +azure_node_pool ( 2,.google.cloud.gkemulticloud.v1.AzureNodePoolBàA +azure_node_pool_id ( BàA + validate_only ("µ +UpdateAzureNodePoolRequestJ +azure_node_pool ( 2,.google.cloud.gkemulticloud.v1.AzureNodePoolBàA + validate_only (4 + update_mask ( 2.google.protobuf.FieldMaskBàA"[ +GetAzureNodePoolRequest@ +name ( B2àAúA, +*gkemulticloud.googleapis.com/AzureNodePool"† +ListAzureNodePoolsRequestB +parent ( B2àAúA,*gkemulticloud.googleapis.com/AzureNodePool + page_size ( + +page_token ( "} +ListAzureNodePoolsResponseF +azure_node_pools ( 2,.google.cloud.gkemulticloud.v1.AzureNodePool +next_page_token ( "š +DeleteAzureNodePoolRequest@ +name ( B2àAúA, +*gkemulticloud.googleapis.com/AzureNodePool + validate_only ( + allow_missing ( +etag ( "c +GetAzureServerConfigRequestD +name ( B6àAúA0 +.gkemulticloud.googleapis.com/AzureServerConfig"Ø +CreateAzureClientRequest@ +parent ( B0àAúA*(gkemulticloud.googleapis.com/AzureClientE + azure_client ( 2*.google.cloud.gkemulticloud.v1.AzureClientBàA +azure_client_id ( BàA + validate_only ("W +GetAzureClientRequest> +name ( B0àAúA* +(gkemulticloud.googleapis.com/AzureClient"‚ +ListAzureClientsRequest@ +parent ( B0àAúA*(gkemulticloud.googleapis.com/AzureClient + page_size ( + +page_token ( "v +ListAzureClientsResponseA + azure_clients ( 2*.google.cloud.gkemulticloud.v1.AzureClient +next_page_token ( "ˆ +DeleteAzureClientRequest> +name ( B0àAúA* +(gkemulticloud.googleapis.com/AzureClient + allow_missing ( + validate_only ("k +GenerateAzureAccessTokenRequestH + azure_cluster ( B1àAúA+ +)gkemulticloud.googleapis.com/AzureCluster"w + GenerateAzureAccessTokenResponse + access_token ( BàA8 +expiration_time ( 2.google.protobuf.TimestampBàA2Ý + AzureClustersý +CreateAzureClient7.google.cloud.gkemulticloud.v1.CreateAzureClientRequest.google.longrunning.Operation"‚Óä“@"0/v1/{parent=projects/*/locations/*}/azureClients: azure_clientÚA#parent,azure_client,azure_client_idÊA + AzureClientOperationMetadata³ +GetAzureClient4.google.cloud.gkemulticloud.v1.GetAzureClientRequest*.google.cloud.gkemulticloud.v1.AzureClient"?‚Óä“20/v1/{name=projects/*/locations/*/azureClients/*}ÚAnameÆ +ListAzureClients6.google.cloud.gkemulticloud.v1.ListAzureClientsRequest7.google.cloud.gkemulticloud.v1.ListAzureClientsResponse"A‚Óä“20/v1/{parent=projects/*/locations/*}/azureClientsÚAparentÙ +DeleteAzureClient7.google.cloud.gkemulticloud.v1.DeleteAzureClientRequest.google.longrunning.Operation"l‚Óä“2*0/v1/{name=projects/*/locations/*/azureClients/*}ÚAnameÊA* +google.protobuf.EmptyOperationMetadata„ +CreateAzureCluster8.google.cloud.gkemulticloud.v1.CreateAzureClusterRequest.google.longrunning.Operation"”‚Óä“B"1/v1/{parent=projects/*/locations/*}/azureClusters: azure_clusterÚA%parent,azure_cluster,azure_cluster_idÊA! + AzureClusterOperationMetadata† +UpdateAzureCluster8.google.cloud.gkemulticloud.v1.UpdateAzureClusterRequest.google.longrunning.Operation"–‚Óä“P2?/v1/{azure_cluster.name=projects/*/locations/*/azureClusters/*}: azure_clusterÚAazure_cluster,update_maskÊA! + AzureClusterOperationMetadata· +GetAzureCluster5.google.cloud.gkemulticloud.v1.GetAzureClusterRequest+.google.cloud.gkemulticloud.v1.AzureCluster"@‚Óä“31/v1/{name=projects/*/locations/*/azureClusters/*}ÚAnameÊ +ListAzureClusters7.google.cloud.gkemulticloud.v1.ListAzureClustersRequest8.google.cloud.gkemulticloud.v1.ListAzureClustersResponse"B‚Óä“31/v1/{parent=projects/*/locations/*}/azureClustersÚAparentÜ +DeleteAzureCluster8.google.cloud.gkemulticloud.v1.DeleteAzureClusterRequest.google.longrunning.Operation"m‚Óä“3*1/v1/{name=projects/*/locations/*/azureClusters/*}ÚAnameÊA* +google.protobuf.EmptyOperationMetadataø +GenerateAzureAccessToken>.google.cloud.gkemulticloud.v1.GenerateAzureAccessTokenRequest?.google.cloud.gkemulticloud.v1.GenerateAzureAccessTokenResponse"[‚Óä“US/v1/{azure_cluster=projects/*/locations/*/azureClusters/*}:generateAzureAccessTokenž +CreateAzureNodePool9.google.cloud.gkemulticloud.v1.CreateAzureNodePoolRequest.google.longrunning.Operation"¬‚Óä“U"B/v1/{parent=projects/*/locations/*/azureClusters/*}/azureNodePools:azure_node_poolÚA)parent,azure_node_pool,azure_node_pool_idÊA" + AzureNodePoolOperationMetadata  +UpdateAzureNodePool9.google.cloud.gkemulticloud.v1.UpdateAzureNodePoolRequest.google.longrunning.Operation"®‚Óä“e2R/v1/{azure_node_pool.name=projects/*/locations/*/azureClusters/*/azureNodePools/*}:azure_node_poolÚAazure_node_pool,update_maskÊA" + AzureNodePoolOperationMetadataË +GetAzureNodePool6.google.cloud.gkemulticloud.v1.GetAzureNodePoolRequest,.google.cloud.gkemulticloud.v1.AzureNodePool"Q‚Óä“DB/v1/{name=projects/*/locations/*/azureClusters/*/azureNodePools/*}ÚAnameÞ +ListAzureNodePools8.google.cloud.gkemulticloud.v1.ListAzureNodePoolsRequest9.google.cloud.gkemulticloud.v1.ListAzureNodePoolsResponse"S‚Óä“DB/v1/{parent=projects/*/locations/*/azureClusters/*}/azureNodePoolsÚAparentï +DeleteAzureNodePool9.google.cloud.gkemulticloud.v1.DeleteAzureNodePoolRequest.google.longrunning.Operation"~‚Óä“D*B/v1/{name=projects/*/locations/*/azureClusters/*/azureNodePools/*}ÚAnameÊA* +google.protobuf.EmptyOperationMetadataÈ +GetAzureServerConfig:.google.cloud.gkemulticloud.v1.GetAzureServerConfigRequest0.google.cloud.gkemulticloud.v1.AzureServerConfig"B‚Óä“53/v1/{name=projects/*/locations/*/azureServerConfig}ÚAnamePÊAgkemulticloud.googleapis.comÒA.https://www.googleapis.com/auth/cloud-platformBä +!com.google.cloud.gkemulticloud.v1BAzureServiceProtoPZGcloud.google.com/go/gkemulticloud/apiv1/gkemulticloudpb;gkemulticloudpbªGoogle.Cloud.GkeMultiCloud.V1ÊGoogle\\Cloud\\GkeMultiCloud\\V1ê Google::Cloud::GkeMultiCloud::V1bproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/GPBMetadata/Google/Cloud/Gkemulticloud/V1/CommonResources.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/GPBMetadata/Google/Cloud/Gkemulticloud/V1/CommonResources.php new file mode 100644 index 000000000000..c07c39fa719b Binary files /dev/null and b/owl-bot-staging/GkeMultiCloud/v1/proto/src/GPBMetadata/Google/Cloud/Gkemulticloud/V1/CommonResources.php differ diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AttachedCluster.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AttachedCluster.php new file mode 100644 index 000000000000..7ed03e86dca6 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AttachedCluster.php @@ -0,0 +1,877 @@ +google.cloud.gkemulticloud.v1.AttachedCluster + */ +class AttachedCluster extends \Google\Protobuf\Internal\Message +{ + /** + * The name of this resource. + * Cluster names are formatted as + * `projects//locations//attachedClusters/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * Optional. A human readable description of this cluster. + * Cannot be longer than 255 UTF-8 encoded bytes. + * + * Generated from protobuf field string description = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $description = ''; + /** + * Required. OpenID Connect (OIDC) configuration for the cluster. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AttachedOidcConfig oidc_config = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $oidc_config = null; + /** + * Required. The platform version for the cluster (e.g. `1.19.0-gke.1000`). + * You can list all supported versions on a given Google Cloud region by + * calling + * [GetAttachedServerConfig][google.cloud.gkemulticloud.v1.AttachedClusters.GetAttachedServerConfig]. + * + * Generated from protobuf field string platform_version = 4 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $platform_version = ''; + /** + * Required. The Kubernetes distribution of the underlying attached cluster. + * Supported values: ["eks", "aks"]. + * + * Generated from protobuf field string distribution = 16 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $distribution = ''; + /** + * Output only. The region where this cluster runs. + * For EKS clusters, this is a AWS region. For AKS clusters, + * this is an Azure region. + * + * Generated from protobuf field string cluster_region = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $cluster_region = ''; + /** + * Required. Fleet configuration. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.Fleet fleet = 5 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $fleet = null; + /** + * Output only. The current state of the cluster. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AttachedCluster.State state = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Output only. A globally unique identifier for the cluster. + * + * Generated from protobuf field string uid = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $uid = ''; + /** + * Output only. If set, there are currently changes in flight to the cluster. + * + * Generated from protobuf field bool reconciling = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $reconciling = false; + /** + * Output only. The time at which this cluster was registered. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. The time at which this cluster was last updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * Allows clients to perform consistent read-modify-writes + * through optimistic concurrency control. + * Can be sent on update and delete requests to ensure the + * client has an up-to-date value before proceeding. + * + * Generated from protobuf field string etag = 11; + */ + protected $etag = ''; + /** + * Output only. The Kubernetes version of the cluster. + * + * Generated from protobuf field string kubernetes_version = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $kubernetes_version = ''; + /** + * Optional. Annotations on the cluster. + * This field has the same restrictions as Kubernetes annotations. + * The total size of all keys and values combined is limited to 256k. + * Key can have 2 segments: prefix (optional) and name (required), + * separated by a slash (/). + * Prefix must be a DNS subdomain. + * Name must be 63 characters or less, begin and end with alphanumerics, + * with dashes (-), underscores (_), dots (.), and alphanumerics between. + * + * Generated from protobuf field map annotations = 13 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $annotations; + /** + * Output only. Workload Identity settings. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.WorkloadIdentityConfig workload_identity_config = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $workload_identity_config = null; + /** + * Optional. Logging configuration for this cluster. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.LoggingConfig logging_config = 15 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $logging_config = null; + /** + * Output only. A set of errors found in the cluster. + * + * Generated from protobuf field repeated .google.cloud.gkemulticloud.v1.AttachedClusterError errors = 20 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $errors; + /** + * Optional. Configuration related to the cluster RBAC settings. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AttachedClustersAuthorization authorization = 21 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $authorization = null; + /** + * Optional. Monitoring configuration for this cluster. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.MonitoringConfig monitoring_config = 23 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $monitoring_config = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The name of this resource. + * Cluster names are formatted as + * `projects//locations//attachedClusters/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * @type string $description + * Optional. A human readable description of this cluster. + * Cannot be longer than 255 UTF-8 encoded bytes. + * @type \Google\Cloud\GkeMultiCloud\V1\AttachedOidcConfig $oidc_config + * Required. OpenID Connect (OIDC) configuration for the cluster. + * @type string $platform_version + * Required. The platform version for the cluster (e.g. `1.19.0-gke.1000`). + * You can list all supported versions on a given Google Cloud region by + * calling + * [GetAttachedServerConfig][google.cloud.gkemulticloud.v1.AttachedClusters.GetAttachedServerConfig]. + * @type string $distribution + * Required. The Kubernetes distribution of the underlying attached cluster. + * Supported values: ["eks", "aks"]. + * @type string $cluster_region + * Output only. The region where this cluster runs. + * For EKS clusters, this is a AWS region. For AKS clusters, + * this is an Azure region. + * @type \Google\Cloud\GkeMultiCloud\V1\Fleet $fleet + * Required. Fleet configuration. + * @type int $state + * Output only. The current state of the cluster. + * @type string $uid + * Output only. A globally unique identifier for the cluster. + * @type bool $reconciling + * Output only. If set, there are currently changes in flight to the cluster. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The time at which this cluster was registered. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. The time at which this cluster was last updated. + * @type string $etag + * Allows clients to perform consistent read-modify-writes + * through optimistic concurrency control. + * Can be sent on update and delete requests to ensure the + * client has an up-to-date value before proceeding. + * @type string $kubernetes_version + * Output only. The Kubernetes version of the cluster. + * @type array|\Google\Protobuf\Internal\MapField $annotations + * Optional. Annotations on the cluster. + * This field has the same restrictions as Kubernetes annotations. + * The total size of all keys and values combined is limited to 256k. + * Key can have 2 segments: prefix (optional) and name (required), + * separated by a slash (/). + * Prefix must be a DNS subdomain. + * Name must be 63 characters or less, begin and end with alphanumerics, + * with dashes (-), underscores (_), dots (.), and alphanumerics between. + * @type \Google\Cloud\GkeMultiCloud\V1\WorkloadIdentityConfig $workload_identity_config + * Output only. Workload Identity settings. + * @type \Google\Cloud\GkeMultiCloud\V1\LoggingConfig $logging_config + * Optional. Logging configuration for this cluster. + * @type array<\Google\Cloud\GkeMultiCloud\V1\AttachedClusterError>|\Google\Protobuf\Internal\RepeatedField $errors + * Output only. A set of errors found in the cluster. + * @type \Google\Cloud\GkeMultiCloud\V1\AttachedClustersAuthorization $authorization + * Optional. Configuration related to the cluster RBAC settings. + * @type \Google\Cloud\GkeMultiCloud\V1\MonitoringConfig $monitoring_config + * Optional. Monitoring configuration for this cluster. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AttachedResources::initOnce(); + parent::__construct($data); + } + + /** + * The name of this resource. + * Cluster names are formatted as + * `projects//locations//attachedClusters/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The name of this resource. + * Cluster names are formatted as + * `projects//locations//attachedClusters/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Optional. A human readable description of this cluster. + * Cannot be longer than 255 UTF-8 encoded bytes. + * + * Generated from protobuf field string description = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Optional. A human readable description of this cluster. + * Cannot be longer than 255 UTF-8 encoded bytes. + * + * Generated from protobuf field string description = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * Required. OpenID Connect (OIDC) configuration for the cluster. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AttachedOidcConfig oidc_config = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\GkeMultiCloud\V1\AttachedOidcConfig|null + */ + public function getOidcConfig() + { + return $this->oidc_config; + } + + public function hasOidcConfig() + { + return isset($this->oidc_config); + } + + public function clearOidcConfig() + { + unset($this->oidc_config); + } + + /** + * Required. OpenID Connect (OIDC) configuration for the cluster. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AttachedOidcConfig oidc_config = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\GkeMultiCloud\V1\AttachedOidcConfig $var + * @return $this + */ + public function setOidcConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeMultiCloud\V1\AttachedOidcConfig::class); + $this->oidc_config = $var; + + return $this; + } + + /** + * Required. The platform version for the cluster (e.g. `1.19.0-gke.1000`). + * You can list all supported versions on a given Google Cloud region by + * calling + * [GetAttachedServerConfig][google.cloud.gkemulticloud.v1.AttachedClusters.GetAttachedServerConfig]. + * + * Generated from protobuf field string platform_version = 4 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getPlatformVersion() + { + return $this->platform_version; + } + + /** + * Required. The platform version for the cluster (e.g. `1.19.0-gke.1000`). + * You can list all supported versions on a given Google Cloud region by + * calling + * [GetAttachedServerConfig][google.cloud.gkemulticloud.v1.AttachedClusters.GetAttachedServerConfig]. + * + * Generated from protobuf field string platform_version = 4 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setPlatformVersion($var) + { + GPBUtil::checkString($var, True); + $this->platform_version = $var; + + return $this; + } + + /** + * Required. The Kubernetes distribution of the underlying attached cluster. + * Supported values: ["eks", "aks"]. + * + * Generated from protobuf field string distribution = 16 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getDistribution() + { + return $this->distribution; + } + + /** + * Required. The Kubernetes distribution of the underlying attached cluster. + * Supported values: ["eks", "aks"]. + * + * Generated from protobuf field string distribution = 16 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setDistribution($var) + { + GPBUtil::checkString($var, True); + $this->distribution = $var; + + return $this; + } + + /** + * Output only. The region where this cluster runs. + * For EKS clusters, this is a AWS region. For AKS clusters, + * this is an Azure region. + * + * Generated from protobuf field string cluster_region = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getClusterRegion() + { + return $this->cluster_region; + } + + /** + * Output only. The region where this cluster runs. + * For EKS clusters, this is a AWS region. For AKS clusters, + * this is an Azure region. + * + * Generated from protobuf field string cluster_region = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setClusterRegion($var) + { + GPBUtil::checkString($var, True); + $this->cluster_region = $var; + + return $this; + } + + /** + * Required. Fleet configuration. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.Fleet fleet = 5 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\GkeMultiCloud\V1\Fleet|null + */ + public function getFleet() + { + return $this->fleet; + } + + public function hasFleet() + { + return isset($this->fleet); + } + + public function clearFleet() + { + unset($this->fleet); + } + + /** + * Required. Fleet configuration. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.Fleet fleet = 5 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\GkeMultiCloud\V1\Fleet $var + * @return $this + */ + public function setFleet($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeMultiCloud\V1\Fleet::class); + $this->fleet = $var; + + return $this; + } + + /** + * Output only. The current state of the cluster. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AttachedCluster.State state = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. The current state of the cluster. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AttachedCluster.State state = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\GkeMultiCloud\V1\AttachedCluster\State::class); + $this->state = $var; + + return $this; + } + + /** + * Output only. A globally unique identifier for the cluster. + * + * Generated from protobuf field string uid = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getUid() + { + return $this->uid; + } + + /** + * Output only. A globally unique identifier for the cluster. + * + * Generated from protobuf field string uid = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setUid($var) + { + GPBUtil::checkString($var, True); + $this->uid = $var; + + return $this; + } + + /** + * Output only. If set, there are currently changes in flight to the cluster. + * + * Generated from protobuf field bool reconciling = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return bool + */ + public function getReconciling() + { + return $this->reconciling; + } + + /** + * Output only. If set, there are currently changes in flight to the cluster. + * + * Generated from protobuf field bool reconciling = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param bool $var + * @return $this + */ + public function setReconciling($var) + { + GPBUtil::checkBool($var); + $this->reconciling = $var; + + return $this; + } + + /** + * Output only. The time at which this cluster was registered. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 9 [(.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 at which this cluster was registered. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 9 [(.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 at which this cluster was last updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 10 [(.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 at which this cluster was last updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 10 [(.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; + } + + /** + * Allows clients to perform consistent read-modify-writes + * through optimistic concurrency control. + * Can be sent on update and delete requests to ensure the + * client has an up-to-date value before proceeding. + * + * Generated from protobuf field string etag = 11; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * Allows clients to perform consistent read-modify-writes + * through optimistic concurrency control. + * Can be sent on update and delete requests to ensure the + * client has an up-to-date value before proceeding. + * + * Generated from protobuf field string etag = 11; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, True); + $this->etag = $var; + + return $this; + } + + /** + * Output only. The Kubernetes version of the cluster. + * + * Generated from protobuf field string kubernetes_version = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getKubernetesVersion() + { + return $this->kubernetes_version; + } + + /** + * Output only. The Kubernetes version of the cluster. + * + * Generated from protobuf field string kubernetes_version = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setKubernetesVersion($var) + { + GPBUtil::checkString($var, True); + $this->kubernetes_version = $var; + + return $this; + } + + /** + * Optional. Annotations on the cluster. + * This field has the same restrictions as Kubernetes annotations. + * The total size of all keys and values combined is limited to 256k. + * Key can have 2 segments: prefix (optional) and name (required), + * separated by a slash (/). + * Prefix must be a DNS subdomain. + * Name must be 63 characters or less, begin and end with alphanumerics, + * with dashes (-), underscores (_), dots (.), and alphanumerics between. + * + * Generated from protobuf field map annotations = 13 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\MapField + */ + public function getAnnotations() + { + return $this->annotations; + } + + /** + * Optional. Annotations on the cluster. + * This field has the same restrictions as Kubernetes annotations. + * The total size of all keys and values combined is limited to 256k. + * Key can have 2 segments: prefix (optional) and name (required), + * separated by a slash (/). + * Prefix must be a DNS subdomain. + * Name must be 63 characters or less, begin and end with alphanumerics, + * with dashes (-), underscores (_), dots (.), and alphanumerics between. + * + * Generated from protobuf field map annotations = 13 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setAnnotations($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->annotations = $arr; + + return $this; + } + + /** + * Output only. Workload Identity settings. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.WorkloadIdentityConfig workload_identity_config = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\GkeMultiCloud\V1\WorkloadIdentityConfig|null + */ + public function getWorkloadIdentityConfig() + { + return $this->workload_identity_config; + } + + public function hasWorkloadIdentityConfig() + { + return isset($this->workload_identity_config); + } + + public function clearWorkloadIdentityConfig() + { + unset($this->workload_identity_config); + } + + /** + * Output only. Workload Identity settings. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.WorkloadIdentityConfig workload_identity_config = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\GkeMultiCloud\V1\WorkloadIdentityConfig $var + * @return $this + */ + public function setWorkloadIdentityConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeMultiCloud\V1\WorkloadIdentityConfig::class); + $this->workload_identity_config = $var; + + return $this; + } + + /** + * Optional. Logging configuration for this cluster. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.LoggingConfig logging_config = 15 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\GkeMultiCloud\V1\LoggingConfig|null + */ + public function getLoggingConfig() + { + return $this->logging_config; + } + + public function hasLoggingConfig() + { + return isset($this->logging_config); + } + + public function clearLoggingConfig() + { + unset($this->logging_config); + } + + /** + * Optional. Logging configuration for this cluster. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.LoggingConfig logging_config = 15 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\GkeMultiCloud\V1\LoggingConfig $var + * @return $this + */ + public function setLoggingConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeMultiCloud\V1\LoggingConfig::class); + $this->logging_config = $var; + + return $this; + } + + /** + * Output only. A set of errors found in the cluster. + * + * Generated from protobuf field repeated .google.cloud.gkemulticloud.v1.AttachedClusterError errors = 20 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getErrors() + { + return $this->errors; + } + + /** + * Output only. A set of errors found in the cluster. + * + * Generated from protobuf field repeated .google.cloud.gkemulticloud.v1.AttachedClusterError errors = 20 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array<\Google\Cloud\GkeMultiCloud\V1\AttachedClusterError>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setErrors($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\GkeMultiCloud\V1\AttachedClusterError::class); + $this->errors = $arr; + + return $this; + } + + /** + * Optional. Configuration related to the cluster RBAC settings. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AttachedClustersAuthorization authorization = 21 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\GkeMultiCloud\V1\AttachedClustersAuthorization|null + */ + public function getAuthorization() + { + return $this->authorization; + } + + public function hasAuthorization() + { + return isset($this->authorization); + } + + public function clearAuthorization() + { + unset($this->authorization); + } + + /** + * Optional. Configuration related to the cluster RBAC settings. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AttachedClustersAuthorization authorization = 21 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\GkeMultiCloud\V1\AttachedClustersAuthorization $var + * @return $this + */ + public function setAuthorization($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeMultiCloud\V1\AttachedClustersAuthorization::class); + $this->authorization = $var; + + return $this; + } + + /** + * Optional. Monitoring configuration for this cluster. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.MonitoringConfig monitoring_config = 23 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\GkeMultiCloud\V1\MonitoringConfig|null + */ + public function getMonitoringConfig() + { + return $this->monitoring_config; + } + + public function hasMonitoringConfig() + { + return isset($this->monitoring_config); + } + + public function clearMonitoringConfig() + { + unset($this->monitoring_config); + } + + /** + * Optional. Monitoring configuration for this cluster. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.MonitoringConfig monitoring_config = 23 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\GkeMultiCloud\V1\MonitoringConfig $var + * @return $this + */ + public function setMonitoringConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeMultiCloud\V1\MonitoringConfig::class); + $this->monitoring_config = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AttachedCluster/State.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AttachedCluster/State.php new file mode 100644 index 000000000000..51a928e34a8a --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AttachedCluster/State.php @@ -0,0 +1,96 @@ +google.cloud.gkemulticloud.v1.AttachedCluster.State + */ +class State +{ + /** + * Not set. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The PROVISIONING state indicates the cluster is being registered. + * + * Generated from protobuf enum PROVISIONING = 1; + */ + const PROVISIONING = 1; + /** + * The RUNNING state indicates the cluster has been register and is fully + * usable. + * + * Generated from protobuf enum RUNNING = 2; + */ + const RUNNING = 2; + /** + * The RECONCILING state indicates that some work is actively being done on + * the cluster, such as upgrading software components. + * + * Generated from protobuf enum RECONCILING = 3; + */ + const RECONCILING = 3; + /** + * The STOPPING state indicates the cluster is being de-registered. + * + * Generated from protobuf enum STOPPING = 4; + */ + const STOPPING = 4; + /** + * The ERROR state indicates the cluster is in a broken unrecoverable + * state. + * + * Generated from protobuf enum ERROR = 5; + */ + const ERROR = 5; + /** + * The DEGRADED state indicates the cluster requires user action to + * restore full functionality. + * + * Generated from protobuf enum DEGRADED = 6; + */ + const DEGRADED = 6; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::PROVISIONING => 'PROVISIONING', + self::RUNNING => 'RUNNING', + self::RECONCILING => 'RECONCILING', + self::STOPPING => 'STOPPING', + self::ERROR => 'ERROR', + self::DEGRADED => 'DEGRADED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\GkeMultiCloud\V1\AttachedCluster_State::class); + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AttachedClusterError.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AttachedClusterError.php new file mode 100644 index 000000000000..7e2ea588596e --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AttachedClusterError.php @@ -0,0 +1,67 @@ +google.cloud.gkemulticloud.v1.AttachedClusterError + */ +class AttachedClusterError extends \Google\Protobuf\Internal\Message +{ + /** + * Human-friendly description of the error. + * + * Generated from protobuf field string message = 1; + */ + protected $message = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $message + * Human-friendly description of the error. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AttachedResources::initOnce(); + parent::__construct($data); + } + + /** + * Human-friendly description of the error. + * + * Generated from protobuf field string message = 1; + * @return string + */ + public function getMessage() + { + return $this->message; + } + + /** + * Human-friendly description of the error. + * + * Generated from protobuf field string message = 1; + * @param string $var + * @return $this + */ + public function setMessage($var) + { + GPBUtil::checkString($var, True); + $this->message = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AttachedClusterUser.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AttachedClusterUser.php new file mode 100644 index 000000000000..f020f59ff48b --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AttachedClusterUser.php @@ -0,0 +1,67 @@ +google.cloud.gkemulticloud.v1.AttachedClusterUser + */ +class AttachedClusterUser extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the user, e.g. `my-gcp-id@gmail.com`. + * + * Generated from protobuf field string username = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $username = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $username + * Required. The name of the user, e.g. `my-gcp-id@gmail.com`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AttachedResources::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the user, e.g. `my-gcp-id@gmail.com`. + * + * Generated from protobuf field string username = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getUsername() + { + return $this->username; + } + + /** + * Required. The name of the user, e.g. `my-gcp-id@gmail.com`. + * + * Generated from protobuf field string username = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setUsername($var) + { + GPBUtil::checkString($var, True); + $this->username = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AttachedCluster_State.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AttachedCluster_State.php new file mode 100644 index 000000000000..57e11504c53e --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AttachedCluster_State.php @@ -0,0 +1,16 @@ +google.cloud.gkemulticloud.v1.AttachedClustersAuthorization + */ +class AttachedClustersAuthorization extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Users that can perform operations as a cluster admin. A managed + * ClusterRoleBinding will be created to grant the `cluster-admin` ClusterRole + * to the users. Up to ten admin users can be provided. + * For more info on RBAC, see + * https://kubernetes.io/docs/reference/access-authn-authz/rbac/#user-facing-roles + * + * Generated from protobuf field repeated .google.cloud.gkemulticloud.v1.AttachedClusterUser admin_users = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private $admin_users; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\GkeMultiCloud\V1\AttachedClusterUser>|\Google\Protobuf\Internal\RepeatedField $admin_users + * Required. Users that can perform operations as a cluster admin. A managed + * ClusterRoleBinding will be created to grant the `cluster-admin` ClusterRole + * to the users. Up to ten admin users can be provided. + * For more info on RBAC, see + * https://kubernetes.io/docs/reference/access-authn-authz/rbac/#user-facing-roles + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AttachedResources::initOnce(); + parent::__construct($data); + } + + /** + * Required. Users that can perform operations as a cluster admin. A managed + * ClusterRoleBinding will be created to grant the `cluster-admin` ClusterRole + * to the users. Up to ten admin users can be provided. + * For more info on RBAC, see + * https://kubernetes.io/docs/reference/access-authn-authz/rbac/#user-facing-roles + * + * Generated from protobuf field repeated .google.cloud.gkemulticloud.v1.AttachedClusterUser admin_users = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAdminUsers() + { + return $this->admin_users; + } + + /** + * Required. Users that can perform operations as a cluster admin. A managed + * ClusterRoleBinding will be created to grant the `cluster-admin` ClusterRole + * to the users. Up to ten admin users can be provided. + * For more info on RBAC, see + * https://kubernetes.io/docs/reference/access-authn-authz/rbac/#user-facing-roles + * + * Generated from protobuf field repeated .google.cloud.gkemulticloud.v1.AttachedClusterUser admin_users = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param array<\Google\Cloud\GkeMultiCloud\V1\AttachedClusterUser>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAdminUsers($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\GkeMultiCloud\V1\AttachedClusterUser::class); + $this->admin_users = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AttachedClustersGrpcClient.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AttachedClustersGrpcClient.php new file mode 100644 index 000000000000..70d149efa524 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AttachedClustersGrpcClient.php @@ -0,0 +1,181 @@ +_simpleRequest('/google.cloud.gkemulticloud.v1.AttachedClusters/CreateAttachedCluster', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Updates an + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster]. + * @param \Google\Cloud\GkeMultiCloud\V1\UpdateAttachedClusterRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function UpdateAttachedCluster(\Google\Cloud\GkeMultiCloud\V1\UpdateAttachedClusterRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.gkemulticloud.v1.AttachedClusters/UpdateAttachedCluster', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Imports creates a new + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource + * by importing an existing Fleet Membership resource. + * + * Attached Clusters created before the introduction of the Anthos Multi-Cloud + * API can be imported through this method. + * + * If successful, the response contains a newly created + * [Operation][google.longrunning.Operation] resource that can be + * described to track the status of the operation. + * @param \Google\Cloud\GkeMultiCloud\V1\ImportAttachedClusterRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function ImportAttachedCluster(\Google\Cloud\GkeMultiCloud\V1\ImportAttachedClusterRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.gkemulticloud.v1.AttachedClusters/ImportAttachedCluster', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Describes a specific + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource. + * @param \Google\Cloud\GkeMultiCloud\V1\GetAttachedClusterRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function GetAttachedCluster(\Google\Cloud\GkeMultiCloud\V1\GetAttachedClusterRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.gkemulticloud.v1.AttachedClusters/GetAttachedCluster', + $argument, + ['\Google\Cloud\GkeMultiCloud\V1\AttachedCluster', 'decode'], + $metadata, $options); + } + + /** + * Lists all [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] + * resources on a given Google Cloud project and region. + * @param \Google\Cloud\GkeMultiCloud\V1\ListAttachedClustersRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function ListAttachedClusters(\Google\Cloud\GkeMultiCloud\V1\ListAttachedClustersRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.gkemulticloud.v1.AttachedClusters/ListAttachedClusters', + $argument, + ['\Google\Cloud\GkeMultiCloud\V1\ListAttachedClustersResponse', 'decode'], + $metadata, $options); + } + + /** + * Deletes a specific + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource. + * + * If successful, the response contains a newly created + * [Operation][google.longrunning.Operation] resource that can be + * described to track the status of the operation. + * @param \Google\Cloud\GkeMultiCloud\V1\DeleteAttachedClusterRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function DeleteAttachedCluster(\Google\Cloud\GkeMultiCloud\V1\DeleteAttachedClusterRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.gkemulticloud.v1.AttachedClusters/DeleteAttachedCluster', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Returns information, such as supported Kubernetes versions, on a given + * Google Cloud location. + * @param \Google\Cloud\GkeMultiCloud\V1\GetAttachedServerConfigRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function GetAttachedServerConfig(\Google\Cloud\GkeMultiCloud\V1\GetAttachedServerConfigRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.gkemulticloud.v1.AttachedClusters/GetAttachedServerConfig', + $argument, + ['\Google\Cloud\GkeMultiCloud\V1\AttachedServerConfig', 'decode'], + $metadata, $options); + } + + /** + * Generates the install manifest to be installed on the target cluster. + * @param \Google\Cloud\GkeMultiCloud\V1\GenerateAttachedClusterInstallManifestRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function GenerateAttachedClusterInstallManifest(\Google\Cloud\GkeMultiCloud\V1\GenerateAttachedClusterInstallManifestRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.gkemulticloud.v1.AttachedClusters/GenerateAttachedClusterInstallManifest', + $argument, + ['\Google\Cloud\GkeMultiCloud\V1\GenerateAttachedClusterInstallManifestResponse', 'decode'], + $metadata, $options); + } + +} diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AttachedOidcConfig.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AttachedOidcConfig.php new file mode 100644 index 000000000000..116db53533d8 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AttachedOidcConfig.php @@ -0,0 +1,129 @@ +google.cloud.gkemulticloud.v1.AttachedOidcConfig + */ +class AttachedOidcConfig extends \Google\Protobuf\Internal\Message +{ + /** + * A JSON Web Token (JWT) issuer URI. `issuer` must start with `https://`. + * + * Generated from protobuf field string issuer_url = 1; + */ + protected $issuer_url = ''; + /** + * Optional. OIDC verification keys in JWKS format (RFC 7517). + * It contains a list of OIDC verification keys that can be used to verify + * OIDC JWTs. + * This field is required for cluster that doesn't have a publicly available + * discovery endpoint. When provided, it will be directly used + * to verify the OIDC JWT asserted by the IDP. + * + * Generated from protobuf field bytes jwks = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $jwks = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $issuer_url + * A JSON Web Token (JWT) issuer URI. `issuer` must start with `https://`. + * @type string $jwks + * Optional. OIDC verification keys in JWKS format (RFC 7517). + * It contains a list of OIDC verification keys that can be used to verify + * OIDC JWTs. + * This field is required for cluster that doesn't have a publicly available + * discovery endpoint. When provided, it will be directly used + * to verify the OIDC JWT asserted by the IDP. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AttachedResources::initOnce(); + parent::__construct($data); + } + + /** + * A JSON Web Token (JWT) issuer URI. `issuer` must start with `https://`. + * + * Generated from protobuf field string issuer_url = 1; + * @return string + */ + public function getIssuerUrl() + { + return $this->issuer_url; + } + + /** + * A JSON Web Token (JWT) issuer URI. `issuer` must start with `https://`. + * + * Generated from protobuf field string issuer_url = 1; + * @param string $var + * @return $this + */ + public function setIssuerUrl($var) + { + GPBUtil::checkString($var, True); + $this->issuer_url = $var; + + return $this; + } + + /** + * Optional. OIDC verification keys in JWKS format (RFC 7517). + * It contains a list of OIDC verification keys that can be used to verify + * OIDC JWTs. + * This field is required for cluster that doesn't have a publicly available + * discovery endpoint. When provided, it will be directly used + * to verify the OIDC JWT asserted by the IDP. + * + * Generated from protobuf field bytes jwks = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getJwks() + { + return $this->jwks; + } + + /** + * Optional. OIDC verification keys in JWKS format (RFC 7517). + * It contains a list of OIDC verification keys that can be used to verify + * OIDC JWTs. + * This field is required for cluster that doesn't have a publicly available + * discovery endpoint. When provided, it will be directly used + * to verify the OIDC JWT asserted by the IDP. + * + * Generated from protobuf field bytes jwks = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setJwks($var) + { + GPBUtil::checkString($var, False); + $this->jwks = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AttachedPlatformVersionInfo.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AttachedPlatformVersionInfo.php new file mode 100644 index 000000000000..a81ade67a335 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AttachedPlatformVersionInfo.php @@ -0,0 +1,67 @@ +google.cloud.gkemulticloud.v1.AttachedPlatformVersionInfo + */ +class AttachedPlatformVersionInfo extends \Google\Protobuf\Internal\Message +{ + /** + * Platform version name. + * + * Generated from protobuf field string version = 1; + */ + protected $version = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $version + * Platform version name. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AttachedResources::initOnce(); + parent::__construct($data); + } + + /** + * Platform version name. + * + * Generated from protobuf field string version = 1; + * @return string + */ + public function getVersion() + { + return $this->version; + } + + /** + * Platform version name. + * + * Generated from protobuf field string version = 1; + * @param string $var + * @return $this + */ + public function setVersion($var) + { + GPBUtil::checkString($var, True); + $this->version = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AttachedServerConfig.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AttachedServerConfig.php new file mode 100644 index 000000000000..3257fd12cab9 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AttachedServerConfig.php @@ -0,0 +1,102 @@ +google.cloud.gkemulticloud.v1.AttachedServerConfig + */ +class AttachedServerConfig extends \Google\Protobuf\Internal\Message +{ + /** + * The resource name of the config. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * List of valid platform versions. + * + * Generated from protobuf field repeated .google.cloud.gkemulticloud.v1.AttachedPlatformVersionInfo valid_versions = 2; + */ + private $valid_versions; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The resource name of the config. + * @type array<\Google\Cloud\GkeMultiCloud\V1\AttachedPlatformVersionInfo>|\Google\Protobuf\Internal\RepeatedField $valid_versions + * List of valid platform versions. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AttachedResources::initOnce(); + parent::__construct($data); + } + + /** + * The resource name of the config. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The resource name of the config. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * List of valid platform versions. + * + * Generated from protobuf field repeated .google.cloud.gkemulticloud.v1.AttachedPlatformVersionInfo valid_versions = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getValidVersions() + { + return $this->valid_versions; + } + + /** + * List of valid platform versions. + * + * Generated from protobuf field repeated .google.cloud.gkemulticloud.v1.AttachedPlatformVersionInfo valid_versions = 2; + * @param array<\Google\Cloud\GkeMultiCloud\V1\AttachedPlatformVersionInfo>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setValidVersions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\GkeMultiCloud\V1\AttachedPlatformVersionInfo::class); + $this->valid_versions = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsAuthorization.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsAuthorization.php new file mode 100644 index 000000000000..02a19ba26a49 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsAuthorization.php @@ -0,0 +1,83 @@ +google.cloud.gkemulticloud.v1.AwsAuthorization + */ +class AwsAuthorization extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Users that can perform operations as a cluster admin. A managed + * ClusterRoleBinding will be created to grant the `cluster-admin` ClusterRole + * to the users. Up to ten admin users can be provided. + * For more info on RBAC, see + * https://kubernetes.io/docs/reference/access-authn-authz/rbac/#user-facing-roles + * + * Generated from protobuf field repeated .google.cloud.gkemulticloud.v1.AwsClusterUser admin_users = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private $admin_users; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\GkeMultiCloud\V1\AwsClusterUser>|\Google\Protobuf\Internal\RepeatedField $admin_users + * Required. Users that can perform operations as a cluster admin. A managed + * ClusterRoleBinding will be created to grant the `cluster-admin` ClusterRole + * to the users. Up to ten admin users can be provided. + * For more info on RBAC, see + * https://kubernetes.io/docs/reference/access-authn-authz/rbac/#user-facing-roles + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AwsResources::initOnce(); + parent::__construct($data); + } + + /** + * Required. Users that can perform operations as a cluster admin. A managed + * ClusterRoleBinding will be created to grant the `cluster-admin` ClusterRole + * to the users. Up to ten admin users can be provided. + * For more info on RBAC, see + * https://kubernetes.io/docs/reference/access-authn-authz/rbac/#user-facing-roles + * + * Generated from protobuf field repeated .google.cloud.gkemulticloud.v1.AwsClusterUser admin_users = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAdminUsers() + { + return $this->admin_users; + } + + /** + * Required. Users that can perform operations as a cluster admin. A managed + * ClusterRoleBinding will be created to grant the `cluster-admin` ClusterRole + * to the users. Up to ten admin users can be provided. + * For more info on RBAC, see + * https://kubernetes.io/docs/reference/access-authn-authz/rbac/#user-facing-roles + * + * Generated from protobuf field repeated .google.cloud.gkemulticloud.v1.AwsClusterUser admin_users = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param array<\Google\Cloud\GkeMultiCloud\V1\AwsClusterUser>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAdminUsers($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\GkeMultiCloud\V1\AwsClusterUser::class); + $this->admin_users = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsAutoscalingGroupMetricsCollection.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsAutoscalingGroupMetricsCollection.php new file mode 100644 index 000000000000..dddb1fd5dc97 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsAutoscalingGroupMetricsCollection.php @@ -0,0 +1,118 @@ +google.cloud.gkemulticloud.v1.AwsAutoscalingGroupMetricsCollection + */ +class AwsAutoscalingGroupMetricsCollection extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The frequency at which EC2 Auto Scaling sends aggregated data to + * AWS CloudWatch. The only valid value is "1Minute". + * + * Generated from protobuf field string granularity = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $granularity = ''; + /** + * Optional. The metrics to enable. For a list of valid metrics, see + * https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_EnableMetricsCollection.html. + * If you specify Granularity and don't specify any metrics, all metrics are + * enabled. + * + * Generated from protobuf field repeated string metrics = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $metrics; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $granularity + * Required. The frequency at which EC2 Auto Scaling sends aggregated data to + * AWS CloudWatch. The only valid value is "1Minute". + * @type array|\Google\Protobuf\Internal\RepeatedField $metrics + * Optional. The metrics to enable. For a list of valid metrics, see + * https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_EnableMetricsCollection.html. + * If you specify Granularity and don't specify any metrics, all metrics are + * enabled. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AwsResources::initOnce(); + parent::__construct($data); + } + + /** + * Required. The frequency at which EC2 Auto Scaling sends aggregated data to + * AWS CloudWatch. The only valid value is "1Minute". + * + * Generated from protobuf field string granularity = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getGranularity() + { + return $this->granularity; + } + + /** + * Required. The frequency at which EC2 Auto Scaling sends aggregated data to + * AWS CloudWatch. The only valid value is "1Minute". + * + * Generated from protobuf field string granularity = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setGranularity($var) + { + GPBUtil::checkString($var, True); + $this->granularity = $var; + + return $this; + } + + /** + * Optional. The metrics to enable. For a list of valid metrics, see + * https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_EnableMetricsCollection.html. + * If you specify Granularity and don't specify any metrics, all metrics are + * enabled. + * + * Generated from protobuf field repeated string metrics = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getMetrics() + { + return $this->metrics; + } + + /** + * Optional. The metrics to enable. For a list of valid metrics, see + * https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_EnableMetricsCollection.html. + * If you specify Granularity and don't specify any metrics, all metrics are + * enabled. + * + * Generated from protobuf field repeated string metrics = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setMetrics($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->metrics = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsCluster.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsCluster.php new file mode 100644 index 000000000000..839b53ed9989 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsCluster.php @@ -0,0 +1,879 @@ +google.cloud.gkemulticloud.v1.AwsCluster + */ +class AwsCluster extends \Google\Protobuf\Internal\Message +{ + /** + * The name of this resource. + * Cluster names are formatted as + * `projects//locations//awsClusters/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * Optional. A human readable description of this cluster. + * Cannot be longer than 255 UTF-8 encoded bytes. + * + * Generated from protobuf field string description = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $description = ''; + /** + * Required. Cluster-wide networking configuration. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsClusterNetworking networking = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $networking = null; + /** + * Required. The AWS region where the cluster runs. + * Each Google Cloud region supports a subset of nearby AWS regions. + * You can call + * [GetAwsServerConfig][google.cloud.gkemulticloud.v1.AwsClusters.GetAwsServerConfig] + * to list all supported AWS regions within a given Google Cloud region. + * + * Generated from protobuf field string aws_region = 4 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $aws_region = ''; + /** + * Required. Configuration related to the cluster control plane. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsControlPlane control_plane = 5 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $control_plane = null; + /** + * Required. Configuration related to the cluster RBAC settings. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsAuthorization authorization = 15 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $authorization = null; + /** + * Output only. The current state of the cluster. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsCluster.State state = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Output only. The endpoint of the cluster's API server. + * + * Generated from protobuf field string endpoint = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $endpoint = ''; + /** + * Output only. A globally unique identifier for the cluster. + * + * Generated from protobuf field string uid = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $uid = ''; + /** + * Output only. If set, there are currently changes in flight to the cluster. + * + * Generated from protobuf field bool reconciling = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $reconciling = false; + /** + * Output only. The time at which this cluster was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. The time at which this cluster was last updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * Allows clients to perform consistent read-modify-writes + * through optimistic concurrency control. + * Can be sent on update and delete requests to ensure the + * client has an up-to-date value before proceeding. + * + * Generated from protobuf field string etag = 13; + */ + protected $etag = ''; + /** + * Optional. Annotations on the cluster. + * This field has the same restrictions as Kubernetes annotations. + * The total size of all keys and values combined is limited to 256k. + * Key can have 2 segments: prefix (optional) and name (required), + * separated by a slash (/). + * Prefix must be a DNS subdomain. + * Name must be 63 characters or less, begin and end with alphanumerics, + * with dashes (-), underscores (_), dots (.), and alphanumerics between. + * + * Generated from protobuf field map annotations = 14 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $annotations; + /** + * Output only. Workload Identity settings. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.WorkloadIdentityConfig workload_identity_config = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $workload_identity_config = null; + /** + * Output only. PEM encoded x509 certificate of the cluster root of trust. + * + * Generated from protobuf field string cluster_ca_certificate = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $cluster_ca_certificate = ''; + /** + * Required. Fleet configuration. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.Fleet fleet = 18 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $fleet = null; + /** + * Optional. Logging configuration for this cluster. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.LoggingConfig logging_config = 19 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $logging_config = null; + /** + * Output only. A set of errors found in the cluster. + * + * Generated from protobuf field repeated .google.cloud.gkemulticloud.v1.AwsClusterError errors = 20 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $errors; + /** + * Optional. Monitoring configuration for this cluster. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.MonitoringConfig monitoring_config = 21 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $monitoring_config = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The name of this resource. + * Cluster names are formatted as + * `projects//locations//awsClusters/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * @type string $description + * Optional. A human readable description of this cluster. + * Cannot be longer than 255 UTF-8 encoded bytes. + * @type \Google\Cloud\GkeMultiCloud\V1\AwsClusterNetworking $networking + * Required. Cluster-wide networking configuration. + * @type string $aws_region + * Required. The AWS region where the cluster runs. + * Each Google Cloud region supports a subset of nearby AWS regions. + * You can call + * [GetAwsServerConfig][google.cloud.gkemulticloud.v1.AwsClusters.GetAwsServerConfig] + * to list all supported AWS regions within a given Google Cloud region. + * @type \Google\Cloud\GkeMultiCloud\V1\AwsControlPlane $control_plane + * Required. Configuration related to the cluster control plane. + * @type \Google\Cloud\GkeMultiCloud\V1\AwsAuthorization $authorization + * Required. Configuration related to the cluster RBAC settings. + * @type int $state + * Output only. The current state of the cluster. + * @type string $endpoint + * Output only. The endpoint of the cluster's API server. + * @type string $uid + * Output only. A globally unique identifier for the cluster. + * @type bool $reconciling + * Output only. If set, there are currently changes in flight to the cluster. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The time at which this cluster was created. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. The time at which this cluster was last updated. + * @type string $etag + * Allows clients to perform consistent read-modify-writes + * through optimistic concurrency control. + * Can be sent on update and delete requests to ensure the + * client has an up-to-date value before proceeding. + * @type array|\Google\Protobuf\Internal\MapField $annotations + * Optional. Annotations on the cluster. + * This field has the same restrictions as Kubernetes annotations. + * The total size of all keys and values combined is limited to 256k. + * Key can have 2 segments: prefix (optional) and name (required), + * separated by a slash (/). + * Prefix must be a DNS subdomain. + * Name must be 63 characters or less, begin and end with alphanumerics, + * with dashes (-), underscores (_), dots (.), and alphanumerics between. + * @type \Google\Cloud\GkeMultiCloud\V1\WorkloadIdentityConfig $workload_identity_config + * Output only. Workload Identity settings. + * @type string $cluster_ca_certificate + * Output only. PEM encoded x509 certificate of the cluster root of trust. + * @type \Google\Cloud\GkeMultiCloud\V1\Fleet $fleet + * Required. Fleet configuration. + * @type \Google\Cloud\GkeMultiCloud\V1\LoggingConfig $logging_config + * Optional. Logging configuration for this cluster. + * @type array<\Google\Cloud\GkeMultiCloud\V1\AwsClusterError>|\Google\Protobuf\Internal\RepeatedField $errors + * Output only. A set of errors found in the cluster. + * @type \Google\Cloud\GkeMultiCloud\V1\MonitoringConfig $monitoring_config + * Optional. Monitoring configuration for this cluster. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AwsResources::initOnce(); + parent::__construct($data); + } + + /** + * The name of this resource. + * Cluster names are formatted as + * `projects//locations//awsClusters/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The name of this resource. + * Cluster names are formatted as + * `projects//locations//awsClusters/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Optional. A human readable description of this cluster. + * Cannot be longer than 255 UTF-8 encoded bytes. + * + * Generated from protobuf field string description = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Optional. A human readable description of this cluster. + * Cannot be longer than 255 UTF-8 encoded bytes. + * + * Generated from protobuf field string description = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * Required. Cluster-wide networking configuration. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsClusterNetworking networking = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\GkeMultiCloud\V1\AwsClusterNetworking|null + */ + public function getNetworking() + { + return $this->networking; + } + + public function hasNetworking() + { + return isset($this->networking); + } + + public function clearNetworking() + { + unset($this->networking); + } + + /** + * Required. Cluster-wide networking configuration. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsClusterNetworking networking = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\GkeMultiCloud\V1\AwsClusterNetworking $var + * @return $this + */ + public function setNetworking($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeMultiCloud\V1\AwsClusterNetworking::class); + $this->networking = $var; + + return $this; + } + + /** + * Required. The AWS region where the cluster runs. + * Each Google Cloud region supports a subset of nearby AWS regions. + * You can call + * [GetAwsServerConfig][google.cloud.gkemulticloud.v1.AwsClusters.GetAwsServerConfig] + * to list all supported AWS regions within a given Google Cloud region. + * + * Generated from protobuf field string aws_region = 4 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getAwsRegion() + { + return $this->aws_region; + } + + /** + * Required. The AWS region where the cluster runs. + * Each Google Cloud region supports a subset of nearby AWS regions. + * You can call + * [GetAwsServerConfig][google.cloud.gkemulticloud.v1.AwsClusters.GetAwsServerConfig] + * to list all supported AWS regions within a given Google Cloud region. + * + * Generated from protobuf field string aws_region = 4 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setAwsRegion($var) + { + GPBUtil::checkString($var, True); + $this->aws_region = $var; + + return $this; + } + + /** + * Required. Configuration related to the cluster control plane. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsControlPlane control_plane = 5 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\GkeMultiCloud\V1\AwsControlPlane|null + */ + public function getControlPlane() + { + return $this->control_plane; + } + + public function hasControlPlane() + { + return isset($this->control_plane); + } + + public function clearControlPlane() + { + unset($this->control_plane); + } + + /** + * Required. Configuration related to the cluster control plane. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsControlPlane control_plane = 5 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\GkeMultiCloud\V1\AwsControlPlane $var + * @return $this + */ + public function setControlPlane($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeMultiCloud\V1\AwsControlPlane::class); + $this->control_plane = $var; + + return $this; + } + + /** + * Required. Configuration related to the cluster RBAC settings. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsAuthorization authorization = 15 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\GkeMultiCloud\V1\AwsAuthorization|null + */ + public function getAuthorization() + { + return $this->authorization; + } + + public function hasAuthorization() + { + return isset($this->authorization); + } + + public function clearAuthorization() + { + unset($this->authorization); + } + + /** + * Required. Configuration related to the cluster RBAC settings. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsAuthorization authorization = 15 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\GkeMultiCloud\V1\AwsAuthorization $var + * @return $this + */ + public function setAuthorization($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeMultiCloud\V1\AwsAuthorization::class); + $this->authorization = $var; + + return $this; + } + + /** + * Output only. The current state of the cluster. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsCluster.State state = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. The current state of the cluster. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsCluster.State state = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\GkeMultiCloud\V1\AwsCluster\State::class); + $this->state = $var; + + return $this; + } + + /** + * Output only. The endpoint of the cluster's API server. + * + * Generated from protobuf field string endpoint = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getEndpoint() + { + return $this->endpoint; + } + + /** + * Output only. The endpoint of the cluster's API server. + * + * Generated from protobuf field string endpoint = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setEndpoint($var) + { + GPBUtil::checkString($var, True); + $this->endpoint = $var; + + return $this; + } + + /** + * Output only. A globally unique identifier for the cluster. + * + * Generated from protobuf field string uid = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getUid() + { + return $this->uid; + } + + /** + * Output only. A globally unique identifier for the cluster. + * + * Generated from protobuf field string uid = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setUid($var) + { + GPBUtil::checkString($var, True); + $this->uid = $var; + + return $this; + } + + /** + * Output only. If set, there are currently changes in flight to the cluster. + * + * Generated from protobuf field bool reconciling = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return bool + */ + public function getReconciling() + { + return $this->reconciling; + } + + /** + * Output only. If set, there are currently changes in flight to the cluster. + * + * Generated from protobuf field bool reconciling = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param bool $var + * @return $this + */ + public function setReconciling($var) + { + GPBUtil::checkBool($var); + $this->reconciling = $var; + + return $this; + } + + /** + * Output only. The time at which this cluster was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 11 [(.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 at which this cluster was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 11 [(.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 at which this cluster was last updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 12 [(.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 at which this cluster was last updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 12 [(.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; + } + + /** + * Allows clients to perform consistent read-modify-writes + * through optimistic concurrency control. + * Can be sent on update and delete requests to ensure the + * client has an up-to-date value before proceeding. + * + * Generated from protobuf field string etag = 13; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * Allows clients to perform consistent read-modify-writes + * through optimistic concurrency control. + * Can be sent on update and delete requests to ensure the + * client has an up-to-date value before proceeding. + * + * Generated from protobuf field string etag = 13; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, True); + $this->etag = $var; + + return $this; + } + + /** + * Optional. Annotations on the cluster. + * This field has the same restrictions as Kubernetes annotations. + * The total size of all keys and values combined is limited to 256k. + * Key can have 2 segments: prefix (optional) and name (required), + * separated by a slash (/). + * Prefix must be a DNS subdomain. + * Name must be 63 characters or less, begin and end with alphanumerics, + * with dashes (-), underscores (_), dots (.), and alphanumerics between. + * + * Generated from protobuf field map annotations = 14 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\MapField + */ + public function getAnnotations() + { + return $this->annotations; + } + + /** + * Optional. Annotations on the cluster. + * This field has the same restrictions as Kubernetes annotations. + * The total size of all keys and values combined is limited to 256k. + * Key can have 2 segments: prefix (optional) and name (required), + * separated by a slash (/). + * Prefix must be a DNS subdomain. + * Name must be 63 characters or less, begin and end with alphanumerics, + * with dashes (-), underscores (_), dots (.), and alphanumerics between. + * + * Generated from protobuf field map annotations = 14 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setAnnotations($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->annotations = $arr; + + return $this; + } + + /** + * Output only. Workload Identity settings. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.WorkloadIdentityConfig workload_identity_config = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\GkeMultiCloud\V1\WorkloadIdentityConfig|null + */ + public function getWorkloadIdentityConfig() + { + return $this->workload_identity_config; + } + + public function hasWorkloadIdentityConfig() + { + return isset($this->workload_identity_config); + } + + public function clearWorkloadIdentityConfig() + { + unset($this->workload_identity_config); + } + + /** + * Output only. Workload Identity settings. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.WorkloadIdentityConfig workload_identity_config = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\GkeMultiCloud\V1\WorkloadIdentityConfig $var + * @return $this + */ + public function setWorkloadIdentityConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeMultiCloud\V1\WorkloadIdentityConfig::class); + $this->workload_identity_config = $var; + + return $this; + } + + /** + * Output only. PEM encoded x509 certificate of the cluster root of trust. + * + * Generated from protobuf field string cluster_ca_certificate = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getClusterCaCertificate() + { + return $this->cluster_ca_certificate; + } + + /** + * Output only. PEM encoded x509 certificate of the cluster root of trust. + * + * Generated from protobuf field string cluster_ca_certificate = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setClusterCaCertificate($var) + { + GPBUtil::checkString($var, True); + $this->cluster_ca_certificate = $var; + + return $this; + } + + /** + * Required. Fleet configuration. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.Fleet fleet = 18 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\GkeMultiCloud\V1\Fleet|null + */ + public function getFleet() + { + return $this->fleet; + } + + public function hasFleet() + { + return isset($this->fleet); + } + + public function clearFleet() + { + unset($this->fleet); + } + + /** + * Required. Fleet configuration. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.Fleet fleet = 18 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\GkeMultiCloud\V1\Fleet $var + * @return $this + */ + public function setFleet($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeMultiCloud\V1\Fleet::class); + $this->fleet = $var; + + return $this; + } + + /** + * Optional. Logging configuration for this cluster. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.LoggingConfig logging_config = 19 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\GkeMultiCloud\V1\LoggingConfig|null + */ + public function getLoggingConfig() + { + return $this->logging_config; + } + + public function hasLoggingConfig() + { + return isset($this->logging_config); + } + + public function clearLoggingConfig() + { + unset($this->logging_config); + } + + /** + * Optional. Logging configuration for this cluster. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.LoggingConfig logging_config = 19 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\GkeMultiCloud\V1\LoggingConfig $var + * @return $this + */ + public function setLoggingConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeMultiCloud\V1\LoggingConfig::class); + $this->logging_config = $var; + + return $this; + } + + /** + * Output only. A set of errors found in the cluster. + * + * Generated from protobuf field repeated .google.cloud.gkemulticloud.v1.AwsClusterError errors = 20 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getErrors() + { + return $this->errors; + } + + /** + * Output only. A set of errors found in the cluster. + * + * Generated from protobuf field repeated .google.cloud.gkemulticloud.v1.AwsClusterError errors = 20 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array<\Google\Cloud\GkeMultiCloud\V1\AwsClusterError>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setErrors($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\GkeMultiCloud\V1\AwsClusterError::class); + $this->errors = $arr; + + return $this; + } + + /** + * Optional. Monitoring configuration for this cluster. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.MonitoringConfig monitoring_config = 21 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\GkeMultiCloud\V1\MonitoringConfig|null + */ + public function getMonitoringConfig() + { + return $this->monitoring_config; + } + + public function hasMonitoringConfig() + { + return isset($this->monitoring_config); + } + + public function clearMonitoringConfig() + { + unset($this->monitoring_config); + } + + /** + * Optional. Monitoring configuration for this cluster. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.MonitoringConfig monitoring_config = 21 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\GkeMultiCloud\V1\MonitoringConfig $var + * @return $this + */ + public function setMonitoringConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeMultiCloud\V1\MonitoringConfig::class); + $this->monitoring_config = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsCluster/State.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsCluster/State.php new file mode 100644 index 000000000000..59e416b25a7b --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsCluster/State.php @@ -0,0 +1,96 @@ +google.cloud.gkemulticloud.v1.AwsCluster.State + */ +class State +{ + /** + * Not set. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The PROVISIONING state indicates the cluster is being created. + * + * Generated from protobuf enum PROVISIONING = 1; + */ + const PROVISIONING = 1; + /** + * The RUNNING state indicates the cluster has been created and is fully + * usable. + * + * Generated from protobuf enum RUNNING = 2; + */ + const RUNNING = 2; + /** + * The RECONCILING state indicates that some work is actively being done on + * the cluster, such as upgrading the control plane replicas. + * + * Generated from protobuf enum RECONCILING = 3; + */ + const RECONCILING = 3; + /** + * The STOPPING state indicates the cluster is being deleted. + * + * Generated from protobuf enum STOPPING = 4; + */ + const STOPPING = 4; + /** + * The ERROR state indicates the cluster is in a broken unrecoverable + * state. + * + * Generated from protobuf enum ERROR = 5; + */ + const ERROR = 5; + /** + * The DEGRADED state indicates the cluster requires user action to + * restore full functionality. + * + * Generated from protobuf enum DEGRADED = 6; + */ + const DEGRADED = 6; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::PROVISIONING => 'PROVISIONING', + self::RUNNING => 'RUNNING', + self::RECONCILING => 'RECONCILING', + self::STOPPING => 'STOPPING', + self::ERROR => 'ERROR', + self::DEGRADED => 'DEGRADED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\GkeMultiCloud\V1\AwsCluster_State::class); + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsClusterError.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsClusterError.php new file mode 100644 index 000000000000..f40a291a78f8 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsClusterError.php @@ -0,0 +1,67 @@ +google.cloud.gkemulticloud.v1.AwsClusterError + */ +class AwsClusterError extends \Google\Protobuf\Internal\Message +{ + /** + * Human-friendly description of the error. + * + * Generated from protobuf field string message = 1; + */ + protected $message = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $message + * Human-friendly description of the error. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AwsResources::initOnce(); + parent::__construct($data); + } + + /** + * Human-friendly description of the error. + * + * Generated from protobuf field string message = 1; + * @return string + */ + public function getMessage() + { + return $this->message; + } + + /** + * Human-friendly description of the error. + * + * Generated from protobuf field string message = 1; + * @param string $var + * @return $this + */ + public function setMessage($var) + { + GPBUtil::checkString($var, True); + $this->message = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsClusterNetworking.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsClusterNetworking.php new file mode 100644 index 000000000000..f4b4ded352a1 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsClusterNetworking.php @@ -0,0 +1,161 @@ +google.cloud.gkemulticloud.v1.AwsClusterNetworking + */ +class AwsClusterNetworking extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The VPC associated with the cluster. All component clusters + * (i.e. control plane and node pools) run on a single VPC. + * This field cannot be changed after creation. + * + * Generated from protobuf field string vpc_id = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $vpc_id = ''; + /** + * Required. All pods in the cluster are assigned an IPv4 address from these + * ranges. Only a single range is supported. This field cannot be changed + * after creation. + * + * Generated from protobuf field repeated string pod_address_cidr_blocks = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + private $pod_address_cidr_blocks; + /** + * Required. All services in the cluster are assigned an IPv4 address from + * these ranges. Only a single range is supported. This field cannot be + * changed after creation. + * + * Generated from protobuf field repeated string service_address_cidr_blocks = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + private $service_address_cidr_blocks; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $vpc_id + * Required. The VPC associated with the cluster. All component clusters + * (i.e. control plane and node pools) run on a single VPC. + * This field cannot be changed after creation. + * @type array|\Google\Protobuf\Internal\RepeatedField $pod_address_cidr_blocks + * Required. All pods in the cluster are assigned an IPv4 address from these + * ranges. Only a single range is supported. This field cannot be changed + * after creation. + * @type array|\Google\Protobuf\Internal\RepeatedField $service_address_cidr_blocks + * Required. All services in the cluster are assigned an IPv4 address from + * these ranges. Only a single range is supported. This field cannot be + * changed after creation. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AwsResources::initOnce(); + parent::__construct($data); + } + + /** + * Required. The VPC associated with the cluster. All component clusters + * (i.e. control plane and node pools) run on a single VPC. + * This field cannot be changed after creation. + * + * Generated from protobuf field string vpc_id = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getVpcId() + { + return $this->vpc_id; + } + + /** + * Required. The VPC associated with the cluster. All component clusters + * (i.e. control plane and node pools) run on a single VPC. + * This field cannot be changed after creation. + * + * Generated from protobuf field string vpc_id = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setVpcId($var) + { + GPBUtil::checkString($var, True); + $this->vpc_id = $var; + + return $this; + } + + /** + * Required. All pods in the cluster are assigned an IPv4 address from these + * ranges. Only a single range is supported. This field cannot be changed + * after creation. + * + * Generated from protobuf field repeated string pod_address_cidr_blocks = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getPodAddressCidrBlocks() + { + return $this->pod_address_cidr_blocks; + } + + /** + * Required. All pods in the cluster are assigned an IPv4 address from these + * ranges. Only a single range is supported. This field cannot be changed + * after creation. + * + * Generated from protobuf field repeated string pod_address_cidr_blocks = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setPodAddressCidrBlocks($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->pod_address_cidr_blocks = $arr; + + return $this; + } + + /** + * Required. All services in the cluster are assigned an IPv4 address from + * these ranges. Only a single range is supported. This field cannot be + * changed after creation. + * + * Generated from protobuf field repeated string service_address_cidr_blocks = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getServiceAddressCidrBlocks() + { + return $this->service_address_cidr_blocks; + } + + /** + * Required. All services in the cluster are assigned an IPv4 address from + * these ranges. Only a single range is supported. This field cannot be + * changed after creation. + * + * Generated from protobuf field repeated string service_address_cidr_blocks = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setServiceAddressCidrBlocks($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->service_address_cidr_blocks = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsClusterUser.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsClusterUser.php new file mode 100644 index 000000000000..005bd094c801 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsClusterUser.php @@ -0,0 +1,67 @@ +google.cloud.gkemulticloud.v1.AwsClusterUser + */ +class AwsClusterUser extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the user, e.g. `my-gcp-id@gmail.com`. + * + * Generated from protobuf field string username = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $username = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $username + * Required. The name of the user, e.g. `my-gcp-id@gmail.com`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AwsResources::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the user, e.g. `my-gcp-id@gmail.com`. + * + * Generated from protobuf field string username = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getUsername() + { + return $this->username; + } + + /** + * Required. The name of the user, e.g. `my-gcp-id@gmail.com`. + * + * Generated from protobuf field string username = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setUsername($var) + { + GPBUtil::checkString($var, True); + $this->username = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsCluster_State.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsCluster_State.php new file mode 100644 index 000000000000..5b0cb23eabe2 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsCluster_State.php @@ -0,0 +1,16 @@ +_simpleRequest('/google.cloud.gkemulticloud.v1.AwsClusters/CreateAwsCluster', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Updates an [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster]. + * @param \Google\Cloud\GkeMultiCloud\V1\UpdateAwsClusterRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function UpdateAwsCluster(\Google\Cloud\GkeMultiCloud\V1\UpdateAwsClusterRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.gkemulticloud.v1.AwsClusters/UpdateAwsCluster', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Describes a specific [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] + * resource. + * @param \Google\Cloud\GkeMultiCloud\V1\GetAwsClusterRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function GetAwsCluster(\Google\Cloud\GkeMultiCloud\V1\GetAwsClusterRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.gkemulticloud.v1.AwsClusters/GetAwsCluster', + $argument, + ['\Google\Cloud\GkeMultiCloud\V1\AwsCluster', 'decode'], + $metadata, $options); + } + + /** + * Lists all [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resources + * on a given Google Cloud project and region. + * @param \Google\Cloud\GkeMultiCloud\V1\ListAwsClustersRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function ListAwsClusters(\Google\Cloud\GkeMultiCloud\V1\ListAwsClustersRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.gkemulticloud.v1.AwsClusters/ListAwsClusters', + $argument, + ['\Google\Cloud\GkeMultiCloud\V1\ListAwsClustersResponse', 'decode'], + $metadata, $options); + } + + /** + * Deletes a specific [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] + * resource. + * + * Fails if the cluster has one or more associated + * [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] resources. + * + * If successful, the response contains a newly created + * [Operation][google.longrunning.Operation] resource that can be + * described to track the status of the operation. + * @param \Google\Cloud\GkeMultiCloud\V1\DeleteAwsClusterRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function DeleteAwsCluster(\Google\Cloud\GkeMultiCloud\V1\DeleteAwsClusterRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.gkemulticloud.v1.AwsClusters/DeleteAwsCluster', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Generates a short-lived access token to authenticate to a given + * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resource. + * @param \Google\Cloud\GkeMultiCloud\V1\GenerateAwsAccessTokenRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function GenerateAwsAccessToken(\Google\Cloud\GkeMultiCloud\V1\GenerateAwsAccessTokenRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.gkemulticloud.v1.AwsClusters/GenerateAwsAccessToken', + $argument, + ['\Google\Cloud\GkeMultiCloud\V1\GenerateAwsAccessTokenResponse', 'decode'], + $metadata, $options); + } + + /** + * Creates a new [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool], + * attached to a given [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster]. + * + * If successful, the response contains a newly created + * [Operation][google.longrunning.Operation] resource that can be + * described to track the status of the operation. + * @param \Google\Cloud\GkeMultiCloud\V1\CreateAwsNodePoolRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function CreateAwsNodePool(\Google\Cloud\GkeMultiCloud\V1\CreateAwsNodePoolRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.gkemulticloud.v1.AwsClusters/CreateAwsNodePool', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Updates an [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool]. + * @param \Google\Cloud\GkeMultiCloud\V1\UpdateAwsNodePoolRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function UpdateAwsNodePool(\Google\Cloud\GkeMultiCloud\V1\UpdateAwsNodePoolRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.gkemulticloud.v1.AwsClusters/UpdateAwsNodePool', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Describes a specific + * [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] resource. + * @param \Google\Cloud\GkeMultiCloud\V1\GetAwsNodePoolRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function GetAwsNodePool(\Google\Cloud\GkeMultiCloud\V1\GetAwsNodePoolRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.gkemulticloud.v1.AwsClusters/GetAwsNodePool', + $argument, + ['\Google\Cloud\GkeMultiCloud\V1\AwsNodePool', 'decode'], + $metadata, $options); + } + + /** + * Lists all [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] + * resources on a given + * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster]. + * @param \Google\Cloud\GkeMultiCloud\V1\ListAwsNodePoolsRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function ListAwsNodePools(\Google\Cloud\GkeMultiCloud\V1\ListAwsNodePoolsRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.gkemulticloud.v1.AwsClusters/ListAwsNodePools', + $argument, + ['\Google\Cloud\GkeMultiCloud\V1\ListAwsNodePoolsResponse', 'decode'], + $metadata, $options); + } + + /** + * Deletes a specific [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] + * resource. + * + * If successful, the response contains a newly created + * [Operation][google.longrunning.Operation] resource that can be + * described to track the status of the operation. + * @param \Google\Cloud\GkeMultiCloud\V1\DeleteAwsNodePoolRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function DeleteAwsNodePool(\Google\Cloud\GkeMultiCloud\V1\DeleteAwsNodePoolRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.gkemulticloud.v1.AwsClusters/DeleteAwsNodePool', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Returns information, such as supported AWS regions and Kubernetes + * versions, on a given Google Cloud location. + * @param \Google\Cloud\GkeMultiCloud\V1\GetAwsServerConfigRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function GetAwsServerConfig(\Google\Cloud\GkeMultiCloud\V1\GetAwsServerConfigRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.gkemulticloud.v1.AwsClusters/GetAwsServerConfig', + $argument, + ['\Google\Cloud\GkeMultiCloud\V1\AwsServerConfig', 'decode'], + $metadata, $options); + } + +} diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsConfigEncryption.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsConfigEncryption.php new file mode 100644 index 000000000000..ed4be8aef12a --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsConfigEncryption.php @@ -0,0 +1,67 @@ +google.cloud.gkemulticloud.v1.AwsConfigEncryption + */ +class AwsConfigEncryption extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The ARN of the AWS KMS key used to encrypt user data. + * + * Generated from protobuf field string kms_key_arn = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $kms_key_arn = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $kms_key_arn + * Required. The ARN of the AWS KMS key used to encrypt user data. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AwsResources::initOnce(); + parent::__construct($data); + } + + /** + * Required. The ARN of the AWS KMS key used to encrypt user data. + * + * Generated from protobuf field string kms_key_arn = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getKmsKeyArn() + { + return $this->kms_key_arn; + } + + /** + * Required. The ARN of the AWS KMS key used to encrypt user data. + * + * Generated from protobuf field string kms_key_arn = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setKmsKeyArn($var) + { + GPBUtil::checkString($var, True); + $this->kms_key_arn = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsControlPlane.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsControlPlane.php new file mode 100644 index 000000000000..826ee8af1a67 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsControlPlane.php @@ -0,0 +1,693 @@ +google.cloud.gkemulticloud.v1.AwsControlPlane + */ +class AwsControlPlane extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The Kubernetes version to run on control plane replicas + * (e.g. `1.19.10-gke.1000`). + * You can list all supported versions on a given Google Cloud region by + * calling + * [GetAwsServerConfig][google.cloud.gkemulticloud.v1.AwsClusters.GetAwsServerConfig]. + * + * Generated from protobuf field string version = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $version = ''; + /** + * Optional. The AWS instance type. + * When unspecified, it uses a default based on the cluster's version. + * + * Generated from protobuf field string instance_type = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $instance_type = ''; + /** + * Optional. SSH configuration for how to access the underlying control plane + * machines. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsSshConfig ssh_config = 14 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $ssh_config = null; + /** + * Required. The list of subnets where control plane replicas will run. + * A replica will be provisioned on each subnet and up to three values + * can be provided. + * Each subnet must be in a different AWS Availability Zone (AZ). + * + * Generated from protobuf field repeated string subnet_ids = 4 [(.google.api.field_behavior) = REQUIRED]; + */ + private $subnet_ids; + /** + * Optional. The IDs of additional security groups to add to control plane + * replicas. The Anthos Multi-Cloud API will automatically create and manage + * security groups with the minimum rules needed for a functioning cluster. + * + * Generated from protobuf field repeated string security_group_ids = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $security_group_ids; + /** + * Required. The name or ARN of the AWS IAM instance profile to assign to each + * control plane replica. + * + * Generated from protobuf field string iam_instance_profile = 7 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $iam_instance_profile = ''; + /** + * Optional. Configuration related to the root volume provisioned for each + * control plane replica. + * Volumes will be provisioned in the availability zone associated + * with the corresponding subnet. + * When unspecified, it defaults to 32 GiB with the GP2 volume type. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsVolumeTemplate root_volume = 8 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $root_volume = null; + /** + * Optional. Configuration related to the main volume provisioned for each + * control plane replica. + * The main volume is in charge of storing all of the cluster's etcd state. + * Volumes will be provisioned in the availability zone associated + * with the corresponding subnet. + * When unspecified, it defaults to 8 GiB with the GP2 volume type. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsVolumeTemplate main_volume = 9 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $main_volume = null; + /** + * Required. The ARN of the AWS KMS key used to encrypt cluster secrets. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsDatabaseEncryption database_encryption = 10 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $database_encryption = null; + /** + * Optional. A set of AWS resource tags to propagate to all underlying managed + * AWS resources. + * Specify at most 50 pairs containing alphanumerics, spaces, and symbols + * (.+-=_:@/). Keys can be up to 127 Unicode characters. Values can be up to + * 255 Unicode characters. + * + * Generated from protobuf field map tags = 11 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $tags; + /** + * Required. Authentication configuration for management of AWS resources. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsServicesAuthentication aws_services_authentication = 12 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $aws_services_authentication = null; + /** + * Optional. Proxy configuration for outbound HTTP(S) traffic. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsProxyConfig proxy_config = 16 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $proxy_config = null; + /** + * Required. Config encryption for user data. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsConfigEncryption config_encryption = 17 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $config_encryption = null; + /** + * Optional. The placement to use on control plane instances. + * When unspecified, the VPC's default tenancy will be used. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsInstancePlacement instance_placement = 18 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $instance_placement = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $version + * Required. The Kubernetes version to run on control plane replicas + * (e.g. `1.19.10-gke.1000`). + * You can list all supported versions on a given Google Cloud region by + * calling + * [GetAwsServerConfig][google.cloud.gkemulticloud.v1.AwsClusters.GetAwsServerConfig]. + * @type string $instance_type + * Optional. The AWS instance type. + * When unspecified, it uses a default based on the cluster's version. + * @type \Google\Cloud\GkeMultiCloud\V1\AwsSshConfig $ssh_config + * Optional. SSH configuration for how to access the underlying control plane + * machines. + * @type array|\Google\Protobuf\Internal\RepeatedField $subnet_ids + * Required. The list of subnets where control plane replicas will run. + * A replica will be provisioned on each subnet and up to three values + * can be provided. + * Each subnet must be in a different AWS Availability Zone (AZ). + * @type array|\Google\Protobuf\Internal\RepeatedField $security_group_ids + * Optional. The IDs of additional security groups to add to control plane + * replicas. The Anthos Multi-Cloud API will automatically create and manage + * security groups with the minimum rules needed for a functioning cluster. + * @type string $iam_instance_profile + * Required. The name or ARN of the AWS IAM instance profile to assign to each + * control plane replica. + * @type \Google\Cloud\GkeMultiCloud\V1\AwsVolumeTemplate $root_volume + * Optional. Configuration related to the root volume provisioned for each + * control plane replica. + * Volumes will be provisioned in the availability zone associated + * with the corresponding subnet. + * When unspecified, it defaults to 32 GiB with the GP2 volume type. + * @type \Google\Cloud\GkeMultiCloud\V1\AwsVolumeTemplate $main_volume + * Optional. Configuration related to the main volume provisioned for each + * control plane replica. + * The main volume is in charge of storing all of the cluster's etcd state. + * Volumes will be provisioned in the availability zone associated + * with the corresponding subnet. + * When unspecified, it defaults to 8 GiB with the GP2 volume type. + * @type \Google\Cloud\GkeMultiCloud\V1\AwsDatabaseEncryption $database_encryption + * Required. The ARN of the AWS KMS key used to encrypt cluster secrets. + * @type array|\Google\Protobuf\Internal\MapField $tags + * Optional. A set of AWS resource tags to propagate to all underlying managed + * AWS resources. + * Specify at most 50 pairs containing alphanumerics, spaces, and symbols + * (.+-=_:@/). Keys can be up to 127 Unicode characters. Values can be up to + * 255 Unicode characters. + * @type \Google\Cloud\GkeMultiCloud\V1\AwsServicesAuthentication $aws_services_authentication + * Required. Authentication configuration for management of AWS resources. + * @type \Google\Cloud\GkeMultiCloud\V1\AwsProxyConfig $proxy_config + * Optional. Proxy configuration for outbound HTTP(S) traffic. + * @type \Google\Cloud\GkeMultiCloud\V1\AwsConfigEncryption $config_encryption + * Required. Config encryption for user data. + * @type \Google\Cloud\GkeMultiCloud\V1\AwsInstancePlacement $instance_placement + * Optional. The placement to use on control plane instances. + * When unspecified, the VPC's default tenancy will be used. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AwsResources::initOnce(); + parent::__construct($data); + } + + /** + * Required. The Kubernetes version to run on control plane replicas + * (e.g. `1.19.10-gke.1000`). + * You can list all supported versions on a given Google Cloud region by + * calling + * [GetAwsServerConfig][google.cloud.gkemulticloud.v1.AwsClusters.GetAwsServerConfig]. + * + * Generated from protobuf field string version = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getVersion() + { + return $this->version; + } + + /** + * Required. The Kubernetes version to run on control plane replicas + * (e.g. `1.19.10-gke.1000`). + * You can list all supported versions on a given Google Cloud region by + * calling + * [GetAwsServerConfig][google.cloud.gkemulticloud.v1.AwsClusters.GetAwsServerConfig]. + * + * Generated from protobuf field string version = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setVersion($var) + { + GPBUtil::checkString($var, True); + $this->version = $var; + + return $this; + } + + /** + * Optional. The AWS instance type. + * When unspecified, it uses a default based on the cluster's version. + * + * Generated from protobuf field string instance_type = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getInstanceType() + { + return $this->instance_type; + } + + /** + * Optional. The AWS instance type. + * When unspecified, it uses a default based on the cluster's version. + * + * Generated from protobuf field string instance_type = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setInstanceType($var) + { + GPBUtil::checkString($var, True); + $this->instance_type = $var; + + return $this; + } + + /** + * Optional. SSH configuration for how to access the underlying control plane + * machines. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsSshConfig ssh_config = 14 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\GkeMultiCloud\V1\AwsSshConfig|null + */ + public function getSshConfig() + { + return $this->ssh_config; + } + + public function hasSshConfig() + { + return isset($this->ssh_config); + } + + public function clearSshConfig() + { + unset($this->ssh_config); + } + + /** + * Optional. SSH configuration for how to access the underlying control plane + * machines. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsSshConfig ssh_config = 14 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\GkeMultiCloud\V1\AwsSshConfig $var + * @return $this + */ + public function setSshConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeMultiCloud\V1\AwsSshConfig::class); + $this->ssh_config = $var; + + return $this; + } + + /** + * Required. The list of subnets where control plane replicas will run. + * A replica will be provisioned on each subnet and up to three values + * can be provided. + * Each subnet must be in a different AWS Availability Zone (AZ). + * + * Generated from protobuf field repeated string subnet_ids = 4 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSubnetIds() + { + return $this->subnet_ids; + } + + /** + * Required. The list of subnets where control plane replicas will run. + * A replica will be provisioned on each subnet and up to three values + * can be provided. + * Each subnet must be in a different AWS Availability Zone (AZ). + * + * Generated from protobuf field repeated string subnet_ids = 4 [(.google.api.field_behavior) = REQUIRED]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSubnetIds($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->subnet_ids = $arr; + + return $this; + } + + /** + * Optional. The IDs of additional security groups to add to control plane + * replicas. The Anthos Multi-Cloud API will automatically create and manage + * security groups with the minimum rules needed for a functioning cluster. + * + * Generated from protobuf field repeated string security_group_ids = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSecurityGroupIds() + { + return $this->security_group_ids; + } + + /** + * Optional. The IDs of additional security groups to add to control plane + * replicas. The Anthos Multi-Cloud API will automatically create and manage + * security groups with the minimum rules needed for a functioning cluster. + * + * Generated from protobuf field repeated string security_group_ids = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSecurityGroupIds($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->security_group_ids = $arr; + + return $this; + } + + /** + * Required. The name or ARN of the AWS IAM instance profile to assign to each + * control plane replica. + * + * Generated from protobuf field string iam_instance_profile = 7 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getIamInstanceProfile() + { + return $this->iam_instance_profile; + } + + /** + * Required. The name or ARN of the AWS IAM instance profile to assign to each + * control plane replica. + * + * Generated from protobuf field string iam_instance_profile = 7 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setIamInstanceProfile($var) + { + GPBUtil::checkString($var, True); + $this->iam_instance_profile = $var; + + return $this; + } + + /** + * Optional. Configuration related to the root volume provisioned for each + * control plane replica. + * Volumes will be provisioned in the availability zone associated + * with the corresponding subnet. + * When unspecified, it defaults to 32 GiB with the GP2 volume type. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsVolumeTemplate root_volume = 8 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\GkeMultiCloud\V1\AwsVolumeTemplate|null + */ + public function getRootVolume() + { + return $this->root_volume; + } + + public function hasRootVolume() + { + return isset($this->root_volume); + } + + public function clearRootVolume() + { + unset($this->root_volume); + } + + /** + * Optional. Configuration related to the root volume provisioned for each + * control plane replica. + * Volumes will be provisioned in the availability zone associated + * with the corresponding subnet. + * When unspecified, it defaults to 32 GiB with the GP2 volume type. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsVolumeTemplate root_volume = 8 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\GkeMultiCloud\V1\AwsVolumeTemplate $var + * @return $this + */ + public function setRootVolume($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeMultiCloud\V1\AwsVolumeTemplate::class); + $this->root_volume = $var; + + return $this; + } + + /** + * Optional. Configuration related to the main volume provisioned for each + * control plane replica. + * The main volume is in charge of storing all of the cluster's etcd state. + * Volumes will be provisioned in the availability zone associated + * with the corresponding subnet. + * When unspecified, it defaults to 8 GiB with the GP2 volume type. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsVolumeTemplate main_volume = 9 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\GkeMultiCloud\V1\AwsVolumeTemplate|null + */ + public function getMainVolume() + { + return $this->main_volume; + } + + public function hasMainVolume() + { + return isset($this->main_volume); + } + + public function clearMainVolume() + { + unset($this->main_volume); + } + + /** + * Optional. Configuration related to the main volume provisioned for each + * control plane replica. + * The main volume is in charge of storing all of the cluster's etcd state. + * Volumes will be provisioned in the availability zone associated + * with the corresponding subnet. + * When unspecified, it defaults to 8 GiB with the GP2 volume type. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsVolumeTemplate main_volume = 9 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\GkeMultiCloud\V1\AwsVolumeTemplate $var + * @return $this + */ + public function setMainVolume($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeMultiCloud\V1\AwsVolumeTemplate::class); + $this->main_volume = $var; + + return $this; + } + + /** + * Required. The ARN of the AWS KMS key used to encrypt cluster secrets. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsDatabaseEncryption database_encryption = 10 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\GkeMultiCloud\V1\AwsDatabaseEncryption|null + */ + public function getDatabaseEncryption() + { + return $this->database_encryption; + } + + public function hasDatabaseEncryption() + { + return isset($this->database_encryption); + } + + public function clearDatabaseEncryption() + { + unset($this->database_encryption); + } + + /** + * Required. The ARN of the AWS KMS key used to encrypt cluster secrets. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsDatabaseEncryption database_encryption = 10 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\GkeMultiCloud\V1\AwsDatabaseEncryption $var + * @return $this + */ + public function setDatabaseEncryption($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeMultiCloud\V1\AwsDatabaseEncryption::class); + $this->database_encryption = $var; + + return $this; + } + + /** + * Optional. A set of AWS resource tags to propagate to all underlying managed + * AWS resources. + * Specify at most 50 pairs containing alphanumerics, spaces, and symbols + * (.+-=_:@/). Keys can be up to 127 Unicode characters. Values can be up to + * 255 Unicode characters. + * + * Generated from protobuf field map tags = 11 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\MapField + */ + public function getTags() + { + return $this->tags; + } + + /** + * Optional. A set of AWS resource tags to propagate to all underlying managed + * AWS resources. + * Specify at most 50 pairs containing alphanumerics, spaces, and symbols + * (.+-=_:@/). Keys can be up to 127 Unicode characters. Values can be up to + * 255 Unicode characters. + * + * Generated from protobuf field map tags = 11 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setTags($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->tags = $arr; + + return $this; + } + + /** + * Required. Authentication configuration for management of AWS resources. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsServicesAuthentication aws_services_authentication = 12 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\GkeMultiCloud\V1\AwsServicesAuthentication|null + */ + public function getAwsServicesAuthentication() + { + return $this->aws_services_authentication; + } + + public function hasAwsServicesAuthentication() + { + return isset($this->aws_services_authentication); + } + + public function clearAwsServicesAuthentication() + { + unset($this->aws_services_authentication); + } + + /** + * Required. Authentication configuration for management of AWS resources. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsServicesAuthentication aws_services_authentication = 12 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\GkeMultiCloud\V1\AwsServicesAuthentication $var + * @return $this + */ + public function setAwsServicesAuthentication($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeMultiCloud\V1\AwsServicesAuthentication::class); + $this->aws_services_authentication = $var; + + return $this; + } + + /** + * Optional. Proxy configuration for outbound HTTP(S) traffic. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsProxyConfig proxy_config = 16 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\GkeMultiCloud\V1\AwsProxyConfig|null + */ + public function getProxyConfig() + { + return $this->proxy_config; + } + + public function hasProxyConfig() + { + return isset($this->proxy_config); + } + + public function clearProxyConfig() + { + unset($this->proxy_config); + } + + /** + * Optional. Proxy configuration for outbound HTTP(S) traffic. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsProxyConfig proxy_config = 16 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\GkeMultiCloud\V1\AwsProxyConfig $var + * @return $this + */ + public function setProxyConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeMultiCloud\V1\AwsProxyConfig::class); + $this->proxy_config = $var; + + return $this; + } + + /** + * Required. Config encryption for user data. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsConfigEncryption config_encryption = 17 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\GkeMultiCloud\V1\AwsConfigEncryption|null + */ + public function getConfigEncryption() + { + return $this->config_encryption; + } + + public function hasConfigEncryption() + { + return isset($this->config_encryption); + } + + public function clearConfigEncryption() + { + unset($this->config_encryption); + } + + /** + * Required. Config encryption for user data. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsConfigEncryption config_encryption = 17 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\GkeMultiCloud\V1\AwsConfigEncryption $var + * @return $this + */ + public function setConfigEncryption($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeMultiCloud\V1\AwsConfigEncryption::class); + $this->config_encryption = $var; + + return $this; + } + + /** + * Optional. The placement to use on control plane instances. + * When unspecified, the VPC's default tenancy will be used. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsInstancePlacement instance_placement = 18 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\GkeMultiCloud\V1\AwsInstancePlacement|null + */ + public function getInstancePlacement() + { + return $this->instance_placement; + } + + public function hasInstancePlacement() + { + return isset($this->instance_placement); + } + + public function clearInstancePlacement() + { + unset($this->instance_placement); + } + + /** + * Optional. The placement to use on control plane instances. + * When unspecified, the VPC's default tenancy will be used. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsInstancePlacement instance_placement = 18 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\GkeMultiCloud\V1\AwsInstancePlacement $var + * @return $this + */ + public function setInstancePlacement($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeMultiCloud\V1\AwsInstancePlacement::class); + $this->instance_placement = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsDatabaseEncryption.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsDatabaseEncryption.php new file mode 100644 index 000000000000..e7e0ce60bd12 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsDatabaseEncryption.php @@ -0,0 +1,67 @@ +google.cloud.gkemulticloud.v1.AwsDatabaseEncryption + */ +class AwsDatabaseEncryption extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The ARN of the AWS KMS key used to encrypt cluster secrets. + * + * Generated from protobuf field string kms_key_arn = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $kms_key_arn = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $kms_key_arn + * Required. The ARN of the AWS KMS key used to encrypt cluster secrets. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AwsResources::initOnce(); + parent::__construct($data); + } + + /** + * Required. The ARN of the AWS KMS key used to encrypt cluster secrets. + * + * Generated from protobuf field string kms_key_arn = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getKmsKeyArn() + { + return $this->kms_key_arn; + } + + /** + * Required. The ARN of the AWS KMS key used to encrypt cluster secrets. + * + * Generated from protobuf field string kms_key_arn = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setKmsKeyArn($var) + { + GPBUtil::checkString($var, True); + $this->kms_key_arn = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsInstancePlacement.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsInstancePlacement.php new file mode 100644 index 000000000000..e2eccd85ae67 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsInstancePlacement.php @@ -0,0 +1,70 @@ +google.cloud.gkemulticloud.v1.AwsInstancePlacement + */ +class AwsInstancePlacement extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The tenancy for instance. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsInstancePlacement.Tenancy tenancy = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $tenancy = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $tenancy + * Required. The tenancy for instance. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AwsResources::initOnce(); + parent::__construct($data); + } + + /** + * Required. The tenancy for instance. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsInstancePlacement.Tenancy tenancy = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getTenancy() + { + return $this->tenancy; + } + + /** + * Required. The tenancy for instance. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsInstancePlacement.Tenancy tenancy = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setTenancy($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\GkeMultiCloud\V1\AwsInstancePlacement\Tenancy::class); + $this->tenancy = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsInstancePlacement/Tenancy.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsInstancePlacement/Tenancy.php new file mode 100644 index 000000000000..7c147a1fef41 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsInstancePlacement/Tenancy.php @@ -0,0 +1,75 @@ +google.cloud.gkemulticloud.v1.AwsInstancePlacement.Tenancy + */ +class Tenancy +{ + /** + * Not set. + * + * Generated from protobuf enum TENANCY_UNSPECIFIED = 0; + */ + const TENANCY_UNSPECIFIED = 0; + /** + * Use default VPC tenancy. + * + * Generated from protobuf enum DEFAULT = 1; + */ + const PBDEFAULT = 1; + /** + * Run a dedicated instance. + * + * Generated from protobuf enum DEDICATED = 2; + */ + const DEDICATED = 2; + /** + * Launch this instance to a dedicated host. + * + * Generated from protobuf enum HOST = 3; + */ + const HOST = 3; + + private static $valueToName = [ + self::TENANCY_UNSPECIFIED => 'TENANCY_UNSPECIFIED', + self::PBDEFAULT => 'DEFAULT', + self::DEDICATED => 'DEDICATED', + self::HOST => 'HOST', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + $pbconst = __CLASS__. '::PB' . strtoupper($name); + if (!defined($pbconst)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($pbconst); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Tenancy::class, \Google\Cloud\GkeMultiCloud\V1\AwsInstancePlacement_Tenancy::class); + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsInstancePlacement_Tenancy.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsInstancePlacement_Tenancy.php new file mode 100644 index 000000000000..1c6525314c65 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsInstancePlacement_Tenancy.php @@ -0,0 +1,16 @@ +google.cloud.gkemulticloud.v1.AwsK8sVersionInfo + */ +class AwsK8sVersionInfo extends \Google\Protobuf\Internal\Message +{ + /** + * Kubernetes version name. + * + * Generated from protobuf field string version = 1; + */ + protected $version = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $version + * Kubernetes version name. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AwsResources::initOnce(); + parent::__construct($data); + } + + /** + * Kubernetes version name. + * + * Generated from protobuf field string version = 1; + * @return string + */ + public function getVersion() + { + return $this->version; + } + + /** + * Kubernetes version name. + * + * Generated from protobuf field string version = 1; + * @param string $var + * @return $this + */ + public function setVersion($var) + { + GPBUtil::checkString($var, True); + $this->version = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsNodeConfig.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsNodeConfig.php new file mode 100644 index 000000000000..453635f072b7 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsNodeConfig.php @@ -0,0 +1,607 @@ +google.cloud.gkemulticloud.v1.AwsNodeConfig + */ +class AwsNodeConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. The AWS instance type. + * When unspecified, it uses a default based on the node pool's version. + * + * Generated from protobuf field string instance_type = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $instance_type = ''; + /** + * Optional. Template for the root volume provisioned for node pool nodes. + * Volumes will be provisioned in the availability zone assigned + * to the node pool subnet. + * When unspecified, it defaults to 32 GiB with the GP2 volume type. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsVolumeTemplate root_volume = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $root_volume = null; + /** + * Optional. The initial taints assigned to nodes of this node pool. + * + * Generated from protobuf field repeated .google.cloud.gkemulticloud.v1.NodeTaint taints = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $taints; + /** + * Optional. The initial labels assigned to nodes of this node pool. An object + * containing a list of "key": value pairs. Example: { "name": "wrench", + * "mass": "1.3kg", "count": "3" }. + * + * Generated from protobuf field map labels = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $labels; + /** + * Optional. Key/value metadata to assign to each underlying AWS resource. + * Specify at most 50 pairs containing alphanumerics, spaces, and symbols + * (.+-=_:@/). Keys can be up to 127 Unicode characters. Values can be up to + * 255 Unicode characters. + * + * Generated from protobuf field map tags = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $tags; + /** + * Required. The name or ARN of the AWS IAM role assigned to nodes in the + * pool. + * + * Generated from protobuf field string iam_instance_profile = 6 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $iam_instance_profile = ''; + /** + * Optional. The OS image type to use on node pool instances. + * Can have a value of `ubuntu`, or `windows` if the cluster enables + * the Windows node pool preview feature. + * When unspecified, it defaults to `ubuntu`. + * + * Generated from protobuf field string image_type = 11 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $image_type = ''; + /** + * Optional. The SSH configuration. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsSshConfig ssh_config = 9 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $ssh_config = null; + /** + * Optional. The IDs of additional security groups to add to nodes in this + * pool. The manager will automatically create security groups with minimum + * rules needed for a functioning cluster. + * + * Generated from protobuf field repeated string security_group_ids = 10 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $security_group_ids; + /** + * Optional. Proxy configuration for outbound HTTP(S) traffic. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsProxyConfig proxy_config = 12 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $proxy_config = null; + /** + * Required. Config encryption for user data. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsConfigEncryption config_encryption = 13 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $config_encryption = null; + /** + * Optional. Placement related info for this node. + * When unspecified, the VPC's default tenancy will be used. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsInstancePlacement instance_placement = 14 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $instance_placement = null; + /** + * Optional. Configuration related to CloudWatch metrics collection on the + * Auto Scaling group of the node pool. + * When unspecified, metrics collection is disabled. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsAutoscalingGroupMetricsCollection autoscaling_metrics_collection = 15 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $autoscaling_metrics_collection = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $instance_type + * Optional. The AWS instance type. + * When unspecified, it uses a default based on the node pool's version. + * @type \Google\Cloud\GkeMultiCloud\V1\AwsVolumeTemplate $root_volume + * Optional. Template for the root volume provisioned for node pool nodes. + * Volumes will be provisioned in the availability zone assigned + * to the node pool subnet. + * When unspecified, it defaults to 32 GiB with the GP2 volume type. + * @type array<\Google\Cloud\GkeMultiCloud\V1\NodeTaint>|\Google\Protobuf\Internal\RepeatedField $taints + * Optional. The initial taints assigned to nodes of this node pool. + * @type array|\Google\Protobuf\Internal\MapField $labels + * Optional. The initial labels assigned to nodes of this node pool. An object + * containing a list of "key": value pairs. Example: { "name": "wrench", + * "mass": "1.3kg", "count": "3" }. + * @type array|\Google\Protobuf\Internal\MapField $tags + * Optional. Key/value metadata to assign to each underlying AWS resource. + * Specify at most 50 pairs containing alphanumerics, spaces, and symbols + * (.+-=_:@/). Keys can be up to 127 Unicode characters. Values can be up to + * 255 Unicode characters. + * @type string $iam_instance_profile + * Required. The name or ARN of the AWS IAM role assigned to nodes in the + * pool. + * @type string $image_type + * Optional. The OS image type to use on node pool instances. + * Can have a value of `ubuntu`, or `windows` if the cluster enables + * the Windows node pool preview feature. + * When unspecified, it defaults to `ubuntu`. + * @type \Google\Cloud\GkeMultiCloud\V1\AwsSshConfig $ssh_config + * Optional. The SSH configuration. + * @type array|\Google\Protobuf\Internal\RepeatedField $security_group_ids + * Optional. The IDs of additional security groups to add to nodes in this + * pool. The manager will automatically create security groups with minimum + * rules needed for a functioning cluster. + * @type \Google\Cloud\GkeMultiCloud\V1\AwsProxyConfig $proxy_config + * Optional. Proxy configuration for outbound HTTP(S) traffic. + * @type \Google\Cloud\GkeMultiCloud\V1\AwsConfigEncryption $config_encryption + * Required. Config encryption for user data. + * @type \Google\Cloud\GkeMultiCloud\V1\AwsInstancePlacement $instance_placement + * Optional. Placement related info for this node. + * When unspecified, the VPC's default tenancy will be used. + * @type \Google\Cloud\GkeMultiCloud\V1\AwsAutoscalingGroupMetricsCollection $autoscaling_metrics_collection + * Optional. Configuration related to CloudWatch metrics collection on the + * Auto Scaling group of the node pool. + * When unspecified, metrics collection is disabled. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AwsResources::initOnce(); + parent::__construct($data); + } + + /** + * Optional. The AWS instance type. + * When unspecified, it uses a default based on the node pool's version. + * + * Generated from protobuf field string instance_type = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getInstanceType() + { + return $this->instance_type; + } + + /** + * Optional. The AWS instance type. + * When unspecified, it uses a default based on the node pool's version. + * + * Generated from protobuf field string instance_type = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setInstanceType($var) + { + GPBUtil::checkString($var, True); + $this->instance_type = $var; + + return $this; + } + + /** + * Optional. Template for the root volume provisioned for node pool nodes. + * Volumes will be provisioned in the availability zone assigned + * to the node pool subnet. + * When unspecified, it defaults to 32 GiB with the GP2 volume type. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsVolumeTemplate root_volume = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\GkeMultiCloud\V1\AwsVolumeTemplate|null + */ + public function getRootVolume() + { + return $this->root_volume; + } + + public function hasRootVolume() + { + return isset($this->root_volume); + } + + public function clearRootVolume() + { + unset($this->root_volume); + } + + /** + * Optional. Template for the root volume provisioned for node pool nodes. + * Volumes will be provisioned in the availability zone assigned + * to the node pool subnet. + * When unspecified, it defaults to 32 GiB with the GP2 volume type. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsVolumeTemplate root_volume = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\GkeMultiCloud\V1\AwsVolumeTemplate $var + * @return $this + */ + public function setRootVolume($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeMultiCloud\V1\AwsVolumeTemplate::class); + $this->root_volume = $var; + + return $this; + } + + /** + * Optional. The initial taints assigned to nodes of this node pool. + * + * Generated from protobuf field repeated .google.cloud.gkemulticloud.v1.NodeTaint taints = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTaints() + { + return $this->taints; + } + + /** + * Optional. The initial taints assigned to nodes of this node pool. + * + * Generated from protobuf field repeated .google.cloud.gkemulticloud.v1.NodeTaint taints = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param array<\Google\Cloud\GkeMultiCloud\V1\NodeTaint>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTaints($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\GkeMultiCloud\V1\NodeTaint::class); + $this->taints = $arr; + + return $this; + } + + /** + * Optional. The initial labels assigned to nodes of this node pool. An object + * containing a list of "key": value pairs. Example: { "name": "wrench", + * "mass": "1.3kg", "count": "3" }. + * + * Generated from protobuf field map labels = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * Optional. The initial labels assigned to nodes of this node pool. An object + * containing a list of "key": value pairs. Example: { "name": "wrench", + * "mass": "1.3kg", "count": "3" }. + * + * Generated from protobuf field map labels = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + + /** + * Optional. Key/value metadata to assign to each underlying AWS resource. + * Specify at most 50 pairs containing alphanumerics, spaces, and symbols + * (.+-=_:@/). Keys can be up to 127 Unicode characters. Values can be up to + * 255 Unicode characters. + * + * Generated from protobuf field map tags = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\MapField + */ + public function getTags() + { + return $this->tags; + } + + /** + * Optional. Key/value metadata to assign to each underlying AWS resource. + * Specify at most 50 pairs containing alphanumerics, spaces, and symbols + * (.+-=_:@/). Keys can be up to 127 Unicode characters. Values can be up to + * 255 Unicode characters. + * + * Generated from protobuf field map tags = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setTags($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->tags = $arr; + + return $this; + } + + /** + * Required. The name or ARN of the AWS IAM role assigned to nodes in the + * pool. + * + * Generated from protobuf field string iam_instance_profile = 6 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getIamInstanceProfile() + { + return $this->iam_instance_profile; + } + + /** + * Required. The name or ARN of the AWS IAM role assigned to nodes in the + * pool. + * + * Generated from protobuf field string iam_instance_profile = 6 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setIamInstanceProfile($var) + { + GPBUtil::checkString($var, True); + $this->iam_instance_profile = $var; + + return $this; + } + + /** + * Optional. The OS image type to use on node pool instances. + * Can have a value of `ubuntu`, or `windows` if the cluster enables + * the Windows node pool preview feature. + * When unspecified, it defaults to `ubuntu`. + * + * Generated from protobuf field string image_type = 11 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getImageType() + { + return $this->image_type; + } + + /** + * Optional. The OS image type to use on node pool instances. + * Can have a value of `ubuntu`, or `windows` if the cluster enables + * the Windows node pool preview feature. + * When unspecified, it defaults to `ubuntu`. + * + * Generated from protobuf field string image_type = 11 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setImageType($var) + { + GPBUtil::checkString($var, True); + $this->image_type = $var; + + return $this; + } + + /** + * Optional. The SSH configuration. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsSshConfig ssh_config = 9 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\GkeMultiCloud\V1\AwsSshConfig|null + */ + public function getSshConfig() + { + return $this->ssh_config; + } + + public function hasSshConfig() + { + return isset($this->ssh_config); + } + + public function clearSshConfig() + { + unset($this->ssh_config); + } + + /** + * Optional. The SSH configuration. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsSshConfig ssh_config = 9 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\GkeMultiCloud\V1\AwsSshConfig $var + * @return $this + */ + public function setSshConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeMultiCloud\V1\AwsSshConfig::class); + $this->ssh_config = $var; + + return $this; + } + + /** + * Optional. The IDs of additional security groups to add to nodes in this + * pool. The manager will automatically create security groups with minimum + * rules needed for a functioning cluster. + * + * Generated from protobuf field repeated string security_group_ids = 10 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSecurityGroupIds() + { + return $this->security_group_ids; + } + + /** + * Optional. The IDs of additional security groups to add to nodes in this + * pool. The manager will automatically create security groups with minimum + * rules needed for a functioning cluster. + * + * Generated from protobuf field repeated string security_group_ids = 10 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSecurityGroupIds($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->security_group_ids = $arr; + + return $this; + } + + /** + * Optional. Proxy configuration for outbound HTTP(S) traffic. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsProxyConfig proxy_config = 12 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\GkeMultiCloud\V1\AwsProxyConfig|null + */ + public function getProxyConfig() + { + return $this->proxy_config; + } + + public function hasProxyConfig() + { + return isset($this->proxy_config); + } + + public function clearProxyConfig() + { + unset($this->proxy_config); + } + + /** + * Optional. Proxy configuration for outbound HTTP(S) traffic. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsProxyConfig proxy_config = 12 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\GkeMultiCloud\V1\AwsProxyConfig $var + * @return $this + */ + public function setProxyConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeMultiCloud\V1\AwsProxyConfig::class); + $this->proxy_config = $var; + + return $this; + } + + /** + * Required. Config encryption for user data. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsConfigEncryption config_encryption = 13 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\GkeMultiCloud\V1\AwsConfigEncryption|null + */ + public function getConfigEncryption() + { + return $this->config_encryption; + } + + public function hasConfigEncryption() + { + return isset($this->config_encryption); + } + + public function clearConfigEncryption() + { + unset($this->config_encryption); + } + + /** + * Required. Config encryption for user data. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsConfigEncryption config_encryption = 13 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\GkeMultiCloud\V1\AwsConfigEncryption $var + * @return $this + */ + public function setConfigEncryption($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeMultiCloud\V1\AwsConfigEncryption::class); + $this->config_encryption = $var; + + return $this; + } + + /** + * Optional. Placement related info for this node. + * When unspecified, the VPC's default tenancy will be used. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsInstancePlacement instance_placement = 14 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\GkeMultiCloud\V1\AwsInstancePlacement|null + */ + public function getInstancePlacement() + { + return $this->instance_placement; + } + + public function hasInstancePlacement() + { + return isset($this->instance_placement); + } + + public function clearInstancePlacement() + { + unset($this->instance_placement); + } + + /** + * Optional. Placement related info for this node. + * When unspecified, the VPC's default tenancy will be used. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsInstancePlacement instance_placement = 14 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\GkeMultiCloud\V1\AwsInstancePlacement $var + * @return $this + */ + public function setInstancePlacement($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeMultiCloud\V1\AwsInstancePlacement::class); + $this->instance_placement = $var; + + return $this; + } + + /** + * Optional. Configuration related to CloudWatch metrics collection on the + * Auto Scaling group of the node pool. + * When unspecified, metrics collection is disabled. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsAutoscalingGroupMetricsCollection autoscaling_metrics_collection = 15 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\GkeMultiCloud\V1\AwsAutoscalingGroupMetricsCollection|null + */ + public function getAutoscalingMetricsCollection() + { + return $this->autoscaling_metrics_collection; + } + + public function hasAutoscalingMetricsCollection() + { + return isset($this->autoscaling_metrics_collection); + } + + public function clearAutoscalingMetricsCollection() + { + unset($this->autoscaling_metrics_collection); + } + + /** + * Optional. Configuration related to CloudWatch metrics collection on the + * Auto Scaling group of the node pool. + * When unspecified, metrics collection is disabled. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsAutoscalingGroupMetricsCollection autoscaling_metrics_collection = 15 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\GkeMultiCloud\V1\AwsAutoscalingGroupMetricsCollection $var + * @return $this + */ + public function setAutoscalingMetricsCollection($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeMultiCloud\V1\AwsAutoscalingGroupMetricsCollection::class); + $this->autoscaling_metrics_collection = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsNodePool.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsNodePool.php new file mode 100644 index 000000000000..2c71f5573170 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsNodePool.php @@ -0,0 +1,639 @@ +google.cloud.gkemulticloud.v1.AwsNodePool + */ +class AwsNodePool extends \Google\Protobuf\Internal\Message +{ + /** + * The name of this resource. + * Node pool names are formatted as + * `projects//locations//awsClusters//awsNodePools/`. + * For more details on Google Cloud resource names, + * see [Resource Names](https://cloud.google.com/apis/design/resource_names) + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * Required. The Kubernetes version to run on this node pool (e.g. + * `1.19.10-gke.1000`). + * You can list all supported versions on a given Google Cloud region by + * calling + * [GetAwsServerConfig][google.cloud.gkemulticloud.v1.AwsClusters.GetAwsServerConfig]. + * + * Generated from protobuf field string version = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $version = ''; + /** + * Required. The configuration of the node pool. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsNodeConfig config = 28 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $config = null; + /** + * Required. Autoscaler configuration for this node pool. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsNodePoolAutoscaling autoscaling = 25 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $autoscaling = null; + /** + * Required. The subnet where the node pool node run. + * + * Generated from protobuf field string subnet_id = 6 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $subnet_id = ''; + /** + * Output only. The lifecycle state of the node pool. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsNodePool.State state = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Output only. A globally unique identifier for the node pool. + * + * Generated from protobuf field string uid = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $uid = ''; + /** + * Output only. If set, there are currently changes in flight to the node + * pool. + * + * Generated from protobuf field bool reconciling = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $reconciling = false; + /** + * Output only. The time at which this node pool was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. The time at which this node pool was last updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 20 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * Allows clients to perform consistent read-modify-writes + * through optimistic concurrency control. + * Can be sent on update and delete requests to ensure the + * client has an up-to-date value before proceeding. + * + * Generated from protobuf field string etag = 21; + */ + protected $etag = ''; + /** + * Optional. Annotations on the node pool. + * This field has the same restrictions as Kubernetes annotations. + * The total size of all keys and values combined is limited to 256k. + * Key can have 2 segments: prefix (optional) and name (required), + * separated by a slash (/). + * Prefix must be a DNS subdomain. + * Name must be 63 characters or less, begin and end with alphanumerics, + * with dashes (-), underscores (_), dots (.), and alphanumerics between. + * + * Generated from protobuf field map annotations = 22 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $annotations; + /** + * Required. The constraint on the maximum number of pods that can be run + * simultaneously on a node in the node pool. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.MaxPodsConstraint max_pods_constraint = 27 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $max_pods_constraint = null; + /** + * Output only. A set of errors found in the node pool. + * + * Generated from protobuf field repeated .google.cloud.gkemulticloud.v1.AwsNodePoolError errors = 29 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $errors; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The name of this resource. + * Node pool names are formatted as + * `projects//locations//awsClusters//awsNodePools/`. + * For more details on Google Cloud resource names, + * see [Resource Names](https://cloud.google.com/apis/design/resource_names) + * @type string $version + * Required. The Kubernetes version to run on this node pool (e.g. + * `1.19.10-gke.1000`). + * You can list all supported versions on a given Google Cloud region by + * calling + * [GetAwsServerConfig][google.cloud.gkemulticloud.v1.AwsClusters.GetAwsServerConfig]. + * @type \Google\Cloud\GkeMultiCloud\V1\AwsNodeConfig $config + * Required. The configuration of the node pool. + * @type \Google\Cloud\GkeMultiCloud\V1\AwsNodePoolAutoscaling $autoscaling + * Required. Autoscaler configuration for this node pool. + * @type string $subnet_id + * Required. The subnet where the node pool node run. + * @type int $state + * Output only. The lifecycle state of the node pool. + * @type string $uid + * Output only. A globally unique identifier for the node pool. + * @type bool $reconciling + * Output only. If set, there are currently changes in flight to the node + * pool. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The time at which this node pool was created. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. The time at which this node pool was last updated. + * @type string $etag + * Allows clients to perform consistent read-modify-writes + * through optimistic concurrency control. + * Can be sent on update and delete requests to ensure the + * client has an up-to-date value before proceeding. + * @type array|\Google\Protobuf\Internal\MapField $annotations + * Optional. Annotations on the node pool. + * This field has the same restrictions as Kubernetes annotations. + * The total size of all keys and values combined is limited to 256k. + * Key can have 2 segments: prefix (optional) and name (required), + * separated by a slash (/). + * Prefix must be a DNS subdomain. + * Name must be 63 characters or less, begin and end with alphanumerics, + * with dashes (-), underscores (_), dots (.), and alphanumerics between. + * @type \Google\Cloud\GkeMultiCloud\V1\MaxPodsConstraint $max_pods_constraint + * Required. The constraint on the maximum number of pods that can be run + * simultaneously on a node in the node pool. + * @type array<\Google\Cloud\GkeMultiCloud\V1\AwsNodePoolError>|\Google\Protobuf\Internal\RepeatedField $errors + * Output only. A set of errors found in the node pool. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AwsResources::initOnce(); + parent::__construct($data); + } + + /** + * The name of this resource. + * Node pool names are formatted as + * `projects//locations//awsClusters//awsNodePools/`. + * For more details on Google Cloud resource names, + * see [Resource Names](https://cloud.google.com/apis/design/resource_names) + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The name of this resource. + * Node pool names are formatted as + * `projects//locations//awsClusters//awsNodePools/`. + * For more details on Google Cloud resource names, + * see [Resource Names](https://cloud.google.com/apis/design/resource_names) + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Required. The Kubernetes version to run on this node pool (e.g. + * `1.19.10-gke.1000`). + * You can list all supported versions on a given Google Cloud region by + * calling + * [GetAwsServerConfig][google.cloud.gkemulticloud.v1.AwsClusters.GetAwsServerConfig]. + * + * Generated from protobuf field string version = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getVersion() + { + return $this->version; + } + + /** + * Required. The Kubernetes version to run on this node pool (e.g. + * `1.19.10-gke.1000`). + * You can list all supported versions on a given Google Cloud region by + * calling + * [GetAwsServerConfig][google.cloud.gkemulticloud.v1.AwsClusters.GetAwsServerConfig]. + * + * Generated from protobuf field string version = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setVersion($var) + { + GPBUtil::checkString($var, True); + $this->version = $var; + + return $this; + } + + /** + * Required. The configuration of the node pool. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsNodeConfig config = 28 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\GkeMultiCloud\V1\AwsNodeConfig|null + */ + public function getConfig() + { + return $this->config; + } + + public function hasConfig() + { + return isset($this->config); + } + + public function clearConfig() + { + unset($this->config); + } + + /** + * Required. The configuration of the node pool. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsNodeConfig config = 28 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\GkeMultiCloud\V1\AwsNodeConfig $var + * @return $this + */ + public function setConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeMultiCloud\V1\AwsNodeConfig::class); + $this->config = $var; + + return $this; + } + + /** + * Required. Autoscaler configuration for this node pool. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsNodePoolAutoscaling autoscaling = 25 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\GkeMultiCloud\V1\AwsNodePoolAutoscaling|null + */ + public function getAutoscaling() + { + return $this->autoscaling; + } + + public function hasAutoscaling() + { + return isset($this->autoscaling); + } + + public function clearAutoscaling() + { + unset($this->autoscaling); + } + + /** + * Required. Autoscaler configuration for this node pool. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsNodePoolAutoscaling autoscaling = 25 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\GkeMultiCloud\V1\AwsNodePoolAutoscaling $var + * @return $this + */ + public function setAutoscaling($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeMultiCloud\V1\AwsNodePoolAutoscaling::class); + $this->autoscaling = $var; + + return $this; + } + + /** + * Required. The subnet where the node pool node run. + * + * Generated from protobuf field string subnet_id = 6 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getSubnetId() + { + return $this->subnet_id; + } + + /** + * Required. The subnet where the node pool node run. + * + * Generated from protobuf field string subnet_id = 6 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setSubnetId($var) + { + GPBUtil::checkString($var, True); + $this->subnet_id = $var; + + return $this; + } + + /** + * Output only. The lifecycle state of the node pool. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsNodePool.State state = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. The lifecycle state of the node pool. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsNodePool.State state = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\GkeMultiCloud\V1\AwsNodePool\State::class); + $this->state = $var; + + return $this; + } + + /** + * Output only. A globally unique identifier for the node pool. + * + * Generated from protobuf field string uid = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getUid() + { + return $this->uid; + } + + /** + * Output only. A globally unique identifier for the node pool. + * + * Generated from protobuf field string uid = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setUid($var) + { + GPBUtil::checkString($var, True); + $this->uid = $var; + + return $this; + } + + /** + * Output only. If set, there are currently changes in flight to the node + * pool. + * + * Generated from protobuf field bool reconciling = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return bool + */ + public function getReconciling() + { + return $this->reconciling; + } + + /** + * Output only. If set, there are currently changes in flight to the node + * pool. + * + * Generated from protobuf field bool reconciling = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param bool $var + * @return $this + */ + public function setReconciling($var) + { + GPBUtil::checkBool($var); + $this->reconciling = $var; + + return $this; + } + + /** + * Output only. The time at which this node pool was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 19 [(.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 at which this node pool was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 19 [(.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 at which this node pool was last updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 20 [(.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 at which this node pool was last updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 20 [(.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; + } + + /** + * Allows clients to perform consistent read-modify-writes + * through optimistic concurrency control. + * Can be sent on update and delete requests to ensure the + * client has an up-to-date value before proceeding. + * + * Generated from protobuf field string etag = 21; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * Allows clients to perform consistent read-modify-writes + * through optimistic concurrency control. + * Can be sent on update and delete requests to ensure the + * client has an up-to-date value before proceeding. + * + * Generated from protobuf field string etag = 21; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, True); + $this->etag = $var; + + return $this; + } + + /** + * Optional. Annotations on the node pool. + * This field has the same restrictions as Kubernetes annotations. + * The total size of all keys and values combined is limited to 256k. + * Key can have 2 segments: prefix (optional) and name (required), + * separated by a slash (/). + * Prefix must be a DNS subdomain. + * Name must be 63 characters or less, begin and end with alphanumerics, + * with dashes (-), underscores (_), dots (.), and alphanumerics between. + * + * Generated from protobuf field map annotations = 22 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\MapField + */ + public function getAnnotations() + { + return $this->annotations; + } + + /** + * Optional. Annotations on the node pool. + * This field has the same restrictions as Kubernetes annotations. + * The total size of all keys and values combined is limited to 256k. + * Key can have 2 segments: prefix (optional) and name (required), + * separated by a slash (/). + * Prefix must be a DNS subdomain. + * Name must be 63 characters or less, begin and end with alphanumerics, + * with dashes (-), underscores (_), dots (.), and alphanumerics between. + * + * Generated from protobuf field map annotations = 22 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setAnnotations($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->annotations = $arr; + + return $this; + } + + /** + * Required. The constraint on the maximum number of pods that can be run + * simultaneously on a node in the node pool. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.MaxPodsConstraint max_pods_constraint = 27 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\GkeMultiCloud\V1\MaxPodsConstraint|null + */ + public function getMaxPodsConstraint() + { + return $this->max_pods_constraint; + } + + public function hasMaxPodsConstraint() + { + return isset($this->max_pods_constraint); + } + + public function clearMaxPodsConstraint() + { + unset($this->max_pods_constraint); + } + + /** + * Required. The constraint on the maximum number of pods that can be run + * simultaneously on a node in the node pool. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.MaxPodsConstraint max_pods_constraint = 27 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\GkeMultiCloud\V1\MaxPodsConstraint $var + * @return $this + */ + public function setMaxPodsConstraint($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeMultiCloud\V1\MaxPodsConstraint::class); + $this->max_pods_constraint = $var; + + return $this; + } + + /** + * Output only. A set of errors found in the node pool. + * + * Generated from protobuf field repeated .google.cloud.gkemulticloud.v1.AwsNodePoolError errors = 29 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getErrors() + { + return $this->errors; + } + + /** + * Output only. A set of errors found in the node pool. + * + * Generated from protobuf field repeated .google.cloud.gkemulticloud.v1.AwsNodePoolError errors = 29 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array<\Google\Cloud\GkeMultiCloud\V1\AwsNodePoolError>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setErrors($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\GkeMultiCloud\V1\AwsNodePoolError::class); + $this->errors = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsNodePool/State.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsNodePool/State.php new file mode 100644 index 000000000000..6c57e22b0028 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsNodePool/State.php @@ -0,0 +1,95 @@ +google.cloud.gkemulticloud.v1.AwsNodePool.State + */ +class State +{ + /** + * Not set. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The PROVISIONING state indicates the node pool is being created. + * + * Generated from protobuf enum PROVISIONING = 1; + */ + const PROVISIONING = 1; + /** + * The RUNNING state indicates the node pool has been created + * and is fully usable. + * + * Generated from protobuf enum RUNNING = 2; + */ + const RUNNING = 2; + /** + * The RECONCILING state indicates that the node pool is being reconciled. + * + * Generated from protobuf enum RECONCILING = 3; + */ + const RECONCILING = 3; + /** + * The STOPPING state indicates the node pool is being deleted. + * + * Generated from protobuf enum STOPPING = 4; + */ + const STOPPING = 4; + /** + * The ERROR state indicates the node pool is in a broken unrecoverable + * state. + * + * Generated from protobuf enum ERROR = 5; + */ + const ERROR = 5; + /** + * The DEGRADED state indicates the node pool requires user action to + * restore full functionality. + * + * Generated from protobuf enum DEGRADED = 6; + */ + const DEGRADED = 6; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::PROVISIONING => 'PROVISIONING', + self::RUNNING => 'RUNNING', + self::RECONCILING => 'RECONCILING', + self::STOPPING => 'STOPPING', + self::ERROR => 'ERROR', + self::DEGRADED => 'DEGRADED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\GkeMultiCloud\V1\AwsNodePool_State::class); + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsNodePoolAutoscaling.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsNodePoolAutoscaling.php new file mode 100644 index 000000000000..fa2cda6ccf53 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsNodePoolAutoscaling.php @@ -0,0 +1,110 @@ +google.cloud.gkemulticloud.v1.AwsNodePoolAutoscaling + */ +class AwsNodePoolAutoscaling extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Minimum number of nodes in the node pool. Must be greater than or + * equal to 1 and less than or equal to max_node_count. + * + * Generated from protobuf field int32 min_node_count = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $min_node_count = 0; + /** + * Required. Maximum number of nodes in the node pool. Must be greater than or + * equal to min_node_count and less than or equal to 50. + * + * Generated from protobuf field int32 max_node_count = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $max_node_count = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $min_node_count + * Required. Minimum number of nodes in the node pool. Must be greater than or + * equal to 1 and less than or equal to max_node_count. + * @type int $max_node_count + * Required. Maximum number of nodes in the node pool. Must be greater than or + * equal to min_node_count and less than or equal to 50. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AwsResources::initOnce(); + parent::__construct($data); + } + + /** + * Required. Minimum number of nodes in the node pool. Must be greater than or + * equal to 1 and less than or equal to max_node_count. + * + * Generated from protobuf field int32 min_node_count = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getMinNodeCount() + { + return $this->min_node_count; + } + + /** + * Required. Minimum number of nodes in the node pool. Must be greater than or + * equal to 1 and less than or equal to max_node_count. + * + * Generated from protobuf field int32 min_node_count = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setMinNodeCount($var) + { + GPBUtil::checkInt32($var); + $this->min_node_count = $var; + + return $this; + } + + /** + * Required. Maximum number of nodes in the node pool. Must be greater than or + * equal to min_node_count and less than or equal to 50. + * + * Generated from protobuf field int32 max_node_count = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getMaxNodeCount() + { + return $this->max_node_count; + } + + /** + * Required. Maximum number of nodes in the node pool. Must be greater than or + * equal to min_node_count and less than or equal to 50. + * + * Generated from protobuf field int32 max_node_count = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setMaxNodeCount($var) + { + GPBUtil::checkInt32($var); + $this->max_node_count = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsNodePoolError.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsNodePoolError.php new file mode 100644 index 000000000000..c5a04b7d3934 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsNodePoolError.php @@ -0,0 +1,67 @@ +google.cloud.gkemulticloud.v1.AwsNodePoolError + */ +class AwsNodePoolError extends \Google\Protobuf\Internal\Message +{ + /** + * Human-friendly description of the error. + * + * Generated from protobuf field string message = 1; + */ + protected $message = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $message + * Human-friendly description of the error. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AwsResources::initOnce(); + parent::__construct($data); + } + + /** + * Human-friendly description of the error. + * + * Generated from protobuf field string message = 1; + * @return string + */ + public function getMessage() + { + return $this->message; + } + + /** + * Human-friendly description of the error. + * + * Generated from protobuf field string message = 1; + * @param string $var + * @return $this + */ + public function setMessage($var) + { + GPBUtil::checkString($var, True); + $this->message = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsNodePool_State.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsNodePool_State.php new file mode 100644 index 000000000000..2e4dbf88c811 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsNodePool_State.php @@ -0,0 +1,16 @@ +google.cloud.gkemulticloud.v1.AwsProxyConfig + */ +class AwsProxyConfig extends \Google\Protobuf\Internal\Message +{ + /** + * The ARN of the AWS Secret Manager secret that contains the HTTP(S) proxy + * configuration. + * The secret must be a JSON encoded proxy configuration + * as described in + * https://cloud.google.com/anthos/clusters/docs/multi-cloud/aws/how-to/use-a-proxy#create_a_proxy_configuration_file + * + * Generated from protobuf field string secret_arn = 1; + */ + protected $secret_arn = ''; + /** + * The version string of the AWS Secret Manager secret that contains the + * HTTP(S) proxy configuration. + * + * Generated from protobuf field string secret_version = 2; + */ + protected $secret_version = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $secret_arn + * The ARN of the AWS Secret Manager secret that contains the HTTP(S) proxy + * configuration. + * The secret must be a JSON encoded proxy configuration + * as described in + * https://cloud.google.com/anthos/clusters/docs/multi-cloud/aws/how-to/use-a-proxy#create_a_proxy_configuration_file + * @type string $secret_version + * The version string of the AWS Secret Manager secret that contains the + * HTTP(S) proxy configuration. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AwsResources::initOnce(); + parent::__construct($data); + } + + /** + * The ARN of the AWS Secret Manager secret that contains the HTTP(S) proxy + * configuration. + * The secret must be a JSON encoded proxy configuration + * as described in + * https://cloud.google.com/anthos/clusters/docs/multi-cloud/aws/how-to/use-a-proxy#create_a_proxy_configuration_file + * + * Generated from protobuf field string secret_arn = 1; + * @return string + */ + public function getSecretArn() + { + return $this->secret_arn; + } + + /** + * The ARN of the AWS Secret Manager secret that contains the HTTP(S) proxy + * configuration. + * The secret must be a JSON encoded proxy configuration + * as described in + * https://cloud.google.com/anthos/clusters/docs/multi-cloud/aws/how-to/use-a-proxy#create_a_proxy_configuration_file + * + * Generated from protobuf field string secret_arn = 1; + * @param string $var + * @return $this + */ + public function setSecretArn($var) + { + GPBUtil::checkString($var, True); + $this->secret_arn = $var; + + return $this; + } + + /** + * The version string of the AWS Secret Manager secret that contains the + * HTTP(S) proxy configuration. + * + * Generated from protobuf field string secret_version = 2; + * @return string + */ + public function getSecretVersion() + { + return $this->secret_version; + } + + /** + * The version string of the AWS Secret Manager secret that contains the + * HTTP(S) proxy configuration. + * + * Generated from protobuf field string secret_version = 2; + * @param string $var + * @return $this + */ + public function setSecretVersion($var) + { + GPBUtil::checkString($var, True); + $this->secret_version = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsServerConfig.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsServerConfig.php new file mode 100644 index 000000000000..c00bfe0636c7 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsServerConfig.php @@ -0,0 +1,135 @@ +google.cloud.gkemulticloud.v1.AwsServerConfig + */ +class AwsServerConfig extends \Google\Protobuf\Internal\Message +{ + /** + * The resource name of the config. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * List of valid Kubernetes versions. + * + * Generated from protobuf field repeated .google.cloud.gkemulticloud.v1.AwsK8sVersionInfo valid_versions = 2; + */ + private $valid_versions; + /** + * The list of supported AWS regions. + * + * Generated from protobuf field repeated string supported_aws_regions = 3; + */ + private $supported_aws_regions; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The resource name of the config. + * @type array<\Google\Cloud\GkeMultiCloud\V1\AwsK8sVersionInfo>|\Google\Protobuf\Internal\RepeatedField $valid_versions + * List of valid Kubernetes versions. + * @type array|\Google\Protobuf\Internal\RepeatedField $supported_aws_regions + * The list of supported AWS regions. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AwsResources::initOnce(); + parent::__construct($data); + } + + /** + * The resource name of the config. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The resource name of the config. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * List of valid Kubernetes versions. + * + * Generated from protobuf field repeated .google.cloud.gkemulticloud.v1.AwsK8sVersionInfo valid_versions = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getValidVersions() + { + return $this->valid_versions; + } + + /** + * List of valid Kubernetes versions. + * + * Generated from protobuf field repeated .google.cloud.gkemulticloud.v1.AwsK8sVersionInfo valid_versions = 2; + * @param array<\Google\Cloud\GkeMultiCloud\V1\AwsK8sVersionInfo>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setValidVersions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\GkeMultiCloud\V1\AwsK8sVersionInfo::class); + $this->valid_versions = $arr; + + return $this; + } + + /** + * The list of supported AWS regions. + * + * Generated from protobuf field repeated string supported_aws_regions = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSupportedAwsRegions() + { + return $this->supported_aws_regions; + } + + /** + * The list of supported AWS regions. + * + * Generated from protobuf field repeated string supported_aws_regions = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSupportedAwsRegions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->supported_aws_regions = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsServicesAuthentication.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsServicesAuthentication.php new file mode 100644 index 000000000000..cef249ad091f --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsServicesAuthentication.php @@ -0,0 +1,109 @@ +google.cloud.gkemulticloud.v1.AwsServicesAuthentication + */ +class AwsServicesAuthentication extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The Amazon Resource Name (ARN) of the role that the Anthos + * Multi-Cloud API will assume when managing AWS resources on your account. + * + * Generated from protobuf field string role_arn = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $role_arn = ''; + /** + * Optional. An identifier for the assumed role session. + * When unspecified, it defaults to `multicloud-service-agent`. + * + * Generated from protobuf field string role_session_name = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $role_session_name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $role_arn + * Required. The Amazon Resource Name (ARN) of the role that the Anthos + * Multi-Cloud API will assume when managing AWS resources on your account. + * @type string $role_session_name + * Optional. An identifier for the assumed role session. + * When unspecified, it defaults to `multicloud-service-agent`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AwsResources::initOnce(); + parent::__construct($data); + } + + /** + * Required. The Amazon Resource Name (ARN) of the role that the Anthos + * Multi-Cloud API will assume when managing AWS resources on your account. + * + * Generated from protobuf field string role_arn = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getRoleArn() + { + return $this->role_arn; + } + + /** + * Required. The Amazon Resource Name (ARN) of the role that the Anthos + * Multi-Cloud API will assume when managing AWS resources on your account. + * + * Generated from protobuf field string role_arn = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setRoleArn($var) + { + GPBUtil::checkString($var, True); + $this->role_arn = $var; + + return $this; + } + + /** + * Optional. An identifier for the assumed role session. + * When unspecified, it defaults to `multicloud-service-agent`. + * + * Generated from protobuf field string role_session_name = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRoleSessionName() + { + return $this->role_session_name; + } + + /** + * Optional. An identifier for the assumed role session. + * When unspecified, it defaults to `multicloud-service-agent`. + * + * Generated from protobuf field string role_session_name = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRoleSessionName($var) + { + GPBUtil::checkString($var, True); + $this->role_session_name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsSshConfig.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsSshConfig.php new file mode 100644 index 000000000000..a3e356328b16 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsSshConfig.php @@ -0,0 +1,67 @@ +google.cloud.gkemulticloud.v1.AwsSshConfig + */ +class AwsSshConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the EC2 key pair used to login into cluster machines. + * + * Generated from protobuf field string ec2_key_pair = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $ec2_key_pair = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $ec2_key_pair + * Required. The name of the EC2 key pair used to login into cluster machines. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AwsResources::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the EC2 key pair used to login into cluster machines. + * + * Generated from protobuf field string ec2_key_pair = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getEc2KeyPair() + { + return $this->ec2_key_pair; + } + + /** + * Required. The name of the EC2 key pair used to login into cluster machines. + * + * Generated from protobuf field string ec2_key_pair = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setEc2KeyPair($var) + { + GPBUtil::checkString($var, True); + $this->ec2_key_pair = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsVolumeTemplate.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsVolumeTemplate.php new file mode 100644 index 000000000000..99028858b4e9 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsVolumeTemplate.php @@ -0,0 +1,197 @@ +google.cloud.gkemulticloud.v1.AwsVolumeTemplate + */ +class AwsVolumeTemplate extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. The size of the volume, in GiBs. + * When unspecified, a default value is provided. See the specific reference + * in the parent resource. + * + * Generated from protobuf field int32 size_gib = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $size_gib = 0; + /** + * Optional. Type of the EBS volume. + * When unspecified, it defaults to GP2 volume. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsVolumeTemplate.VolumeType volume_type = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $volume_type = 0; + /** + * Optional. The number of I/O operations per second (IOPS) to provision for + * GP3 volume. + * + * Generated from protobuf field int32 iops = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $iops = 0; + /** + * Optional. The Amazon Resource Name (ARN) of the Customer Managed Key (CMK) + * used to encrypt AWS EBS volumes. + * If not specified, the default Amazon managed key associated to + * the AWS region where this cluster runs will be used. + * + * Generated from protobuf field string kms_key_arn = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $kms_key_arn = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $size_gib + * Optional. The size of the volume, in GiBs. + * When unspecified, a default value is provided. See the specific reference + * in the parent resource. + * @type int $volume_type + * Optional. Type of the EBS volume. + * When unspecified, it defaults to GP2 volume. + * @type int $iops + * Optional. The number of I/O operations per second (IOPS) to provision for + * GP3 volume. + * @type string $kms_key_arn + * Optional. The Amazon Resource Name (ARN) of the Customer Managed Key (CMK) + * used to encrypt AWS EBS volumes. + * If not specified, the default Amazon managed key associated to + * the AWS region where this cluster runs will be used. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AwsResources::initOnce(); + parent::__construct($data); + } + + /** + * Optional. The size of the volume, in GiBs. + * When unspecified, a default value is provided. See the specific reference + * in the parent resource. + * + * Generated from protobuf field int32 size_gib = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getSizeGib() + { + return $this->size_gib; + } + + /** + * Optional. The size of the volume, in GiBs. + * When unspecified, a default value is provided. See the specific reference + * in the parent resource. + * + * Generated from protobuf field int32 size_gib = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setSizeGib($var) + { + GPBUtil::checkInt32($var); + $this->size_gib = $var; + + return $this; + } + + /** + * Optional. Type of the EBS volume. + * When unspecified, it defaults to GP2 volume. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsVolumeTemplate.VolumeType volume_type = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getVolumeType() + { + return $this->volume_type; + } + + /** + * Optional. Type of the EBS volume. + * When unspecified, it defaults to GP2 volume. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsVolumeTemplate.VolumeType volume_type = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setVolumeType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\GkeMultiCloud\V1\AwsVolumeTemplate\VolumeType::class); + $this->volume_type = $var; + + return $this; + } + + /** + * Optional. The number of I/O operations per second (IOPS) to provision for + * GP3 volume. + * + * Generated from protobuf field int32 iops = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getIops() + { + return $this->iops; + } + + /** + * Optional. The number of I/O operations per second (IOPS) to provision for + * GP3 volume. + * + * Generated from protobuf field int32 iops = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setIops($var) + { + GPBUtil::checkInt32($var); + $this->iops = $var; + + return $this; + } + + /** + * Optional. The Amazon Resource Name (ARN) of the Customer Managed Key (CMK) + * used to encrypt AWS EBS volumes. + * If not specified, the default Amazon managed key associated to + * the AWS region where this cluster runs will be used. + * + * Generated from protobuf field string kms_key_arn = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getKmsKeyArn() + { + return $this->kms_key_arn; + } + + /** + * Optional. The Amazon Resource Name (ARN) of the Customer Managed Key (CMK) + * used to encrypt AWS EBS volumes. + * If not specified, the default Amazon managed key associated to + * the AWS region where this cluster runs will be used. + * + * Generated from protobuf field string kms_key_arn = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setKmsKeyArn($var) + { + GPBUtil::checkString($var, True); + $this->kms_key_arn = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsVolumeTemplate/VolumeType.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsVolumeTemplate/VolumeType.php new file mode 100644 index 000000000000..8a88654de373 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsVolumeTemplate/VolumeType.php @@ -0,0 +1,67 @@ +google.cloud.gkemulticloud.v1.AwsVolumeTemplate.VolumeType + */ +class VolumeType +{ + /** + * Not set. + * + * Generated from protobuf enum VOLUME_TYPE_UNSPECIFIED = 0; + */ + const VOLUME_TYPE_UNSPECIFIED = 0; + /** + * GP2 (General Purpose SSD volume type). + * + * Generated from protobuf enum GP2 = 1; + */ + const GP2 = 1; + /** + * GP3 (General Purpose SSD volume type). + * + * Generated from protobuf enum GP3 = 2; + */ + const GP3 = 2; + + private static $valueToName = [ + self::VOLUME_TYPE_UNSPECIFIED => 'VOLUME_TYPE_UNSPECIFIED', + self::GP2 => 'GP2', + self::GP3 => 'GP3', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(VolumeType::class, \Google\Cloud\GkeMultiCloud\V1\AwsVolumeTemplate_VolumeType::class); + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsVolumeTemplate_VolumeType.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsVolumeTemplate_VolumeType.php new file mode 100644 index 000000000000..dc53da62729d --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AwsVolumeTemplate_VolumeType.php @@ -0,0 +1,16 @@ +google.cloud.gkemulticloud.v1.AzureAuthorization + */ +class AzureAuthorization extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Users that can perform operations as a cluster admin. A managed + * ClusterRoleBinding will be created to grant the `cluster-admin` ClusterRole + * to the users. Up to ten admin users can be provided. + * For more info on RBAC, see + * https://kubernetes.io/docs/reference/access-authn-authz/rbac/#user-facing-roles + * + * Generated from protobuf field repeated .google.cloud.gkemulticloud.v1.AzureClusterUser admin_users = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private $admin_users; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\GkeMultiCloud\V1\AzureClusterUser>|\Google\Protobuf\Internal\RepeatedField $admin_users + * Required. Users that can perform operations as a cluster admin. A managed + * ClusterRoleBinding will be created to grant the `cluster-admin` ClusterRole + * to the users. Up to ten admin users can be provided. + * For more info on RBAC, see + * https://kubernetes.io/docs/reference/access-authn-authz/rbac/#user-facing-roles + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AzureResources::initOnce(); + parent::__construct($data); + } + + /** + * Required. Users that can perform operations as a cluster admin. A managed + * ClusterRoleBinding will be created to grant the `cluster-admin` ClusterRole + * to the users. Up to ten admin users can be provided. + * For more info on RBAC, see + * https://kubernetes.io/docs/reference/access-authn-authz/rbac/#user-facing-roles + * + * Generated from protobuf field repeated .google.cloud.gkemulticloud.v1.AzureClusterUser admin_users = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAdminUsers() + { + return $this->admin_users; + } + + /** + * Required. Users that can perform operations as a cluster admin. A managed + * ClusterRoleBinding will be created to grant the `cluster-admin` ClusterRole + * to the users. Up to ten admin users can be provided. + * For more info on RBAC, see + * https://kubernetes.io/docs/reference/access-authn-authz/rbac/#user-facing-roles + * + * Generated from protobuf field repeated .google.cloud.gkemulticloud.v1.AzureClusterUser admin_users = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param array<\Google\Cloud\GkeMultiCloud\V1\AzureClusterUser>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAdminUsers($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\GkeMultiCloud\V1\AzureClusterUser::class); + $this->admin_users = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AzureClient.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AzureClient.php new file mode 100644 index 000000000000..002830ccfddd --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AzureClient.php @@ -0,0 +1,411 @@ +google.cloud.gkemulticloud.v1.AzureClient + */ +class AzureClient extends \Google\Protobuf\Internal\Message +{ + /** + * The name of this resource. + * `AzureClient` resource names are formatted as + * `projects//locations//azureClients/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * Required. The Azure Active Directory Tenant ID. + * + * Generated from protobuf field string tenant_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $tenant_id = ''; + /** + * Required. The Azure Active Directory Application ID. + * + * Generated from protobuf field string application_id = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $application_id = ''; + /** + * Output only. If set, there are currently pending changes to the client. + * + * Generated from protobuf field bool reconciling = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $reconciling = false; + /** + * Optional. Annotations on the resource. + * This field has the same restrictions as Kubernetes annotations. + * The total size of all keys and values combined is limited to 256k. + * Keys can have 2 segments: prefix (optional) and name (required), + * separated by a slash (/). + * Prefix must be a DNS subdomain. + * Name must be 63 characters or less, begin and end with alphanumerics, + * with dashes (-), underscores (_), dots (.), and alphanumerics between. + * + * Generated from protobuf field map annotations = 8 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $annotations; + /** + * Output only. The PEM encoded x509 certificate. + * + * Generated from protobuf field string pem_certificate = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $pem_certificate = ''; + /** + * Output only. A globally unique identifier for the client. + * + * Generated from protobuf field string uid = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $uid = ''; + /** + * Output only. The time at which this resource was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. The time at which this client was last updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The name of this resource. + * `AzureClient` resource names are formatted as + * `projects//locations//azureClients/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * @type string $tenant_id + * Required. The Azure Active Directory Tenant ID. + * @type string $application_id + * Required. The Azure Active Directory Application ID. + * @type bool $reconciling + * Output only. If set, there are currently pending changes to the client. + * @type array|\Google\Protobuf\Internal\MapField $annotations + * Optional. Annotations on the resource. + * This field has the same restrictions as Kubernetes annotations. + * The total size of all keys and values combined is limited to 256k. + * Keys can have 2 segments: prefix (optional) and name (required), + * separated by a slash (/). + * Prefix must be a DNS subdomain. + * Name must be 63 characters or less, begin and end with alphanumerics, + * with dashes (-), underscores (_), dots (.), and alphanumerics between. + * @type string $pem_certificate + * Output only. The PEM encoded x509 certificate. + * @type string $uid + * Output only. A globally unique identifier for the client. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The time at which this resource was created. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. The time at which this client was last updated. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AzureResources::initOnce(); + parent::__construct($data); + } + + /** + * The name of this resource. + * `AzureClient` resource names are formatted as + * `projects//locations//azureClients/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The name of this resource. + * `AzureClient` resource names are formatted as + * `projects//locations//azureClients/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Required. The Azure Active Directory Tenant ID. + * + * Generated from protobuf field string tenant_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getTenantId() + { + return $this->tenant_id; + } + + /** + * Required. The Azure Active Directory Tenant ID. + * + * Generated from protobuf field string tenant_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setTenantId($var) + { + GPBUtil::checkString($var, True); + $this->tenant_id = $var; + + return $this; + } + + /** + * Required. The Azure Active Directory Application ID. + * + * Generated from protobuf field string application_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getApplicationId() + { + return $this->application_id; + } + + /** + * Required. The Azure Active Directory Application ID. + * + * Generated from protobuf field string application_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setApplicationId($var) + { + GPBUtil::checkString($var, True); + $this->application_id = $var; + + return $this; + } + + /** + * Output only. If set, there are currently pending changes to the client. + * + * Generated from protobuf field bool reconciling = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return bool + */ + public function getReconciling() + { + return $this->reconciling; + } + + /** + * Output only. If set, there are currently pending changes to the client. + * + * Generated from protobuf field bool reconciling = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param bool $var + * @return $this + */ + public function setReconciling($var) + { + GPBUtil::checkBool($var); + $this->reconciling = $var; + + return $this; + } + + /** + * Optional. Annotations on the resource. + * This field has the same restrictions as Kubernetes annotations. + * The total size of all keys and values combined is limited to 256k. + * Keys can have 2 segments: prefix (optional) and name (required), + * separated by a slash (/). + * Prefix must be a DNS subdomain. + * Name must be 63 characters or less, begin and end with alphanumerics, + * with dashes (-), underscores (_), dots (.), and alphanumerics between. + * + * Generated from protobuf field map annotations = 8 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\MapField + */ + public function getAnnotations() + { + return $this->annotations; + } + + /** + * Optional. Annotations on the resource. + * This field has the same restrictions as Kubernetes annotations. + * The total size of all keys and values combined is limited to 256k. + * Keys can have 2 segments: prefix (optional) and name (required), + * separated by a slash (/). + * Prefix must be a DNS subdomain. + * Name must be 63 characters or less, begin and end with alphanumerics, + * with dashes (-), underscores (_), dots (.), and alphanumerics between. + * + * Generated from protobuf field map annotations = 8 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setAnnotations($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->annotations = $arr; + + return $this; + } + + /** + * Output only. The PEM encoded x509 certificate. + * + * Generated from protobuf field string pem_certificate = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getPemCertificate() + { + return $this->pem_certificate; + } + + /** + * Output only. The PEM encoded x509 certificate. + * + * Generated from protobuf field string pem_certificate = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setPemCertificate($var) + { + GPBUtil::checkString($var, True); + $this->pem_certificate = $var; + + return $this; + } + + /** + * Output only. A globally unique identifier for the client. + * + * Generated from protobuf field string uid = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getUid() + { + return $this->uid; + } + + /** + * Output only. A globally unique identifier for the client. + * + * Generated from protobuf field string uid = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setUid($var) + { + GPBUtil::checkString($var, True); + $this->uid = $var; + + return $this; + } + + /** + * Output only. The time at which this resource was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 6 [(.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 at which this resource was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 6 [(.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 at which this client was last updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 10 [(.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 at which this client was last updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 10 [(.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/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AzureCluster.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AzureCluster.php new file mode 100644 index 000000000000..000cb5587dac --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AzureCluster.php @@ -0,0 +1,1079 @@ +google.cloud.gkemulticloud.v1.AzureCluster + */ +class AzureCluster extends \Google\Protobuf\Internal\Message +{ + /** + * The name of this resource. + * Cluster names are formatted as + * `projects//locations//azureClusters/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * Optional. A human readable description of this cluster. + * Cannot be longer than 255 UTF-8 encoded bytes. + * + * Generated from protobuf field string description = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $description = ''; + /** + * Required. The Azure region where the cluster runs. + * Each Google Cloud region supports a subset of nearby Azure regions. + * You can call + * [GetAzureServerConfig][google.cloud.gkemulticloud.v1.AzureClusters.GetAzureServerConfig] + * to list all supported Azure regions within a given Google Cloud region. + * + * Generated from protobuf field string azure_region = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $azure_region = ''; + /** + * Required. The ARM ID of the resource group where the cluster resources are + * deployed. For example: + * `/subscriptions//resourceGroups/` + * + * Generated from protobuf field string resource_group_id = 17 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $resource_group_id = ''; + /** + * Optional. Name of the + * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] that contains + * authentication configuration for how the Anthos Multi-Cloud API connects to + * Azure APIs. + * The `AzureClient` resource must reside on the same Google Cloud Platform + * project and region as the `AzureCluster`. + * `AzureClient` names are formatted as + * `projects//locations//azureClients/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * + * Generated from protobuf field string azure_client = 16 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $azure_client = ''; + /** + * Required. Cluster-wide networking configuration. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureClusterNetworking networking = 4 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $networking = null; + /** + * Required. Configuration related to the cluster control plane. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureControlPlane control_plane = 5 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $control_plane = null; + /** + * Required. Configuration related to the cluster RBAC settings. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureAuthorization authorization = 6 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $authorization = null; + /** + * Optional. Authentication configuration for management of Azure resources. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureServicesAuthentication azure_services_authentication = 22 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $azure_services_authentication = null; + /** + * Output only. The current state of the cluster. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureCluster.State state = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Output only. The endpoint of the cluster's API server. + * + * Generated from protobuf field string endpoint = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $endpoint = ''; + /** + * Output only. A globally unique identifier for the cluster. + * + * Generated from protobuf field string uid = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $uid = ''; + /** + * Output only. If set, there are currently changes in flight to the cluster. + * + * Generated from protobuf field bool reconciling = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $reconciling = false; + /** + * Output only. The time at which this cluster was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. The time at which this cluster was last updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * Allows clients to perform consistent read-modify-writes + * through optimistic concurrency control. + * Can be sent on update and delete requests to ensure the + * client has an up-to-date value before proceeding. + * + * Generated from protobuf field string etag = 13; + */ + protected $etag = ''; + /** + * Optional. Annotations on the cluster. + * This field has the same restrictions as Kubernetes annotations. + * The total size of all keys and values combined is limited to 256k. + * Keys can have 2 segments: prefix (optional) and name (required), + * separated by a slash (/). + * Prefix must be a DNS subdomain. + * Name must be 63 characters or less, begin and end with alphanumerics, + * with dashes (-), underscores (_), dots (.), and alphanumerics between. + * + * Generated from protobuf field map annotations = 14 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $annotations; + /** + * Output only. Workload Identity settings. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.WorkloadIdentityConfig workload_identity_config = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $workload_identity_config = null; + /** + * Output only. PEM encoded x509 certificate of the cluster root of trust. + * + * Generated from protobuf field string cluster_ca_certificate = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $cluster_ca_certificate = ''; + /** + * Required. Fleet configuration. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.Fleet fleet = 20 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $fleet = null; + /** + * Output only. Managed Azure resources for this cluster. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureClusterResources managed_resources = 21 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $managed_resources = null; + /** + * Optional. Logging configuration for this cluster. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.LoggingConfig logging_config = 23 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $logging_config = null; + /** + * Output only. A set of errors found in the cluster. + * + * Generated from protobuf field repeated .google.cloud.gkemulticloud.v1.AzureClusterError errors = 24 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $errors; + /** + * Optional. Monitoring configuration for this cluster. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.MonitoringConfig monitoring_config = 25 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $monitoring_config = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The name of this resource. + * Cluster names are formatted as + * `projects//locations//azureClusters/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * @type string $description + * Optional. A human readable description of this cluster. + * Cannot be longer than 255 UTF-8 encoded bytes. + * @type string $azure_region + * Required. The Azure region where the cluster runs. + * Each Google Cloud region supports a subset of nearby Azure regions. + * You can call + * [GetAzureServerConfig][google.cloud.gkemulticloud.v1.AzureClusters.GetAzureServerConfig] + * to list all supported Azure regions within a given Google Cloud region. + * @type string $resource_group_id + * Required. The ARM ID of the resource group where the cluster resources are + * deployed. For example: + * `/subscriptions//resourceGroups/` + * @type string $azure_client + * Optional. Name of the + * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] that contains + * authentication configuration for how the Anthos Multi-Cloud API connects to + * Azure APIs. + * The `AzureClient` resource must reside on the same Google Cloud Platform + * project and region as the `AzureCluster`. + * `AzureClient` names are formatted as + * `projects//locations//azureClients/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * @type \Google\Cloud\GkeMultiCloud\V1\AzureClusterNetworking $networking + * Required. Cluster-wide networking configuration. + * @type \Google\Cloud\GkeMultiCloud\V1\AzureControlPlane $control_plane + * Required. Configuration related to the cluster control plane. + * @type \Google\Cloud\GkeMultiCloud\V1\AzureAuthorization $authorization + * Required. Configuration related to the cluster RBAC settings. + * @type \Google\Cloud\GkeMultiCloud\V1\AzureServicesAuthentication $azure_services_authentication + * Optional. Authentication configuration for management of Azure resources. + * @type int $state + * Output only. The current state of the cluster. + * @type string $endpoint + * Output only. The endpoint of the cluster's API server. + * @type string $uid + * Output only. A globally unique identifier for the cluster. + * @type bool $reconciling + * Output only. If set, there are currently changes in flight to the cluster. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The time at which this cluster was created. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. The time at which this cluster was last updated. + * @type string $etag + * Allows clients to perform consistent read-modify-writes + * through optimistic concurrency control. + * Can be sent on update and delete requests to ensure the + * client has an up-to-date value before proceeding. + * @type array|\Google\Protobuf\Internal\MapField $annotations + * Optional. Annotations on the cluster. + * This field has the same restrictions as Kubernetes annotations. + * The total size of all keys and values combined is limited to 256k. + * Keys can have 2 segments: prefix (optional) and name (required), + * separated by a slash (/). + * Prefix must be a DNS subdomain. + * Name must be 63 characters or less, begin and end with alphanumerics, + * with dashes (-), underscores (_), dots (.), and alphanumerics between. + * @type \Google\Cloud\GkeMultiCloud\V1\WorkloadIdentityConfig $workload_identity_config + * Output only. Workload Identity settings. + * @type string $cluster_ca_certificate + * Output only. PEM encoded x509 certificate of the cluster root of trust. + * @type \Google\Cloud\GkeMultiCloud\V1\Fleet $fleet + * Required. Fleet configuration. + * @type \Google\Cloud\GkeMultiCloud\V1\AzureClusterResources $managed_resources + * Output only. Managed Azure resources for this cluster. + * @type \Google\Cloud\GkeMultiCloud\V1\LoggingConfig $logging_config + * Optional. Logging configuration for this cluster. + * @type array<\Google\Cloud\GkeMultiCloud\V1\AzureClusterError>|\Google\Protobuf\Internal\RepeatedField $errors + * Output only. A set of errors found in the cluster. + * @type \Google\Cloud\GkeMultiCloud\V1\MonitoringConfig $monitoring_config + * Optional. Monitoring configuration for this cluster. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AzureResources::initOnce(); + parent::__construct($data); + } + + /** + * The name of this resource. + * Cluster names are formatted as + * `projects//locations//azureClusters/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The name of this resource. + * Cluster names are formatted as + * `projects//locations//azureClusters/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Optional. A human readable description of this cluster. + * Cannot be longer than 255 UTF-8 encoded bytes. + * + * Generated from protobuf field string description = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Optional. A human readable description of this cluster. + * Cannot be longer than 255 UTF-8 encoded bytes. + * + * Generated from protobuf field string description = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * Required. The Azure region where the cluster runs. + * Each Google Cloud region supports a subset of nearby Azure regions. + * You can call + * [GetAzureServerConfig][google.cloud.gkemulticloud.v1.AzureClusters.GetAzureServerConfig] + * to list all supported Azure regions within a given Google Cloud region. + * + * Generated from protobuf field string azure_region = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getAzureRegion() + { + return $this->azure_region; + } + + /** + * Required. The Azure region where the cluster runs. + * Each Google Cloud region supports a subset of nearby Azure regions. + * You can call + * [GetAzureServerConfig][google.cloud.gkemulticloud.v1.AzureClusters.GetAzureServerConfig] + * to list all supported Azure regions within a given Google Cloud region. + * + * Generated from protobuf field string azure_region = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setAzureRegion($var) + { + GPBUtil::checkString($var, True); + $this->azure_region = $var; + + return $this; + } + + /** + * Required. The ARM ID of the resource group where the cluster resources are + * deployed. For example: + * `/subscriptions//resourceGroups/` + * + * Generated from protobuf field string resource_group_id = 17 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getResourceGroupId() + { + return $this->resource_group_id; + } + + /** + * Required. The ARM ID of the resource group where the cluster resources are + * deployed. For example: + * `/subscriptions//resourceGroups/` + * + * Generated from protobuf field string resource_group_id = 17 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setResourceGroupId($var) + { + GPBUtil::checkString($var, True); + $this->resource_group_id = $var; + + return $this; + } + + /** + * Optional. Name of the + * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] that contains + * authentication configuration for how the Anthos Multi-Cloud API connects to + * Azure APIs. + * The `AzureClient` resource must reside on the same Google Cloud Platform + * project and region as the `AzureCluster`. + * `AzureClient` names are formatted as + * `projects//locations//azureClients/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * + * Generated from protobuf field string azure_client = 16 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getAzureClient() + { + return $this->azure_client; + } + + /** + * Optional. Name of the + * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] that contains + * authentication configuration for how the Anthos Multi-Cloud API connects to + * Azure APIs. + * The `AzureClient` resource must reside on the same Google Cloud Platform + * project and region as the `AzureCluster`. + * `AzureClient` names are formatted as + * `projects//locations//azureClients/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * + * Generated from protobuf field string azure_client = 16 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setAzureClient($var) + { + GPBUtil::checkString($var, True); + $this->azure_client = $var; + + return $this; + } + + /** + * Required. Cluster-wide networking configuration. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureClusterNetworking networking = 4 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\GkeMultiCloud\V1\AzureClusterNetworking|null + */ + public function getNetworking() + { + return $this->networking; + } + + public function hasNetworking() + { + return isset($this->networking); + } + + public function clearNetworking() + { + unset($this->networking); + } + + /** + * Required. Cluster-wide networking configuration. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureClusterNetworking networking = 4 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\GkeMultiCloud\V1\AzureClusterNetworking $var + * @return $this + */ + public function setNetworking($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeMultiCloud\V1\AzureClusterNetworking::class); + $this->networking = $var; + + return $this; + } + + /** + * Required. Configuration related to the cluster control plane. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureControlPlane control_plane = 5 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\GkeMultiCloud\V1\AzureControlPlane|null + */ + public function getControlPlane() + { + return $this->control_plane; + } + + public function hasControlPlane() + { + return isset($this->control_plane); + } + + public function clearControlPlane() + { + unset($this->control_plane); + } + + /** + * Required. Configuration related to the cluster control plane. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureControlPlane control_plane = 5 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\GkeMultiCloud\V1\AzureControlPlane $var + * @return $this + */ + public function setControlPlane($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeMultiCloud\V1\AzureControlPlane::class); + $this->control_plane = $var; + + return $this; + } + + /** + * Required. Configuration related to the cluster RBAC settings. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureAuthorization authorization = 6 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\GkeMultiCloud\V1\AzureAuthorization|null + */ + public function getAuthorization() + { + return $this->authorization; + } + + public function hasAuthorization() + { + return isset($this->authorization); + } + + public function clearAuthorization() + { + unset($this->authorization); + } + + /** + * Required. Configuration related to the cluster RBAC settings. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureAuthorization authorization = 6 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\GkeMultiCloud\V1\AzureAuthorization $var + * @return $this + */ + public function setAuthorization($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeMultiCloud\V1\AzureAuthorization::class); + $this->authorization = $var; + + return $this; + } + + /** + * Optional. Authentication configuration for management of Azure resources. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureServicesAuthentication azure_services_authentication = 22 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\GkeMultiCloud\V1\AzureServicesAuthentication|null + */ + public function getAzureServicesAuthentication() + { + return $this->azure_services_authentication; + } + + public function hasAzureServicesAuthentication() + { + return isset($this->azure_services_authentication); + } + + public function clearAzureServicesAuthentication() + { + unset($this->azure_services_authentication); + } + + /** + * Optional. Authentication configuration for management of Azure resources. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureServicesAuthentication azure_services_authentication = 22 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\GkeMultiCloud\V1\AzureServicesAuthentication $var + * @return $this + */ + public function setAzureServicesAuthentication($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeMultiCloud\V1\AzureServicesAuthentication::class); + $this->azure_services_authentication = $var; + + return $this; + } + + /** + * Output only. The current state of the cluster. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureCluster.State state = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. The current state of the cluster. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureCluster.State state = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\GkeMultiCloud\V1\AzureCluster\State::class); + $this->state = $var; + + return $this; + } + + /** + * Output only. The endpoint of the cluster's API server. + * + * Generated from protobuf field string endpoint = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getEndpoint() + { + return $this->endpoint; + } + + /** + * Output only. The endpoint of the cluster's API server. + * + * Generated from protobuf field string endpoint = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setEndpoint($var) + { + GPBUtil::checkString($var, True); + $this->endpoint = $var; + + return $this; + } + + /** + * Output only. A globally unique identifier for the cluster. + * + * Generated from protobuf field string uid = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getUid() + { + return $this->uid; + } + + /** + * Output only. A globally unique identifier for the cluster. + * + * Generated from protobuf field string uid = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setUid($var) + { + GPBUtil::checkString($var, True); + $this->uid = $var; + + return $this; + } + + /** + * Output only. If set, there are currently changes in flight to the cluster. + * + * Generated from protobuf field bool reconciling = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return bool + */ + public function getReconciling() + { + return $this->reconciling; + } + + /** + * Output only. If set, there are currently changes in flight to the cluster. + * + * Generated from protobuf field bool reconciling = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param bool $var + * @return $this + */ + public function setReconciling($var) + { + GPBUtil::checkBool($var); + $this->reconciling = $var; + + return $this; + } + + /** + * Output only. The time at which this cluster was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 11 [(.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 at which this cluster was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 11 [(.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 at which this cluster was last updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 12 [(.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 at which this cluster was last updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 12 [(.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; + } + + /** + * Allows clients to perform consistent read-modify-writes + * through optimistic concurrency control. + * Can be sent on update and delete requests to ensure the + * client has an up-to-date value before proceeding. + * + * Generated from protobuf field string etag = 13; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * Allows clients to perform consistent read-modify-writes + * through optimistic concurrency control. + * Can be sent on update and delete requests to ensure the + * client has an up-to-date value before proceeding. + * + * Generated from protobuf field string etag = 13; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, True); + $this->etag = $var; + + return $this; + } + + /** + * Optional. Annotations on the cluster. + * This field has the same restrictions as Kubernetes annotations. + * The total size of all keys and values combined is limited to 256k. + * Keys can have 2 segments: prefix (optional) and name (required), + * separated by a slash (/). + * Prefix must be a DNS subdomain. + * Name must be 63 characters or less, begin and end with alphanumerics, + * with dashes (-), underscores (_), dots (.), and alphanumerics between. + * + * Generated from protobuf field map annotations = 14 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\MapField + */ + public function getAnnotations() + { + return $this->annotations; + } + + /** + * Optional. Annotations on the cluster. + * This field has the same restrictions as Kubernetes annotations. + * The total size of all keys and values combined is limited to 256k. + * Keys can have 2 segments: prefix (optional) and name (required), + * separated by a slash (/). + * Prefix must be a DNS subdomain. + * Name must be 63 characters or less, begin and end with alphanumerics, + * with dashes (-), underscores (_), dots (.), and alphanumerics between. + * + * Generated from protobuf field map annotations = 14 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setAnnotations($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->annotations = $arr; + + return $this; + } + + /** + * Output only. Workload Identity settings. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.WorkloadIdentityConfig workload_identity_config = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\GkeMultiCloud\V1\WorkloadIdentityConfig|null + */ + public function getWorkloadIdentityConfig() + { + return $this->workload_identity_config; + } + + public function hasWorkloadIdentityConfig() + { + return isset($this->workload_identity_config); + } + + public function clearWorkloadIdentityConfig() + { + unset($this->workload_identity_config); + } + + /** + * Output only. Workload Identity settings. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.WorkloadIdentityConfig workload_identity_config = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\GkeMultiCloud\V1\WorkloadIdentityConfig $var + * @return $this + */ + public function setWorkloadIdentityConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeMultiCloud\V1\WorkloadIdentityConfig::class); + $this->workload_identity_config = $var; + + return $this; + } + + /** + * Output only. PEM encoded x509 certificate of the cluster root of trust. + * + * Generated from protobuf field string cluster_ca_certificate = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getClusterCaCertificate() + { + return $this->cluster_ca_certificate; + } + + /** + * Output only. PEM encoded x509 certificate of the cluster root of trust. + * + * Generated from protobuf field string cluster_ca_certificate = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setClusterCaCertificate($var) + { + GPBUtil::checkString($var, True); + $this->cluster_ca_certificate = $var; + + return $this; + } + + /** + * Required. Fleet configuration. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.Fleet fleet = 20 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\GkeMultiCloud\V1\Fleet|null + */ + public function getFleet() + { + return $this->fleet; + } + + public function hasFleet() + { + return isset($this->fleet); + } + + public function clearFleet() + { + unset($this->fleet); + } + + /** + * Required. Fleet configuration. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.Fleet fleet = 20 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\GkeMultiCloud\V1\Fleet $var + * @return $this + */ + public function setFleet($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeMultiCloud\V1\Fleet::class); + $this->fleet = $var; + + return $this; + } + + /** + * Output only. Managed Azure resources for this cluster. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureClusterResources managed_resources = 21 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\GkeMultiCloud\V1\AzureClusterResources|null + */ + public function getManagedResources() + { + return $this->managed_resources; + } + + public function hasManagedResources() + { + return isset($this->managed_resources); + } + + public function clearManagedResources() + { + unset($this->managed_resources); + } + + /** + * Output only. Managed Azure resources for this cluster. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureClusterResources managed_resources = 21 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\GkeMultiCloud\V1\AzureClusterResources $var + * @return $this + */ + public function setManagedResources($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeMultiCloud\V1\AzureClusterResources::class); + $this->managed_resources = $var; + + return $this; + } + + /** + * Optional. Logging configuration for this cluster. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.LoggingConfig logging_config = 23 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\GkeMultiCloud\V1\LoggingConfig|null + */ + public function getLoggingConfig() + { + return $this->logging_config; + } + + public function hasLoggingConfig() + { + return isset($this->logging_config); + } + + public function clearLoggingConfig() + { + unset($this->logging_config); + } + + /** + * Optional. Logging configuration for this cluster. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.LoggingConfig logging_config = 23 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\GkeMultiCloud\V1\LoggingConfig $var + * @return $this + */ + public function setLoggingConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeMultiCloud\V1\LoggingConfig::class); + $this->logging_config = $var; + + return $this; + } + + /** + * Output only. A set of errors found in the cluster. + * + * Generated from protobuf field repeated .google.cloud.gkemulticloud.v1.AzureClusterError errors = 24 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getErrors() + { + return $this->errors; + } + + /** + * Output only. A set of errors found in the cluster. + * + * Generated from protobuf field repeated .google.cloud.gkemulticloud.v1.AzureClusterError errors = 24 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array<\Google\Cloud\GkeMultiCloud\V1\AzureClusterError>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setErrors($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\GkeMultiCloud\V1\AzureClusterError::class); + $this->errors = $arr; + + return $this; + } + + /** + * Optional. Monitoring configuration for this cluster. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.MonitoringConfig monitoring_config = 25 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\GkeMultiCloud\V1\MonitoringConfig|null + */ + public function getMonitoringConfig() + { + return $this->monitoring_config; + } + + public function hasMonitoringConfig() + { + return isset($this->monitoring_config); + } + + public function clearMonitoringConfig() + { + unset($this->monitoring_config); + } + + /** + * Optional. Monitoring configuration for this cluster. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.MonitoringConfig monitoring_config = 25 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\GkeMultiCloud\V1\MonitoringConfig $var + * @return $this + */ + public function setMonitoringConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeMultiCloud\V1\MonitoringConfig::class); + $this->monitoring_config = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AzureCluster/State.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AzureCluster/State.php new file mode 100644 index 000000000000..e62a7b58f248 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AzureCluster/State.php @@ -0,0 +1,96 @@ +google.cloud.gkemulticloud.v1.AzureCluster.State + */ +class State +{ + /** + * Not set. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The PROVISIONING state indicates the cluster is being created. + * + * Generated from protobuf enum PROVISIONING = 1; + */ + const PROVISIONING = 1; + /** + * The RUNNING state indicates the cluster has been created and is fully + * usable. + * + * Generated from protobuf enum RUNNING = 2; + */ + const RUNNING = 2; + /** + * The RECONCILING state indicates that some work is actively being done on + * the cluster, such as upgrading the control plane replicas. + * + * Generated from protobuf enum RECONCILING = 3; + */ + const RECONCILING = 3; + /** + * The STOPPING state indicates the cluster is being deleted. + * + * Generated from protobuf enum STOPPING = 4; + */ + const STOPPING = 4; + /** + * The ERROR state indicates the cluster is in a broken unrecoverable + * state. + * + * Generated from protobuf enum ERROR = 5; + */ + const ERROR = 5; + /** + * The DEGRADED state indicates the cluster requires user action to + * restore full functionality. + * + * Generated from protobuf enum DEGRADED = 6; + */ + const DEGRADED = 6; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::PROVISIONING => 'PROVISIONING', + self::RUNNING => 'RUNNING', + self::RECONCILING => 'RECONCILING', + self::STOPPING => 'STOPPING', + self::ERROR => 'ERROR', + self::DEGRADED => 'DEGRADED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\GkeMultiCloud\V1\AzureCluster_State::class); + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AzureClusterError.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AzureClusterError.php new file mode 100644 index 000000000000..cf9a9b6b2e5d --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AzureClusterError.php @@ -0,0 +1,67 @@ +google.cloud.gkemulticloud.v1.AzureClusterError + */ +class AzureClusterError extends \Google\Protobuf\Internal\Message +{ + /** + * Human-friendly description of the error. + * + * Generated from protobuf field string message = 1; + */ + protected $message = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $message + * Human-friendly description of the error. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AzureResources::initOnce(); + parent::__construct($data); + } + + /** + * Human-friendly description of the error. + * + * Generated from protobuf field string message = 1; + * @return string + */ + public function getMessage() + { + return $this->message; + } + + /** + * Human-friendly description of the error. + * + * Generated from protobuf field string message = 1; + * @param string $var + * @return $this + */ + public function setMessage($var) + { + GPBUtil::checkString($var, True); + $this->message = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AzureClusterNetworking.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AzureClusterNetworking.php new file mode 100644 index 000000000000..c4425dee6e7c --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AzureClusterNetworking.php @@ -0,0 +1,241 @@ +google.cloud.gkemulticloud.v1.AzureClusterNetworking + */ +class AzureClusterNetworking extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The Azure Resource Manager (ARM) ID of the VNet associated with + * your cluster. + * All components in the cluster (i.e. control plane and node pools) run on a + * single VNet. + * Example: + * `/subscriptions//resourceGroups//providers/Microsoft.Network/virtualNetworks/` + * This field cannot be changed after creation. + * + * Generated from protobuf field string virtual_network_id = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $virtual_network_id = ''; + /** + * Required. The IP address range of the pods in this cluster, in CIDR + * notation (e.g. `10.96.0.0/14`). + * All pods in the cluster get assigned a unique IPv4 address from these + * ranges. Only a single range is supported. + * This field cannot be changed after creation. + * + * Generated from protobuf field repeated string pod_address_cidr_blocks = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + private $pod_address_cidr_blocks; + /** + * Required. The IP address range for services in this cluster, in CIDR + * notation (e.g. `10.96.0.0/14`). + * All services in the cluster get assigned a unique IPv4 address from these + * ranges. Only a single range is supported. + * This field cannot be changed after creating a cluster. + * + * Generated from protobuf field repeated string service_address_cidr_blocks = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + private $service_address_cidr_blocks; + /** + * Optional. The ARM ID of the subnet where Kubernetes private service type + * load balancers are deployed. When unspecified, it defaults to + * AzureControlPlane.subnet_id. + * Example: + * "/subscriptions/d00494d6-6f3c-4280-bbb2-899e163d1d30/resourceGroups/anthos_cluster_gkeust4/providers/Microsoft.Network/virtualNetworks/gke-vnet-gkeust4/subnets/subnetid456" + * + * Generated from protobuf field string service_load_balancer_subnet_id = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $service_load_balancer_subnet_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $virtual_network_id + * Required. The Azure Resource Manager (ARM) ID of the VNet associated with + * your cluster. + * All components in the cluster (i.e. control plane and node pools) run on a + * single VNet. + * Example: + * `/subscriptions//resourceGroups//providers/Microsoft.Network/virtualNetworks/` + * This field cannot be changed after creation. + * @type array|\Google\Protobuf\Internal\RepeatedField $pod_address_cidr_blocks + * Required. The IP address range of the pods in this cluster, in CIDR + * notation (e.g. `10.96.0.0/14`). + * All pods in the cluster get assigned a unique IPv4 address from these + * ranges. Only a single range is supported. + * This field cannot be changed after creation. + * @type array|\Google\Protobuf\Internal\RepeatedField $service_address_cidr_blocks + * Required. The IP address range for services in this cluster, in CIDR + * notation (e.g. `10.96.0.0/14`). + * All services in the cluster get assigned a unique IPv4 address from these + * ranges. Only a single range is supported. + * This field cannot be changed after creating a cluster. + * @type string $service_load_balancer_subnet_id + * Optional. The ARM ID of the subnet where Kubernetes private service type + * load balancers are deployed. When unspecified, it defaults to + * AzureControlPlane.subnet_id. + * Example: + * "/subscriptions/d00494d6-6f3c-4280-bbb2-899e163d1d30/resourceGroups/anthos_cluster_gkeust4/providers/Microsoft.Network/virtualNetworks/gke-vnet-gkeust4/subnets/subnetid456" + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AzureResources::initOnce(); + parent::__construct($data); + } + + /** + * Required. The Azure Resource Manager (ARM) ID of the VNet associated with + * your cluster. + * All components in the cluster (i.e. control plane and node pools) run on a + * single VNet. + * Example: + * `/subscriptions//resourceGroups//providers/Microsoft.Network/virtualNetworks/` + * This field cannot be changed after creation. + * + * Generated from protobuf field string virtual_network_id = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getVirtualNetworkId() + { + return $this->virtual_network_id; + } + + /** + * Required. The Azure Resource Manager (ARM) ID of the VNet associated with + * your cluster. + * All components in the cluster (i.e. control plane and node pools) run on a + * single VNet. + * Example: + * `/subscriptions//resourceGroups//providers/Microsoft.Network/virtualNetworks/` + * This field cannot be changed after creation. + * + * Generated from protobuf field string virtual_network_id = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setVirtualNetworkId($var) + { + GPBUtil::checkString($var, True); + $this->virtual_network_id = $var; + + return $this; + } + + /** + * Required. The IP address range of the pods in this cluster, in CIDR + * notation (e.g. `10.96.0.0/14`). + * All pods in the cluster get assigned a unique IPv4 address from these + * ranges. Only a single range is supported. + * This field cannot be changed after creation. + * + * Generated from protobuf field repeated string pod_address_cidr_blocks = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getPodAddressCidrBlocks() + { + return $this->pod_address_cidr_blocks; + } + + /** + * Required. The IP address range of the pods in this cluster, in CIDR + * notation (e.g. `10.96.0.0/14`). + * All pods in the cluster get assigned a unique IPv4 address from these + * ranges. Only a single range is supported. + * This field cannot be changed after creation. + * + * Generated from protobuf field repeated string pod_address_cidr_blocks = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setPodAddressCidrBlocks($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->pod_address_cidr_blocks = $arr; + + return $this; + } + + /** + * Required. The IP address range for services in this cluster, in CIDR + * notation (e.g. `10.96.0.0/14`). + * All services in the cluster get assigned a unique IPv4 address from these + * ranges. Only a single range is supported. + * This field cannot be changed after creating a cluster. + * + * Generated from protobuf field repeated string service_address_cidr_blocks = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getServiceAddressCidrBlocks() + { + return $this->service_address_cidr_blocks; + } + + /** + * Required. The IP address range for services in this cluster, in CIDR + * notation (e.g. `10.96.0.0/14`). + * All services in the cluster get assigned a unique IPv4 address from these + * ranges. Only a single range is supported. + * This field cannot be changed after creating a cluster. + * + * Generated from protobuf field repeated string service_address_cidr_blocks = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setServiceAddressCidrBlocks($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->service_address_cidr_blocks = $arr; + + return $this; + } + + /** + * Optional. The ARM ID of the subnet where Kubernetes private service type + * load balancers are deployed. When unspecified, it defaults to + * AzureControlPlane.subnet_id. + * Example: + * "/subscriptions/d00494d6-6f3c-4280-bbb2-899e163d1d30/resourceGroups/anthos_cluster_gkeust4/providers/Microsoft.Network/virtualNetworks/gke-vnet-gkeust4/subnets/subnetid456" + * + * Generated from protobuf field string service_load_balancer_subnet_id = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getServiceLoadBalancerSubnetId() + { + return $this->service_load_balancer_subnet_id; + } + + /** + * Optional. The ARM ID of the subnet where Kubernetes private service type + * load balancers are deployed. When unspecified, it defaults to + * AzureControlPlane.subnet_id. + * Example: + * "/subscriptions/d00494d6-6f3c-4280-bbb2-899e163d1d30/resourceGroups/anthos_cluster_gkeust4/providers/Microsoft.Network/virtualNetworks/gke-vnet-gkeust4/subnets/subnetid456" + * + * Generated from protobuf field string service_load_balancer_subnet_id = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setServiceLoadBalancerSubnetId($var) + { + GPBUtil::checkString($var, True); + $this->service_load_balancer_subnet_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AzureClusterResources.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AzureClusterResources.php new file mode 100644 index 000000000000..ca301cadedac --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AzureClusterResources.php @@ -0,0 +1,102 @@ +google.cloud.gkemulticloud.v1.AzureClusterResources + */ +class AzureClusterResources extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The ARM ID of the cluster network security group. + * + * Generated from protobuf field string network_security_group_id = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $network_security_group_id = ''; + /** + * Output only. The ARM ID of the control plane application security group. + * + * Generated from protobuf field string control_plane_application_security_group_id = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $control_plane_application_security_group_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $network_security_group_id + * Output only. The ARM ID of the cluster network security group. + * @type string $control_plane_application_security_group_id + * Output only. The ARM ID of the control plane application security group. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AzureResources::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The ARM ID of the cluster network security group. + * + * Generated from protobuf field string network_security_group_id = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getNetworkSecurityGroupId() + { + return $this->network_security_group_id; + } + + /** + * Output only. The ARM ID of the cluster network security group. + * + * Generated from protobuf field string network_security_group_id = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setNetworkSecurityGroupId($var) + { + GPBUtil::checkString($var, True); + $this->network_security_group_id = $var; + + return $this; + } + + /** + * Output only. The ARM ID of the control plane application security group. + * + * Generated from protobuf field string control_plane_application_security_group_id = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getControlPlaneApplicationSecurityGroupId() + { + return $this->control_plane_application_security_group_id; + } + + /** + * Output only. The ARM ID of the control plane application security group. + * + * Generated from protobuf field string control_plane_application_security_group_id = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setControlPlaneApplicationSecurityGroupId($var) + { + GPBUtil::checkString($var, True); + $this->control_plane_application_security_group_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AzureClusterUser.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AzureClusterUser.php new file mode 100644 index 000000000000..3aecd59fbf61 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AzureClusterUser.php @@ -0,0 +1,67 @@ +google.cloud.gkemulticloud.v1.AzureClusterUser + */ +class AzureClusterUser extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the user, e.g. `my-gcp-id@gmail.com`. + * + * Generated from protobuf field string username = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $username = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $username + * Required. The name of the user, e.g. `my-gcp-id@gmail.com`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AzureResources::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the user, e.g. `my-gcp-id@gmail.com`. + * + * Generated from protobuf field string username = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getUsername() + { + return $this->username; + } + + /** + * Required. The name of the user, e.g. `my-gcp-id@gmail.com`. + * + * Generated from protobuf field string username = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setUsername($var) + { + GPBUtil::checkString($var, True); + $this->username = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AzureCluster_State.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AzureCluster_State.php new file mode 100644 index 000000000000..8920c0ef3e68 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AzureCluster_State.php @@ -0,0 +1,16 @@ +_simpleRequest('/google.cloud.gkemulticloud.v1.AzureClusters/CreateAzureClient', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Describes a specific + * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] resource. + * @param \Google\Cloud\GkeMultiCloud\V1\GetAzureClientRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function GetAzureClient(\Google\Cloud\GkeMultiCloud\V1\GetAzureClientRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.gkemulticloud.v1.AzureClusters/GetAzureClient', + $argument, + ['\Google\Cloud\GkeMultiCloud\V1\AzureClient', 'decode'], + $metadata, $options); + } + + /** + * Lists all [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] + * resources on a given Google Cloud project and region. + * @param \Google\Cloud\GkeMultiCloud\V1\ListAzureClientsRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function ListAzureClients(\Google\Cloud\GkeMultiCloud\V1\ListAzureClientsRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.gkemulticloud.v1.AzureClusters/ListAzureClients', + $argument, + ['\Google\Cloud\GkeMultiCloud\V1\ListAzureClientsResponse', 'decode'], + $metadata, $options); + } + + /** + * Deletes a specific [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] + * resource. + * + * If the client is used by one or more clusters, deletion will + * fail and a `FAILED_PRECONDITION` error will be returned. + * + * If successful, the response contains a newly created + * [Operation][google.longrunning.Operation] resource that can be + * described to track the status of the operation. + * @param \Google\Cloud\GkeMultiCloud\V1\DeleteAzureClientRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function DeleteAzureClient(\Google\Cloud\GkeMultiCloud\V1\DeleteAzureClientRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.gkemulticloud.v1.AzureClusters/DeleteAzureClient', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Creates a new [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] + * resource on a given Google Cloud Platform project and region. + * + * If successful, the response contains a newly created + * [Operation][google.longrunning.Operation] resource that can be + * described to track the status of the operation. + * @param \Google\Cloud\GkeMultiCloud\V1\CreateAzureClusterRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function CreateAzureCluster(\Google\Cloud\GkeMultiCloud\V1\CreateAzureClusterRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.gkemulticloud.v1.AzureClusters/CreateAzureCluster', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Updates an [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster]. + * @param \Google\Cloud\GkeMultiCloud\V1\UpdateAzureClusterRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function UpdateAzureCluster(\Google\Cloud\GkeMultiCloud\V1\UpdateAzureClusterRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.gkemulticloud.v1.AzureClusters/UpdateAzureCluster', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Describes a specific + * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource. + * @param \Google\Cloud\GkeMultiCloud\V1\GetAzureClusterRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function GetAzureCluster(\Google\Cloud\GkeMultiCloud\V1\GetAzureClusterRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.gkemulticloud.v1.AzureClusters/GetAzureCluster', + $argument, + ['\Google\Cloud\GkeMultiCloud\V1\AzureCluster', 'decode'], + $metadata, $options); + } + + /** + * Lists all [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] + * resources on a given Google Cloud project and region. + * @param \Google\Cloud\GkeMultiCloud\V1\ListAzureClustersRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function ListAzureClusters(\Google\Cloud\GkeMultiCloud\V1\ListAzureClustersRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.gkemulticloud.v1.AzureClusters/ListAzureClusters', + $argument, + ['\Google\Cloud\GkeMultiCloud\V1\ListAzureClustersResponse', 'decode'], + $metadata, $options); + } + + /** + * Deletes a specific + * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource. + * + * Fails if the cluster has one or more associated + * [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] resources. + * + * If successful, the response contains a newly created + * [Operation][google.longrunning.Operation] resource that can be + * described to track the status of the operation. + * @param \Google\Cloud\GkeMultiCloud\V1\DeleteAzureClusterRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function DeleteAzureCluster(\Google\Cloud\GkeMultiCloud\V1\DeleteAzureClusterRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.gkemulticloud.v1.AzureClusters/DeleteAzureCluster', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Generates a short-lived access token to authenticate to a given + * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource. + * @param \Google\Cloud\GkeMultiCloud\V1\GenerateAzureAccessTokenRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function GenerateAzureAccessToken(\Google\Cloud\GkeMultiCloud\V1\GenerateAzureAccessTokenRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.gkemulticloud.v1.AzureClusters/GenerateAzureAccessToken', + $argument, + ['\Google\Cloud\GkeMultiCloud\V1\GenerateAzureAccessTokenResponse', 'decode'], + $metadata, $options); + } + + /** + * Creates a new [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool], + * attached to a given + * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster]. + * + * If successful, the response contains a newly created + * [Operation][google.longrunning.Operation] resource that can be + * described to track the status of the operation. + * @param \Google\Cloud\GkeMultiCloud\V1\CreateAzureNodePoolRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function CreateAzureNodePool(\Google\Cloud\GkeMultiCloud\V1\CreateAzureNodePoolRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.gkemulticloud.v1.AzureClusters/CreateAzureNodePool', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Updates an [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool]. + * @param \Google\Cloud\GkeMultiCloud\V1\UpdateAzureNodePoolRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function UpdateAzureNodePool(\Google\Cloud\GkeMultiCloud\V1\UpdateAzureNodePoolRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.gkemulticloud.v1.AzureClusters/UpdateAzureNodePool', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Describes a specific + * [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] resource. + * @param \Google\Cloud\GkeMultiCloud\V1\GetAzureNodePoolRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function GetAzureNodePool(\Google\Cloud\GkeMultiCloud\V1\GetAzureNodePoolRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.gkemulticloud.v1.AzureClusters/GetAzureNodePool', + $argument, + ['\Google\Cloud\GkeMultiCloud\V1\AzureNodePool', 'decode'], + $metadata, $options); + } + + /** + * Lists all [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] + * resources on a given + * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster]. + * @param \Google\Cloud\GkeMultiCloud\V1\ListAzureNodePoolsRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function ListAzureNodePools(\Google\Cloud\GkeMultiCloud\V1\ListAzureNodePoolsRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.gkemulticloud.v1.AzureClusters/ListAzureNodePools', + $argument, + ['\Google\Cloud\GkeMultiCloud\V1\ListAzureNodePoolsResponse', 'decode'], + $metadata, $options); + } + + /** + * Deletes a specific + * [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] resource. + * + * If successful, the response contains a newly created + * [Operation][google.longrunning.Operation] resource that can be + * described to track the status of the operation. + * @param \Google\Cloud\GkeMultiCloud\V1\DeleteAzureNodePoolRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function DeleteAzureNodePool(\Google\Cloud\GkeMultiCloud\V1\DeleteAzureNodePoolRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.gkemulticloud.v1.AzureClusters/DeleteAzureNodePool', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Returns information, such as supported Azure regions and Kubernetes + * versions, on a given Google Cloud location. + * @param \Google\Cloud\GkeMultiCloud\V1\GetAzureServerConfigRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function GetAzureServerConfig(\Google\Cloud\GkeMultiCloud\V1\GetAzureServerConfigRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.gkemulticloud.v1.AzureClusters/GetAzureServerConfig', + $argument, + ['\Google\Cloud\GkeMultiCloud\V1\AzureServerConfig', 'decode'], + $metadata, $options); + } + +} diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AzureConfigEncryption.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AzureConfigEncryption.php new file mode 100644 index 000000000000..f90fcdd501a4 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AzureConfigEncryption.php @@ -0,0 +1,131 @@ +google.cloud.gkemulticloud.v1.AzureConfigEncryption + */ +class AzureConfigEncryption extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The ARM ID of the Azure Key Vault key to encrypt / decrypt config + * data. + * For example: + * `/subscriptions//resourceGroups//providers/Microsoft.KeyVault/vaults//keys/` + * + * Generated from protobuf field string key_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $key_id = ''; + /** + * Optional. RSA key of the Azure Key Vault public key to use for encrypting + * the data. + * This key must be formatted as a PEM-encoded SubjectPublicKeyInfo (RFC 5280) + * in ASN.1 DER form. The string must be comprised of a single PEM block of + * type "PUBLIC KEY". + * + * Generated from protobuf field string public_key = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $public_key = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $key_id + * Required. The ARM ID of the Azure Key Vault key to encrypt / decrypt config + * data. + * For example: + * `/subscriptions//resourceGroups//providers/Microsoft.KeyVault/vaults//keys/` + * @type string $public_key + * Optional. RSA key of the Azure Key Vault public key to use for encrypting + * the data. + * This key must be formatted as a PEM-encoded SubjectPublicKeyInfo (RFC 5280) + * in ASN.1 DER form. The string must be comprised of a single PEM block of + * type "PUBLIC KEY". + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AzureResources::initOnce(); + parent::__construct($data); + } + + /** + * Required. The ARM ID of the Azure Key Vault key to encrypt / decrypt config + * data. + * For example: + * `/subscriptions//resourceGroups//providers/Microsoft.KeyVault/vaults//keys/` + * + * Generated from protobuf field string key_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getKeyId() + { + return $this->key_id; + } + + /** + * Required. The ARM ID of the Azure Key Vault key to encrypt / decrypt config + * data. + * For example: + * `/subscriptions//resourceGroups//providers/Microsoft.KeyVault/vaults//keys/` + * + * Generated from protobuf field string key_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setKeyId($var) + { + GPBUtil::checkString($var, True); + $this->key_id = $var; + + return $this; + } + + /** + * Optional. RSA key of the Azure Key Vault public key to use for encrypting + * the data. + * This key must be formatted as a PEM-encoded SubjectPublicKeyInfo (RFC 5280) + * in ASN.1 DER form. The string must be comprised of a single PEM block of + * type "PUBLIC KEY". + * + * Generated from protobuf field string public_key = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPublicKey() + { + return $this->public_key; + } + + /** + * Optional. RSA key of the Azure Key Vault public key to use for encrypting + * the data. + * This key must be formatted as a PEM-encoded SubjectPublicKeyInfo (RFC 5280) + * in ASN.1 DER form. The string must be comprised of a single PEM block of + * type "PUBLIC KEY". + * + * Generated from protobuf field string public_key = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setPublicKey($var) + { + GPBUtil::checkString($var, True); + $this->public_key = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AzureControlPlane.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AzureControlPlane.php new file mode 100644 index 000000000000..92f3fed0095f --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AzureControlPlane.php @@ -0,0 +1,613 @@ +google.cloud.gkemulticloud.v1.AzureControlPlane + */ +class AzureControlPlane extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The Kubernetes version to run on control plane replicas + * (e.g. `1.19.10-gke.1000`). + * You can list all supported versions on a given Google Cloud region by + * calling + * [GetAzureServerConfig][google.cloud.gkemulticloud.v1.AzureClusters.GetAzureServerConfig]. + * + * Generated from protobuf field string version = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $version = ''; + /** + * Optional. The ARM ID of the default subnet for the control plane. The + * control plane VMs are deployed in this subnet, unless + * `AzureControlPlane.replica_placements` is specified. This subnet will also + * be used as default for `AzureControlPlane.endpoint_subnet_id` if + * `AzureControlPlane.endpoint_subnet_id` is not specified. Similarly it will + * be used as default for + * `AzureClusterNetworking.service_load_balancer_subnet_id`. + * Example: + * `/subscriptions//resourceGroups//providers/Microsoft.Network/virtualNetworks//subnets/default`. + * + * Generated from protobuf field string subnet_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $subnet_id = ''; + /** + * Optional. The Azure VM size name. Example: `Standard_DS2_v2`. + * For available VM sizes, see + * https://docs.microsoft.com/en-us/azure/virtual-machines/vm-naming-conventions. + * When unspecified, it defaults to `Standard_DS2_v2`. + * + * Generated from protobuf field string vm_size = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $vm_size = ''; + /** + * Required. SSH configuration for how to access the underlying control plane + * machines. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureSshConfig ssh_config = 11 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $ssh_config = null; + /** + * Optional. Configuration related to the root volume provisioned for each + * control plane replica. + * When unspecified, it defaults to 32-GiB Azure Disk. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureDiskTemplate root_volume = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $root_volume = null; + /** + * Optional. Configuration related to the main volume provisioned for each + * control plane replica. + * The main volume is in charge of storing all of the cluster's etcd state. + * When unspecified, it defaults to a 8-GiB Azure Disk. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureDiskTemplate main_volume = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $main_volume = null; + /** + * Optional. Configuration related to application-layer secrets encryption. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureDatabaseEncryption database_encryption = 10 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $database_encryption = null; + /** + * Optional. Proxy configuration for outbound HTTP(S) traffic. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureProxyConfig proxy_config = 12 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $proxy_config = null; + /** + * Optional. Configuration related to vm config encryption. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureConfigEncryption config_encryption = 14 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $config_encryption = null; + /** + * Optional. A set of tags to apply to all underlying control plane Azure + * resources. + * + * Generated from protobuf field map tags = 7 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $tags; + /** + * Optional. Configuration for where to place the control plane replicas. + * Up to three replica placement instances can be specified. If + * replica_placements is set, the replica placement instances will be applied + * to the three control plane replicas as evenly as possible. + * + * Generated from protobuf field repeated .google.cloud.gkemulticloud.v1.ReplicaPlacement replica_placements = 13 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $replica_placements; + /** + * Optional. The ARM ID of the subnet where the control plane load balancer is + * deployed. When unspecified, it defaults to AzureControlPlane.subnet_id. + * Example: + * "/subscriptions/d00494d6-6f3c-4280-bbb2-899e163d1d30/resourceGroups/anthos_cluster_gkeust4/providers/Microsoft.Network/virtualNetworks/gke-vnet-gkeust4/subnets/subnetid123" + * + * Generated from protobuf field string endpoint_subnet_id = 15 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $endpoint_subnet_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $version + * Required. The Kubernetes version to run on control plane replicas + * (e.g. `1.19.10-gke.1000`). + * You can list all supported versions on a given Google Cloud region by + * calling + * [GetAzureServerConfig][google.cloud.gkemulticloud.v1.AzureClusters.GetAzureServerConfig]. + * @type string $subnet_id + * Optional. The ARM ID of the default subnet for the control plane. The + * control plane VMs are deployed in this subnet, unless + * `AzureControlPlane.replica_placements` is specified. This subnet will also + * be used as default for `AzureControlPlane.endpoint_subnet_id` if + * `AzureControlPlane.endpoint_subnet_id` is not specified. Similarly it will + * be used as default for + * `AzureClusterNetworking.service_load_balancer_subnet_id`. + * Example: + * `/subscriptions//resourceGroups//providers/Microsoft.Network/virtualNetworks//subnets/default`. + * @type string $vm_size + * Optional. The Azure VM size name. Example: `Standard_DS2_v2`. + * For available VM sizes, see + * https://docs.microsoft.com/en-us/azure/virtual-machines/vm-naming-conventions. + * When unspecified, it defaults to `Standard_DS2_v2`. + * @type \Google\Cloud\GkeMultiCloud\V1\AzureSshConfig $ssh_config + * Required. SSH configuration for how to access the underlying control plane + * machines. + * @type \Google\Cloud\GkeMultiCloud\V1\AzureDiskTemplate $root_volume + * Optional. Configuration related to the root volume provisioned for each + * control plane replica. + * When unspecified, it defaults to 32-GiB Azure Disk. + * @type \Google\Cloud\GkeMultiCloud\V1\AzureDiskTemplate $main_volume + * Optional. Configuration related to the main volume provisioned for each + * control plane replica. + * The main volume is in charge of storing all of the cluster's etcd state. + * When unspecified, it defaults to a 8-GiB Azure Disk. + * @type \Google\Cloud\GkeMultiCloud\V1\AzureDatabaseEncryption $database_encryption + * Optional. Configuration related to application-layer secrets encryption. + * @type \Google\Cloud\GkeMultiCloud\V1\AzureProxyConfig $proxy_config + * Optional. Proxy configuration for outbound HTTP(S) traffic. + * @type \Google\Cloud\GkeMultiCloud\V1\AzureConfigEncryption $config_encryption + * Optional. Configuration related to vm config encryption. + * @type array|\Google\Protobuf\Internal\MapField $tags + * Optional. A set of tags to apply to all underlying control plane Azure + * resources. + * @type array<\Google\Cloud\GkeMultiCloud\V1\ReplicaPlacement>|\Google\Protobuf\Internal\RepeatedField $replica_placements + * Optional. Configuration for where to place the control plane replicas. + * Up to three replica placement instances can be specified. If + * replica_placements is set, the replica placement instances will be applied + * to the three control plane replicas as evenly as possible. + * @type string $endpoint_subnet_id + * Optional. The ARM ID of the subnet where the control plane load balancer is + * deployed. When unspecified, it defaults to AzureControlPlane.subnet_id. + * Example: + * "/subscriptions/d00494d6-6f3c-4280-bbb2-899e163d1d30/resourceGroups/anthos_cluster_gkeust4/providers/Microsoft.Network/virtualNetworks/gke-vnet-gkeust4/subnets/subnetid123" + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AzureResources::initOnce(); + parent::__construct($data); + } + + /** + * Required. The Kubernetes version to run on control plane replicas + * (e.g. `1.19.10-gke.1000`). + * You can list all supported versions on a given Google Cloud region by + * calling + * [GetAzureServerConfig][google.cloud.gkemulticloud.v1.AzureClusters.GetAzureServerConfig]. + * + * Generated from protobuf field string version = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getVersion() + { + return $this->version; + } + + /** + * Required. The Kubernetes version to run on control plane replicas + * (e.g. `1.19.10-gke.1000`). + * You can list all supported versions on a given Google Cloud region by + * calling + * [GetAzureServerConfig][google.cloud.gkemulticloud.v1.AzureClusters.GetAzureServerConfig]. + * + * Generated from protobuf field string version = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setVersion($var) + { + GPBUtil::checkString($var, True); + $this->version = $var; + + return $this; + } + + /** + * Optional. The ARM ID of the default subnet for the control plane. The + * control plane VMs are deployed in this subnet, unless + * `AzureControlPlane.replica_placements` is specified. This subnet will also + * be used as default for `AzureControlPlane.endpoint_subnet_id` if + * `AzureControlPlane.endpoint_subnet_id` is not specified. Similarly it will + * be used as default for + * `AzureClusterNetworking.service_load_balancer_subnet_id`. + * Example: + * `/subscriptions//resourceGroups//providers/Microsoft.Network/virtualNetworks//subnets/default`. + * + * Generated from protobuf field string subnet_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getSubnetId() + { + return $this->subnet_id; + } + + /** + * Optional. The ARM ID of the default subnet for the control plane. The + * control plane VMs are deployed in this subnet, unless + * `AzureControlPlane.replica_placements` is specified. This subnet will also + * be used as default for `AzureControlPlane.endpoint_subnet_id` if + * `AzureControlPlane.endpoint_subnet_id` is not specified. Similarly it will + * be used as default for + * `AzureClusterNetworking.service_load_balancer_subnet_id`. + * Example: + * `/subscriptions//resourceGroups//providers/Microsoft.Network/virtualNetworks//subnets/default`. + * + * Generated from protobuf field string subnet_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setSubnetId($var) + { + GPBUtil::checkString($var, True); + $this->subnet_id = $var; + + return $this; + } + + /** + * Optional. The Azure VM size name. Example: `Standard_DS2_v2`. + * For available VM sizes, see + * https://docs.microsoft.com/en-us/azure/virtual-machines/vm-naming-conventions. + * When unspecified, it defaults to `Standard_DS2_v2`. + * + * Generated from protobuf field string vm_size = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getVmSize() + { + return $this->vm_size; + } + + /** + * Optional. The Azure VM size name. Example: `Standard_DS2_v2`. + * For available VM sizes, see + * https://docs.microsoft.com/en-us/azure/virtual-machines/vm-naming-conventions. + * When unspecified, it defaults to `Standard_DS2_v2`. + * + * Generated from protobuf field string vm_size = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setVmSize($var) + { + GPBUtil::checkString($var, True); + $this->vm_size = $var; + + return $this; + } + + /** + * Required. SSH configuration for how to access the underlying control plane + * machines. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureSshConfig ssh_config = 11 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\GkeMultiCloud\V1\AzureSshConfig|null + */ + public function getSshConfig() + { + return $this->ssh_config; + } + + public function hasSshConfig() + { + return isset($this->ssh_config); + } + + public function clearSshConfig() + { + unset($this->ssh_config); + } + + /** + * Required. SSH configuration for how to access the underlying control plane + * machines. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureSshConfig ssh_config = 11 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\GkeMultiCloud\V1\AzureSshConfig $var + * @return $this + */ + public function setSshConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeMultiCloud\V1\AzureSshConfig::class); + $this->ssh_config = $var; + + return $this; + } + + /** + * Optional. Configuration related to the root volume provisioned for each + * control plane replica. + * When unspecified, it defaults to 32-GiB Azure Disk. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureDiskTemplate root_volume = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\GkeMultiCloud\V1\AzureDiskTemplate|null + */ + public function getRootVolume() + { + return $this->root_volume; + } + + public function hasRootVolume() + { + return isset($this->root_volume); + } + + public function clearRootVolume() + { + unset($this->root_volume); + } + + /** + * Optional. Configuration related to the root volume provisioned for each + * control plane replica. + * When unspecified, it defaults to 32-GiB Azure Disk. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureDiskTemplate root_volume = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\GkeMultiCloud\V1\AzureDiskTemplate $var + * @return $this + */ + public function setRootVolume($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeMultiCloud\V1\AzureDiskTemplate::class); + $this->root_volume = $var; + + return $this; + } + + /** + * Optional. Configuration related to the main volume provisioned for each + * control plane replica. + * The main volume is in charge of storing all of the cluster's etcd state. + * When unspecified, it defaults to a 8-GiB Azure Disk. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureDiskTemplate main_volume = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\GkeMultiCloud\V1\AzureDiskTemplate|null + */ + public function getMainVolume() + { + return $this->main_volume; + } + + public function hasMainVolume() + { + return isset($this->main_volume); + } + + public function clearMainVolume() + { + unset($this->main_volume); + } + + /** + * Optional. Configuration related to the main volume provisioned for each + * control plane replica. + * The main volume is in charge of storing all of the cluster's etcd state. + * When unspecified, it defaults to a 8-GiB Azure Disk. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureDiskTemplate main_volume = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\GkeMultiCloud\V1\AzureDiskTemplate $var + * @return $this + */ + public function setMainVolume($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeMultiCloud\V1\AzureDiskTemplate::class); + $this->main_volume = $var; + + return $this; + } + + /** + * Optional. Configuration related to application-layer secrets encryption. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureDatabaseEncryption database_encryption = 10 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\GkeMultiCloud\V1\AzureDatabaseEncryption|null + */ + public function getDatabaseEncryption() + { + return $this->database_encryption; + } + + public function hasDatabaseEncryption() + { + return isset($this->database_encryption); + } + + public function clearDatabaseEncryption() + { + unset($this->database_encryption); + } + + /** + * Optional. Configuration related to application-layer secrets encryption. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureDatabaseEncryption database_encryption = 10 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\GkeMultiCloud\V1\AzureDatabaseEncryption $var + * @return $this + */ + public function setDatabaseEncryption($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeMultiCloud\V1\AzureDatabaseEncryption::class); + $this->database_encryption = $var; + + return $this; + } + + /** + * Optional. Proxy configuration for outbound HTTP(S) traffic. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureProxyConfig proxy_config = 12 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\GkeMultiCloud\V1\AzureProxyConfig|null + */ + public function getProxyConfig() + { + return $this->proxy_config; + } + + public function hasProxyConfig() + { + return isset($this->proxy_config); + } + + public function clearProxyConfig() + { + unset($this->proxy_config); + } + + /** + * Optional. Proxy configuration for outbound HTTP(S) traffic. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureProxyConfig proxy_config = 12 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\GkeMultiCloud\V1\AzureProxyConfig $var + * @return $this + */ + public function setProxyConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeMultiCloud\V1\AzureProxyConfig::class); + $this->proxy_config = $var; + + return $this; + } + + /** + * Optional. Configuration related to vm config encryption. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureConfigEncryption config_encryption = 14 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\GkeMultiCloud\V1\AzureConfigEncryption|null + */ + public function getConfigEncryption() + { + return $this->config_encryption; + } + + public function hasConfigEncryption() + { + return isset($this->config_encryption); + } + + public function clearConfigEncryption() + { + unset($this->config_encryption); + } + + /** + * Optional. Configuration related to vm config encryption. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureConfigEncryption config_encryption = 14 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\GkeMultiCloud\V1\AzureConfigEncryption $var + * @return $this + */ + public function setConfigEncryption($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeMultiCloud\V1\AzureConfigEncryption::class); + $this->config_encryption = $var; + + return $this; + } + + /** + * Optional. A set of tags to apply to all underlying control plane Azure + * resources. + * + * Generated from protobuf field map tags = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\MapField + */ + public function getTags() + { + return $this->tags; + } + + /** + * Optional. A set of tags to apply to all underlying control plane Azure + * resources. + * + * Generated from protobuf field map tags = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setTags($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->tags = $arr; + + return $this; + } + + /** + * Optional. Configuration for where to place the control plane replicas. + * Up to three replica placement instances can be specified. If + * replica_placements is set, the replica placement instances will be applied + * to the three control plane replicas as evenly as possible. + * + * Generated from protobuf field repeated .google.cloud.gkemulticloud.v1.ReplicaPlacement replica_placements = 13 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getReplicaPlacements() + { + return $this->replica_placements; + } + + /** + * Optional. Configuration for where to place the control plane replicas. + * Up to three replica placement instances can be specified. If + * replica_placements is set, the replica placement instances will be applied + * to the three control plane replicas as evenly as possible. + * + * Generated from protobuf field repeated .google.cloud.gkemulticloud.v1.ReplicaPlacement replica_placements = 13 [(.google.api.field_behavior) = OPTIONAL]; + * @param array<\Google\Cloud\GkeMultiCloud\V1\ReplicaPlacement>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setReplicaPlacements($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\GkeMultiCloud\V1\ReplicaPlacement::class); + $this->replica_placements = $arr; + + return $this; + } + + /** + * Optional. The ARM ID of the subnet where the control plane load balancer is + * deployed. When unspecified, it defaults to AzureControlPlane.subnet_id. + * Example: + * "/subscriptions/d00494d6-6f3c-4280-bbb2-899e163d1d30/resourceGroups/anthos_cluster_gkeust4/providers/Microsoft.Network/virtualNetworks/gke-vnet-gkeust4/subnets/subnetid123" + * + * Generated from protobuf field string endpoint_subnet_id = 15 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getEndpointSubnetId() + { + return $this->endpoint_subnet_id; + } + + /** + * Optional. The ARM ID of the subnet where the control plane load balancer is + * deployed. When unspecified, it defaults to AzureControlPlane.subnet_id. + * Example: + * "/subscriptions/d00494d6-6f3c-4280-bbb2-899e163d1d30/resourceGroups/anthos_cluster_gkeust4/providers/Microsoft.Network/virtualNetworks/gke-vnet-gkeust4/subnets/subnetid123" + * + * Generated from protobuf field string endpoint_subnet_id = 15 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setEndpointSubnetId($var) + { + GPBUtil::checkString($var, True); + $this->endpoint_subnet_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AzureDatabaseEncryption.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AzureDatabaseEncryption.php new file mode 100644 index 000000000000..21c7b8009267 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AzureDatabaseEncryption.php @@ -0,0 +1,85 @@ +google.cloud.gkemulticloud.v1.AzureDatabaseEncryption + */ +class AzureDatabaseEncryption extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The ARM ID of the Azure Key Vault key to encrypt / decrypt data. + * For example: + * `/subscriptions//resourceGroups//providers/Microsoft.KeyVault/vaults//keys/` + * Encryption will always take the latest version of the key and hence + * specific version is not supported. + * + * Generated from protobuf field string key_id = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $key_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $key_id + * Required. The ARM ID of the Azure Key Vault key to encrypt / decrypt data. + * For example: + * `/subscriptions//resourceGroups//providers/Microsoft.KeyVault/vaults//keys/` + * Encryption will always take the latest version of the key and hence + * specific version is not supported. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AzureResources::initOnce(); + parent::__construct($data); + } + + /** + * Required. The ARM ID of the Azure Key Vault key to encrypt / decrypt data. + * For example: + * `/subscriptions//resourceGroups//providers/Microsoft.KeyVault/vaults//keys/` + * Encryption will always take the latest version of the key and hence + * specific version is not supported. + * + * Generated from protobuf field string key_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getKeyId() + { + return $this->key_id; + } + + /** + * Required. The ARM ID of the Azure Key Vault key to encrypt / decrypt data. + * For example: + * `/subscriptions//resourceGroups//providers/Microsoft.KeyVault/vaults//keys/` + * Encryption will always take the latest version of the key and hence + * specific version is not supported. + * + * Generated from protobuf field string key_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setKeyId($var) + { + GPBUtil::checkString($var, True); + $this->key_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AzureDiskTemplate.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AzureDiskTemplate.php new file mode 100644 index 000000000000..f3c1a39446b7 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AzureDiskTemplate.php @@ -0,0 +1,75 @@ +google.cloud.gkemulticloud.v1.AzureDiskTemplate + */ +class AzureDiskTemplate extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. The size of the disk, in GiBs. + * When unspecified, a default value is provided. See the specific reference + * in the parent resource. + * + * Generated from protobuf field int32 size_gib = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $size_gib = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $size_gib + * Optional. The size of the disk, in GiBs. + * When unspecified, a default value is provided. See the specific reference + * in the parent resource. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AzureResources::initOnce(); + parent::__construct($data); + } + + /** + * Optional. The size of the disk, in GiBs. + * When unspecified, a default value is provided. See the specific reference + * in the parent resource. + * + * Generated from protobuf field int32 size_gib = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getSizeGib() + { + return $this->size_gib; + } + + /** + * Optional. The size of the disk, in GiBs. + * When unspecified, a default value is provided. See the specific reference + * in the parent resource. + * + * Generated from protobuf field int32 size_gib = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setSizeGib($var) + { + GPBUtil::checkInt32($var); + $this->size_gib = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AzureK8sVersionInfo.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AzureK8sVersionInfo.php new file mode 100644 index 000000000000..c5f4598bb33e --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AzureK8sVersionInfo.php @@ -0,0 +1,67 @@ +google.cloud.gkemulticloud.v1.AzureK8sVersionInfo + */ +class AzureK8sVersionInfo extends \Google\Protobuf\Internal\Message +{ + /** + * A supported Kubernetes version (for example, `1.19.10-gke.1000`) + * + * Generated from protobuf field string version = 1; + */ + protected $version = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $version + * A supported Kubernetes version (for example, `1.19.10-gke.1000`) + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AzureResources::initOnce(); + parent::__construct($data); + } + + /** + * A supported Kubernetes version (for example, `1.19.10-gke.1000`) + * + * Generated from protobuf field string version = 1; + * @return string + */ + public function getVersion() + { + return $this->version; + } + + /** + * A supported Kubernetes version (for example, `1.19.10-gke.1000`) + * + * Generated from protobuf field string version = 1; + * @param string $var + * @return $this + */ + public function setVersion($var) + { + GPBUtil::checkString($var, True); + $this->version = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AzureNodeConfig.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AzureNodeConfig.php new file mode 100644 index 000000000000..6008f9ede920 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AzureNodeConfig.php @@ -0,0 +1,436 @@ +google.cloud.gkemulticloud.v1.AzureNodeConfig + */ +class AzureNodeConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. The Azure VM size name. Example: `Standard_DS2_v2`. + * See [Supported VM + * sizes](/anthos/clusters/docs/azure/reference/supported-vms) for options. + * When unspecified, it defaults to `Standard_DS2_v2`. + * + * Generated from protobuf field string vm_size = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $vm_size = ''; + /** + * Optional. Configuration related to the root volume provisioned for each + * node pool machine. + * When unspecified, it defaults to a 32-GiB Azure Disk. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureDiskTemplate root_volume = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $root_volume = null; + /** + * Optional. A set of tags to apply to all underlying Azure resources for this + * node pool. This currently only includes Virtual Machine Scale Sets. + * Specify at most 50 pairs containing alphanumerics, spaces, and symbols + * (.+-=_:@/). Keys can be up to 127 Unicode characters. Values can be up to + * 255 Unicode characters. + * + * Generated from protobuf field map tags = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $tags; + /** + * Optional. The OS image type to use on node pool instances. + * Can have a value of `ubuntu`, or `windows` if the cluster enables + * the Windows node pool preview feature. + * When unspecified, it defaults to `ubuntu`. + * + * Generated from protobuf field string image_type = 8 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $image_type = ''; + /** + * Required. SSH configuration for how to access the node pool machines. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureSshConfig ssh_config = 7 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $ssh_config = null; + /** + * Optional. Proxy configuration for outbound HTTP(S) traffic. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureProxyConfig proxy_config = 9 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $proxy_config = null; + /** + * Optional. Configuration related to vm config encryption. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureConfigEncryption config_encryption = 12 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $config_encryption = null; + /** + * Optional. The initial taints assigned to nodes of this node pool. + * + * Generated from protobuf field repeated .google.cloud.gkemulticloud.v1.NodeTaint taints = 10 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $taints; + /** + * Optional. The initial labels assigned to nodes of this node pool. An object + * containing a list of "key": value pairs. Example: { "name": "wrench", + * "mass": "1.3kg", "count": "3" }. + * + * Generated from protobuf field map labels = 11 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $labels; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $vm_size + * Optional. The Azure VM size name. Example: `Standard_DS2_v2`. + * See [Supported VM + * sizes](/anthos/clusters/docs/azure/reference/supported-vms) for options. + * When unspecified, it defaults to `Standard_DS2_v2`. + * @type \Google\Cloud\GkeMultiCloud\V1\AzureDiskTemplate $root_volume + * Optional. Configuration related to the root volume provisioned for each + * node pool machine. + * When unspecified, it defaults to a 32-GiB Azure Disk. + * @type array|\Google\Protobuf\Internal\MapField $tags + * Optional. A set of tags to apply to all underlying Azure resources for this + * node pool. This currently only includes Virtual Machine Scale Sets. + * Specify at most 50 pairs containing alphanumerics, spaces, and symbols + * (.+-=_:@/). Keys can be up to 127 Unicode characters. Values can be up to + * 255 Unicode characters. + * @type string $image_type + * Optional. The OS image type to use on node pool instances. + * Can have a value of `ubuntu`, or `windows` if the cluster enables + * the Windows node pool preview feature. + * When unspecified, it defaults to `ubuntu`. + * @type \Google\Cloud\GkeMultiCloud\V1\AzureSshConfig $ssh_config + * Required. SSH configuration for how to access the node pool machines. + * @type \Google\Cloud\GkeMultiCloud\V1\AzureProxyConfig $proxy_config + * Optional. Proxy configuration for outbound HTTP(S) traffic. + * @type \Google\Cloud\GkeMultiCloud\V1\AzureConfigEncryption $config_encryption + * Optional. Configuration related to vm config encryption. + * @type array<\Google\Cloud\GkeMultiCloud\V1\NodeTaint>|\Google\Protobuf\Internal\RepeatedField $taints + * Optional. The initial taints assigned to nodes of this node pool. + * @type array|\Google\Protobuf\Internal\MapField $labels + * Optional. The initial labels assigned to nodes of this node pool. An object + * containing a list of "key": value pairs. Example: { "name": "wrench", + * "mass": "1.3kg", "count": "3" }. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AzureResources::initOnce(); + parent::__construct($data); + } + + /** + * Optional. The Azure VM size name. Example: `Standard_DS2_v2`. + * See [Supported VM + * sizes](/anthos/clusters/docs/azure/reference/supported-vms) for options. + * When unspecified, it defaults to `Standard_DS2_v2`. + * + * Generated from protobuf field string vm_size = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getVmSize() + { + return $this->vm_size; + } + + /** + * Optional. The Azure VM size name. Example: `Standard_DS2_v2`. + * See [Supported VM + * sizes](/anthos/clusters/docs/azure/reference/supported-vms) for options. + * When unspecified, it defaults to `Standard_DS2_v2`. + * + * Generated from protobuf field string vm_size = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setVmSize($var) + { + GPBUtil::checkString($var, True); + $this->vm_size = $var; + + return $this; + } + + /** + * Optional. Configuration related to the root volume provisioned for each + * node pool machine. + * When unspecified, it defaults to a 32-GiB Azure Disk. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureDiskTemplate root_volume = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\GkeMultiCloud\V1\AzureDiskTemplate|null + */ + public function getRootVolume() + { + return $this->root_volume; + } + + public function hasRootVolume() + { + return isset($this->root_volume); + } + + public function clearRootVolume() + { + unset($this->root_volume); + } + + /** + * Optional. Configuration related to the root volume provisioned for each + * node pool machine. + * When unspecified, it defaults to a 32-GiB Azure Disk. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureDiskTemplate root_volume = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\GkeMultiCloud\V1\AzureDiskTemplate $var + * @return $this + */ + public function setRootVolume($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeMultiCloud\V1\AzureDiskTemplate::class); + $this->root_volume = $var; + + return $this; + } + + /** + * Optional. A set of tags to apply to all underlying Azure resources for this + * node pool. This currently only includes Virtual Machine Scale Sets. + * Specify at most 50 pairs containing alphanumerics, spaces, and symbols + * (.+-=_:@/). Keys can be up to 127 Unicode characters. Values can be up to + * 255 Unicode characters. + * + * Generated from protobuf field map tags = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\MapField + */ + public function getTags() + { + return $this->tags; + } + + /** + * Optional. A set of tags to apply to all underlying Azure resources for this + * node pool. This currently only includes Virtual Machine Scale Sets. + * Specify at most 50 pairs containing alphanumerics, spaces, and symbols + * (.+-=_:@/). Keys can be up to 127 Unicode characters. Values can be up to + * 255 Unicode characters. + * + * Generated from protobuf field map tags = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setTags($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->tags = $arr; + + return $this; + } + + /** + * Optional. The OS image type to use on node pool instances. + * Can have a value of `ubuntu`, or `windows` if the cluster enables + * the Windows node pool preview feature. + * When unspecified, it defaults to `ubuntu`. + * + * Generated from protobuf field string image_type = 8 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getImageType() + { + return $this->image_type; + } + + /** + * Optional. The OS image type to use on node pool instances. + * Can have a value of `ubuntu`, or `windows` if the cluster enables + * the Windows node pool preview feature. + * When unspecified, it defaults to `ubuntu`. + * + * Generated from protobuf field string image_type = 8 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setImageType($var) + { + GPBUtil::checkString($var, True); + $this->image_type = $var; + + return $this; + } + + /** + * Required. SSH configuration for how to access the node pool machines. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureSshConfig ssh_config = 7 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\GkeMultiCloud\V1\AzureSshConfig|null + */ + public function getSshConfig() + { + return $this->ssh_config; + } + + public function hasSshConfig() + { + return isset($this->ssh_config); + } + + public function clearSshConfig() + { + unset($this->ssh_config); + } + + /** + * Required. SSH configuration for how to access the node pool machines. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureSshConfig ssh_config = 7 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\GkeMultiCloud\V1\AzureSshConfig $var + * @return $this + */ + public function setSshConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeMultiCloud\V1\AzureSshConfig::class); + $this->ssh_config = $var; + + return $this; + } + + /** + * Optional. Proxy configuration for outbound HTTP(S) traffic. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureProxyConfig proxy_config = 9 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\GkeMultiCloud\V1\AzureProxyConfig|null + */ + public function getProxyConfig() + { + return $this->proxy_config; + } + + public function hasProxyConfig() + { + return isset($this->proxy_config); + } + + public function clearProxyConfig() + { + unset($this->proxy_config); + } + + /** + * Optional. Proxy configuration for outbound HTTP(S) traffic. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureProxyConfig proxy_config = 9 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\GkeMultiCloud\V1\AzureProxyConfig $var + * @return $this + */ + public function setProxyConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeMultiCloud\V1\AzureProxyConfig::class); + $this->proxy_config = $var; + + return $this; + } + + /** + * Optional. Configuration related to vm config encryption. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureConfigEncryption config_encryption = 12 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\GkeMultiCloud\V1\AzureConfigEncryption|null + */ + public function getConfigEncryption() + { + return $this->config_encryption; + } + + public function hasConfigEncryption() + { + return isset($this->config_encryption); + } + + public function clearConfigEncryption() + { + unset($this->config_encryption); + } + + /** + * Optional. Configuration related to vm config encryption. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureConfigEncryption config_encryption = 12 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\GkeMultiCloud\V1\AzureConfigEncryption $var + * @return $this + */ + public function setConfigEncryption($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeMultiCloud\V1\AzureConfigEncryption::class); + $this->config_encryption = $var; + + return $this; + } + + /** + * Optional. The initial taints assigned to nodes of this node pool. + * + * Generated from protobuf field repeated .google.cloud.gkemulticloud.v1.NodeTaint taints = 10 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTaints() + { + return $this->taints; + } + + /** + * Optional. The initial taints assigned to nodes of this node pool. + * + * Generated from protobuf field repeated .google.cloud.gkemulticloud.v1.NodeTaint taints = 10 [(.google.api.field_behavior) = OPTIONAL]; + * @param array<\Google\Cloud\GkeMultiCloud\V1\NodeTaint>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTaints($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\GkeMultiCloud\V1\NodeTaint::class); + $this->taints = $arr; + + return $this; + } + + /** + * Optional. The initial labels assigned to nodes of this node pool. An object + * containing a list of "key": value pairs. Example: { "name": "wrench", + * "mass": "1.3kg", "count": "3" }. + * + * Generated from protobuf field map labels = 11 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * Optional. The initial labels assigned to nodes of this node pool. An object + * containing a list of "key": value pairs. Example: { "name": "wrench", + * "mass": "1.3kg", "count": "3" }. + * + * Generated from protobuf field map labels = 11 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AzureNodePool.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AzureNodePool.php new file mode 100644 index 000000000000..957f0cef0a6c --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AzureNodePool.php @@ -0,0 +1,669 @@ +google.cloud.gkemulticloud.v1.AzureNodePool + */ +class AzureNodePool extends \Google\Protobuf\Internal\Message +{ + /** + * The name of this resource. + * Node pool names are formatted as + * `projects//locations//azureClusters//azureNodePools/`. + * For more details on Google Cloud resource names, + * see [Resource Names](https://cloud.google.com/apis/design/resource_names) + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * Required. The Kubernetes version (e.g. `1.19.10-gke.1000`) running on this + * node pool. + * + * Generated from protobuf field string version = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $version = ''; + /** + * Required. The node configuration of the node pool. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureNodeConfig config = 22 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $config = null; + /** + * Required. The ARM ID of the subnet where the node pool VMs run. Make sure + * it's a subnet under the virtual network in the cluster configuration. + * + * Generated from protobuf field string subnet_id = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $subnet_id = ''; + /** + * Required. Autoscaler configuration for this node pool. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureNodePoolAutoscaling autoscaling = 4 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $autoscaling = null; + /** + * Output only. The current state of the node pool. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureNodePool.State state = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Output only. A globally unique identifier for the node pool. + * + * Generated from protobuf field string uid = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $uid = ''; + /** + * Output only. If set, there are currently pending changes to the node + * pool. + * + * Generated from protobuf field bool reconciling = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $reconciling = false; + /** + * Output only. The time at which this node pool was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. The time at which this node pool was last updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * Allows clients to perform consistent read-modify-writes + * through optimistic concurrency control. + * Can be sent on update and delete requests to ensure the + * client has an up-to-date value before proceeding. + * + * Generated from protobuf field string etag = 12; + */ + protected $etag = ''; + /** + * Optional. Annotations on the node pool. + * This field has the same restrictions as Kubernetes annotations. + * The total size of all keys and values combined is limited to 256k. + * Keys can have 2 segments: prefix (optional) and name (required), + * separated by a slash (/). + * Prefix must be a DNS subdomain. + * Name must be 63 characters or less, begin and end with alphanumerics, + * with dashes (-), underscores (_), dots (.), and alphanumerics between. + * + * Generated from protobuf field map annotations = 13 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $annotations; + /** + * Required. The constraint on the maximum number of pods that can be run + * simultaneously on a node in the node pool. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.MaxPodsConstraint max_pods_constraint = 21 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $max_pods_constraint = null; + /** + * Optional. The Azure availability zone of the nodes in this nodepool. + * When unspecified, it defaults to `1`. + * + * Generated from protobuf field string azure_availability_zone = 23 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $azure_availability_zone = ''; + /** + * Output only. A set of errors found in the node pool. + * + * Generated from protobuf field repeated .google.cloud.gkemulticloud.v1.AzureNodePoolError errors = 29 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $errors; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The name of this resource. + * Node pool names are formatted as + * `projects//locations//azureClusters//azureNodePools/`. + * For more details on Google Cloud resource names, + * see [Resource Names](https://cloud.google.com/apis/design/resource_names) + * @type string $version + * Required. The Kubernetes version (e.g. `1.19.10-gke.1000`) running on this + * node pool. + * @type \Google\Cloud\GkeMultiCloud\V1\AzureNodeConfig $config + * Required. The node configuration of the node pool. + * @type string $subnet_id + * Required. The ARM ID of the subnet where the node pool VMs run. Make sure + * it's a subnet under the virtual network in the cluster configuration. + * @type \Google\Cloud\GkeMultiCloud\V1\AzureNodePoolAutoscaling $autoscaling + * Required. Autoscaler configuration for this node pool. + * @type int $state + * Output only. The current state of the node pool. + * @type string $uid + * Output only. A globally unique identifier for the node pool. + * @type bool $reconciling + * Output only. If set, there are currently pending changes to the node + * pool. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The time at which this node pool was created. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. The time at which this node pool was last updated. + * @type string $etag + * Allows clients to perform consistent read-modify-writes + * through optimistic concurrency control. + * Can be sent on update and delete requests to ensure the + * client has an up-to-date value before proceeding. + * @type array|\Google\Protobuf\Internal\MapField $annotations + * Optional. Annotations on the node pool. + * This field has the same restrictions as Kubernetes annotations. + * The total size of all keys and values combined is limited to 256k. + * Keys can have 2 segments: prefix (optional) and name (required), + * separated by a slash (/). + * Prefix must be a DNS subdomain. + * Name must be 63 characters or less, begin and end with alphanumerics, + * with dashes (-), underscores (_), dots (.), and alphanumerics between. + * @type \Google\Cloud\GkeMultiCloud\V1\MaxPodsConstraint $max_pods_constraint + * Required. The constraint on the maximum number of pods that can be run + * simultaneously on a node in the node pool. + * @type string $azure_availability_zone + * Optional. The Azure availability zone of the nodes in this nodepool. + * When unspecified, it defaults to `1`. + * @type array<\Google\Cloud\GkeMultiCloud\V1\AzureNodePoolError>|\Google\Protobuf\Internal\RepeatedField $errors + * Output only. A set of errors found in the node pool. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AzureResources::initOnce(); + parent::__construct($data); + } + + /** + * The name of this resource. + * Node pool names are formatted as + * `projects//locations//azureClusters//azureNodePools/`. + * For more details on Google Cloud resource names, + * see [Resource Names](https://cloud.google.com/apis/design/resource_names) + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The name of this resource. + * Node pool names are formatted as + * `projects//locations//azureClusters//azureNodePools/`. + * For more details on Google Cloud resource names, + * see [Resource Names](https://cloud.google.com/apis/design/resource_names) + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Required. The Kubernetes version (e.g. `1.19.10-gke.1000`) running on this + * node pool. + * + * Generated from protobuf field string version = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getVersion() + { + return $this->version; + } + + /** + * Required. The Kubernetes version (e.g. `1.19.10-gke.1000`) running on this + * node pool. + * + * Generated from protobuf field string version = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setVersion($var) + { + GPBUtil::checkString($var, True); + $this->version = $var; + + return $this; + } + + /** + * Required. The node configuration of the node pool. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureNodeConfig config = 22 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\GkeMultiCloud\V1\AzureNodeConfig|null + */ + public function getConfig() + { + return $this->config; + } + + public function hasConfig() + { + return isset($this->config); + } + + public function clearConfig() + { + unset($this->config); + } + + /** + * Required. The node configuration of the node pool. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureNodeConfig config = 22 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\GkeMultiCloud\V1\AzureNodeConfig $var + * @return $this + */ + public function setConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeMultiCloud\V1\AzureNodeConfig::class); + $this->config = $var; + + return $this; + } + + /** + * Required. The ARM ID of the subnet where the node pool VMs run. Make sure + * it's a subnet under the virtual network in the cluster configuration. + * + * Generated from protobuf field string subnet_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getSubnetId() + { + return $this->subnet_id; + } + + /** + * Required. The ARM ID of the subnet where the node pool VMs run. Make sure + * it's a subnet under the virtual network in the cluster configuration. + * + * Generated from protobuf field string subnet_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setSubnetId($var) + { + GPBUtil::checkString($var, True); + $this->subnet_id = $var; + + return $this; + } + + /** + * Required. Autoscaler configuration for this node pool. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureNodePoolAutoscaling autoscaling = 4 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\GkeMultiCloud\V1\AzureNodePoolAutoscaling|null + */ + public function getAutoscaling() + { + return $this->autoscaling; + } + + public function hasAutoscaling() + { + return isset($this->autoscaling); + } + + public function clearAutoscaling() + { + unset($this->autoscaling); + } + + /** + * Required. Autoscaler configuration for this node pool. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureNodePoolAutoscaling autoscaling = 4 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\GkeMultiCloud\V1\AzureNodePoolAutoscaling $var + * @return $this + */ + public function setAutoscaling($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeMultiCloud\V1\AzureNodePoolAutoscaling::class); + $this->autoscaling = $var; + + return $this; + } + + /** + * Output only. The current state of the node pool. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureNodePool.State state = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. The current state of the node pool. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureNodePool.State state = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\GkeMultiCloud\V1\AzureNodePool\State::class); + $this->state = $var; + + return $this; + } + + /** + * Output only. A globally unique identifier for the node pool. + * + * Generated from protobuf field string uid = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getUid() + { + return $this->uid; + } + + /** + * Output only. A globally unique identifier for the node pool. + * + * Generated from protobuf field string uid = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setUid($var) + { + GPBUtil::checkString($var, True); + $this->uid = $var; + + return $this; + } + + /** + * Output only. If set, there are currently pending changes to the node + * pool. + * + * Generated from protobuf field bool reconciling = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return bool + */ + public function getReconciling() + { + return $this->reconciling; + } + + /** + * Output only. If set, there are currently pending changes to the node + * pool. + * + * Generated from protobuf field bool reconciling = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param bool $var + * @return $this + */ + public function setReconciling($var) + { + GPBUtil::checkBool($var); + $this->reconciling = $var; + + return $this; + } + + /** + * Output only. The time at which this node pool was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 10 [(.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 at which this node pool was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 10 [(.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 at which this node pool was last updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 11 [(.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 at which this node pool was last updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 11 [(.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; + } + + /** + * Allows clients to perform consistent read-modify-writes + * through optimistic concurrency control. + * Can be sent on update and delete requests to ensure the + * client has an up-to-date value before proceeding. + * + * Generated from protobuf field string etag = 12; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * Allows clients to perform consistent read-modify-writes + * through optimistic concurrency control. + * Can be sent on update and delete requests to ensure the + * client has an up-to-date value before proceeding. + * + * Generated from protobuf field string etag = 12; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, True); + $this->etag = $var; + + return $this; + } + + /** + * Optional. Annotations on the node pool. + * This field has the same restrictions as Kubernetes annotations. + * The total size of all keys and values combined is limited to 256k. + * Keys can have 2 segments: prefix (optional) and name (required), + * separated by a slash (/). + * Prefix must be a DNS subdomain. + * Name must be 63 characters or less, begin and end with alphanumerics, + * with dashes (-), underscores (_), dots (.), and alphanumerics between. + * + * Generated from protobuf field map annotations = 13 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\MapField + */ + public function getAnnotations() + { + return $this->annotations; + } + + /** + * Optional. Annotations on the node pool. + * This field has the same restrictions as Kubernetes annotations. + * The total size of all keys and values combined is limited to 256k. + * Keys can have 2 segments: prefix (optional) and name (required), + * separated by a slash (/). + * Prefix must be a DNS subdomain. + * Name must be 63 characters or less, begin and end with alphanumerics, + * with dashes (-), underscores (_), dots (.), and alphanumerics between. + * + * Generated from protobuf field map annotations = 13 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setAnnotations($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->annotations = $arr; + + return $this; + } + + /** + * Required. The constraint on the maximum number of pods that can be run + * simultaneously on a node in the node pool. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.MaxPodsConstraint max_pods_constraint = 21 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\GkeMultiCloud\V1\MaxPodsConstraint|null + */ + public function getMaxPodsConstraint() + { + return $this->max_pods_constraint; + } + + public function hasMaxPodsConstraint() + { + return isset($this->max_pods_constraint); + } + + public function clearMaxPodsConstraint() + { + unset($this->max_pods_constraint); + } + + /** + * Required. The constraint on the maximum number of pods that can be run + * simultaneously on a node in the node pool. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.MaxPodsConstraint max_pods_constraint = 21 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\GkeMultiCloud\V1\MaxPodsConstraint $var + * @return $this + */ + public function setMaxPodsConstraint($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeMultiCloud\V1\MaxPodsConstraint::class); + $this->max_pods_constraint = $var; + + return $this; + } + + /** + * Optional. The Azure availability zone of the nodes in this nodepool. + * When unspecified, it defaults to `1`. + * + * Generated from protobuf field string azure_availability_zone = 23 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getAzureAvailabilityZone() + { + return $this->azure_availability_zone; + } + + /** + * Optional. The Azure availability zone of the nodes in this nodepool. + * When unspecified, it defaults to `1`. + * + * Generated from protobuf field string azure_availability_zone = 23 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setAzureAvailabilityZone($var) + { + GPBUtil::checkString($var, True); + $this->azure_availability_zone = $var; + + return $this; + } + + /** + * Output only. A set of errors found in the node pool. + * + * Generated from protobuf field repeated .google.cloud.gkemulticloud.v1.AzureNodePoolError errors = 29 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getErrors() + { + return $this->errors; + } + + /** + * Output only. A set of errors found in the node pool. + * + * Generated from protobuf field repeated .google.cloud.gkemulticloud.v1.AzureNodePoolError errors = 29 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array<\Google\Cloud\GkeMultiCloud\V1\AzureNodePoolError>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setErrors($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\GkeMultiCloud\V1\AzureNodePoolError::class); + $this->errors = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AzureNodePool/State.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AzureNodePool/State.php new file mode 100644 index 000000000000..1d994d640f61 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AzureNodePool/State.php @@ -0,0 +1,95 @@ +google.cloud.gkemulticloud.v1.AzureNodePool.State + */ +class State +{ + /** + * Not set. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The PROVISIONING state indicates the node pool is being created. + * + * Generated from protobuf enum PROVISIONING = 1; + */ + const PROVISIONING = 1; + /** + * The RUNNING state indicates the node pool has been created and is fully + * usable. + * + * Generated from protobuf enum RUNNING = 2; + */ + const RUNNING = 2; + /** + * The RECONCILING state indicates that the node pool is being reconciled. + * + * Generated from protobuf enum RECONCILING = 3; + */ + const RECONCILING = 3; + /** + * The STOPPING state indicates the node pool is being deleted. + * + * Generated from protobuf enum STOPPING = 4; + */ + const STOPPING = 4; + /** + * The ERROR state indicates the node pool is in a broken unrecoverable + * state. + * + * Generated from protobuf enum ERROR = 5; + */ + const ERROR = 5; + /** + * The DEGRADED state indicates the node pool requires user action to + * restore full functionality. + * + * Generated from protobuf enum DEGRADED = 6; + */ + const DEGRADED = 6; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::PROVISIONING => 'PROVISIONING', + self::RUNNING => 'RUNNING', + self::RECONCILING => 'RECONCILING', + self::STOPPING => 'STOPPING', + self::ERROR => 'ERROR', + self::DEGRADED => 'DEGRADED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\GkeMultiCloud\V1\AzureNodePool_State::class); + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AzureNodePoolAutoscaling.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AzureNodePoolAutoscaling.php new file mode 100644 index 000000000000..2688e11da544 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AzureNodePoolAutoscaling.php @@ -0,0 +1,111 @@ +google.cloud.gkemulticloud.v1.AzureNodePoolAutoscaling + */ +class AzureNodePoolAutoscaling extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Minimum number of nodes in the node pool. Must be greater than or + * equal to 1 and less than or equal to max_node_count. + * + * Generated from protobuf field int32 min_node_count = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $min_node_count = 0; + /** + * Required. Maximum number of nodes in the node pool. Must be greater than or + * equal to min_node_count and less than or equal to 50. + * + * Generated from protobuf field int32 max_node_count = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $max_node_count = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $min_node_count + * Required. Minimum number of nodes in the node pool. Must be greater than or + * equal to 1 and less than or equal to max_node_count. + * @type int $max_node_count + * Required. Maximum number of nodes in the node pool. Must be greater than or + * equal to min_node_count and less than or equal to 50. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AzureResources::initOnce(); + parent::__construct($data); + } + + /** + * Required. Minimum number of nodes in the node pool. Must be greater than or + * equal to 1 and less than or equal to max_node_count. + * + * Generated from protobuf field int32 min_node_count = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getMinNodeCount() + { + return $this->min_node_count; + } + + /** + * Required. Minimum number of nodes in the node pool. Must be greater than or + * equal to 1 and less than or equal to max_node_count. + * + * Generated from protobuf field int32 min_node_count = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setMinNodeCount($var) + { + GPBUtil::checkInt32($var); + $this->min_node_count = $var; + + return $this; + } + + /** + * Required. Maximum number of nodes in the node pool. Must be greater than or + * equal to min_node_count and less than or equal to 50. + * + * Generated from protobuf field int32 max_node_count = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getMaxNodeCount() + { + return $this->max_node_count; + } + + /** + * Required. Maximum number of nodes in the node pool. Must be greater than or + * equal to min_node_count and less than or equal to 50. + * + * Generated from protobuf field int32 max_node_count = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setMaxNodeCount($var) + { + GPBUtil::checkInt32($var); + $this->max_node_count = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AzureNodePoolError.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AzureNodePoolError.php new file mode 100644 index 000000000000..854ce75b671a --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AzureNodePoolError.php @@ -0,0 +1,67 @@ +google.cloud.gkemulticloud.v1.AzureNodePoolError + */ +class AzureNodePoolError extends \Google\Protobuf\Internal\Message +{ + /** + * Human-friendly description of the error. + * + * Generated from protobuf field string message = 1; + */ + protected $message = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $message + * Human-friendly description of the error. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AzureResources::initOnce(); + parent::__construct($data); + } + + /** + * Human-friendly description of the error. + * + * Generated from protobuf field string message = 1; + * @return string + */ + public function getMessage() + { + return $this->message; + } + + /** + * Human-friendly description of the error. + * + * Generated from protobuf field string message = 1; + * @param string $var + * @return $this + */ + public function setMessage($var) + { + GPBUtil::checkString($var, True); + $this->message = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AzureNodePool_State.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AzureNodePool_State.php new file mode 100644 index 000000000000..564057a0a4f3 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AzureNodePool_State.php @@ -0,0 +1,16 @@ +google.cloud.gkemulticloud.v1.AzureProxyConfig + */ +class AzureProxyConfig extends \Google\Protobuf\Internal\Message +{ + /** + * The ARM ID the of the resource group containing proxy keyvault. + * Resource group ids are formatted as + * `/subscriptions//resourceGroups/`. + * + * Generated from protobuf field string resource_group_id = 1; + */ + protected $resource_group_id = ''; + /** + * The URL the of the proxy setting secret with its version. + * The secret must be a JSON encoded proxy configuration + * as described in + * https://cloud.google.com/anthos/clusters/docs/multi-cloud/azure/how-to/use-a-proxy#create_a_proxy_configuration_file + * Secret ids are formatted as + * `https://.vault.azure.net/secrets//`. + * + * Generated from protobuf field string secret_id = 2; + */ + protected $secret_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $resource_group_id + * The ARM ID the of the resource group containing proxy keyvault. + * Resource group ids are formatted as + * `/subscriptions//resourceGroups/`. + * @type string $secret_id + * The URL the of the proxy setting secret with its version. + * The secret must be a JSON encoded proxy configuration + * as described in + * https://cloud.google.com/anthos/clusters/docs/multi-cloud/azure/how-to/use-a-proxy#create_a_proxy_configuration_file + * Secret ids are formatted as + * `https://.vault.azure.net/secrets//`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AzureResources::initOnce(); + parent::__construct($data); + } + + /** + * The ARM ID the of the resource group containing proxy keyvault. + * Resource group ids are formatted as + * `/subscriptions//resourceGroups/`. + * + * Generated from protobuf field string resource_group_id = 1; + * @return string + */ + public function getResourceGroupId() + { + return $this->resource_group_id; + } + + /** + * The ARM ID the of the resource group containing proxy keyvault. + * Resource group ids are formatted as + * `/subscriptions//resourceGroups/`. + * + * Generated from protobuf field string resource_group_id = 1; + * @param string $var + * @return $this + */ + public function setResourceGroupId($var) + { + GPBUtil::checkString($var, True); + $this->resource_group_id = $var; + + return $this; + } + + /** + * The URL the of the proxy setting secret with its version. + * The secret must be a JSON encoded proxy configuration + * as described in + * https://cloud.google.com/anthos/clusters/docs/multi-cloud/azure/how-to/use-a-proxy#create_a_proxy_configuration_file + * Secret ids are formatted as + * `https://.vault.azure.net/secrets//`. + * + * Generated from protobuf field string secret_id = 2; + * @return string + */ + public function getSecretId() + { + return $this->secret_id; + } + + /** + * The URL the of the proxy setting secret with its version. + * The secret must be a JSON encoded proxy configuration + * as described in + * https://cloud.google.com/anthos/clusters/docs/multi-cloud/azure/how-to/use-a-proxy#create_a_proxy_configuration_file + * Secret ids are formatted as + * `https://.vault.azure.net/secrets//`. + * + * Generated from protobuf field string secret_id = 2; + * @param string $var + * @return $this + */ + public function setSecretId($var) + { + GPBUtil::checkString($var, True); + $this->secret_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AzureServerConfig.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AzureServerConfig.php new file mode 100644 index 000000000000..e9a3cec31efe --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AzureServerConfig.php @@ -0,0 +1,152 @@ +google.cloud.gkemulticloud.v1.AzureServerConfig + */ +class AzureServerConfig extends \Google\Protobuf\Internal\Message +{ + /** + * The `AzureServerConfig` resource name. + * `AzureServerConfig` names are formatted as + * `projects//locations//azureServerConfig`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * List of valid Kubernetes versions. + * + * Generated from protobuf field repeated .google.cloud.gkemulticloud.v1.AzureK8sVersionInfo valid_versions = 2; + */ + private $valid_versions; + /** + * The list of supported Azure regions. + * + * Generated from protobuf field repeated string supported_azure_regions = 3; + */ + private $supported_azure_regions; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The `AzureServerConfig` resource name. + * `AzureServerConfig` names are formatted as + * `projects//locations//azureServerConfig`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * @type array<\Google\Cloud\GkeMultiCloud\V1\AzureK8sVersionInfo>|\Google\Protobuf\Internal\RepeatedField $valid_versions + * List of valid Kubernetes versions. + * @type array|\Google\Protobuf\Internal\RepeatedField $supported_azure_regions + * The list of supported Azure regions. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AzureResources::initOnce(); + parent::__construct($data); + } + + /** + * The `AzureServerConfig` resource name. + * `AzureServerConfig` names are formatted as + * `projects//locations//azureServerConfig`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The `AzureServerConfig` resource name. + * `AzureServerConfig` names are formatted as + * `projects//locations//azureServerConfig`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * List of valid Kubernetes versions. + * + * Generated from protobuf field repeated .google.cloud.gkemulticloud.v1.AzureK8sVersionInfo valid_versions = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getValidVersions() + { + return $this->valid_versions; + } + + /** + * List of valid Kubernetes versions. + * + * Generated from protobuf field repeated .google.cloud.gkemulticloud.v1.AzureK8sVersionInfo valid_versions = 2; + * @param array<\Google\Cloud\GkeMultiCloud\V1\AzureK8sVersionInfo>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setValidVersions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\GkeMultiCloud\V1\AzureK8sVersionInfo::class); + $this->valid_versions = $arr; + + return $this; + } + + /** + * The list of supported Azure regions. + * + * Generated from protobuf field repeated string supported_azure_regions = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSupportedAzureRegions() + { + return $this->supported_azure_regions; + } + + /** + * The list of supported Azure regions. + * + * Generated from protobuf field repeated string supported_azure_regions = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSupportedAzureRegions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->supported_azure_regions = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AzureServicesAuthentication.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AzureServicesAuthentication.php new file mode 100644 index 000000000000..b5a17552ed8f --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AzureServicesAuthentication.php @@ -0,0 +1,101 @@ +google.cloud.gkemulticloud.v1.AzureServicesAuthentication + */ +class AzureServicesAuthentication extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The Azure Active Directory Tenant ID. + * + * Generated from protobuf field string tenant_id = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $tenant_id = ''; + /** + * Required. The Azure Active Directory Application ID. + * + * Generated from protobuf field string application_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $application_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $tenant_id + * Required. The Azure Active Directory Tenant ID. + * @type string $application_id + * Required. The Azure Active Directory Application ID. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AzureResources::initOnce(); + parent::__construct($data); + } + + /** + * Required. The Azure Active Directory Tenant ID. + * + * Generated from protobuf field string tenant_id = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getTenantId() + { + return $this->tenant_id; + } + + /** + * Required. The Azure Active Directory Tenant ID. + * + * Generated from protobuf field string tenant_id = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setTenantId($var) + { + GPBUtil::checkString($var, True); + $this->tenant_id = $var; + + return $this; + } + + /** + * Required. The Azure Active Directory Application ID. + * + * Generated from protobuf field string application_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getApplicationId() + { + return $this->application_id; + } + + /** + * Required. The Azure Active Directory Application ID. + * + * Generated from protobuf field string application_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setApplicationId($var) + { + GPBUtil::checkString($var, True); + $this->application_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AzureSshConfig.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AzureSshConfig.php new file mode 100644 index 000000000000..1327e9f14c97 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/AzureSshConfig.php @@ -0,0 +1,75 @@ +google.cloud.gkemulticloud.v1.AzureSshConfig + */ +class AzureSshConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The SSH public key data for VMs managed by Anthos. This accepts + * the authorized_keys file format used in OpenSSH according to the sshd(8) + * manual page. + * + * Generated from protobuf field string authorized_key = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $authorized_key = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $authorized_key + * Required. The SSH public key data for VMs managed by Anthos. This accepts + * the authorized_keys file format used in OpenSSH according to the sshd(8) + * manual page. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AzureResources::initOnce(); + parent::__construct($data); + } + + /** + * Required. The SSH public key data for VMs managed by Anthos. This accepts + * the authorized_keys file format used in OpenSSH according to the sshd(8) + * manual page. + * + * Generated from protobuf field string authorized_key = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getAuthorizedKey() + { + return $this->authorized_key; + } + + /** + * Required. The SSH public key data for VMs managed by Anthos. This accepts + * the authorized_keys file format used in OpenSSH according to the sshd(8) + * manual page. + * + * Generated from protobuf field string authorized_key = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setAuthorizedKey($var) + { + GPBUtil::checkString($var, True); + $this->authorized_key = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/CreateAttachedClusterRequest.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/CreateAttachedClusterRequest.php new file mode 100644 index 000000000000..80fed129c9ca --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/CreateAttachedClusterRequest.php @@ -0,0 +1,261 @@ +google.cloud.gkemulticloud.v1.CreateAttachedClusterRequest + */ +class CreateAttachedClusterRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent location where this + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource + * will be created. + * Location names are formatted as `projects//locations/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The specification of the + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] to create. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AttachedCluster attached_cluster = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $attached_cluster = null; + /** + * Required. A client provided ID the resource. Must be unique within the + * parent resource. + * The provided ID will be part of the + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource + * name formatted as + * `projects//locations//attachedClusters/`. + * Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. + * + * Generated from protobuf field string attached_cluster_id = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $attached_cluster_id = ''; + /** + * If set, only validate the request, but do not actually create the cluster. + * + * Generated from protobuf field bool validate_only = 4; + */ + protected $validate_only = false; + + /** + * @param string $parent Required. The parent location where this + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource + * will be created. + * + * Location names are formatted as `projects//locations/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. Please see + * {@see AttachedClustersClient::locationName()} for help formatting this field. + * @param \Google\Cloud\GkeMultiCloud\V1\AttachedCluster $attachedCluster Required. The specification of the + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] to create. + * @param string $attachedClusterId Required. A client provided ID the resource. Must be unique within the + * parent resource. + * + * The provided ID will be part of the + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource + * name formatted as + * `projects//locations//attachedClusters/`. + * + * Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. + * + * @return \Google\Cloud\GkeMultiCloud\V1\CreateAttachedClusterRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\GkeMultiCloud\V1\AttachedCluster $attachedCluster, string $attachedClusterId): self + { + return (new self()) + ->setParent($parent) + ->setAttachedCluster($attachedCluster) + ->setAttachedClusterId($attachedClusterId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The parent location where this + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource + * will be created. + * Location names are formatted as `projects//locations/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * @type \Google\Cloud\GkeMultiCloud\V1\AttachedCluster $attached_cluster + * Required. The specification of the + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] to create. + * @type string $attached_cluster_id + * Required. A client provided ID the resource. Must be unique within the + * parent resource. + * The provided ID will be part of the + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource + * name formatted as + * `projects//locations//attachedClusters/`. + * Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. + * @type bool $validate_only + * If set, only validate the request, but do not actually create the cluster. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AttachedService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent location where this + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource + * will be created. + * Location names are formatted as `projects//locations/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * + * 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. The parent location where this + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource + * will be created. + * Location names are formatted as `projects//locations/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * + * 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. The specification of the + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] to create. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AttachedCluster attached_cluster = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\GkeMultiCloud\V1\AttachedCluster|null + */ + public function getAttachedCluster() + { + return $this->attached_cluster; + } + + public function hasAttachedCluster() + { + return isset($this->attached_cluster); + } + + public function clearAttachedCluster() + { + unset($this->attached_cluster); + } + + /** + * Required. The specification of the + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] to create. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AttachedCluster attached_cluster = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\GkeMultiCloud\V1\AttachedCluster $var + * @return $this + */ + public function setAttachedCluster($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeMultiCloud\V1\AttachedCluster::class); + $this->attached_cluster = $var; + + return $this; + } + + /** + * Required. A client provided ID the resource. Must be unique within the + * parent resource. + * The provided ID will be part of the + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource + * name formatted as + * `projects//locations//attachedClusters/`. + * Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. + * + * Generated from protobuf field string attached_cluster_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getAttachedClusterId() + { + return $this->attached_cluster_id; + } + + /** + * Required. A client provided ID the resource. Must be unique within the + * parent resource. + * The provided ID will be part of the + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource + * name formatted as + * `projects//locations//attachedClusters/`. + * Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. + * + * Generated from protobuf field string attached_cluster_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setAttachedClusterId($var) + { + GPBUtil::checkString($var, True); + $this->attached_cluster_id = $var; + + return $this; + } + + /** + * If set, only validate the request, but do not actually create the cluster. + * + * Generated from protobuf field bool validate_only = 4; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * If set, only validate the request, but do not actually create the cluster. + * + * Generated from protobuf field bool validate_only = 4; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/CreateAwsClusterRequest.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/CreateAwsClusterRequest.php new file mode 100644 index 000000000000..2421c4f73fba --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/CreateAwsClusterRequest.php @@ -0,0 +1,261 @@ +google.cloud.gkemulticloud.v1.CreateAwsClusterRequest + */ +class CreateAwsClusterRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent location where this + * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resource will be + * created. + * Location names are formatted as `projects//locations/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The specification of the + * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] to create. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsCluster aws_cluster = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $aws_cluster = null; + /** + * Required. A client provided ID the resource. Must be unique within the + * parent resource. + * The provided ID will be part of the + * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resource name + * formatted as + * `projects//locations//awsClusters/`. + * Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. + * + * Generated from protobuf field string aws_cluster_id = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $aws_cluster_id = ''; + /** + * If set, only validate the request, but do not actually create the cluster. + * + * Generated from protobuf field bool validate_only = 4; + */ + protected $validate_only = false; + + /** + * @param string $parent Required. The parent location where this + * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resource will be + * created. + * + * Location names are formatted as `projects//locations/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. Please see + * {@see AwsClustersClient::locationName()} for help formatting this field. + * @param \Google\Cloud\GkeMultiCloud\V1\AwsCluster $awsCluster Required. The specification of the + * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] to create. + * @param string $awsClusterId Required. A client provided ID the resource. Must be unique within the + * parent resource. + * + * The provided ID will be part of the + * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resource name + * formatted as + * `projects//locations//awsClusters/`. + * + * Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. + * + * @return \Google\Cloud\GkeMultiCloud\V1\CreateAwsClusterRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\GkeMultiCloud\V1\AwsCluster $awsCluster, string $awsClusterId): self + { + return (new self()) + ->setParent($parent) + ->setAwsCluster($awsCluster) + ->setAwsClusterId($awsClusterId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The parent location where this + * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resource will be + * created. + * Location names are formatted as `projects//locations/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * @type \Google\Cloud\GkeMultiCloud\V1\AwsCluster $aws_cluster + * Required. The specification of the + * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] to create. + * @type string $aws_cluster_id + * Required. A client provided ID the resource. Must be unique within the + * parent resource. + * The provided ID will be part of the + * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resource name + * formatted as + * `projects//locations//awsClusters/`. + * Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. + * @type bool $validate_only + * If set, only validate the request, but do not actually create the cluster. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AwsService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent location where this + * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resource will be + * created. + * Location names are formatted as `projects//locations/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * + * 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. The parent location where this + * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resource will be + * created. + * Location names are formatted as `projects//locations/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * + * 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. The specification of the + * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] to create. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsCluster aws_cluster = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\GkeMultiCloud\V1\AwsCluster|null + */ + public function getAwsCluster() + { + return $this->aws_cluster; + } + + public function hasAwsCluster() + { + return isset($this->aws_cluster); + } + + public function clearAwsCluster() + { + unset($this->aws_cluster); + } + + /** + * Required. The specification of the + * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] to create. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsCluster aws_cluster = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\GkeMultiCloud\V1\AwsCluster $var + * @return $this + */ + public function setAwsCluster($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeMultiCloud\V1\AwsCluster::class); + $this->aws_cluster = $var; + + return $this; + } + + /** + * Required. A client provided ID the resource. Must be unique within the + * parent resource. + * The provided ID will be part of the + * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resource name + * formatted as + * `projects//locations//awsClusters/`. + * Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. + * + * Generated from protobuf field string aws_cluster_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getAwsClusterId() + { + return $this->aws_cluster_id; + } + + /** + * Required. A client provided ID the resource. Must be unique within the + * parent resource. + * The provided ID will be part of the + * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resource name + * formatted as + * `projects//locations//awsClusters/`. + * Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. + * + * Generated from protobuf field string aws_cluster_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setAwsClusterId($var) + { + GPBUtil::checkString($var, True); + $this->aws_cluster_id = $var; + + return $this; + } + + /** + * If set, only validate the request, but do not actually create the cluster. + * + * Generated from protobuf field bool validate_only = 4; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * If set, only validate the request, but do not actually create the cluster. + * + * Generated from protobuf field bool validate_only = 4; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/CreateAwsNodePoolRequest.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/CreateAwsNodePoolRequest.php new file mode 100644 index 000000000000..0a50ccd7b646 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/CreateAwsNodePoolRequest.php @@ -0,0 +1,265 @@ +google.cloud.gkemulticloud.v1.CreateAwsNodePoolRequest + */ +class CreateAwsNodePoolRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] + * resource where this node pool will be created. + * `AwsCluster` names are formatted as + * `projects//locations//awsClusters/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The specification of the + * [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] to create. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsNodePool aws_node_pool = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $aws_node_pool = null; + /** + * Required. A client provided ID the resource. Must be unique within the + * parent resource. + * The provided ID will be part of the + * [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] resource name + * formatted as + * `projects//locations//awsClusters//awsNodePools/`. + * Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. + * + * Generated from protobuf field string aws_node_pool_id = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $aws_node_pool_id = ''; + /** + * If set, only validate the request, but do not actually create the node + * pool. + * + * Generated from protobuf field bool validate_only = 4; + */ + protected $validate_only = false; + + /** + * @param string $parent Required. The [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] + * resource where this node pool will be created. + * + * `AwsCluster` names are formatted as + * `projects//locations//awsClusters/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. Please see + * {@see AwsClustersClient::awsClusterName()} for help formatting this field. + * @param \Google\Cloud\GkeMultiCloud\V1\AwsNodePool $awsNodePool Required. The specification of the + * [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] to create. + * @param string $awsNodePoolId Required. A client provided ID the resource. Must be unique within the + * parent resource. + * + * The provided ID will be part of the + * [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] resource name + * formatted as + * `projects//locations//awsClusters//awsNodePools/`. + * + * Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. + * + * @return \Google\Cloud\GkeMultiCloud\V1\CreateAwsNodePoolRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\GkeMultiCloud\V1\AwsNodePool $awsNodePool, string $awsNodePoolId): self + { + return (new self()) + ->setParent($parent) + ->setAwsNodePool($awsNodePool) + ->setAwsNodePoolId($awsNodePoolId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] + * resource where this node pool will be created. + * `AwsCluster` names are formatted as + * `projects//locations//awsClusters/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * @type \Google\Cloud\GkeMultiCloud\V1\AwsNodePool $aws_node_pool + * Required. The specification of the + * [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] to create. + * @type string $aws_node_pool_id + * Required. A client provided ID the resource. Must be unique within the + * parent resource. + * The provided ID will be part of the + * [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] resource name + * formatted as + * `projects//locations//awsClusters//awsNodePools/`. + * Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. + * @type bool $validate_only + * If set, only validate the request, but do not actually create the node + * pool. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AwsService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] + * resource where this node pool will be created. + * `AwsCluster` names are formatted as + * `projects//locations//awsClusters/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * + * 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. The [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] + * resource where this node pool will be created. + * `AwsCluster` names are formatted as + * `projects//locations//awsClusters/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * + * 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. The specification of the + * [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] to create. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsNodePool aws_node_pool = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\GkeMultiCloud\V1\AwsNodePool|null + */ + public function getAwsNodePool() + { + return $this->aws_node_pool; + } + + public function hasAwsNodePool() + { + return isset($this->aws_node_pool); + } + + public function clearAwsNodePool() + { + unset($this->aws_node_pool); + } + + /** + * Required. The specification of the + * [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] to create. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsNodePool aws_node_pool = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\GkeMultiCloud\V1\AwsNodePool $var + * @return $this + */ + public function setAwsNodePool($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeMultiCloud\V1\AwsNodePool::class); + $this->aws_node_pool = $var; + + return $this; + } + + /** + * Required. A client provided ID the resource. Must be unique within the + * parent resource. + * The provided ID will be part of the + * [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] resource name + * formatted as + * `projects//locations//awsClusters//awsNodePools/`. + * Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. + * + * Generated from protobuf field string aws_node_pool_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getAwsNodePoolId() + { + return $this->aws_node_pool_id; + } + + /** + * Required. A client provided ID the resource. Must be unique within the + * parent resource. + * The provided ID will be part of the + * [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] resource name + * formatted as + * `projects//locations//awsClusters//awsNodePools/`. + * Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. + * + * Generated from protobuf field string aws_node_pool_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setAwsNodePoolId($var) + { + GPBUtil::checkString($var, True); + $this->aws_node_pool_id = $var; + + return $this; + } + + /** + * If set, only validate the request, but do not actually create the node + * pool. + * + * Generated from protobuf field bool validate_only = 4; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * If set, only validate the request, but do not actually create the node + * pool. + * + * Generated from protobuf field bool validate_only = 4; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/CreateAzureClientRequest.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/CreateAzureClientRequest.php new file mode 100644 index 000000000000..79ffc0e05dc3 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/CreateAzureClientRequest.php @@ -0,0 +1,261 @@ +google.cloud.gkemulticloud.v1.CreateAzureClientRequest + */ +class CreateAzureClientRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent location where this + * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] resource will be + * created. + * Location names are formatted as `projects//locations/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The specification of the + * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] to create. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureClient azure_client = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $azure_client = null; + /** + * Required. A client provided ID the resource. Must be unique within the + * parent resource. + * The provided ID will be part of the + * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] resource name + * formatted as + * `projects//locations//azureClients/`. + * Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. + * + * Generated from protobuf field string azure_client_id = 4 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $azure_client_id = ''; + /** + * If set, only validate the request, but do not actually create the client. + * + * Generated from protobuf field bool validate_only = 3; + */ + protected $validate_only = false; + + /** + * @param string $parent Required. The parent location where this + * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] resource will be + * created. + * + * Location names are formatted as `projects//locations/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. Please see + * {@see AzureClustersClient::locationName()} for help formatting this field. + * @param \Google\Cloud\GkeMultiCloud\V1\AzureClient $azureClient Required. The specification of the + * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] to create. + * @param string $azureClientId Required. A client provided ID the resource. Must be unique within the + * parent resource. + * + * The provided ID will be part of the + * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] resource name + * formatted as + * `projects//locations//azureClients/`. + * + * Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. + * + * @return \Google\Cloud\GkeMultiCloud\V1\CreateAzureClientRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\GkeMultiCloud\V1\AzureClient $azureClient, string $azureClientId): self + { + return (new self()) + ->setParent($parent) + ->setAzureClient($azureClient) + ->setAzureClientId($azureClientId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The parent location where this + * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] resource will be + * created. + * Location names are formatted as `projects//locations/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * @type \Google\Cloud\GkeMultiCloud\V1\AzureClient $azure_client + * Required. The specification of the + * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] to create. + * @type string $azure_client_id + * Required. A client provided ID the resource. Must be unique within the + * parent resource. + * The provided ID will be part of the + * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] resource name + * formatted as + * `projects//locations//azureClients/`. + * Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. + * @type bool $validate_only + * If set, only validate the request, but do not actually create the client. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AzureService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent location where this + * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] resource will be + * created. + * Location names are formatted as `projects//locations/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * + * 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. The parent location where this + * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] resource will be + * created. + * Location names are formatted as `projects//locations/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * + * 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. The specification of the + * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] to create. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureClient azure_client = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\GkeMultiCloud\V1\AzureClient|null + */ + public function getAzureClient() + { + return $this->azure_client; + } + + public function hasAzureClient() + { + return isset($this->azure_client); + } + + public function clearAzureClient() + { + unset($this->azure_client); + } + + /** + * Required. The specification of the + * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] to create. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureClient azure_client = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\GkeMultiCloud\V1\AzureClient $var + * @return $this + */ + public function setAzureClient($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeMultiCloud\V1\AzureClient::class); + $this->azure_client = $var; + + return $this; + } + + /** + * Required. A client provided ID the resource. Must be unique within the + * parent resource. + * The provided ID will be part of the + * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] resource name + * formatted as + * `projects//locations//azureClients/`. + * Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. + * + * Generated from protobuf field string azure_client_id = 4 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getAzureClientId() + { + return $this->azure_client_id; + } + + /** + * Required. A client provided ID the resource. Must be unique within the + * parent resource. + * The provided ID will be part of the + * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] resource name + * formatted as + * `projects//locations//azureClients/`. + * Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. + * + * Generated from protobuf field string azure_client_id = 4 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setAzureClientId($var) + { + GPBUtil::checkString($var, True); + $this->azure_client_id = $var; + + return $this; + } + + /** + * If set, only validate the request, but do not actually create the client. + * + * Generated from protobuf field bool validate_only = 3; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * If set, only validate the request, but do not actually create the client. + * + * Generated from protobuf field bool validate_only = 3; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/CreateAzureClusterRequest.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/CreateAzureClusterRequest.php new file mode 100644 index 000000000000..4a91100acf58 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/CreateAzureClusterRequest.php @@ -0,0 +1,261 @@ +google.cloud.gkemulticloud.v1.CreateAzureClusterRequest + */ +class CreateAzureClusterRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent location where this + * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource will be + * created. + * Location names are formatted as `projects//locations/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The specification of the + * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] to create. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureCluster azure_cluster = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $azure_cluster = null; + /** + * Required. A client provided ID the resource. Must be unique within the + * parent resource. + * The provided ID will be part of the + * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource name + * formatted as + * `projects//locations//azureClusters/`. + * Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. + * + * Generated from protobuf field string azure_cluster_id = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $azure_cluster_id = ''; + /** + * If set, only validate the request, but do not actually create the cluster. + * + * Generated from protobuf field bool validate_only = 4; + */ + protected $validate_only = false; + + /** + * @param string $parent Required. The parent location where this + * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource will be + * created. + * + * Location names are formatted as `projects//locations/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. Please see + * {@see AzureClustersClient::locationName()} for help formatting this field. + * @param \Google\Cloud\GkeMultiCloud\V1\AzureCluster $azureCluster Required. The specification of the + * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] to create. + * @param string $azureClusterId Required. A client provided ID the resource. Must be unique within the + * parent resource. + * + * The provided ID will be part of the + * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource name + * formatted as + * `projects//locations//azureClusters/`. + * + * Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. + * + * @return \Google\Cloud\GkeMultiCloud\V1\CreateAzureClusterRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\GkeMultiCloud\V1\AzureCluster $azureCluster, string $azureClusterId): self + { + return (new self()) + ->setParent($parent) + ->setAzureCluster($azureCluster) + ->setAzureClusterId($azureClusterId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The parent location where this + * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource will be + * created. + * Location names are formatted as `projects//locations/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * @type \Google\Cloud\GkeMultiCloud\V1\AzureCluster $azure_cluster + * Required. The specification of the + * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] to create. + * @type string $azure_cluster_id + * Required. A client provided ID the resource. Must be unique within the + * parent resource. + * The provided ID will be part of the + * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource name + * formatted as + * `projects//locations//azureClusters/`. + * Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. + * @type bool $validate_only + * If set, only validate the request, but do not actually create the cluster. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AzureService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent location where this + * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource will be + * created. + * Location names are formatted as `projects//locations/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * + * 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. The parent location where this + * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource will be + * created. + * Location names are formatted as `projects//locations/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * + * 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. The specification of the + * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] to create. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureCluster azure_cluster = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\GkeMultiCloud\V1\AzureCluster|null + */ + public function getAzureCluster() + { + return $this->azure_cluster; + } + + public function hasAzureCluster() + { + return isset($this->azure_cluster); + } + + public function clearAzureCluster() + { + unset($this->azure_cluster); + } + + /** + * Required. The specification of the + * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] to create. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureCluster azure_cluster = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\GkeMultiCloud\V1\AzureCluster $var + * @return $this + */ + public function setAzureCluster($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeMultiCloud\V1\AzureCluster::class); + $this->azure_cluster = $var; + + return $this; + } + + /** + * Required. A client provided ID the resource. Must be unique within the + * parent resource. + * The provided ID will be part of the + * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource name + * formatted as + * `projects//locations//azureClusters/`. + * Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. + * + * Generated from protobuf field string azure_cluster_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getAzureClusterId() + { + return $this->azure_cluster_id; + } + + /** + * Required. A client provided ID the resource. Must be unique within the + * parent resource. + * The provided ID will be part of the + * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource name + * formatted as + * `projects//locations//azureClusters/`. + * Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. + * + * Generated from protobuf field string azure_cluster_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setAzureClusterId($var) + { + GPBUtil::checkString($var, True); + $this->azure_cluster_id = $var; + + return $this; + } + + /** + * If set, only validate the request, but do not actually create the cluster. + * + * Generated from protobuf field bool validate_only = 4; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * If set, only validate the request, but do not actually create the cluster. + * + * Generated from protobuf field bool validate_only = 4; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/CreateAzureNodePoolRequest.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/CreateAzureNodePoolRequest.php new file mode 100644 index 000000000000..ea6409e0b8d9 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/CreateAzureNodePoolRequest.php @@ -0,0 +1,260 @@ +google.cloud.gkemulticloud.v1.CreateAzureNodePoolRequest + */ +class CreateAzureNodePoolRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] + * resource where this node pool will be created. + * Location names are formatted as `projects//locations/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The specification of the + * [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] to create. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureNodePool azure_node_pool = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $azure_node_pool = null; + /** + * Required. A client provided ID the resource. Must be unique within the + * parent resource. + * The provided ID will be part of the + * [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] resource name + * formatted as + * `projects//locations//azureClusters//azureNodePools/`. + * Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. + * + * Generated from protobuf field string azure_node_pool_id = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $azure_node_pool_id = ''; + /** + * If set, only validate the request, but do not actually create the node + * pool. + * + * Generated from protobuf field bool validate_only = 4; + */ + protected $validate_only = false; + + /** + * @param string $parent Required. The [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] + * resource where this node pool will be created. + * + * Location names are formatted as `projects//locations/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. Please see + * {@see AzureClustersClient::azureClusterName()} for help formatting this field. + * @param \Google\Cloud\GkeMultiCloud\V1\AzureNodePool $azureNodePool Required. The specification of the + * [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] to create. + * @param string $azureNodePoolId Required. A client provided ID the resource. Must be unique within the + * parent resource. + * + * The provided ID will be part of the + * [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] resource name + * formatted as + * `projects//locations//azureClusters//azureNodePools/`. + * + * Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. + * + * @return \Google\Cloud\GkeMultiCloud\V1\CreateAzureNodePoolRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\GkeMultiCloud\V1\AzureNodePool $azureNodePool, string $azureNodePoolId): self + { + return (new self()) + ->setParent($parent) + ->setAzureNodePool($azureNodePool) + ->setAzureNodePoolId($azureNodePoolId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] + * resource where this node pool will be created. + * Location names are formatted as `projects//locations/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * @type \Google\Cloud\GkeMultiCloud\V1\AzureNodePool $azure_node_pool + * Required. The specification of the + * [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] to create. + * @type string $azure_node_pool_id + * Required. A client provided ID the resource. Must be unique within the + * parent resource. + * The provided ID will be part of the + * [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] resource name + * formatted as + * `projects//locations//azureClusters//azureNodePools/`. + * Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. + * @type bool $validate_only + * If set, only validate the request, but do not actually create the node + * pool. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AzureService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] + * resource where this node pool will be created. + * Location names are formatted as `projects//locations/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * + * 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. The [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] + * resource where this node pool will be created. + * Location names are formatted as `projects//locations/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * + * 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. The specification of the + * [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] to create. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureNodePool azure_node_pool = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\GkeMultiCloud\V1\AzureNodePool|null + */ + public function getAzureNodePool() + { + return $this->azure_node_pool; + } + + public function hasAzureNodePool() + { + return isset($this->azure_node_pool); + } + + public function clearAzureNodePool() + { + unset($this->azure_node_pool); + } + + /** + * Required. The specification of the + * [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] to create. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureNodePool azure_node_pool = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\GkeMultiCloud\V1\AzureNodePool $var + * @return $this + */ + public function setAzureNodePool($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeMultiCloud\V1\AzureNodePool::class); + $this->azure_node_pool = $var; + + return $this; + } + + /** + * Required. A client provided ID the resource. Must be unique within the + * parent resource. + * The provided ID will be part of the + * [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] resource name + * formatted as + * `projects//locations//azureClusters//azureNodePools/`. + * Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. + * + * Generated from protobuf field string azure_node_pool_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getAzureNodePoolId() + { + return $this->azure_node_pool_id; + } + + /** + * Required. A client provided ID the resource. Must be unique within the + * parent resource. + * The provided ID will be part of the + * [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] resource name + * formatted as + * `projects//locations//azureClusters//azureNodePools/`. + * Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. + * + * Generated from protobuf field string azure_node_pool_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setAzureNodePoolId($var) + { + GPBUtil::checkString($var, True); + $this->azure_node_pool_id = $var; + + return $this; + } + + /** + * If set, only validate the request, but do not actually create the node + * pool. + * + * Generated from protobuf field bool validate_only = 4; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * If set, only validate the request, but do not actually create the node + * pool. + * + * Generated from protobuf field bool validate_only = 4; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/DeleteAttachedClusterRequest.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/DeleteAttachedClusterRequest.php new file mode 100644 index 000000000000..0d3c5f6c7d10 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/DeleteAttachedClusterRequest.php @@ -0,0 +1,292 @@ +google.cloud.gkemulticloud.v1.DeleteAttachedClusterRequest + */ +class DeleteAttachedClusterRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name the + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] to delete. + * `AttachedCluster` names are formatted as + * `projects//locations//attachedClusters/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * If set, only validate the request, but do not actually delete the resource. + * + * Generated from protobuf field bool validate_only = 2; + */ + protected $validate_only = false; + /** + * If set to true, and the + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource + * is not found, the request will succeed but no action will be taken on the + * server and a completed [Operation][google.longrunning.Operation] will be + * returned. + * Useful for idempotent deletion. + * + * Generated from protobuf field bool allow_missing = 3; + */ + protected $allow_missing = false; + /** + * If set to true, the deletion of + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource + * will succeed even if errors occur during deleting in cluster resources. + * Using this parameter may result in orphaned resources in the cluster. + * + * Generated from protobuf field bool ignore_errors = 5; + */ + protected $ignore_errors = false; + /** + * The current etag of the + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster]. + * Allows clients to perform deletions through optimistic concurrency control. + * If the provided etag does not match the current etag of the cluster, + * the request will fail and an ABORTED error will be returned. + * + * Generated from protobuf field string etag = 4; + */ + protected $etag = ''; + + /** + * @param string $name Required. The resource name the + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] to delete. + * + * `AttachedCluster` names are formatted as + * `projects//locations//attachedClusters/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. Please see + * {@see AttachedClustersClient::attachedClusterName()} for help formatting this field. + * + * @return \Google\Cloud\GkeMultiCloud\V1\DeleteAttachedClusterRequest + * + * @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 resource name the + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] to delete. + * `AttachedCluster` names are formatted as + * `projects//locations//attachedClusters/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * @type bool $validate_only + * If set, only validate the request, but do not actually delete the resource. + * @type bool $allow_missing + * If set to true, and the + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource + * is not found, the request will succeed but no action will be taken on the + * server and a completed [Operation][google.longrunning.Operation] will be + * returned. + * Useful for idempotent deletion. + * @type bool $ignore_errors + * If set to true, the deletion of + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource + * will succeed even if errors occur during deleting in cluster resources. + * Using this parameter may result in orphaned resources in the cluster. + * @type string $etag + * The current etag of the + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster]. + * Allows clients to perform deletions through optimistic concurrency control. + * If the provided etag does not match the current etag of the cluster, + * the request will fail and an ABORTED error will be returned. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AttachedService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name the + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] to delete. + * `AttachedCluster` names are formatted as + * `projects//locations//attachedClusters/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * + * 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 resource name the + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] to delete. + * `AttachedCluster` names are formatted as + * `projects//locations//attachedClusters/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * + * 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; + } + + /** + * If set, only validate the request, but do not actually delete the resource. + * + * Generated from protobuf field bool validate_only = 2; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * If set, only validate the request, but do not actually delete the resource. + * + * Generated from protobuf field bool validate_only = 2; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + + /** + * If set to true, and the + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource + * is not found, the request will succeed but no action will be taken on the + * server and a completed [Operation][google.longrunning.Operation] will be + * returned. + * Useful for idempotent deletion. + * + * Generated from protobuf field bool allow_missing = 3; + * @return bool + */ + public function getAllowMissing() + { + return $this->allow_missing; + } + + /** + * If set to true, and the + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource + * is not found, the request will succeed but no action will be taken on the + * server and a completed [Operation][google.longrunning.Operation] will be + * returned. + * Useful for idempotent deletion. + * + * Generated from protobuf field bool allow_missing = 3; + * @param bool $var + * @return $this + */ + public function setAllowMissing($var) + { + GPBUtil::checkBool($var); + $this->allow_missing = $var; + + return $this; + } + + /** + * If set to true, the deletion of + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource + * will succeed even if errors occur during deleting in cluster resources. + * Using this parameter may result in orphaned resources in the cluster. + * + * Generated from protobuf field bool ignore_errors = 5; + * @return bool + */ + public function getIgnoreErrors() + { + return $this->ignore_errors; + } + + /** + * If set to true, the deletion of + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource + * will succeed even if errors occur during deleting in cluster resources. + * Using this parameter may result in orphaned resources in the cluster. + * + * Generated from protobuf field bool ignore_errors = 5; + * @param bool $var + * @return $this + */ + public function setIgnoreErrors($var) + { + GPBUtil::checkBool($var); + $this->ignore_errors = $var; + + return $this; + } + + /** + * The current etag of the + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster]. + * Allows clients to perform deletions through optimistic concurrency control. + * If the provided etag does not match the current etag of the cluster, + * the request will fail and an ABORTED error will be returned. + * + * Generated from protobuf field string etag = 4; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * The current etag of the + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster]. + * Allows clients to perform deletions through optimistic concurrency control. + * If the provided etag does not match the current etag of the cluster, + * the request will fail and an ABORTED error will be returned. + * + * Generated from protobuf field string etag = 4; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, True); + $this->etag = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/DeleteAwsClusterRequest.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/DeleteAwsClusterRequest.php new file mode 100644 index 000000000000..c9a9c49f075c --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/DeleteAwsClusterRequest.php @@ -0,0 +1,242 @@ +google.cloud.gkemulticloud.v1.DeleteAwsClusterRequest + */ +class DeleteAwsClusterRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name the + * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] to delete. + * `AwsCluster` names are formatted as + * `projects//locations//awsClusters/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * If set, only validate the request, but do not actually delete the resource. + * + * Generated from protobuf field bool validate_only = 2; + */ + protected $validate_only = false; + /** + * If set to true, and the + * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resource is not + * found, the request will succeed but no action will be taken on the server + * and a completed [Operation][google.longrunning.Operation] will be returned. + * Useful for idempotent deletion. + * + * Generated from protobuf field bool allow_missing = 3; + */ + protected $allow_missing = false; + /** + * The current etag of the + * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster]. + * Allows clients to perform deletions through optimistic concurrency control. + * If the provided etag does not match the current etag of the cluster, + * the request will fail and an ABORTED error will be returned. + * + * Generated from protobuf field string etag = 4; + */ + protected $etag = ''; + + /** + * @param string $name Required. The resource name the + * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] to delete. + * + * `AwsCluster` names are formatted as + * `projects//locations//awsClusters/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. Please see + * {@see AwsClustersClient::awsClusterName()} for help formatting this field. + * + * @return \Google\Cloud\GkeMultiCloud\V1\DeleteAwsClusterRequest + * + * @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 resource name the + * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] to delete. + * `AwsCluster` names are formatted as + * `projects//locations//awsClusters/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * @type bool $validate_only + * If set, only validate the request, but do not actually delete the resource. + * @type bool $allow_missing + * If set to true, and the + * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resource is not + * found, the request will succeed but no action will be taken on the server + * and a completed [Operation][google.longrunning.Operation] will be returned. + * Useful for idempotent deletion. + * @type string $etag + * The current etag of the + * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster]. + * Allows clients to perform deletions through optimistic concurrency control. + * If the provided etag does not match the current etag of the cluster, + * the request will fail and an ABORTED error will be returned. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AwsService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name the + * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] to delete. + * `AwsCluster` names are formatted as + * `projects//locations//awsClusters/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * + * 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 resource name the + * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] to delete. + * `AwsCluster` names are formatted as + * `projects//locations//awsClusters/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * + * 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; + } + + /** + * If set, only validate the request, but do not actually delete the resource. + * + * Generated from protobuf field bool validate_only = 2; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * If set, only validate the request, but do not actually delete the resource. + * + * Generated from protobuf field bool validate_only = 2; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + + /** + * If set to true, and the + * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resource is not + * found, the request will succeed but no action will be taken on the server + * and a completed [Operation][google.longrunning.Operation] will be returned. + * Useful for idempotent deletion. + * + * Generated from protobuf field bool allow_missing = 3; + * @return bool + */ + public function getAllowMissing() + { + return $this->allow_missing; + } + + /** + * If set to true, and the + * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resource is not + * found, the request will succeed but no action will be taken on the server + * and a completed [Operation][google.longrunning.Operation] will be returned. + * Useful for idempotent deletion. + * + * Generated from protobuf field bool allow_missing = 3; + * @param bool $var + * @return $this + */ + public function setAllowMissing($var) + { + GPBUtil::checkBool($var); + $this->allow_missing = $var; + + return $this; + } + + /** + * The current etag of the + * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster]. + * Allows clients to perform deletions through optimistic concurrency control. + * If the provided etag does not match the current etag of the cluster, + * the request will fail and an ABORTED error will be returned. + * + * Generated from protobuf field string etag = 4; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * The current etag of the + * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster]. + * Allows clients to perform deletions through optimistic concurrency control. + * If the provided etag does not match the current etag of the cluster, + * the request will fail and an ABORTED error will be returned. + * + * Generated from protobuf field string etag = 4; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, True); + $this->etag = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/DeleteAwsNodePoolRequest.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/DeleteAwsNodePoolRequest.php new file mode 100644 index 000000000000..98468ae12816 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/DeleteAwsNodePoolRequest.php @@ -0,0 +1,246 @@ +google.cloud.gkemulticloud.v1.DeleteAwsNodePoolRequest + */ +class DeleteAwsNodePoolRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name the + * [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] to delete. + * `AwsNodePool` names are formatted as + * `projects//locations//awsClusters//awsNodePools/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * If set, only validate the request, but do not actually delete the node + * pool. + * + * Generated from protobuf field bool validate_only = 2; + */ + protected $validate_only = false; + /** + * If set to true, and the + * [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] resource is not + * found, the request will succeed but no action will be taken on the server + * and a completed [Operation][google.longrunning.Operation] will be returned. + * Useful for idempotent deletion. + * + * Generated from protobuf field bool allow_missing = 3; + */ + protected $allow_missing = false; + /** + * The current ETag of the + * [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool]. + * Allows clients to perform deletions through optimistic concurrency control. + * If the provided ETag does not match the current etag of the node pool, + * the request will fail and an ABORTED error will be returned. + * + * Generated from protobuf field string etag = 4; + */ + protected $etag = ''; + + /** + * @param string $name Required. The resource name the + * [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] to delete. + * + * `AwsNodePool` names are formatted as + * `projects//locations//awsClusters//awsNodePools/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. Please see + * {@see AwsClustersClient::awsNodePoolName()} for help formatting this field. + * + * @return \Google\Cloud\GkeMultiCloud\V1\DeleteAwsNodePoolRequest + * + * @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 resource name the + * [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] to delete. + * `AwsNodePool` names are formatted as + * `projects//locations//awsClusters//awsNodePools/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * @type bool $validate_only + * If set, only validate the request, but do not actually delete the node + * pool. + * @type bool $allow_missing + * If set to true, and the + * [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] resource is not + * found, the request will succeed but no action will be taken on the server + * and a completed [Operation][google.longrunning.Operation] will be returned. + * Useful for idempotent deletion. + * @type string $etag + * The current ETag of the + * [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool]. + * Allows clients to perform deletions through optimistic concurrency control. + * If the provided ETag does not match the current etag of the node pool, + * the request will fail and an ABORTED error will be returned. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AwsService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name the + * [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] to delete. + * `AwsNodePool` names are formatted as + * `projects//locations//awsClusters//awsNodePools/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * + * 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 resource name the + * [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] to delete. + * `AwsNodePool` names are formatted as + * `projects//locations//awsClusters//awsNodePools/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * + * 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; + } + + /** + * If set, only validate the request, but do not actually delete the node + * pool. + * + * Generated from protobuf field bool validate_only = 2; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * If set, only validate the request, but do not actually delete the node + * pool. + * + * Generated from protobuf field bool validate_only = 2; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + + /** + * If set to true, and the + * [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] resource is not + * found, the request will succeed but no action will be taken on the server + * and a completed [Operation][google.longrunning.Operation] will be returned. + * Useful for idempotent deletion. + * + * Generated from protobuf field bool allow_missing = 3; + * @return bool + */ + public function getAllowMissing() + { + return $this->allow_missing; + } + + /** + * If set to true, and the + * [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] resource is not + * found, the request will succeed but no action will be taken on the server + * and a completed [Operation][google.longrunning.Operation] will be returned. + * Useful for idempotent deletion. + * + * Generated from protobuf field bool allow_missing = 3; + * @param bool $var + * @return $this + */ + public function setAllowMissing($var) + { + GPBUtil::checkBool($var); + $this->allow_missing = $var; + + return $this; + } + + /** + * The current ETag of the + * [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool]. + * Allows clients to perform deletions through optimistic concurrency control. + * If the provided ETag does not match the current etag of the node pool, + * the request will fail and an ABORTED error will be returned. + * + * Generated from protobuf field string etag = 4; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * The current ETag of the + * [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool]. + * Allows clients to perform deletions through optimistic concurrency control. + * If the provided ETag does not match the current etag of the node pool, + * the request will fail and an ABORTED error will be returned. + * + * Generated from protobuf field string etag = 4; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, True); + $this->etag = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/DeleteAzureClientRequest.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/DeleteAzureClientRequest.php new file mode 100644 index 000000000000..37807fa3dee7 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/DeleteAzureClientRequest.php @@ -0,0 +1,197 @@ +google.cloud.gkemulticloud.v1.DeleteAzureClientRequest + */ +class DeleteAzureClientRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name the + * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] to delete. + * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] names are + * formatted as + * `projects//locations//azureClients/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * If set to true, and the + * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] resource is not + * found, the request will succeed but no action will be taken on the server + * and a completed [Operation][google.longrunning.Operation] will be returned. + * Useful for idempotent deletion. + * + * Generated from protobuf field bool allow_missing = 2; + */ + protected $allow_missing = false; + /** + * If set, only validate the request, but do not actually delete the resource. + * + * Generated from protobuf field bool validate_only = 3; + */ + protected $validate_only = false; + + /** + * @param string $name Required. The resource name the + * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] to delete. + * + * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] names are + * formatted as + * `projects//locations//azureClients/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. Please see + * {@see AzureClustersClient::azureClientName()} for help formatting this field. + * + * @return \Google\Cloud\GkeMultiCloud\V1\DeleteAzureClientRequest + * + * @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 resource name the + * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] to delete. + * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] names are + * formatted as + * `projects//locations//azureClients/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * @type bool $allow_missing + * If set to true, and the + * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] resource is not + * found, the request will succeed but no action will be taken on the server + * and a completed [Operation][google.longrunning.Operation] will be returned. + * Useful for idempotent deletion. + * @type bool $validate_only + * If set, only validate the request, but do not actually delete the resource. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AzureService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name the + * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] to delete. + * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] names are + * formatted as + * `projects//locations//azureClients/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * + * 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 resource name the + * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] to delete. + * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] names are + * formatted as + * `projects//locations//azureClients/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * + * 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; + } + + /** + * If set to true, and the + * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] resource is not + * found, the request will succeed but no action will be taken on the server + * and a completed [Operation][google.longrunning.Operation] will be returned. + * Useful for idempotent deletion. + * + * Generated from protobuf field bool allow_missing = 2; + * @return bool + */ + public function getAllowMissing() + { + return $this->allow_missing; + } + + /** + * If set to true, and the + * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] resource is not + * found, the request will succeed but no action will be taken on the server + * and a completed [Operation][google.longrunning.Operation] will be returned. + * Useful for idempotent deletion. + * + * Generated from protobuf field bool allow_missing = 2; + * @param bool $var + * @return $this + */ + public function setAllowMissing($var) + { + GPBUtil::checkBool($var); + $this->allow_missing = $var; + + return $this; + } + + /** + * If set, only validate the request, but do not actually delete the resource. + * + * Generated from protobuf field bool validate_only = 3; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * If set, only validate the request, but do not actually delete the resource. + * + * Generated from protobuf field bool validate_only = 3; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/DeleteAzureClusterRequest.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/DeleteAzureClusterRequest.php new file mode 100644 index 000000000000..ae9f0da3c04a --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/DeleteAzureClusterRequest.php @@ -0,0 +1,242 @@ +google.cloud.gkemulticloud.v1.DeleteAzureClusterRequest + */ +class DeleteAzureClusterRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name the + * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] to delete. + * `AzureCluster` names are formatted as + * `projects//locations//azureClusters/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * If set to true, and the + * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource is not + * found, the request will succeed but no action will be taken on the server + * and a completed [Operation][google.longrunning.Operation] will be returned. + * Useful for idempotent deletion. + * + * Generated from protobuf field bool allow_missing = 2; + */ + protected $allow_missing = false; + /** + * If set, only validate the request, but do not actually delete the resource. + * + * Generated from protobuf field bool validate_only = 3; + */ + protected $validate_only = false; + /** + * The current etag of the + * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster]. + * Allows clients to perform deletions through optimistic concurrency control. + * If the provided etag does not match the current etag of the cluster, + * the request will fail and an ABORTED error will be returned. + * + * Generated from protobuf field string etag = 4; + */ + protected $etag = ''; + + /** + * @param string $name Required. The resource name the + * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] to delete. + * + * `AzureCluster` names are formatted as + * `projects//locations//azureClusters/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. Please see + * {@see AzureClustersClient::azureClusterName()} for help formatting this field. + * + * @return \Google\Cloud\GkeMultiCloud\V1\DeleteAzureClusterRequest + * + * @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 resource name the + * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] to delete. + * `AzureCluster` names are formatted as + * `projects//locations//azureClusters/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * @type bool $allow_missing + * If set to true, and the + * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource is not + * found, the request will succeed but no action will be taken on the server + * and a completed [Operation][google.longrunning.Operation] will be returned. + * Useful for idempotent deletion. + * @type bool $validate_only + * If set, only validate the request, but do not actually delete the resource. + * @type string $etag + * The current etag of the + * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster]. + * Allows clients to perform deletions through optimistic concurrency control. + * If the provided etag does not match the current etag of the cluster, + * the request will fail and an ABORTED error will be returned. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AzureService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name the + * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] to delete. + * `AzureCluster` names are formatted as + * `projects//locations//azureClusters/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * + * 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 resource name the + * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] to delete. + * `AzureCluster` names are formatted as + * `projects//locations//azureClusters/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * + * 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; + } + + /** + * If set to true, and the + * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource is not + * found, the request will succeed but no action will be taken on the server + * and a completed [Operation][google.longrunning.Operation] will be returned. + * Useful for idempotent deletion. + * + * Generated from protobuf field bool allow_missing = 2; + * @return bool + */ + public function getAllowMissing() + { + return $this->allow_missing; + } + + /** + * If set to true, and the + * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource is not + * found, the request will succeed but no action will be taken on the server + * and a completed [Operation][google.longrunning.Operation] will be returned. + * Useful for idempotent deletion. + * + * Generated from protobuf field bool allow_missing = 2; + * @param bool $var + * @return $this + */ + public function setAllowMissing($var) + { + GPBUtil::checkBool($var); + $this->allow_missing = $var; + + return $this; + } + + /** + * If set, only validate the request, but do not actually delete the resource. + * + * Generated from protobuf field bool validate_only = 3; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * If set, only validate the request, but do not actually delete the resource. + * + * Generated from protobuf field bool validate_only = 3; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + + /** + * The current etag of the + * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster]. + * Allows clients to perform deletions through optimistic concurrency control. + * If the provided etag does not match the current etag of the cluster, + * the request will fail and an ABORTED error will be returned. + * + * Generated from protobuf field string etag = 4; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * The current etag of the + * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster]. + * Allows clients to perform deletions through optimistic concurrency control. + * If the provided etag does not match the current etag of the cluster, + * the request will fail and an ABORTED error will be returned. + * + * Generated from protobuf field string etag = 4; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, True); + $this->etag = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/DeleteAzureNodePoolRequest.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/DeleteAzureNodePoolRequest.php new file mode 100644 index 000000000000..80bf85309083 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/DeleteAzureNodePoolRequest.php @@ -0,0 +1,250 @@ +google.cloud.gkemulticloud.v1.DeleteAzureNodePoolRequest + */ +class DeleteAzureNodePoolRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name the + * [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] to delete. + * `AzureNodePool` names are formatted as + * `projects//locations//azureClusters//azureNodePools/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * If set, only validate the request, but do not actually delete the node + * pool. + * + * Generated from protobuf field bool validate_only = 2; + */ + protected $validate_only = false; + /** + * If set to true, and the + * [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] resource is + * not found, the request will succeed but no action will be taken on the + * server and a completed [Operation][google.longrunning.Operation] will be + * returned. + * Useful for idempotent deletion. + * + * Generated from protobuf field bool allow_missing = 3; + */ + protected $allow_missing = false; + /** + * The current ETag of the + * [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool]. + * Allows clients to perform deletions through optimistic concurrency control. + * If the provided ETag does not match the current etag of the node pool, + * the request will fail and an ABORTED error will be returned. + * + * Generated from protobuf field string etag = 4; + */ + protected $etag = ''; + + /** + * @param string $name Required. The resource name the + * [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] to delete. + * + * `AzureNodePool` names are formatted as + * `projects//locations//azureClusters//azureNodePools/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. Please see + * {@see AzureClustersClient::azureNodePoolName()} for help formatting this field. + * + * @return \Google\Cloud\GkeMultiCloud\V1\DeleteAzureNodePoolRequest + * + * @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 resource name the + * [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] to delete. + * `AzureNodePool` names are formatted as + * `projects//locations//azureClusters//azureNodePools/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * @type bool $validate_only + * If set, only validate the request, but do not actually delete the node + * pool. + * @type bool $allow_missing + * If set to true, and the + * [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] resource is + * not found, the request will succeed but no action will be taken on the + * server and a completed [Operation][google.longrunning.Operation] will be + * returned. + * Useful for idempotent deletion. + * @type string $etag + * The current ETag of the + * [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool]. + * Allows clients to perform deletions through optimistic concurrency control. + * If the provided ETag does not match the current etag of the node pool, + * the request will fail and an ABORTED error will be returned. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AzureService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name the + * [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] to delete. + * `AzureNodePool` names are formatted as + * `projects//locations//azureClusters//azureNodePools/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * + * 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 resource name the + * [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] to delete. + * `AzureNodePool` names are formatted as + * `projects//locations//azureClusters//azureNodePools/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * + * 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; + } + + /** + * If set, only validate the request, but do not actually delete the node + * pool. + * + * Generated from protobuf field bool validate_only = 2; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * If set, only validate the request, but do not actually delete the node + * pool. + * + * Generated from protobuf field bool validate_only = 2; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + + /** + * If set to true, and the + * [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] resource is + * not found, the request will succeed but no action will be taken on the + * server and a completed [Operation][google.longrunning.Operation] will be + * returned. + * Useful for idempotent deletion. + * + * Generated from protobuf field bool allow_missing = 3; + * @return bool + */ + public function getAllowMissing() + { + return $this->allow_missing; + } + + /** + * If set to true, and the + * [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] resource is + * not found, the request will succeed but no action will be taken on the + * server and a completed [Operation][google.longrunning.Operation] will be + * returned. + * Useful for idempotent deletion. + * + * Generated from protobuf field bool allow_missing = 3; + * @param bool $var + * @return $this + */ + public function setAllowMissing($var) + { + GPBUtil::checkBool($var); + $this->allow_missing = $var; + + return $this; + } + + /** + * The current ETag of the + * [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool]. + * Allows clients to perform deletions through optimistic concurrency control. + * If the provided ETag does not match the current etag of the node pool, + * the request will fail and an ABORTED error will be returned. + * + * Generated from protobuf field string etag = 4; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * The current ETag of the + * [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool]. + * Allows clients to perform deletions through optimistic concurrency control. + * If the provided ETag does not match the current etag of the node pool, + * the request will fail and an ABORTED error will be returned. + * + * Generated from protobuf field string etag = 4; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, True); + $this->etag = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/Fleet.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/Fleet.php new file mode 100644 index 000000000000..ddc8d53d7ae1 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/Fleet.php @@ -0,0 +1,131 @@ +google.cloud.gkemulticloud.v1.Fleet + */ +class Fleet extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the Fleet host project where this cluster will be + * registered. + * Project names are formatted as + * `projects/`. + * + * Generated from protobuf field string project = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $project = ''; + /** + * Output only. The name of the managed Hub Membership resource associated to + * this cluster. + * Membership names are formatted as + * `projects//locations/global/membership/`. + * + * Generated from protobuf field string membership = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $membership = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $project + * Required. The name of the Fleet host project where this cluster will be + * registered. + * Project names are formatted as + * `projects/`. + * @type string $membership + * Output only. The name of the managed Hub Membership resource associated to + * this cluster. + * Membership names are formatted as + * `projects//locations/global/membership/`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\CommonResources::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the Fleet host project where this cluster will be + * registered. + * Project names are formatted as + * `projects/`. + * + * Generated from protobuf field string project = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getProject() + { + return $this->project; + } + + /** + * Required. The name of the Fleet host project where this cluster will be + * registered. + * Project names are formatted as + * `projects/`. + * + * Generated from protobuf field string project = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setProject($var) + { + GPBUtil::checkString($var, True); + $this->project = $var; + + return $this; + } + + /** + * Output only. The name of the managed Hub Membership resource associated to + * this cluster. + * Membership names are formatted as + * `projects//locations/global/membership/`. + * + * Generated from protobuf field string membership = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getMembership() + { + return $this->membership; + } + + /** + * Output only. The name of the managed Hub Membership resource associated to + * this cluster. + * Membership names are formatted as + * `projects//locations/global/membership/`. + * + * Generated from protobuf field string membership = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setMembership($var) + { + GPBUtil::checkString($var, True); + $this->membership = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/GenerateAttachedClusterInstallManifestRequest.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/GenerateAttachedClusterInstallManifestRequest.php new file mode 100644 index 000000000000..7ed907705b7e --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/GenerateAttachedClusterInstallManifestRequest.php @@ -0,0 +1,245 @@ +google.cloud.gkemulticloud.v1.GenerateAttachedClusterInstallManifestRequest + */ +class GenerateAttachedClusterInstallManifestRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent location where this + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource + * will be created. + * Location names are formatted as `projects//locations/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. A client provided ID of the resource. Must be unique within the + * parent resource. + * The provided ID will be part of the + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource + * name formatted as + * `projects//locations//attachedClusters/`. + * Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. + * When generating an install manifest for importing an existing Membership + * resource, the attached_cluster_id field must be the Membership id. + * Membership names are formatted as + * `projects//locations//memberships/`. + * + * Generated from protobuf field string attached_cluster_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $attached_cluster_id = ''; + /** + * Required. The platform version for the cluster (e.g. `1.19.0-gke.1000`). + * You can list all supported versions on a given Google Cloud region by + * calling + * [GetAttachedServerConfig][google.cloud.gkemulticloud.v1.AttachedClusters.GetAttachedServerConfig]. + * + * Generated from protobuf field string platform_version = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $platform_version = ''; + + /** + * @param string $parent Required. The parent location where this + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource + * will be created. + * + * Location names are formatted as `projects//locations/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. Please see + * {@see AttachedClustersClient::locationName()} for help formatting this field. + * @param string $attachedClusterId Required. A client provided ID of the resource. Must be unique within the + * parent resource. + * + * The provided ID will be part of the + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource + * name formatted as + * `projects//locations//attachedClusters/`. + * + * Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. + * + * When generating an install manifest for importing an existing Membership + * resource, the attached_cluster_id field must be the Membership id. + * + * Membership names are formatted as + * `projects//locations//memberships/`. + * + * @return \Google\Cloud\GkeMultiCloud\V1\GenerateAttachedClusterInstallManifestRequest + * + * @experimental + */ + public static function build(string $parent, string $attachedClusterId): self + { + return (new self()) + ->setParent($parent) + ->setAttachedClusterId($attachedClusterId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The parent location where this + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource + * will be created. + * Location names are formatted as `projects//locations/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * @type string $attached_cluster_id + * Required. A client provided ID of the resource. Must be unique within the + * parent resource. + * The provided ID will be part of the + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource + * name formatted as + * `projects//locations//attachedClusters/`. + * Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. + * When generating an install manifest for importing an existing Membership + * resource, the attached_cluster_id field must be the Membership id. + * Membership names are formatted as + * `projects//locations//memberships/`. + * @type string $platform_version + * Required. The platform version for the cluster (e.g. `1.19.0-gke.1000`). + * You can list all supported versions on a given Google Cloud region by + * calling + * [GetAttachedServerConfig][google.cloud.gkemulticloud.v1.AttachedClusters.GetAttachedServerConfig]. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AttachedService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent location where this + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource + * will be created. + * Location names are formatted as `projects//locations/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * + * 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. The parent location where this + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource + * will be created. + * Location names are formatted as `projects//locations/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * + * 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. A client provided ID of the resource. Must be unique within the + * parent resource. + * The provided ID will be part of the + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource + * name formatted as + * `projects//locations//attachedClusters/`. + * Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. + * When generating an install manifest for importing an existing Membership + * resource, the attached_cluster_id field must be the Membership id. + * Membership names are formatted as + * `projects//locations//memberships/`. + * + * Generated from protobuf field string attached_cluster_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getAttachedClusterId() + { + return $this->attached_cluster_id; + } + + /** + * Required. A client provided ID of the resource. Must be unique within the + * parent resource. + * The provided ID will be part of the + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource + * name formatted as + * `projects//locations//attachedClusters/`. + * Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. + * When generating an install manifest for importing an existing Membership + * resource, the attached_cluster_id field must be the Membership id. + * Membership names are formatted as + * `projects//locations//memberships/`. + * + * Generated from protobuf field string attached_cluster_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setAttachedClusterId($var) + { + GPBUtil::checkString($var, True); + $this->attached_cluster_id = $var; + + return $this; + } + + /** + * Required. The platform version for the cluster (e.g. `1.19.0-gke.1000`). + * You can list all supported versions on a given Google Cloud region by + * calling + * [GetAttachedServerConfig][google.cloud.gkemulticloud.v1.AttachedClusters.GetAttachedServerConfig]. + * + * Generated from protobuf field string platform_version = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getPlatformVersion() + { + return $this->platform_version; + } + + /** + * Required. The platform version for the cluster (e.g. `1.19.0-gke.1000`). + * You can list all supported versions on a given Google Cloud region by + * calling + * [GetAttachedServerConfig][google.cloud.gkemulticloud.v1.AttachedClusters.GetAttachedServerConfig]. + * + * Generated from protobuf field string platform_version = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setPlatformVersion($var) + { + GPBUtil::checkString($var, True); + $this->platform_version = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/GenerateAttachedClusterInstallManifestResponse.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/GenerateAttachedClusterInstallManifestResponse.php new file mode 100644 index 000000000000..558f3fe1e5d2 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/GenerateAttachedClusterInstallManifestResponse.php @@ -0,0 +1,72 @@ +google.cloud.gkemulticloud.v1.GenerateAttachedClusterInstallManifestResponse + */ +class GenerateAttachedClusterInstallManifestResponse extends \Google\Protobuf\Internal\Message +{ + /** + * A set of Kubernetes resources (in YAML format) to be applied + * to the cluster to be attached. + * + * Generated from protobuf field string manifest = 1; + */ + protected $manifest = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $manifest + * A set of Kubernetes resources (in YAML format) to be applied + * to the cluster to be attached. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AttachedService::initOnce(); + parent::__construct($data); + } + + /** + * A set of Kubernetes resources (in YAML format) to be applied + * to the cluster to be attached. + * + * Generated from protobuf field string manifest = 1; + * @return string + */ + public function getManifest() + { + return $this->manifest; + } + + /** + * A set of Kubernetes resources (in YAML format) to be applied + * to the cluster to be attached. + * + * Generated from protobuf field string manifest = 1; + * @param string $var + * @return $this + */ + public function setManifest($var) + { + GPBUtil::checkString($var, True); + $this->manifest = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/GenerateAwsAccessTokenRequest.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/GenerateAwsAccessTokenRequest.php new file mode 100644 index 000000000000..d3d109e81257 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/GenerateAwsAccessTokenRequest.php @@ -0,0 +1,91 @@ +google.cloud.gkemulticloud.v1.GenerateAwsAccessTokenRequest + */ +class GenerateAwsAccessTokenRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the + * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resource to + * authenticate to. + * `AwsCluster` names are formatted as + * `projects//locations//awsClusters/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * + * Generated from protobuf field string aws_cluster = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $aws_cluster = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $aws_cluster + * Required. The name of the + * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resource to + * authenticate to. + * `AwsCluster` names are formatted as + * `projects//locations//awsClusters/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AwsService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the + * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resource to + * authenticate to. + * `AwsCluster` names are formatted as + * `projects//locations//awsClusters/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * + * Generated from protobuf field string aws_cluster = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getAwsCluster() + { + return $this->aws_cluster; + } + + /** + * Required. The name of the + * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resource to + * authenticate to. + * `AwsCluster` names are formatted as + * `projects//locations//awsClusters/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * + * Generated from protobuf field string aws_cluster = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setAwsCluster($var) + { + GPBUtil::checkString($var, True); + $this->aws_cluster = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/GenerateAwsAccessTokenResponse.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/GenerateAwsAccessTokenResponse.php new file mode 100644 index 000000000000..35f1695ffc34 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/GenerateAwsAccessTokenResponse.php @@ -0,0 +1,111 @@ +google.cloud.gkemulticloud.v1.GenerateAwsAccessTokenResponse + */ +class GenerateAwsAccessTokenResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. Access token to authenticate to k8s api-server. + * + * Generated from protobuf field string access_token = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $access_token = ''; + /** + * Output only. Timestamp at which the token will expire. + * + * Generated from protobuf field .google.protobuf.Timestamp expiration_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $expiration_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $access_token + * Output only. Access token to authenticate to k8s api-server. + * @type \Google\Protobuf\Timestamp $expiration_time + * Output only. Timestamp at which the token will expire. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AwsService::initOnce(); + parent::__construct($data); + } + + /** + * Output only. Access token to authenticate to k8s api-server. + * + * Generated from protobuf field string access_token = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getAccessToken() + { + return $this->access_token; + } + + /** + * Output only. Access token to authenticate to k8s api-server. + * + * Generated from protobuf field string access_token = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setAccessToken($var) + { + GPBUtil::checkString($var, True); + $this->access_token = $var; + + return $this; + } + + /** + * Output only. Timestamp at which the token will expire. + * + * Generated from protobuf field .google.protobuf.Timestamp expiration_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getExpirationTime() + { + return $this->expiration_time; + } + + public function hasExpirationTime() + { + return isset($this->expiration_time); + } + + public function clearExpirationTime() + { + unset($this->expiration_time); + } + + /** + * Output only. Timestamp at which the token will expire. + * + * Generated from protobuf field .google.protobuf.Timestamp expiration_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setExpirationTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->expiration_time = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/GenerateAzureAccessTokenRequest.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/GenerateAzureAccessTokenRequest.php new file mode 100644 index 000000000000..f655c348d217 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/GenerateAzureAccessTokenRequest.php @@ -0,0 +1,91 @@ +google.cloud.gkemulticloud.v1.GenerateAzureAccessTokenRequest + */ +class GenerateAzureAccessTokenRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the + * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource to + * authenticate to. + * `AzureCluster` names are formatted as + * `projects//locations//AzureClusters/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * + * Generated from protobuf field string azure_cluster = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $azure_cluster = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $azure_cluster + * Required. The name of the + * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource to + * authenticate to. + * `AzureCluster` names are formatted as + * `projects//locations//AzureClusters/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AzureService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the + * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource to + * authenticate to. + * `AzureCluster` names are formatted as + * `projects//locations//AzureClusters/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * + * Generated from protobuf field string azure_cluster = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getAzureCluster() + { + return $this->azure_cluster; + } + + /** + * Required. The name of the + * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource to + * authenticate to. + * `AzureCluster` names are formatted as + * `projects//locations//AzureClusters/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * + * Generated from protobuf field string azure_cluster = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setAzureCluster($var) + { + GPBUtil::checkString($var, True); + $this->azure_cluster = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/GenerateAzureAccessTokenResponse.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/GenerateAzureAccessTokenResponse.php new file mode 100644 index 000000000000..4371394919c5 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/GenerateAzureAccessTokenResponse.php @@ -0,0 +1,111 @@ +google.cloud.gkemulticloud.v1.GenerateAzureAccessTokenResponse + */ +class GenerateAzureAccessTokenResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. Access token to authenticate to k8s api-server. + * + * Generated from protobuf field string access_token = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $access_token = ''; + /** + * Output only. Timestamp at which the token will expire. + * + * Generated from protobuf field .google.protobuf.Timestamp expiration_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $expiration_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $access_token + * Output only. Access token to authenticate to k8s api-server. + * @type \Google\Protobuf\Timestamp $expiration_time + * Output only. Timestamp at which the token will expire. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AzureService::initOnce(); + parent::__construct($data); + } + + /** + * Output only. Access token to authenticate to k8s api-server. + * + * Generated from protobuf field string access_token = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getAccessToken() + { + return $this->access_token; + } + + /** + * Output only. Access token to authenticate to k8s api-server. + * + * Generated from protobuf field string access_token = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setAccessToken($var) + { + GPBUtil::checkString($var, True); + $this->access_token = $var; + + return $this; + } + + /** + * Output only. Timestamp at which the token will expire. + * + * Generated from protobuf field .google.protobuf.Timestamp expiration_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getExpirationTime() + { + return $this->expiration_time; + } + + public function hasExpirationTime() + { + return isset($this->expiration_time); + } + + public function clearExpirationTime() + { + unset($this->expiration_time); + } + + /** + * Output only. Timestamp at which the token will expire. + * + * Generated from protobuf field .google.protobuf.Timestamp expiration_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setExpirationTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->expiration_time = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/GetAttachedClusterRequest.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/GetAttachedClusterRequest.php new file mode 100644 index 000000000000..b5da37d6fa0a --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/GetAttachedClusterRequest.php @@ -0,0 +1,113 @@ +google.cloud.gkemulticloud.v1.GetAttachedClusterRequest + */ +class GetAttachedClusterRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource + * to describe. + * `AttachedCluster` names are formatted as + * `projects//locations//attachedClusters/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The name of the + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource + * to describe. + * + * `AttachedCluster` names are formatted as + * `projects//locations//attachedClusters/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. Please see + * {@see AttachedClustersClient::attachedClusterName()} for help formatting this field. + * + * @return \Google\Cloud\GkeMultiCloud\V1\GetAttachedClusterRequest + * + * @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 + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource + * to describe. + * `AttachedCluster` names are formatted as + * `projects//locations//attachedClusters/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AttachedService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource + * to describe. + * `AttachedCluster` names are formatted as + * `projects//locations//attachedClusters/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * + * 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 + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource + * to describe. + * `AttachedCluster` names are formatted as + * `projects//locations//attachedClusters/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * + * 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; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/GetAttachedServerConfigRequest.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/GetAttachedServerConfigRequest.php new file mode 100644 index 000000000000..f2ed61ae77c5 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/GetAttachedServerConfigRequest.php @@ -0,0 +1,114 @@ +google.cloud.gkemulticloud.v1.GetAttachedServerConfigRequest + */ +class GetAttachedServerConfigRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the + * [AttachedServerConfig][google.cloud.gkemulticloud.v1.AttachedServerConfig] + * resource to describe. + * `AttachedServerConfig` names are formatted as + * `projects//locations//attachedServerConfig`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The name of the + * [AttachedServerConfig][google.cloud.gkemulticloud.v1.AttachedServerConfig] + * resource to describe. + * + * `AttachedServerConfig` names are formatted as + * `projects//locations//attachedServerConfig`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. Please see + * {@see AttachedClustersClient::attachedServerConfigName()} for help formatting this field. + * + * @return \Google\Cloud\GkeMultiCloud\V1\GetAttachedServerConfigRequest + * + * @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 + * [AttachedServerConfig][google.cloud.gkemulticloud.v1.AttachedServerConfig] + * resource to describe. + * `AttachedServerConfig` names are formatted as + * `projects//locations//attachedServerConfig`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AttachedService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the + * [AttachedServerConfig][google.cloud.gkemulticloud.v1.AttachedServerConfig] + * resource to describe. + * `AttachedServerConfig` names are formatted as + * `projects//locations//attachedServerConfig`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * + * 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 + * [AttachedServerConfig][google.cloud.gkemulticloud.v1.AttachedServerConfig] + * resource to describe. + * `AttachedServerConfig` names are formatted as + * `projects//locations//attachedServerConfig`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * + * 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; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/GetAwsClusterRequest.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/GetAwsClusterRequest.php new file mode 100644 index 000000000000..1a522d11bbb5 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/GetAwsClusterRequest.php @@ -0,0 +1,113 @@ +google.cloud.gkemulticloud.v1.GetAwsClusterRequest + */ +class GetAwsClusterRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the + * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resource to + * describe. + * `AwsCluster` names are formatted as + * `projects//locations//awsClusters/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The name of the + * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resource to + * describe. + * + * `AwsCluster` names are formatted as + * `projects//locations//awsClusters/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. Please see + * {@see AwsClustersClient::awsClusterName()} for help formatting this field. + * + * @return \Google\Cloud\GkeMultiCloud\V1\GetAwsClusterRequest + * + * @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 + * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resource to + * describe. + * `AwsCluster` names are formatted as + * `projects//locations//awsClusters/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AwsService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the + * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resource to + * describe. + * `AwsCluster` names are formatted as + * `projects//locations//awsClusters/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * + * 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 + * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resource to + * describe. + * `AwsCluster` names are formatted as + * `projects//locations//awsClusters/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * + * 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; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/GetAwsNodePoolRequest.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/GetAwsNodePoolRequest.php new file mode 100644 index 000000000000..549d270d9f3e --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/GetAwsNodePoolRequest.php @@ -0,0 +1,113 @@ +google.cloud.gkemulticloud.v1.GetAwsNodePoolRequest + */ +class GetAwsNodePoolRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the + * [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] resource to + * describe. + * `AwsNodePool` names are formatted as + * `projects//locations//awsClusters//awsNodePools/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The name of the + * [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] resource to + * describe. + * + * `AwsNodePool` names are formatted as + * `projects//locations//awsClusters//awsNodePools/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. Please see + * {@see AwsClustersClient::awsNodePoolName()} for help formatting this field. + * + * @return \Google\Cloud\GkeMultiCloud\V1\GetAwsNodePoolRequest + * + * @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 + * [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] resource to + * describe. + * `AwsNodePool` names are formatted as + * `projects//locations//awsClusters//awsNodePools/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AwsService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the + * [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] resource to + * describe. + * `AwsNodePool` names are formatted as + * `projects//locations//awsClusters//awsNodePools/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * + * 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 + * [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] resource to + * describe. + * `AwsNodePool` names are formatted as + * `projects//locations//awsClusters//awsNodePools/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * + * 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; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/GetAwsServerConfigRequest.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/GetAwsServerConfigRequest.php new file mode 100644 index 000000000000..fe925dd0cc05 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/GetAwsServerConfigRequest.php @@ -0,0 +1,113 @@ +google.cloud.gkemulticloud.v1.GetAwsServerConfigRequest + */ +class GetAwsServerConfigRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the + * [AwsServerConfig][google.cloud.gkemulticloud.v1.AwsServerConfig] resource + * to describe. + * `AwsServerConfig` names are formatted as + * `projects//locations//awsServerConfig`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The name of the + * [AwsServerConfig][google.cloud.gkemulticloud.v1.AwsServerConfig] resource + * to describe. + * + * `AwsServerConfig` names are formatted as + * `projects//locations//awsServerConfig`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. Please see + * {@see AwsClustersClient::awsServerConfigName()} for help formatting this field. + * + * @return \Google\Cloud\GkeMultiCloud\V1\GetAwsServerConfigRequest + * + * @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 + * [AwsServerConfig][google.cloud.gkemulticloud.v1.AwsServerConfig] resource + * to describe. + * `AwsServerConfig` names are formatted as + * `projects//locations//awsServerConfig`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AwsService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the + * [AwsServerConfig][google.cloud.gkemulticloud.v1.AwsServerConfig] resource + * to describe. + * `AwsServerConfig` names are formatted as + * `projects//locations//awsServerConfig`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * + * 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 + * [AwsServerConfig][google.cloud.gkemulticloud.v1.AwsServerConfig] resource + * to describe. + * `AwsServerConfig` names are formatted as + * `projects//locations//awsServerConfig`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * + * 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; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/GetAzureClientRequest.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/GetAzureClientRequest.php new file mode 100644 index 000000000000..ce520b46f6bd --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/GetAzureClientRequest.php @@ -0,0 +1,118 @@ +google.cloud.gkemulticloud.v1.GetAzureClientRequest + */ +class GetAzureClientRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the + * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] resource to + * describe. + * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] names are + * formatted as + * `projects//locations//azureClients/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The name of the + * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] resource to + * describe. + * + * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] names are + * formatted as + * `projects//locations//azureClients/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. Please see + * {@see AzureClustersClient::azureClientName()} for help formatting this field. + * + * @return \Google\Cloud\GkeMultiCloud\V1\GetAzureClientRequest + * + * @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 + * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] resource to + * describe. + * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] names are + * formatted as + * `projects//locations//azureClients/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AzureService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the + * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] resource to + * describe. + * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] names are + * formatted as + * `projects//locations//azureClients/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * + * 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 + * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] resource to + * describe. + * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] names are + * formatted as + * `projects//locations//azureClients/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * + * 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; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/GetAzureClusterRequest.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/GetAzureClusterRequest.php new file mode 100644 index 000000000000..c0403c71bf54 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/GetAzureClusterRequest.php @@ -0,0 +1,113 @@ +google.cloud.gkemulticloud.v1.GetAzureClusterRequest + */ +class GetAzureClusterRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the + * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource to + * describe. + * `AzureCluster` names are formatted as + * `projects//locations//azureClusters/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The name of the + * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource to + * describe. + * + * `AzureCluster` names are formatted as + * `projects//locations//azureClusters/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. Please see + * {@see AzureClustersClient::azureClusterName()} for help formatting this field. + * + * @return \Google\Cloud\GkeMultiCloud\V1\GetAzureClusterRequest + * + * @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 + * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource to + * describe. + * `AzureCluster` names are formatted as + * `projects//locations//azureClusters/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AzureService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the + * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource to + * describe. + * `AzureCluster` names are formatted as + * `projects//locations//azureClusters/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * + * 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 + * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource to + * describe. + * `AzureCluster` names are formatted as + * `projects//locations//azureClusters/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * + * 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; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/GetAzureNodePoolRequest.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/GetAzureNodePoolRequest.php new file mode 100644 index 000000000000..d491eade7bca --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/GetAzureNodePoolRequest.php @@ -0,0 +1,113 @@ +google.cloud.gkemulticloud.v1.GetAzureNodePoolRequest + */ +class GetAzureNodePoolRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the + * [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] resource to + * describe. + * `AzureNodePool` names are formatted as + * `projects//locations//azureClusters//azureNodePools/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The name of the + * [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] resource to + * describe. + * + * `AzureNodePool` names are formatted as + * `projects//locations//azureClusters//azureNodePools/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. Please see + * {@see AzureClustersClient::azureNodePoolName()} for help formatting this field. + * + * @return \Google\Cloud\GkeMultiCloud\V1\GetAzureNodePoolRequest + * + * @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 + * [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] resource to + * describe. + * `AzureNodePool` names are formatted as + * `projects//locations//azureClusters//azureNodePools/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AzureService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the + * [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] resource to + * describe. + * `AzureNodePool` names are formatted as + * `projects//locations//azureClusters//azureNodePools/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * + * 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 + * [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] resource to + * describe. + * `AzureNodePool` names are formatted as + * `projects//locations//azureClusters//azureNodePools/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * + * 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; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/GetAzureServerConfigRequest.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/GetAzureServerConfigRequest.php new file mode 100644 index 000000000000..933aca070c01 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/GetAzureServerConfigRequest.php @@ -0,0 +1,113 @@ +google.cloud.gkemulticloud.v1.GetAzureServerConfigRequest + */ +class GetAzureServerConfigRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the + * [AzureServerConfig][google.cloud.gkemulticloud.v1.AzureServerConfig] + * resource to describe. + * `AzureServerConfig` names are formatted as + * `projects//locations//azureServerConfig`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The name of the + * [AzureServerConfig][google.cloud.gkemulticloud.v1.AzureServerConfig] + * resource to describe. + * + * `AzureServerConfig` names are formatted as + * `projects//locations//azureServerConfig`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. Please see + * {@see AzureClustersClient::azureServerConfigName()} for help formatting this field. + * + * @return \Google\Cloud\GkeMultiCloud\V1\GetAzureServerConfigRequest + * + * @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 + * [AzureServerConfig][google.cloud.gkemulticloud.v1.AzureServerConfig] + * resource to describe. + * `AzureServerConfig` names are formatted as + * `projects//locations//azureServerConfig`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AzureService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the + * [AzureServerConfig][google.cloud.gkemulticloud.v1.AzureServerConfig] + * resource to describe. + * `AzureServerConfig` names are formatted as + * `projects//locations//azureServerConfig`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * + * 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 + * [AzureServerConfig][google.cloud.gkemulticloud.v1.AzureServerConfig] + * resource to describe. + * `AzureServerConfig` names are formatted as + * `projects//locations//azureServerConfig`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * + * 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; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/ImportAttachedClusterRequest.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/ImportAttachedClusterRequest.php new file mode 100644 index 000000000000..b34ae2947d2b --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/ImportAttachedClusterRequest.php @@ -0,0 +1,262 @@ +google.cloud.gkemulticloud.v1.ImportAttachedClusterRequest + */ +class ImportAttachedClusterRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent location where this + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource + * will be created. + * Location names are formatted as `projects//locations/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * If set, only validate the request, but do not actually import the cluster. + * + * Generated from protobuf field bool validate_only = 2; + */ + protected $validate_only = false; + /** + * Required. The name of the fleet membership resource to import. + * + * Generated from protobuf field string fleet_membership = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $fleet_membership = ''; + /** + * Required. The platform version for the cluster (e.g. `1.19.0-gke.1000`). + * You can list all supported versions on a given Google Cloud region by + * calling + * [GetAttachedServerConfig][google.cloud.gkemulticloud.v1.AttachedClusters.GetAttachedServerConfig]. + * + * Generated from protobuf field string platform_version = 4 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $platform_version = ''; + /** + * Required. The Kubernetes distribution of the underlying attached cluster. + * Supported values: ["eks", "aks"]. + * + * Generated from protobuf field string distribution = 5 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $distribution = ''; + + /** + * @param string $parent Required. The parent location where this + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource + * will be created. + * + * Location names are formatted as `projects//locations/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. Please see + * {@see AttachedClustersClient::locationName()} for help formatting this field. + * @param string $fleetMembership Required. The name of the fleet membership resource to import. + * + * @return \Google\Cloud\GkeMultiCloud\V1\ImportAttachedClusterRequest + * + * @experimental + */ + public static function build(string $parent, string $fleetMembership): self + { + return (new self()) + ->setParent($parent) + ->setFleetMembership($fleetMembership); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The parent location where this + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource + * will be created. + * Location names are formatted as `projects//locations/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * @type bool $validate_only + * If set, only validate the request, but do not actually import the cluster. + * @type string $fleet_membership + * Required. The name of the fleet membership resource to import. + * @type string $platform_version + * Required. The platform version for the cluster (e.g. `1.19.0-gke.1000`). + * You can list all supported versions on a given Google Cloud region by + * calling + * [GetAttachedServerConfig][google.cloud.gkemulticloud.v1.AttachedClusters.GetAttachedServerConfig]. + * @type string $distribution + * Required. The Kubernetes distribution of the underlying attached cluster. + * Supported values: ["eks", "aks"]. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AttachedService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent location where this + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource + * will be created. + * Location names are formatted as `projects//locations/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * + * 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. The parent location where this + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource + * will be created. + * Location names are formatted as `projects//locations/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * + * 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; + } + + /** + * If set, only validate the request, but do not actually import the cluster. + * + * Generated from protobuf field bool validate_only = 2; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * If set, only validate the request, but do not actually import the cluster. + * + * Generated from protobuf field bool validate_only = 2; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + + /** + * Required. The name of the fleet membership resource to import. + * + * Generated from protobuf field string fleet_membership = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getFleetMembership() + { + return $this->fleet_membership; + } + + /** + * Required. The name of the fleet membership resource to import. + * + * Generated from protobuf field string fleet_membership = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setFleetMembership($var) + { + GPBUtil::checkString($var, True); + $this->fleet_membership = $var; + + return $this; + } + + /** + * Required. The platform version for the cluster (e.g. `1.19.0-gke.1000`). + * You can list all supported versions on a given Google Cloud region by + * calling + * [GetAttachedServerConfig][google.cloud.gkemulticloud.v1.AttachedClusters.GetAttachedServerConfig]. + * + * Generated from protobuf field string platform_version = 4 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getPlatformVersion() + { + return $this->platform_version; + } + + /** + * Required. The platform version for the cluster (e.g. `1.19.0-gke.1000`). + * You can list all supported versions on a given Google Cloud region by + * calling + * [GetAttachedServerConfig][google.cloud.gkemulticloud.v1.AttachedClusters.GetAttachedServerConfig]. + * + * Generated from protobuf field string platform_version = 4 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setPlatformVersion($var) + { + GPBUtil::checkString($var, True); + $this->platform_version = $var; + + return $this; + } + + /** + * Required. The Kubernetes distribution of the underlying attached cluster. + * Supported values: ["eks", "aks"]. + * + * Generated from protobuf field string distribution = 5 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getDistribution() + { + return $this->distribution; + } + + /** + * Required. The Kubernetes distribution of the underlying attached cluster. + * Supported values: ["eks", "aks"]. + * + * Generated from protobuf field string distribution = 5 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setDistribution($var) + { + GPBUtil::checkString($var, True); + $this->distribution = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/ListAttachedClustersRequest.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/ListAttachedClustersRequest.php new file mode 100644 index 000000000000..dbf9477b5b25 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/ListAttachedClustersRequest.php @@ -0,0 +1,199 @@ +google.cloud.gkemulticloud.v1.ListAttachedClustersRequest + */ +class ListAttachedClustersRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent location which owns this collection of + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resources. + * Location names are formatted as `projects//locations/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The maximum number of items to return. + * If not specified, a default value of 50 will be used by the service. + * Regardless of the pageSize value, the response can include a partial list + * and a caller should only rely on response's + * [nextPageToken][google.cloud.gkemulticloud.v1.ListAttachedClustersResponse.next_page_token] + * to determine if there are more instances left to be queried. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * The `nextPageToken` value returned from a previous + * [attachedClusters.list][google.cloud.gkemulticloud.v1.AttachedClusters.ListAttachedClusters] + * request, if any. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + + /** + * @param string $parent Required. The parent location which owns this collection of + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resources. + * + * Location names are formatted as `projects//locations/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. Please see + * {@see AttachedClustersClient::locationName()} for help formatting this field. + * + * @return \Google\Cloud\GkeMultiCloud\V1\ListAttachedClustersRequest + * + * @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. The parent location which owns this collection of + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resources. + * Location names are formatted as `projects//locations/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * @type int $page_size + * The maximum number of items to return. + * If not specified, a default value of 50 will be used by the service. + * Regardless of the pageSize value, the response can include a partial list + * and a caller should only rely on response's + * [nextPageToken][google.cloud.gkemulticloud.v1.ListAttachedClustersResponse.next_page_token] + * to determine if there are more instances left to be queried. + * @type string $page_token + * The `nextPageToken` value returned from a previous + * [attachedClusters.list][google.cloud.gkemulticloud.v1.AttachedClusters.ListAttachedClusters] + * request, if any. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AttachedService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent location which owns this collection of + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resources. + * Location names are formatted as `projects//locations/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * + * 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. The parent location which owns this collection of + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resources. + * Location names are formatted as `projects//locations/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * + * 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; + } + + /** + * The maximum number of items to return. + * If not specified, a default value of 50 will be used by the service. + * Regardless of the pageSize value, the response can include a partial list + * and a caller should only rely on response's + * [nextPageToken][google.cloud.gkemulticloud.v1.ListAttachedClustersResponse.next_page_token] + * to determine if there are more instances left to be queried. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of items to return. + * If not specified, a default value of 50 will be used by the service. + * Regardless of the pageSize value, the response can include a partial list + * and a caller should only rely on response's + * [nextPageToken][google.cloud.gkemulticloud.v1.ListAttachedClustersResponse.next_page_token] + * to determine if there are more instances left to be queried. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * The `nextPageToken` value returned from a previous + * [attachedClusters.list][google.cloud.gkemulticloud.v1.AttachedClusters.ListAttachedClusters] + * request, if any. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * The `nextPageToken` value returned from a previous + * [attachedClusters.list][google.cloud.gkemulticloud.v1.AttachedClusters.ListAttachedClusters] + * request, if any. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/ListAttachedClustersResponse.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/ListAttachedClustersResponse.php new file mode 100644 index 000000000000..1252498f6346 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/ListAttachedClustersResponse.php @@ -0,0 +1,109 @@ +google.cloud.gkemulticloud.v1.ListAttachedClustersResponse + */ +class ListAttachedClustersResponse extends \Google\Protobuf\Internal\Message +{ + /** + * A list of [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] + * resources in the specified Google Cloud Platform project and region region. + * + * Generated from protobuf field repeated .google.cloud.gkemulticloud.v1.AttachedCluster attached_clusters = 1; + */ + private $attached_clusters; + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * 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\GkeMultiCloud\V1\AttachedCluster>|\Google\Protobuf\Internal\RepeatedField $attached_clusters + * A list of [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] + * resources in the specified Google Cloud Platform project and region region. + * @type string $next_page_token + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AttachedService::initOnce(); + parent::__construct($data); + } + + /** + * A list of [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] + * resources in the specified Google Cloud Platform project and region region. + * + * Generated from protobuf field repeated .google.cloud.gkemulticloud.v1.AttachedCluster attached_clusters = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAttachedClusters() + { + return $this->attached_clusters; + } + + /** + * A list of [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] + * resources in the specified Google Cloud Platform project and region region. + * + * Generated from protobuf field repeated .google.cloud.gkemulticloud.v1.AttachedCluster attached_clusters = 1; + * @param array<\Google\Cloud\GkeMultiCloud\V1\AttachedCluster>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAttachedClusters($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\GkeMultiCloud\V1\AttachedCluster::class); + $this->attached_clusters = $arr; + + return $this; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * 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/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/ListAwsClustersRequest.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/ListAwsClustersRequest.php new file mode 100644 index 000000000000..cabd399a840b --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/ListAwsClustersRequest.php @@ -0,0 +1,199 @@ +google.cloud.gkemulticloud.v1.ListAwsClustersRequest + */ +class ListAwsClustersRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent location which owns this collection of + * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resources. + * Location names are formatted as `projects//locations/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The maximum number of items to return. + * If not specified, a default value of 50 will be used by the service. + * Regardless of the pageSize value, the response can include a partial list + * and a caller should only rely on response's + * [nextPageToken][google.cloud.gkemulticloud.v1.ListAwsClustersResponse.next_page_token] + * to determine if there are more instances left to be queried. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * The `nextPageToken` value returned from a previous + * [awsClusters.list][google.cloud.gkemulticloud.v1.AwsClusters.ListAwsClusters] + * request, if any. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + + /** + * @param string $parent Required. The parent location which owns this collection of + * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resources. + * + * Location names are formatted as `projects//locations/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. Please see + * {@see AwsClustersClient::locationName()} for help formatting this field. + * + * @return \Google\Cloud\GkeMultiCloud\V1\ListAwsClustersRequest + * + * @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. The parent location which owns this collection of + * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resources. + * Location names are formatted as `projects//locations/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * @type int $page_size + * The maximum number of items to return. + * If not specified, a default value of 50 will be used by the service. + * Regardless of the pageSize value, the response can include a partial list + * and a caller should only rely on response's + * [nextPageToken][google.cloud.gkemulticloud.v1.ListAwsClustersResponse.next_page_token] + * to determine if there are more instances left to be queried. + * @type string $page_token + * The `nextPageToken` value returned from a previous + * [awsClusters.list][google.cloud.gkemulticloud.v1.AwsClusters.ListAwsClusters] + * request, if any. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AwsService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent location which owns this collection of + * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resources. + * Location names are formatted as `projects//locations/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * + * 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. The parent location which owns this collection of + * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resources. + * Location names are formatted as `projects//locations/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * + * 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; + } + + /** + * The maximum number of items to return. + * If not specified, a default value of 50 will be used by the service. + * Regardless of the pageSize value, the response can include a partial list + * and a caller should only rely on response's + * [nextPageToken][google.cloud.gkemulticloud.v1.ListAwsClustersResponse.next_page_token] + * to determine if there are more instances left to be queried. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of items to return. + * If not specified, a default value of 50 will be used by the service. + * Regardless of the pageSize value, the response can include a partial list + * and a caller should only rely on response's + * [nextPageToken][google.cloud.gkemulticloud.v1.ListAwsClustersResponse.next_page_token] + * to determine if there are more instances left to be queried. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * The `nextPageToken` value returned from a previous + * [awsClusters.list][google.cloud.gkemulticloud.v1.AwsClusters.ListAwsClusters] + * request, if any. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * The `nextPageToken` value returned from a previous + * [awsClusters.list][google.cloud.gkemulticloud.v1.AwsClusters.ListAwsClusters] + * request, if any. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/ListAwsClustersResponse.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/ListAwsClustersResponse.php new file mode 100644 index 000000000000..cf2c1a17dca9 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/ListAwsClustersResponse.php @@ -0,0 +1,109 @@ +google.cloud.gkemulticloud.v1.ListAwsClustersResponse + */ +class ListAwsClustersResponse extends \Google\Protobuf\Internal\Message +{ + /** + * A list of [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resources + * in the specified Google Cloud Platform project and region region. + * + * Generated from protobuf field repeated .google.cloud.gkemulticloud.v1.AwsCluster aws_clusters = 1; + */ + private $aws_clusters; + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * 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\GkeMultiCloud\V1\AwsCluster>|\Google\Protobuf\Internal\RepeatedField $aws_clusters + * A list of [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resources + * in the specified Google Cloud Platform project and region region. + * @type string $next_page_token + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AwsService::initOnce(); + parent::__construct($data); + } + + /** + * A list of [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resources + * in the specified Google Cloud Platform project and region region. + * + * Generated from protobuf field repeated .google.cloud.gkemulticloud.v1.AwsCluster aws_clusters = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAwsClusters() + { + return $this->aws_clusters; + } + + /** + * A list of [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resources + * in the specified Google Cloud Platform project and region region. + * + * Generated from protobuf field repeated .google.cloud.gkemulticloud.v1.AwsCluster aws_clusters = 1; + * @param array<\Google\Cloud\GkeMultiCloud\V1\AwsCluster>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAwsClusters($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\GkeMultiCloud\V1\AwsCluster::class); + $this->aws_clusters = $arr; + + return $this; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * 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/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/ListAwsNodePoolsRequest.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/ListAwsNodePoolsRequest.php new file mode 100644 index 000000000000..ec512d71b6af --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/ListAwsNodePoolsRequest.php @@ -0,0 +1,204 @@ +google.cloud.gkemulticloud.v1.ListAwsNodePoolsRequest + */ +class ListAwsNodePoolsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent `AwsCluster` which owns this collection of + * [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] resources. + * `AwsCluster` names are formatted as + * `projects//locations//awsClusters/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The maximum number of items to return. + * If not specified, a default value of 50 will be used by the service. + * Regardless of the pageSize value, the response can include a partial list + * and a caller should only rely on response's + * [nextPageToken][google.cloud.gkemulticloud.v1.ListAwsNodePoolsResponse.next_page_token] + * to determine if there are more instances left to be queried. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * The `nextPageToken` value returned from a previous + * [awsNodePools.list][google.cloud.gkemulticloud.v1.AwsClusters.ListAwsNodePools] + * request, if any. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + + /** + * @param string $parent Required. The parent `AwsCluster` which owns this collection of + * [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] resources. + * + * `AwsCluster` names are formatted as + * `projects//locations//awsClusters/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. Please see + * {@see AwsClustersClient::awsClusterName()} for help formatting this field. + * + * @return \Google\Cloud\GkeMultiCloud\V1\ListAwsNodePoolsRequest + * + * @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. The parent `AwsCluster` which owns this collection of + * [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] resources. + * `AwsCluster` names are formatted as + * `projects//locations//awsClusters/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * @type int $page_size + * The maximum number of items to return. + * If not specified, a default value of 50 will be used by the service. + * Regardless of the pageSize value, the response can include a partial list + * and a caller should only rely on response's + * [nextPageToken][google.cloud.gkemulticloud.v1.ListAwsNodePoolsResponse.next_page_token] + * to determine if there are more instances left to be queried. + * @type string $page_token + * The `nextPageToken` value returned from a previous + * [awsNodePools.list][google.cloud.gkemulticloud.v1.AwsClusters.ListAwsNodePools] + * request, if any. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AwsService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent `AwsCluster` which owns this collection of + * [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] resources. + * `AwsCluster` names are formatted as + * `projects//locations//awsClusters/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * + * 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. The parent `AwsCluster` which owns this collection of + * [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] resources. + * `AwsCluster` names are formatted as + * `projects//locations//awsClusters/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * + * 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; + } + + /** + * The maximum number of items to return. + * If not specified, a default value of 50 will be used by the service. + * Regardless of the pageSize value, the response can include a partial list + * and a caller should only rely on response's + * [nextPageToken][google.cloud.gkemulticloud.v1.ListAwsNodePoolsResponse.next_page_token] + * to determine if there are more instances left to be queried. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of items to return. + * If not specified, a default value of 50 will be used by the service. + * Regardless of the pageSize value, the response can include a partial list + * and a caller should only rely on response's + * [nextPageToken][google.cloud.gkemulticloud.v1.ListAwsNodePoolsResponse.next_page_token] + * to determine if there are more instances left to be queried. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * The `nextPageToken` value returned from a previous + * [awsNodePools.list][google.cloud.gkemulticloud.v1.AwsClusters.ListAwsNodePools] + * request, if any. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * The `nextPageToken` value returned from a previous + * [awsNodePools.list][google.cloud.gkemulticloud.v1.AwsClusters.ListAwsNodePools] + * request, if any. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/ListAwsNodePoolsResponse.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/ListAwsNodePoolsResponse.php new file mode 100644 index 000000000000..e6a681467d5a --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/ListAwsNodePoolsResponse.php @@ -0,0 +1,109 @@ +google.cloud.gkemulticloud.v1.ListAwsNodePoolsResponse + */ +class ListAwsNodePoolsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * A list of [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] + * resources in the specified `AwsCluster`. + * + * Generated from protobuf field repeated .google.cloud.gkemulticloud.v1.AwsNodePool aws_node_pools = 1; + */ + private $aws_node_pools; + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * 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\GkeMultiCloud\V1\AwsNodePool>|\Google\Protobuf\Internal\RepeatedField $aws_node_pools + * A list of [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] + * resources in the specified `AwsCluster`. + * @type string $next_page_token + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AwsService::initOnce(); + parent::__construct($data); + } + + /** + * A list of [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] + * resources in the specified `AwsCluster`. + * + * Generated from protobuf field repeated .google.cloud.gkemulticloud.v1.AwsNodePool aws_node_pools = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAwsNodePools() + { + return $this->aws_node_pools; + } + + /** + * A list of [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] + * resources in the specified `AwsCluster`. + * + * Generated from protobuf field repeated .google.cloud.gkemulticloud.v1.AwsNodePool aws_node_pools = 1; + * @param array<\Google\Cloud\GkeMultiCloud\V1\AwsNodePool>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAwsNodePools($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\GkeMultiCloud\V1\AwsNodePool::class); + $this->aws_node_pools = $arr; + + return $this; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * 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/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/ListAzureClientsRequest.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/ListAzureClientsRequest.php new file mode 100644 index 000000000000..721195797caf --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/ListAzureClientsRequest.php @@ -0,0 +1,199 @@ +google.cloud.gkemulticloud.v1.ListAzureClientsRequest + */ +class ListAzureClientsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent location which owns this collection of + * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] resources. + * Location names are formatted as `projects//locations/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The maximum number of items to return. + * If not specified, a default value of 50 will be used by the service. + * Regardless of the pageSize value, the response can include a partial list + * and a caller should only rely on response's + * [nextPageToken][google.cloud.gkemulticloud.v1.ListAzureClientsResponse.next_page_token] + * to determine if there are more instances left to be queried. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * The `nextPageToken` value returned from a previous + * [azureClients.list][google.cloud.gkemulticloud.v1.AzureClusters.ListAzureClients] + * request, if any. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + + /** + * @param string $parent Required. The parent location which owns this collection of + * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] resources. + * + * Location names are formatted as `projects//locations/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. Please see + * {@see AzureClustersClient::locationName()} for help formatting this field. + * + * @return \Google\Cloud\GkeMultiCloud\V1\ListAzureClientsRequest + * + * @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. The parent location which owns this collection of + * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] resources. + * Location names are formatted as `projects//locations/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * @type int $page_size + * The maximum number of items to return. + * If not specified, a default value of 50 will be used by the service. + * Regardless of the pageSize value, the response can include a partial list + * and a caller should only rely on response's + * [nextPageToken][google.cloud.gkemulticloud.v1.ListAzureClientsResponse.next_page_token] + * to determine if there are more instances left to be queried. + * @type string $page_token + * The `nextPageToken` value returned from a previous + * [azureClients.list][google.cloud.gkemulticloud.v1.AzureClusters.ListAzureClients] + * request, if any. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AzureService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent location which owns this collection of + * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] resources. + * Location names are formatted as `projects//locations/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * + * 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. The parent location which owns this collection of + * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] resources. + * Location names are formatted as `projects//locations/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * + * 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; + } + + /** + * The maximum number of items to return. + * If not specified, a default value of 50 will be used by the service. + * Regardless of the pageSize value, the response can include a partial list + * and a caller should only rely on response's + * [nextPageToken][google.cloud.gkemulticloud.v1.ListAzureClientsResponse.next_page_token] + * to determine if there are more instances left to be queried. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of items to return. + * If not specified, a default value of 50 will be used by the service. + * Regardless of the pageSize value, the response can include a partial list + * and a caller should only rely on response's + * [nextPageToken][google.cloud.gkemulticloud.v1.ListAzureClientsResponse.next_page_token] + * to determine if there are more instances left to be queried. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * The `nextPageToken` value returned from a previous + * [azureClients.list][google.cloud.gkemulticloud.v1.AzureClusters.ListAzureClients] + * request, if any. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * The `nextPageToken` value returned from a previous + * [azureClients.list][google.cloud.gkemulticloud.v1.AzureClusters.ListAzureClients] + * request, if any. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/ListAzureClientsResponse.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/ListAzureClientsResponse.php new file mode 100644 index 000000000000..6ec3fccc2c48 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/ListAzureClientsResponse.php @@ -0,0 +1,109 @@ +google.cloud.gkemulticloud.v1.ListAzureClientsResponse + */ +class ListAzureClientsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * A list of [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] + * resources in the specified Google Cloud project and region region. + * + * Generated from protobuf field repeated .google.cloud.gkemulticloud.v1.AzureClient azure_clients = 1; + */ + private $azure_clients; + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * 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\GkeMultiCloud\V1\AzureClient>|\Google\Protobuf\Internal\RepeatedField $azure_clients + * A list of [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] + * resources in the specified Google Cloud project and region region. + * @type string $next_page_token + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AzureService::initOnce(); + parent::__construct($data); + } + + /** + * A list of [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] + * resources in the specified Google Cloud project and region region. + * + * Generated from protobuf field repeated .google.cloud.gkemulticloud.v1.AzureClient azure_clients = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAzureClients() + { + return $this->azure_clients; + } + + /** + * A list of [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] + * resources in the specified Google Cloud project and region region. + * + * Generated from protobuf field repeated .google.cloud.gkemulticloud.v1.AzureClient azure_clients = 1; + * @param array<\Google\Cloud\GkeMultiCloud\V1\AzureClient>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAzureClients($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\GkeMultiCloud\V1\AzureClient::class); + $this->azure_clients = $arr; + + return $this; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * 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/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/ListAzureClustersRequest.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/ListAzureClustersRequest.php new file mode 100644 index 000000000000..c8d3b2bc6110 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/ListAzureClustersRequest.php @@ -0,0 +1,199 @@ +google.cloud.gkemulticloud.v1.ListAzureClustersRequest + */ +class ListAzureClustersRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent location which owns this collection of + * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resources. + * Location names are formatted as `projects//locations/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The maximum number of items to return. + * If not specified, a default value of 50 will be used by the service. + * Regardless of the pageSize value, the response can include a partial list + * and a caller should only rely on response's + * [nextPageToken][google.cloud.gkemulticloud.v1.ListAzureClustersResponse.next_page_token] + * to determine if there are more instances left to be queried. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * The `nextPageToken` value returned from a previous + * [azureClusters.list][google.cloud.gkemulticloud.v1.AzureClusters.ListAzureClusters] + * request, if any. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + + /** + * @param string $parent Required. The parent location which owns this collection of + * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resources. + * + * Location names are formatted as `projects//locations/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. Please see + * {@see AzureClustersClient::locationName()} for help formatting this field. + * + * @return \Google\Cloud\GkeMultiCloud\V1\ListAzureClustersRequest + * + * @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. The parent location which owns this collection of + * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resources. + * Location names are formatted as `projects//locations/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * @type int $page_size + * The maximum number of items to return. + * If not specified, a default value of 50 will be used by the service. + * Regardless of the pageSize value, the response can include a partial list + * and a caller should only rely on response's + * [nextPageToken][google.cloud.gkemulticloud.v1.ListAzureClustersResponse.next_page_token] + * to determine if there are more instances left to be queried. + * @type string $page_token + * The `nextPageToken` value returned from a previous + * [azureClusters.list][google.cloud.gkemulticloud.v1.AzureClusters.ListAzureClusters] + * request, if any. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AzureService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent location which owns this collection of + * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resources. + * Location names are formatted as `projects//locations/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * + * 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. The parent location which owns this collection of + * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resources. + * Location names are formatted as `projects//locations/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * + * 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; + } + + /** + * The maximum number of items to return. + * If not specified, a default value of 50 will be used by the service. + * Regardless of the pageSize value, the response can include a partial list + * and a caller should only rely on response's + * [nextPageToken][google.cloud.gkemulticloud.v1.ListAzureClustersResponse.next_page_token] + * to determine if there are more instances left to be queried. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of items to return. + * If not specified, a default value of 50 will be used by the service. + * Regardless of the pageSize value, the response can include a partial list + * and a caller should only rely on response's + * [nextPageToken][google.cloud.gkemulticloud.v1.ListAzureClustersResponse.next_page_token] + * to determine if there are more instances left to be queried. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * The `nextPageToken` value returned from a previous + * [azureClusters.list][google.cloud.gkemulticloud.v1.AzureClusters.ListAzureClusters] + * request, if any. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * The `nextPageToken` value returned from a previous + * [azureClusters.list][google.cloud.gkemulticloud.v1.AzureClusters.ListAzureClusters] + * request, if any. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/ListAzureClustersResponse.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/ListAzureClustersResponse.php new file mode 100644 index 000000000000..ed2af0dfa8b5 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/ListAzureClustersResponse.php @@ -0,0 +1,109 @@ +google.cloud.gkemulticloud.v1.ListAzureClustersResponse + */ +class ListAzureClustersResponse extends \Google\Protobuf\Internal\Message +{ + /** + * A list of [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] + * resources in the specified Google Cloud Platform project and region region. + * + * Generated from protobuf field repeated .google.cloud.gkemulticloud.v1.AzureCluster azure_clusters = 1; + */ + private $azure_clusters; + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * 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\GkeMultiCloud\V1\AzureCluster>|\Google\Protobuf\Internal\RepeatedField $azure_clusters + * A list of [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] + * resources in the specified Google Cloud Platform project and region region. + * @type string $next_page_token + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AzureService::initOnce(); + parent::__construct($data); + } + + /** + * A list of [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] + * resources in the specified Google Cloud Platform project and region region. + * + * Generated from protobuf field repeated .google.cloud.gkemulticloud.v1.AzureCluster azure_clusters = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAzureClusters() + { + return $this->azure_clusters; + } + + /** + * A list of [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] + * resources in the specified Google Cloud Platform project and region region. + * + * Generated from protobuf field repeated .google.cloud.gkemulticloud.v1.AzureCluster azure_clusters = 1; + * @param array<\Google\Cloud\GkeMultiCloud\V1\AzureCluster>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAzureClusters($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\GkeMultiCloud\V1\AzureCluster::class); + $this->azure_clusters = $arr; + + return $this; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * 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/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/ListAzureNodePoolsRequest.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/ListAzureNodePoolsRequest.php new file mode 100644 index 000000000000..4a48b8d5a27d --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/ListAzureNodePoolsRequest.php @@ -0,0 +1,204 @@ +google.cloud.gkemulticloud.v1.ListAzureNodePoolsRequest + */ +class ListAzureNodePoolsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent `AzureCluster` which owns this collection of + * [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] resources. + * `AzureCluster` names are formatted as + * `projects//locations//azureClusters/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The maximum number of items to return. + * If not specified, a default value of 50 will be used by the service. + * Regardless of the pageSize value, the response can include a partial list + * and a caller should only rely on response's + * [nextPageToken][google.cloud.gkemulticloud.v1.ListAzureNodePoolsResponse.next_page_token] + * to determine if there are more instances left to be queried. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * The `nextPageToken` value returned from a previous + * [azureNodePools.list][google.cloud.gkemulticloud.v1.AzureClusters.ListAzureNodePools] + * request, if any. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + + /** + * @param string $parent Required. The parent `AzureCluster` which owns this collection of + * [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] resources. + * + * `AzureCluster` names are formatted as + * `projects//locations//azureClusters/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. Please see + * {@see AzureClustersClient::azureClusterName()} for help formatting this field. + * + * @return \Google\Cloud\GkeMultiCloud\V1\ListAzureNodePoolsRequest + * + * @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. The parent `AzureCluster` which owns this collection of + * [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] resources. + * `AzureCluster` names are formatted as + * `projects//locations//azureClusters/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * @type int $page_size + * The maximum number of items to return. + * If not specified, a default value of 50 will be used by the service. + * Regardless of the pageSize value, the response can include a partial list + * and a caller should only rely on response's + * [nextPageToken][google.cloud.gkemulticloud.v1.ListAzureNodePoolsResponse.next_page_token] + * to determine if there are more instances left to be queried. + * @type string $page_token + * The `nextPageToken` value returned from a previous + * [azureNodePools.list][google.cloud.gkemulticloud.v1.AzureClusters.ListAzureNodePools] + * request, if any. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AzureService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent `AzureCluster` which owns this collection of + * [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] resources. + * `AzureCluster` names are formatted as + * `projects//locations//azureClusters/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * + * 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. The parent `AzureCluster` which owns this collection of + * [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] resources. + * `AzureCluster` names are formatted as + * `projects//locations//azureClusters/`. + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * + * 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; + } + + /** + * The maximum number of items to return. + * If not specified, a default value of 50 will be used by the service. + * Regardless of the pageSize value, the response can include a partial list + * and a caller should only rely on response's + * [nextPageToken][google.cloud.gkemulticloud.v1.ListAzureNodePoolsResponse.next_page_token] + * to determine if there are more instances left to be queried. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of items to return. + * If not specified, a default value of 50 will be used by the service. + * Regardless of the pageSize value, the response can include a partial list + * and a caller should only rely on response's + * [nextPageToken][google.cloud.gkemulticloud.v1.ListAzureNodePoolsResponse.next_page_token] + * to determine if there are more instances left to be queried. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * The `nextPageToken` value returned from a previous + * [azureNodePools.list][google.cloud.gkemulticloud.v1.AzureClusters.ListAzureNodePools] + * request, if any. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * The `nextPageToken` value returned from a previous + * [azureNodePools.list][google.cloud.gkemulticloud.v1.AzureClusters.ListAzureNodePools] + * request, if any. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/ListAzureNodePoolsResponse.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/ListAzureNodePoolsResponse.php new file mode 100644 index 000000000000..dba3b96d705d --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/ListAzureNodePoolsResponse.php @@ -0,0 +1,109 @@ +google.cloud.gkemulticloud.v1.ListAzureNodePoolsResponse + */ +class ListAzureNodePoolsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * A list of [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] + * resources in the specified `AzureCluster`. + * + * Generated from protobuf field repeated .google.cloud.gkemulticloud.v1.AzureNodePool azure_node_pools = 1; + */ + private $azure_node_pools; + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * 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\GkeMultiCloud\V1\AzureNodePool>|\Google\Protobuf\Internal\RepeatedField $azure_node_pools + * A list of [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] + * resources in the specified `AzureCluster`. + * @type string $next_page_token + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AzureService::initOnce(); + parent::__construct($data); + } + + /** + * A list of [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] + * resources in the specified `AzureCluster`. + * + * Generated from protobuf field repeated .google.cloud.gkemulticloud.v1.AzureNodePool azure_node_pools = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAzureNodePools() + { + return $this->azure_node_pools; + } + + /** + * A list of [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] + * resources in the specified `AzureCluster`. + * + * Generated from protobuf field repeated .google.cloud.gkemulticloud.v1.AzureNodePool azure_node_pools = 1; + * @param array<\Google\Cloud\GkeMultiCloud\V1\AzureNodePool>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAzureNodePools($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\GkeMultiCloud\V1\AzureNodePool::class); + $this->azure_node_pools = $arr; + + return $this; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * 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/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/LoggingComponentConfig.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/LoggingComponentConfig.php new file mode 100644 index 000000000000..422fc56a7d5e --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/LoggingComponentConfig.php @@ -0,0 +1,67 @@ +google.cloud.gkemulticloud.v1.LoggingComponentConfig + */ +class LoggingComponentConfig extends \Google\Protobuf\Internal\Message +{ + /** + * The components to be enabled. + * + * Generated from protobuf field repeated .google.cloud.gkemulticloud.v1.LoggingComponentConfig.Component enable_components = 1; + */ + private $enable_components; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $enable_components + * The components to be enabled. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\CommonResources::initOnce(); + parent::__construct($data); + } + + /** + * The components to be enabled. + * + * Generated from protobuf field repeated .google.cloud.gkemulticloud.v1.LoggingComponentConfig.Component enable_components = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getEnableComponents() + { + return $this->enable_components; + } + + /** + * The components to be enabled. + * + * Generated from protobuf field repeated .google.cloud.gkemulticloud.v1.LoggingComponentConfig.Component enable_components = 1; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setEnableComponents($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM, \Google\Cloud\GkeMultiCloud\V1\LoggingComponentConfig\Component::class); + $this->enable_components = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/LoggingComponentConfig/Component.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/LoggingComponentConfig/Component.php new file mode 100644 index 000000000000..7bbb2b8b88ac --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/LoggingComponentConfig/Component.php @@ -0,0 +1,64 @@ +google.cloud.gkemulticloud.v1.LoggingComponentConfig.Component + */ +class Component +{ + /** + * No component is specified + * + * Generated from protobuf enum COMPONENT_UNSPECIFIED = 0; + */ + const COMPONENT_UNSPECIFIED = 0; + /** + * This indicates that system logging components is enabled. + * + * Generated from protobuf enum SYSTEM_COMPONENTS = 1; + */ + const SYSTEM_COMPONENTS = 1; + /** + * This indicates that user workload logging component is enabled. + * + * Generated from protobuf enum WORKLOADS = 2; + */ + const WORKLOADS = 2; + + private static $valueToName = [ + self::COMPONENT_UNSPECIFIED => 'COMPONENT_UNSPECIFIED', + self::SYSTEM_COMPONENTS => 'SYSTEM_COMPONENTS', + self::WORKLOADS => 'WORKLOADS', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Component::class, \Google\Cloud\GkeMultiCloud\V1\LoggingComponentConfig_Component::class); + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/LoggingComponentConfig_Component.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/LoggingComponentConfig_Component.php new file mode 100644 index 000000000000..3d7fd5da3767 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/LoggingComponentConfig_Component.php @@ -0,0 +1,16 @@ +google.cloud.gkemulticloud.v1.LoggingConfig + */ +class LoggingConfig extends \Google\Protobuf\Internal\Message +{ + /** + * The configuration of the logging components; + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.LoggingComponentConfig component_config = 1; + */ + protected $component_config = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\GkeMultiCloud\V1\LoggingComponentConfig $component_config + * The configuration of the logging components; + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\CommonResources::initOnce(); + parent::__construct($data); + } + + /** + * The configuration of the logging components; + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.LoggingComponentConfig component_config = 1; + * @return \Google\Cloud\GkeMultiCloud\V1\LoggingComponentConfig|null + */ + public function getComponentConfig() + { + return $this->component_config; + } + + public function hasComponentConfig() + { + return isset($this->component_config); + } + + public function clearComponentConfig() + { + unset($this->component_config); + } + + /** + * The configuration of the logging components; + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.LoggingComponentConfig component_config = 1; + * @param \Google\Cloud\GkeMultiCloud\V1\LoggingComponentConfig $var + * @return $this + */ + public function setComponentConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeMultiCloud\V1\LoggingComponentConfig::class); + $this->component_config = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/ManagedPrometheusConfig.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/ManagedPrometheusConfig.php new file mode 100644 index 000000000000..c3f7e469972b --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/ManagedPrometheusConfig.php @@ -0,0 +1,68 @@ +google.cloud.gkemulticloud.v1.ManagedPrometheusConfig + */ +class ManagedPrometheusConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Enable Managed Collection. + * + * Generated from protobuf field bool enabled = 1; + */ + protected $enabled = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $enabled + * Enable Managed Collection. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\CommonResources::initOnce(); + parent::__construct($data); + } + + /** + * Enable Managed Collection. + * + * Generated from protobuf field bool enabled = 1; + * @return bool + */ + public function getEnabled() + { + return $this->enabled; + } + + /** + * Enable Managed Collection. + * + * Generated from protobuf field bool enabled = 1; + * @param bool $var + * @return $this + */ + public function setEnabled($var) + { + GPBUtil::checkBool($var); + $this->enabled = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/MaxPodsConstraint.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/MaxPodsConstraint.php new file mode 100644 index 000000000000..abbd020c984a --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/MaxPodsConstraint.php @@ -0,0 +1,67 @@ +google.cloud.gkemulticloud.v1.MaxPodsConstraint + */ +class MaxPodsConstraint extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The maximum number of pods to schedule on a single node. + * + * Generated from protobuf field int64 max_pods_per_node = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $max_pods_per_node = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int|string $max_pods_per_node + * Required. The maximum number of pods to schedule on a single node. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\CommonResources::initOnce(); + parent::__construct($data); + } + + /** + * Required. The maximum number of pods to schedule on a single node. + * + * Generated from protobuf field int64 max_pods_per_node = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return int|string + */ + public function getMaxPodsPerNode() + { + return $this->max_pods_per_node; + } + + /** + * Required. The maximum number of pods to schedule on a single node. + * + * Generated from protobuf field int64 max_pods_per_node = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param int|string $var + * @return $this + */ + public function setMaxPodsPerNode($var) + { + GPBUtil::checkInt64($var); + $this->max_pods_per_node = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/MonitoringConfig.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/MonitoringConfig.php new file mode 100644 index 000000000000..a6b9a2e0a799 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/MonitoringConfig.php @@ -0,0 +1,77 @@ +google.cloud.gkemulticloud.v1.MonitoringConfig + */ +class MonitoringConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Enable Google Cloud Managed Service for Prometheus in the cluster. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.ManagedPrometheusConfig managed_prometheus_config = 2; + */ + protected $managed_prometheus_config = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\GkeMultiCloud\V1\ManagedPrometheusConfig $managed_prometheus_config + * Enable Google Cloud Managed Service for Prometheus in the cluster. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\CommonResources::initOnce(); + parent::__construct($data); + } + + /** + * Enable Google Cloud Managed Service for Prometheus in the cluster. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.ManagedPrometheusConfig managed_prometheus_config = 2; + * @return \Google\Cloud\GkeMultiCloud\V1\ManagedPrometheusConfig|null + */ + public function getManagedPrometheusConfig() + { + return $this->managed_prometheus_config; + } + + public function hasManagedPrometheusConfig() + { + return isset($this->managed_prometheus_config); + } + + public function clearManagedPrometheusConfig() + { + unset($this->managed_prometheus_config); + } + + /** + * Enable Google Cloud Managed Service for Prometheus in the cluster. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.ManagedPrometheusConfig managed_prometheus_config = 2; + * @param \Google\Cloud\GkeMultiCloud\V1\ManagedPrometheusConfig $var + * @return $this + */ + public function setManagedPrometheusConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeMultiCloud\V1\ManagedPrometheusConfig::class); + $this->managed_prometheus_config = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/NodeTaint.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/NodeTaint.php new file mode 100644 index 000000000000..3008c9dd75ef --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/NodeTaint.php @@ -0,0 +1,135 @@ +google.cloud.gkemulticloud.v1.NodeTaint + */ +class NodeTaint extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Key for the taint. + * + * Generated from protobuf field string key = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $key = ''; + /** + * Required. Value for the taint. + * + * Generated from protobuf field string value = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $value = ''; + /** + * Required. The taint effect. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.NodeTaint.Effect effect = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $effect = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $key + * Required. Key for the taint. + * @type string $value + * Required. Value for the taint. + * @type int $effect + * Required. The taint effect. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\CommonResources::initOnce(); + parent::__construct($data); + } + + /** + * Required. Key for the taint. + * + * Generated from protobuf field string key = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getKey() + { + return $this->key; + } + + /** + * Required. Key for the taint. + * + * Generated from protobuf field string key = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setKey($var) + { + GPBUtil::checkString($var, True); + $this->key = $var; + + return $this; + } + + /** + * Required. Value for the taint. + * + * Generated from protobuf field string value = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getValue() + { + return $this->value; + } + + /** + * Required. Value for the taint. + * + * Generated from protobuf field string value = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setValue($var) + { + GPBUtil::checkString($var, True); + $this->value = $var; + + return $this; + } + + /** + * Required. The taint effect. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.NodeTaint.Effect effect = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getEffect() + { + return $this->effect; + } + + /** + * Required. The taint effect. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.NodeTaint.Effect effect = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setEffect($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\GkeMultiCloud\V1\NodeTaint\Effect::class); + $this->effect = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/NodeTaint/Effect.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/NodeTaint/Effect.php new file mode 100644 index 000000000000..e91ecf54c3c1 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/NodeTaint/Effect.php @@ -0,0 +1,77 @@ +google.cloud.gkemulticloud.v1.NodeTaint.Effect + */ +class Effect +{ + /** + * Not set. + * + * Generated from protobuf enum EFFECT_UNSPECIFIED = 0; + */ + const EFFECT_UNSPECIFIED = 0; + /** + * Do not allow new pods to schedule onto the node unless they tolerate the + * taint, but allow all pods submitted to Kubelet without going through the + * scheduler to start, and allow all already-running pods to continue + * running. Enforced by the scheduler. + * + * Generated from protobuf enum NO_SCHEDULE = 1; + */ + const NO_SCHEDULE = 1; + /** + * Like TaintEffectNoSchedule, but the scheduler tries not to schedule + * new pods onto the node, rather than prohibiting new pods from scheduling + * onto the node entirely. Enforced by the scheduler. + * + * Generated from protobuf enum PREFER_NO_SCHEDULE = 2; + */ + const PREFER_NO_SCHEDULE = 2; + /** + * Evict any already-running pods that do not tolerate the taint. + * Currently enforced by NodeController. + * + * Generated from protobuf enum NO_EXECUTE = 3; + */ + const NO_EXECUTE = 3; + + private static $valueToName = [ + self::EFFECT_UNSPECIFIED => 'EFFECT_UNSPECIFIED', + self::NO_SCHEDULE => 'NO_SCHEDULE', + self::PREFER_NO_SCHEDULE => 'PREFER_NO_SCHEDULE', + self::NO_EXECUTE => 'NO_EXECUTE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Effect::class, \Google\Cloud\GkeMultiCloud\V1\NodeTaint_Effect::class); + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/NodeTaint_Effect.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/NodeTaint_Effect.php new file mode 100644 index 000000000000..efd070529c2b --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/NodeTaint_Effect.php @@ -0,0 +1,16 @@ +google.cloud.gkemulticloud.v1.OperationMetadata + */ +class OperationMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The time at which this 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 at which this operation was completed. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $end_time = null; + /** + * Output only. The name of the resource associated to this operation. + * + * Generated from protobuf field string target = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $target = ''; + /** + * Output only. Human-readable status of the operation, if any. + * + * Generated from protobuf field string status_detail = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $status_detail = ''; + /** + * Output only. Human-readable status of any error that occurred during the + * operation. + * + * Generated from protobuf field string error_detail = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $error_detail = ''; + /** + * Output only. The verb associated with the API method which triggered this + * operation. Possible values are "create", "delete", "update" and "import". + * + * Generated from protobuf field string verb = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $verb = ''; + /** + * Output only. Identifies whether it has been requested cancellation + * for the operation. Operations that have successfully been cancelled + * have [Operation.error][] value with a + * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + * `Code.CANCELLED`. + * + * Generated from protobuf field bool requested_cancellation = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $requested_cancellation = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The time at which this operation was created. + * @type \Google\Protobuf\Timestamp $end_time + * Output only. The time at which this operation was completed. + * @type string $target + * Output only. The name of the resource associated to this operation. + * @type string $status_detail + * Output only. Human-readable status of the operation, if any. + * @type string $error_detail + * Output only. Human-readable status of any error that occurred during the + * operation. + * @type string $verb + * Output only. The verb associated with the API method which triggered this + * operation. Possible values are "create", "delete", "update" and "import". + * @type bool $requested_cancellation + * Output only. Identifies whether it has been requested cancellation + * for the operation. Operations that have successfully been cancelled + * have [Operation.error][] value with a + * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + * `Code.CANCELLED`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\CommonResources::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The time at which this 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 at which this 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 at which this operation was completed. + * + * 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 at which this operation was completed. + * + * 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 name of the resource associated to this operation. + * + * Generated from protobuf field string target = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getTarget() + { + return $this->target; + } + + /** + * Output only. The name of the resource associated to this operation. + * + * Generated from protobuf field string target = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setTarget($var) + { + GPBUtil::checkString($var, True); + $this->target = $var; + + return $this; + } + + /** + * Output only. Human-readable status of the operation, if any. + * + * Generated from protobuf field string status_detail = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getStatusDetail() + { + return $this->status_detail; + } + + /** + * Output only. Human-readable status of the operation, if any. + * + * Generated from protobuf field string status_detail = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setStatusDetail($var) + { + GPBUtil::checkString($var, True); + $this->status_detail = $var; + + return $this; + } + + /** + * Output only. Human-readable status of any error that occurred during the + * operation. + * + * Generated from protobuf field string error_detail = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getErrorDetail() + { + return $this->error_detail; + } + + /** + * Output only. Human-readable status of any error that occurred during the + * operation. + * + * Generated from protobuf field string error_detail = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setErrorDetail($var) + { + GPBUtil::checkString($var, True); + $this->error_detail = $var; + + return $this; + } + + /** + * Output only. The verb associated with the API method which triggered this + * operation. Possible values are "create", "delete", "update" and "import". + * + * Generated from protobuf field string verb = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getVerb() + { + return $this->verb; + } + + /** + * Output only. The verb associated with the API method which triggered this + * operation. Possible values are "create", "delete", "update" and "import". + * + * Generated from protobuf field string verb = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setVerb($var) + { + GPBUtil::checkString($var, True); + $this->verb = $var; + + return $this; + } + + /** + * Output only. Identifies whether it has been requested cancellation + * for the operation. Operations that have successfully been cancelled + * have [Operation.error][] value with a + * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + * `Code.CANCELLED`. + * + * Generated from protobuf field bool requested_cancellation = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return bool + */ + public function getRequestedCancellation() + { + return $this->requested_cancellation; + } + + /** + * Output only. Identifies whether it has been requested cancellation + * for the operation. Operations that have successfully been cancelled + * have [Operation.error][] value with a + * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + * `Code.CANCELLED`. + * + * Generated from protobuf field bool requested_cancellation = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param bool $var + * @return $this + */ + public function setRequestedCancellation($var) + { + GPBUtil::checkBool($var); + $this->requested_cancellation = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/ReplicaPlacement.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/ReplicaPlacement.php new file mode 100644 index 000000000000..c78be2466d12 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/ReplicaPlacement.php @@ -0,0 +1,113 @@ +google.cloud.gkemulticloud.v1.ReplicaPlacement + */ +class ReplicaPlacement extends \Google\Protobuf\Internal\Message +{ + /** + * Required. For a given replica, the ARM ID of the subnet where the control + * plane VM is deployed. Make sure it's a subnet under the virtual network in + * the cluster configuration. + * + * Generated from protobuf field string subnet_id = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $subnet_id = ''; + /** + * Required. For a given replica, the Azure availability zone where to + * provision the control plane VM and the ETCD disk. + * + * Generated from protobuf field string azure_availability_zone = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $azure_availability_zone = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $subnet_id + * Required. For a given replica, the ARM ID of the subnet where the control + * plane VM is deployed. Make sure it's a subnet under the virtual network in + * the cluster configuration. + * @type string $azure_availability_zone + * Required. For a given replica, the Azure availability zone where to + * provision the control plane VM and the ETCD disk. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AzureResources::initOnce(); + parent::__construct($data); + } + + /** + * Required. For a given replica, the ARM ID of the subnet where the control + * plane VM is deployed. Make sure it's a subnet under the virtual network in + * the cluster configuration. + * + * Generated from protobuf field string subnet_id = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getSubnetId() + { + return $this->subnet_id; + } + + /** + * Required. For a given replica, the ARM ID of the subnet where the control + * plane VM is deployed. Make sure it's a subnet under the virtual network in + * the cluster configuration. + * + * Generated from protobuf field string subnet_id = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setSubnetId($var) + { + GPBUtil::checkString($var, True); + $this->subnet_id = $var; + + return $this; + } + + /** + * Required. For a given replica, the Azure availability zone where to + * provision the control plane VM and the ETCD disk. + * + * Generated from protobuf field string azure_availability_zone = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getAzureAvailabilityZone() + { + return $this->azure_availability_zone; + } + + /** + * Required. For a given replica, the Azure availability zone where to + * provision the control plane VM and the ETCD disk. + * + * Generated from protobuf field string azure_availability_zone = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setAzureAvailabilityZone($var) + { + GPBUtil::checkString($var, True); + $this->azure_availability_zone = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/UpdateAttachedClusterRequest.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/UpdateAttachedClusterRequest.php new file mode 100644 index 000000000000..74f36f250d85 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/UpdateAttachedClusterRequest.php @@ -0,0 +1,226 @@ +google.cloud.gkemulticloud.v1.UpdateAttachedClusterRequest + */ +class UpdateAttachedClusterRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource + * to update. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AttachedCluster attached_cluster = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $attached_cluster = null; + /** + * If set, only validate the request, but do not actually update the cluster. + * + * Generated from protobuf field bool validate_only = 2; + */ + protected $validate_only = false; + /** + * Required. Mask of fields to update. At least one path must be supplied in + * this field. The elements of the repeated paths field can only include these + * fields from + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster]: + * * `description`. + * * `annotations`. + * * `platform_version`. + * * `authorization.admin_users`. + * * `logging_config.component_config.enable_components`. + * * `monitoring_config.managed_prometheus_config.enabled`. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $update_mask = null; + + /** + * @param \Google\Cloud\GkeMultiCloud\V1\AttachedCluster $attachedCluster Required. The + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource + * to update. + * @param \Google\Protobuf\FieldMask $updateMask Required. Mask of fields to update. At least one path must be supplied in + * this field. The elements of the repeated paths field can only include these + * fields from + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster]: + * + * * `description`. + * * `annotations`. + * * `platform_version`. + * * `authorization.admin_users`. + * * `logging_config.component_config.enable_components`. + * * `monitoring_config.managed_prometheus_config.enabled`. + * + * @return \Google\Cloud\GkeMultiCloud\V1\UpdateAttachedClusterRequest + * + * @experimental + */ + public static function build(\Google\Cloud\GkeMultiCloud\V1\AttachedCluster $attachedCluster, \Google\Protobuf\FieldMask $updateMask): self + { + return (new self()) + ->setAttachedCluster($attachedCluster) + ->setUpdateMask($updateMask); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\GkeMultiCloud\V1\AttachedCluster $attached_cluster + * Required. The + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource + * to update. + * @type bool $validate_only + * If set, only validate the request, but do not actually update the cluster. + * @type \Google\Protobuf\FieldMask $update_mask + * Required. Mask of fields to update. At least one path must be supplied in + * this field. The elements of the repeated paths field can only include these + * fields from + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster]: + * * `description`. + * * `annotations`. + * * `platform_version`. + * * `authorization.admin_users`. + * * `logging_config.component_config.enable_components`. + * * `monitoring_config.managed_prometheus_config.enabled`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AttachedService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource + * to update. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AttachedCluster attached_cluster = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\GkeMultiCloud\V1\AttachedCluster|null + */ + public function getAttachedCluster() + { + return $this->attached_cluster; + } + + public function hasAttachedCluster() + { + return isset($this->attached_cluster); + } + + public function clearAttachedCluster() + { + unset($this->attached_cluster); + } + + /** + * Required. The + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource + * to update. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AttachedCluster attached_cluster = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\GkeMultiCloud\V1\AttachedCluster $var + * @return $this + */ + public function setAttachedCluster($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeMultiCloud\V1\AttachedCluster::class); + $this->attached_cluster = $var; + + return $this; + } + + /** + * If set, only validate the request, but do not actually update the cluster. + * + * Generated from protobuf field bool validate_only = 2; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * If set, only validate the request, but do not actually update the cluster. + * + * Generated from protobuf field bool validate_only = 2; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + + /** + * Required. Mask of fields to update. At least one path must be supplied in + * this field. The elements of the repeated paths field can only include these + * fields from + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster]: + * * `description`. + * * `annotations`. + * * `platform_version`. + * * `authorization.admin_users`. + * * `logging_config.component_config.enable_components`. + * * `monitoring_config.managed_prometheus_config.enabled`. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Required. Mask of fields to update. At least one path must be supplied in + * this field. The elements of the repeated paths field can only include these + * fields from + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster]: + * * `description`. + * * `annotations`. + * * `platform_version`. + * * `authorization.admin_users`. + * * `logging_config.component_config.enable_components`. + * * `monitoring_config.managed_prometheus_config.enabled`. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/UpdateAwsClusterRequest.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/UpdateAwsClusterRequest.php new file mode 100644 index 000000000000..77639a394c82 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/UpdateAwsClusterRequest.php @@ -0,0 +1,301 @@ +google.cloud.gkemulticloud.v1.UpdateAwsClusterRequest + */ +class UpdateAwsClusterRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] + * resource to update. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsCluster aws_cluster = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $aws_cluster = null; + /** + * If set, only validate the request, but do not actually update the cluster. + * + * Generated from protobuf field bool validate_only = 2; + */ + protected $validate_only = false; + /** + * Required. Mask of fields to update. At least one path must be supplied in + * this field. The elements of the repeated paths field can only include these + * fields from [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster]: + * * `description`. + * * `annotations`. + * * `control_plane.version`. + * * `authorization.admin_users`. + * * `control_plane.aws_services_authentication.role_arn`. + * * `control_plane.aws_services_authentication.role_session_name`. + * * `control_plane.config_encryption.kms_key_arn`. + * * `control_plane.instance_type`. + * * `control_plane.security_group_ids`. + * * `control_plane.proxy_config`. + * * `control_plane.proxy_config.secret_arn`. + * * `control_plane.proxy_config.secret_version`. + * * `control_plane.root_volume.size_gib`. + * * `control_plane.root_volume.volume_type`. + * * `control_plane.root_volume.iops`. + * * `control_plane.root_volume.kms_key_arn`. + * * `control_plane.ssh_config`. + * * `control_plane.ssh_config.ec2_key_pair`. + * * `control_plane.instance_placement.tenancy`. + * * `control_plane.iam_instance_profile`. + * * `logging_config.component_config.enable_components`. + * * `control_plane.tags`. + * * `monitoring_config.managed_prometheus_config.enabled`. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 4 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $update_mask = null; + + /** + * @param \Google\Cloud\GkeMultiCloud\V1\AwsCluster $awsCluster Required. The [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] + * resource to update. + * @param \Google\Protobuf\FieldMask $updateMask Required. Mask of fields to update. At least one path must be supplied in + * this field. The elements of the repeated paths field can only include these + * fields from [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster]: + * + * * `description`. + * * `annotations`. + * * `control_plane.version`. + * * `authorization.admin_users`. + * * `control_plane.aws_services_authentication.role_arn`. + * * `control_plane.aws_services_authentication.role_session_name`. + * * `control_plane.config_encryption.kms_key_arn`. + * * `control_plane.instance_type`. + * * `control_plane.security_group_ids`. + * * `control_plane.proxy_config`. + * * `control_plane.proxy_config.secret_arn`. + * * `control_plane.proxy_config.secret_version`. + * * `control_plane.root_volume.size_gib`. + * * `control_plane.root_volume.volume_type`. + * * `control_plane.root_volume.iops`. + * * `control_plane.root_volume.kms_key_arn`. + * * `control_plane.ssh_config`. + * * `control_plane.ssh_config.ec2_key_pair`. + * * `control_plane.instance_placement.tenancy`. + * * `control_plane.iam_instance_profile`. + * * `logging_config.component_config.enable_components`. + * * `control_plane.tags`. + * * `monitoring_config.managed_prometheus_config.enabled`. + * + * @return \Google\Cloud\GkeMultiCloud\V1\UpdateAwsClusterRequest + * + * @experimental + */ + public static function build(\Google\Cloud\GkeMultiCloud\V1\AwsCluster $awsCluster, \Google\Protobuf\FieldMask $updateMask): self + { + return (new self()) + ->setAwsCluster($awsCluster) + ->setUpdateMask($updateMask); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\GkeMultiCloud\V1\AwsCluster $aws_cluster + * Required. The [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] + * resource to update. + * @type bool $validate_only + * If set, only validate the request, but do not actually update the cluster. + * @type \Google\Protobuf\FieldMask $update_mask + * Required. Mask of fields to update. At least one path must be supplied in + * this field. The elements of the repeated paths field can only include these + * fields from [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster]: + * * `description`. + * * `annotations`. + * * `control_plane.version`. + * * `authorization.admin_users`. + * * `control_plane.aws_services_authentication.role_arn`. + * * `control_plane.aws_services_authentication.role_session_name`. + * * `control_plane.config_encryption.kms_key_arn`. + * * `control_plane.instance_type`. + * * `control_plane.security_group_ids`. + * * `control_plane.proxy_config`. + * * `control_plane.proxy_config.secret_arn`. + * * `control_plane.proxy_config.secret_version`. + * * `control_plane.root_volume.size_gib`. + * * `control_plane.root_volume.volume_type`. + * * `control_plane.root_volume.iops`. + * * `control_plane.root_volume.kms_key_arn`. + * * `control_plane.ssh_config`. + * * `control_plane.ssh_config.ec2_key_pair`. + * * `control_plane.instance_placement.tenancy`. + * * `control_plane.iam_instance_profile`. + * * `logging_config.component_config.enable_components`. + * * `control_plane.tags`. + * * `monitoring_config.managed_prometheus_config.enabled`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AwsService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] + * resource to update. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsCluster aws_cluster = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\GkeMultiCloud\V1\AwsCluster|null + */ + public function getAwsCluster() + { + return $this->aws_cluster; + } + + public function hasAwsCluster() + { + return isset($this->aws_cluster); + } + + public function clearAwsCluster() + { + unset($this->aws_cluster); + } + + /** + * Required. The [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] + * resource to update. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsCluster aws_cluster = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\GkeMultiCloud\V1\AwsCluster $var + * @return $this + */ + public function setAwsCluster($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeMultiCloud\V1\AwsCluster::class); + $this->aws_cluster = $var; + + return $this; + } + + /** + * If set, only validate the request, but do not actually update the cluster. + * + * Generated from protobuf field bool validate_only = 2; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * If set, only validate the request, but do not actually update the cluster. + * + * Generated from protobuf field bool validate_only = 2; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + + /** + * Required. Mask of fields to update. At least one path must be supplied in + * this field. The elements of the repeated paths field can only include these + * fields from [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster]: + * * `description`. + * * `annotations`. + * * `control_plane.version`. + * * `authorization.admin_users`. + * * `control_plane.aws_services_authentication.role_arn`. + * * `control_plane.aws_services_authentication.role_session_name`. + * * `control_plane.config_encryption.kms_key_arn`. + * * `control_plane.instance_type`. + * * `control_plane.security_group_ids`. + * * `control_plane.proxy_config`. + * * `control_plane.proxy_config.secret_arn`. + * * `control_plane.proxy_config.secret_version`. + * * `control_plane.root_volume.size_gib`. + * * `control_plane.root_volume.volume_type`. + * * `control_plane.root_volume.iops`. + * * `control_plane.root_volume.kms_key_arn`. + * * `control_plane.ssh_config`. + * * `control_plane.ssh_config.ec2_key_pair`. + * * `control_plane.instance_placement.tenancy`. + * * `control_plane.iam_instance_profile`. + * * `logging_config.component_config.enable_components`. + * * `control_plane.tags`. + * * `monitoring_config.managed_prometheus_config.enabled`. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 4 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Required. Mask of fields to update. At least one path must be supplied in + * this field. The elements of the repeated paths field can only include these + * fields from [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster]: + * * `description`. + * * `annotations`. + * * `control_plane.version`. + * * `authorization.admin_users`. + * * `control_plane.aws_services_authentication.role_arn`. + * * `control_plane.aws_services_authentication.role_session_name`. + * * `control_plane.config_encryption.kms_key_arn`. + * * `control_plane.instance_type`. + * * `control_plane.security_group_ids`. + * * `control_plane.proxy_config`. + * * `control_plane.proxy_config.secret_arn`. + * * `control_plane.proxy_config.secret_version`. + * * `control_plane.root_volume.size_gib`. + * * `control_plane.root_volume.volume_type`. + * * `control_plane.root_volume.iops`. + * * `control_plane.root_volume.kms_key_arn`. + * * `control_plane.ssh_config`. + * * `control_plane.ssh_config.ec2_key_pair`. + * * `control_plane.instance_placement.tenancy`. + * * `control_plane.iam_instance_profile`. + * * `logging_config.component_config.enable_components`. + * * `control_plane.tags`. + * * `monitoring_config.managed_prometheus_config.enabled`. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 4 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/UpdateAwsNodePoolRequest.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/UpdateAwsNodePoolRequest.php new file mode 100644 index 000000000000..9776f2e4532f --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/UpdateAwsNodePoolRequest.php @@ -0,0 +1,296 @@ +google.cloud.gkemulticloud.v1.UpdateAwsNodePoolRequest + */ +class UpdateAwsNodePoolRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] + * resource to update. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsNodePool aws_node_pool = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $aws_node_pool = null; + /** + * If set, only validate the request, but don't actually update the node pool. + * + * Generated from protobuf field bool validate_only = 2; + */ + protected $validate_only = false; + /** + * Required. Mask of fields to update. At least one path must be supplied in + * this field. The elements of the repeated paths field can only include these + * fields from [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool]: + * * `annotations`. + * * `version`. + * * `autoscaling.min_node_count`. + * * `autoscaling.max_node_count`. + * * `config.config_encryption.kms_key_arn`. + * * `config.security_group_ids`. + * * `config.root_volume.iops`. + * * `config.root_volume.kms_key_arn`. + * * `config.root_volume.volume_type`. + * * `config.root_volume.size_gib`. + * * `config.proxy_config`. + * * `config.proxy_config.secret_arn`. + * * `config.proxy_config.secret_version`. + * * `config.ssh_config`. + * * `config.ssh_config.ec2_key_pair`. + * * `config.instance_placement.tenancy`. + * * `config.iam_instance_profile`. + * * `config.labels`. + * * `config.tags`. + * * `config.autoscaling_metrics_collection`. + * * `config.autoscaling_metrics_collection.granularity`. + * * `config.autoscaling_metrics_collection.metrics`. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $update_mask = null; + + /** + * @param \Google\Cloud\GkeMultiCloud\V1\AwsNodePool $awsNodePool Required. The [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] + * resource to update. + * @param \Google\Protobuf\FieldMask $updateMask Required. Mask of fields to update. At least one path must be supplied in + * this field. The elements of the repeated paths field can only include these + * fields from [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool]: + * + * * `annotations`. + * * `version`. + * * `autoscaling.min_node_count`. + * * `autoscaling.max_node_count`. + * * `config.config_encryption.kms_key_arn`. + * * `config.security_group_ids`. + * * `config.root_volume.iops`. + * * `config.root_volume.kms_key_arn`. + * * `config.root_volume.volume_type`. + * * `config.root_volume.size_gib`. + * * `config.proxy_config`. + * * `config.proxy_config.secret_arn`. + * * `config.proxy_config.secret_version`. + * * `config.ssh_config`. + * * `config.ssh_config.ec2_key_pair`. + * * `config.instance_placement.tenancy`. + * * `config.iam_instance_profile`. + * * `config.labels`. + * * `config.tags`. + * * `config.autoscaling_metrics_collection`. + * * `config.autoscaling_metrics_collection.granularity`. + * * `config.autoscaling_metrics_collection.metrics`. + * + * @return \Google\Cloud\GkeMultiCloud\V1\UpdateAwsNodePoolRequest + * + * @experimental + */ + public static function build(\Google\Cloud\GkeMultiCloud\V1\AwsNodePool $awsNodePool, \Google\Protobuf\FieldMask $updateMask): self + { + return (new self()) + ->setAwsNodePool($awsNodePool) + ->setUpdateMask($updateMask); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\GkeMultiCloud\V1\AwsNodePool $aws_node_pool + * Required. The [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] + * resource to update. + * @type bool $validate_only + * If set, only validate the request, but don't actually update the node pool. + * @type \Google\Protobuf\FieldMask $update_mask + * Required. Mask of fields to update. At least one path must be supplied in + * this field. The elements of the repeated paths field can only include these + * fields from [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool]: + * * `annotations`. + * * `version`. + * * `autoscaling.min_node_count`. + * * `autoscaling.max_node_count`. + * * `config.config_encryption.kms_key_arn`. + * * `config.security_group_ids`. + * * `config.root_volume.iops`. + * * `config.root_volume.kms_key_arn`. + * * `config.root_volume.volume_type`. + * * `config.root_volume.size_gib`. + * * `config.proxy_config`. + * * `config.proxy_config.secret_arn`. + * * `config.proxy_config.secret_version`. + * * `config.ssh_config`. + * * `config.ssh_config.ec2_key_pair`. + * * `config.instance_placement.tenancy`. + * * `config.iam_instance_profile`. + * * `config.labels`. + * * `config.tags`. + * * `config.autoscaling_metrics_collection`. + * * `config.autoscaling_metrics_collection.granularity`. + * * `config.autoscaling_metrics_collection.metrics`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AwsService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] + * resource to update. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsNodePool aws_node_pool = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\GkeMultiCloud\V1\AwsNodePool|null + */ + public function getAwsNodePool() + { + return $this->aws_node_pool; + } + + public function hasAwsNodePool() + { + return isset($this->aws_node_pool); + } + + public function clearAwsNodePool() + { + unset($this->aws_node_pool); + } + + /** + * Required. The [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] + * resource to update. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsNodePool aws_node_pool = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\GkeMultiCloud\V1\AwsNodePool $var + * @return $this + */ + public function setAwsNodePool($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeMultiCloud\V1\AwsNodePool::class); + $this->aws_node_pool = $var; + + return $this; + } + + /** + * If set, only validate the request, but don't actually update the node pool. + * + * Generated from protobuf field bool validate_only = 2; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * If set, only validate the request, but don't actually update the node pool. + * + * Generated from protobuf field bool validate_only = 2; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + + /** + * Required. Mask of fields to update. At least one path must be supplied in + * this field. The elements of the repeated paths field can only include these + * fields from [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool]: + * * `annotations`. + * * `version`. + * * `autoscaling.min_node_count`. + * * `autoscaling.max_node_count`. + * * `config.config_encryption.kms_key_arn`. + * * `config.security_group_ids`. + * * `config.root_volume.iops`. + * * `config.root_volume.kms_key_arn`. + * * `config.root_volume.volume_type`. + * * `config.root_volume.size_gib`. + * * `config.proxy_config`. + * * `config.proxy_config.secret_arn`. + * * `config.proxy_config.secret_version`. + * * `config.ssh_config`. + * * `config.ssh_config.ec2_key_pair`. + * * `config.instance_placement.tenancy`. + * * `config.iam_instance_profile`. + * * `config.labels`. + * * `config.tags`. + * * `config.autoscaling_metrics_collection`. + * * `config.autoscaling_metrics_collection.granularity`. + * * `config.autoscaling_metrics_collection.metrics`. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Required. Mask of fields to update. At least one path must be supplied in + * this field. The elements of the repeated paths field can only include these + * fields from [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool]: + * * `annotations`. + * * `version`. + * * `autoscaling.min_node_count`. + * * `autoscaling.max_node_count`. + * * `config.config_encryption.kms_key_arn`. + * * `config.security_group_ids`. + * * `config.root_volume.iops`. + * * `config.root_volume.kms_key_arn`. + * * `config.root_volume.volume_type`. + * * `config.root_volume.size_gib`. + * * `config.proxy_config`. + * * `config.proxy_config.secret_arn`. + * * `config.proxy_config.secret_version`. + * * `config.ssh_config`. + * * `config.ssh_config.ec2_key_pair`. + * * `config.instance_placement.tenancy`. + * * `config.iam_instance_profile`. + * * `config.labels`. + * * `config.tags`. + * * `config.autoscaling_metrics_collection`. + * * `config.autoscaling_metrics_collection.granularity`. + * * `config.autoscaling_metrics_collection.metrics`. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/UpdateAzureClusterRequest.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/UpdateAzureClusterRequest.php new file mode 100644 index 000000000000..ce0ce00f4d80 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/UpdateAzureClusterRequest.php @@ -0,0 +1,266 @@ +google.cloud.gkemulticloud.v1.UpdateAzureClusterRequest + */ +class UpdateAzureClusterRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] + * resource to update. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureCluster azure_cluster = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $azure_cluster = null; + /** + * If set, only validate the request, but do not actually update the cluster. + * + * Generated from protobuf field bool validate_only = 2; + */ + protected $validate_only = false; + /** + * Required. Mask of fields to update. At least one path must be supplied in + * this field. The elements of the repeated paths field can only include these + * fields from [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster]: + * * `description`. + * * `azureClient`. + * * `control_plane.version`. + * * `control_plane.vm_size`. + * * `annotations`. + * * `authorization.admin_users`. + * * `control_plane.root_volume.size_gib`. + * * `azure_services_authentication`. + * * `azure_services_authentication.tenant_id`. + * * `azure_services_authentication.application_id`. + * * `control_plane.proxy_config`. + * * `control_plane.proxy_config.resource_group_id`. + * * `control_plane.proxy_config.secret_id`. + * * `control_plane.ssh_config.authorized_key`. + * * `logging_config.component_config.enable_components` + * * `monitoring_config.managed_prometheus_config.enabled`. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 4 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $update_mask = null; + + /** + * @param \Google\Cloud\GkeMultiCloud\V1\AzureCluster $azureCluster Required. The [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] + * resource to update. + * @param \Google\Protobuf\FieldMask $updateMask Required. Mask of fields to update. At least one path must be supplied in + * this field. The elements of the repeated paths field can only include these + * fields from [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster]: + * + * * `description`. + * * `azureClient`. + * * `control_plane.version`. + * * `control_plane.vm_size`. + * * `annotations`. + * * `authorization.admin_users`. + * * `control_plane.root_volume.size_gib`. + * * `azure_services_authentication`. + * * `azure_services_authentication.tenant_id`. + * * `azure_services_authentication.application_id`. + * * `control_plane.proxy_config`. + * * `control_plane.proxy_config.resource_group_id`. + * * `control_plane.proxy_config.secret_id`. + * * `control_plane.ssh_config.authorized_key`. + * * `logging_config.component_config.enable_components` + * * `monitoring_config.managed_prometheus_config.enabled`. + * + * @return \Google\Cloud\GkeMultiCloud\V1\UpdateAzureClusterRequest + * + * @experimental + */ + public static function build(\Google\Cloud\GkeMultiCloud\V1\AzureCluster $azureCluster, \Google\Protobuf\FieldMask $updateMask): self + { + return (new self()) + ->setAzureCluster($azureCluster) + ->setUpdateMask($updateMask); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\GkeMultiCloud\V1\AzureCluster $azure_cluster + * Required. The [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] + * resource to update. + * @type bool $validate_only + * If set, only validate the request, but do not actually update the cluster. + * @type \Google\Protobuf\FieldMask $update_mask + * Required. Mask of fields to update. At least one path must be supplied in + * this field. The elements of the repeated paths field can only include these + * fields from [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster]: + * * `description`. + * * `azureClient`. + * * `control_plane.version`. + * * `control_plane.vm_size`. + * * `annotations`. + * * `authorization.admin_users`. + * * `control_plane.root_volume.size_gib`. + * * `azure_services_authentication`. + * * `azure_services_authentication.tenant_id`. + * * `azure_services_authentication.application_id`. + * * `control_plane.proxy_config`. + * * `control_plane.proxy_config.resource_group_id`. + * * `control_plane.proxy_config.secret_id`. + * * `control_plane.ssh_config.authorized_key`. + * * `logging_config.component_config.enable_components` + * * `monitoring_config.managed_prometheus_config.enabled`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AzureService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] + * resource to update. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureCluster azure_cluster = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\GkeMultiCloud\V1\AzureCluster|null + */ + public function getAzureCluster() + { + return $this->azure_cluster; + } + + public function hasAzureCluster() + { + return isset($this->azure_cluster); + } + + public function clearAzureCluster() + { + unset($this->azure_cluster); + } + + /** + * Required. The [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] + * resource to update. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureCluster azure_cluster = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\GkeMultiCloud\V1\AzureCluster $var + * @return $this + */ + public function setAzureCluster($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeMultiCloud\V1\AzureCluster::class); + $this->azure_cluster = $var; + + return $this; + } + + /** + * If set, only validate the request, but do not actually update the cluster. + * + * Generated from protobuf field bool validate_only = 2; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * If set, only validate the request, but do not actually update the cluster. + * + * Generated from protobuf field bool validate_only = 2; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + + /** + * Required. Mask of fields to update. At least one path must be supplied in + * this field. The elements of the repeated paths field can only include these + * fields from [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster]: + * * `description`. + * * `azureClient`. + * * `control_plane.version`. + * * `control_plane.vm_size`. + * * `annotations`. + * * `authorization.admin_users`. + * * `control_plane.root_volume.size_gib`. + * * `azure_services_authentication`. + * * `azure_services_authentication.tenant_id`. + * * `azure_services_authentication.application_id`. + * * `control_plane.proxy_config`. + * * `control_plane.proxy_config.resource_group_id`. + * * `control_plane.proxy_config.secret_id`. + * * `control_plane.ssh_config.authorized_key`. + * * `logging_config.component_config.enable_components` + * * `monitoring_config.managed_prometheus_config.enabled`. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 4 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Required. Mask of fields to update. At least one path must be supplied in + * this field. The elements of the repeated paths field can only include these + * fields from [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster]: + * * `description`. + * * `azureClient`. + * * `control_plane.version`. + * * `control_plane.vm_size`. + * * `annotations`. + * * `authorization.admin_users`. + * * `control_plane.root_volume.size_gib`. + * * `azure_services_authentication`. + * * `azure_services_authentication.tenant_id`. + * * `azure_services_authentication.application_id`. + * * `control_plane.proxy_config`. + * * `control_plane.proxy_config.resource_group_id`. + * * `control_plane.proxy_config.secret_id`. + * * `control_plane.ssh_config.authorized_key`. + * * `logging_config.component_config.enable_components` + * * `monitoring_config.managed_prometheus_config.enabled`. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 4 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/UpdateAzureNodePoolRequest.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/UpdateAzureNodePoolRequest.php new file mode 100644 index 000000000000..a6663f0166cb --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/UpdateAzureNodePoolRequest.php @@ -0,0 +1,211 @@ +google.cloud.gkemulticloud.v1.UpdateAzureNodePoolRequest + */ +class UpdateAzureNodePoolRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] + * resource to update. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureNodePool azure_node_pool = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $azure_node_pool = null; + /** + * If set, only validate the request, but don't actually update the node pool. + * + * Generated from protobuf field bool validate_only = 2; + */ + protected $validate_only = false; + /** + * Required. Mask of fields to update. At least one path must be supplied in + * this field. The elements of the repeated paths field can only include these + * fields from [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool]: + * *. `annotations`. + * * `version`. + * * `autoscaling.min_node_count`. + * * `autoscaling.max_node_count`. + * * `config.ssh_config.authorized_key`. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $update_mask = null; + + /** + * @param \Google\Cloud\GkeMultiCloud\V1\AzureNodePool $azureNodePool Required. The [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] + * resource to update. + * @param \Google\Protobuf\FieldMask $updateMask Required. Mask of fields to update. At least one path must be supplied in + * this field. The elements of the repeated paths field can only include these + * fields from [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool]: + * + * *. `annotations`. + * * `version`. + * * `autoscaling.min_node_count`. + * * `autoscaling.max_node_count`. + * * `config.ssh_config.authorized_key`. + * + * @return \Google\Cloud\GkeMultiCloud\V1\UpdateAzureNodePoolRequest + * + * @experimental + */ + public static function build(\Google\Cloud\GkeMultiCloud\V1\AzureNodePool $azureNodePool, \Google\Protobuf\FieldMask $updateMask): self + { + return (new self()) + ->setAzureNodePool($azureNodePool) + ->setUpdateMask($updateMask); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\GkeMultiCloud\V1\AzureNodePool $azure_node_pool + * Required. The [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] + * resource to update. + * @type bool $validate_only + * If set, only validate the request, but don't actually update the node pool. + * @type \Google\Protobuf\FieldMask $update_mask + * Required. Mask of fields to update. At least one path must be supplied in + * this field. The elements of the repeated paths field can only include these + * fields from [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool]: + * *. `annotations`. + * * `version`. + * * `autoscaling.min_node_count`. + * * `autoscaling.max_node_count`. + * * `config.ssh_config.authorized_key`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\AzureService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] + * resource to update. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureNodePool azure_node_pool = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\GkeMultiCloud\V1\AzureNodePool|null + */ + public function getAzureNodePool() + { + return $this->azure_node_pool; + } + + public function hasAzureNodePool() + { + return isset($this->azure_node_pool); + } + + public function clearAzureNodePool() + { + unset($this->azure_node_pool); + } + + /** + * Required. The [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] + * resource to update. + * + * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureNodePool azure_node_pool = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\GkeMultiCloud\V1\AzureNodePool $var + * @return $this + */ + public function setAzureNodePool($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeMultiCloud\V1\AzureNodePool::class); + $this->azure_node_pool = $var; + + return $this; + } + + /** + * If set, only validate the request, but don't actually update the node pool. + * + * Generated from protobuf field bool validate_only = 2; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * If set, only validate the request, but don't actually update the node pool. + * + * Generated from protobuf field bool validate_only = 2; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + + /** + * Required. Mask of fields to update. At least one path must be supplied in + * this field. The elements of the repeated paths field can only include these + * fields from [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool]: + * *. `annotations`. + * * `version`. + * * `autoscaling.min_node_count`. + * * `autoscaling.max_node_count`. + * * `config.ssh_config.authorized_key`. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Required. Mask of fields to update. At least one path must be supplied in + * this field. The elements of the repeated paths field can only include these + * fields from [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool]: + * *. `annotations`. + * * `version`. + * * `autoscaling.min_node_count`. + * * `autoscaling.max_node_count`. + * * `config.ssh_config.authorized_key`. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/WorkloadIdentityConfig.php b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/WorkloadIdentityConfig.php new file mode 100644 index 000000000000..261f7d8542a3 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/proto/src/Google/Cloud/GkeMultiCloud/V1/WorkloadIdentityConfig.php @@ -0,0 +1,139 @@ +google.cloud.gkemulticloud.v1.WorkloadIdentityConfig + */ +class WorkloadIdentityConfig extends \Google\Protobuf\Internal\Message +{ + /** + * The OIDC issuer URL for this cluster. + * + * Generated from protobuf field string issuer_uri = 1; + */ + protected $issuer_uri = ''; + /** + * The Workload Identity Pool associated to the cluster. + * + * Generated from protobuf field string workload_pool = 2; + */ + protected $workload_pool = ''; + /** + * The ID of the OIDC Identity Provider (IdP) associated to the Workload + * Identity Pool. + * + * Generated from protobuf field string identity_provider = 3; + */ + protected $identity_provider = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $issuer_uri + * The OIDC issuer URL for this cluster. + * @type string $workload_pool + * The Workload Identity Pool associated to the cluster. + * @type string $identity_provider + * The ID of the OIDC Identity Provider (IdP) associated to the Workload + * Identity Pool. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkemulticloud\V1\CommonResources::initOnce(); + parent::__construct($data); + } + + /** + * The OIDC issuer URL for this cluster. + * + * Generated from protobuf field string issuer_uri = 1; + * @return string + */ + public function getIssuerUri() + { + return $this->issuer_uri; + } + + /** + * The OIDC issuer URL for this cluster. + * + * Generated from protobuf field string issuer_uri = 1; + * @param string $var + * @return $this + */ + public function setIssuerUri($var) + { + GPBUtil::checkString($var, True); + $this->issuer_uri = $var; + + return $this; + } + + /** + * The Workload Identity Pool associated to the cluster. + * + * Generated from protobuf field string workload_pool = 2; + * @return string + */ + public function getWorkloadPool() + { + return $this->workload_pool; + } + + /** + * The Workload Identity Pool associated to the cluster. + * + * Generated from protobuf field string workload_pool = 2; + * @param string $var + * @return $this + */ + public function setWorkloadPool($var) + { + GPBUtil::checkString($var, True); + $this->workload_pool = $var; + + return $this; + } + + /** + * The ID of the OIDC Identity Provider (IdP) associated to the Workload + * Identity Pool. + * + * Generated from protobuf field string identity_provider = 3; + * @return string + */ + public function getIdentityProvider() + { + return $this->identity_provider; + } + + /** + * The ID of the OIDC Identity Provider (IdP) associated to the Workload + * Identity Pool. + * + * Generated from protobuf field string identity_provider = 3; + * @param string $var + * @return $this + */ + public function setIdentityProvider($var) + { + GPBUtil::checkString($var, True); + $this->identity_provider = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AttachedClustersClient/create_attached_cluster.php b/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AttachedClustersClient/create_attached_cluster.php new file mode 100644 index 000000000000..e60372877e40 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AttachedClustersClient/create_attached_cluster.php @@ -0,0 +1,145 @@ +/locations/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. Please see + * {@see AttachedClustersClient::locationName()} for help formatting this field. + * @param string $attachedClusterPlatformVersion The platform version for the cluster (e.g. `1.19.0-gke.1000`). + * + * You can list all supported versions on a given Google Cloud region by + * calling + * [GetAttachedServerConfig][google.cloud.gkemulticloud.v1.AttachedClusters.GetAttachedServerConfig]. + * @param string $attachedClusterDistribution The Kubernetes distribution of the underlying attached cluster. + * + * Supported values: ["eks", "aks"]. + * @param string $attachedClusterFleetProject The name of the Fleet host project where this cluster will be + * registered. + * + * Project names are formatted as + * `projects/`. + * @param string $attachedClusterId A client provided ID the resource. Must be unique within the + * parent resource. + * + * The provided ID will be part of the + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource + * name formatted as + * `projects//locations//attachedClusters/`. + * + * Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. + */ +function create_attached_cluster_sample( + string $formattedParent, + string $attachedClusterPlatformVersion, + string $attachedClusterDistribution, + string $attachedClusterFleetProject, + string $attachedClusterId +): void { + // Create a client. + $attachedClustersClient = new AttachedClustersClient(); + + // Prepare the request message. + $attachedClusterOidcConfig = new AttachedOidcConfig(); + $attachedClusterFleet = (new Fleet()) + ->setProject($attachedClusterFleetProject); + $attachedCluster = (new AttachedCluster()) + ->setOidcConfig($attachedClusterOidcConfig) + ->setPlatformVersion($attachedClusterPlatformVersion) + ->setDistribution($attachedClusterDistribution) + ->setFleet($attachedClusterFleet); + $request = (new CreateAttachedClusterRequest()) + ->setParent($formattedParent) + ->setAttachedCluster($attachedCluster) + ->setAttachedClusterId($attachedClusterId); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $attachedClustersClient->createAttachedCluster($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var AttachedCluster $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 +{ + $formattedParent = AttachedClustersClient::locationName('[PROJECT]', '[LOCATION]'); + $attachedClusterPlatformVersion = '[PLATFORM_VERSION]'; + $attachedClusterDistribution = '[DISTRIBUTION]'; + $attachedClusterFleetProject = '[PROJECT]'; + $attachedClusterId = '[ATTACHED_CLUSTER_ID]'; + + create_attached_cluster_sample( + $formattedParent, + $attachedClusterPlatformVersion, + $attachedClusterDistribution, + $attachedClusterFleetProject, + $attachedClusterId + ); +} +// [END gkemulticloud_v1_generated_AttachedClusters_CreateAttachedCluster_sync] diff --git a/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AttachedClustersClient/delete_attached_cluster.php b/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AttachedClustersClient/delete_attached_cluster.php new file mode 100644 index 000000000000..2019bf4fb937 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AttachedClustersClient/delete_attached_cluster.php @@ -0,0 +1,96 @@ +/locations//attachedClusters/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. Please see + * {@see AttachedClustersClient::attachedClusterName()} for help formatting this field. + */ +function delete_attached_cluster_sample(string $formattedName): void +{ + // Create a client. + $attachedClustersClient = new AttachedClustersClient(); + + // Prepare the request message. + $request = (new DeleteAttachedClusterRequest()) + ->setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $attachedClustersClient->deleteAttachedCluster($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + printf('Operation completed successfully.' . PHP_EOL); + } 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 = AttachedClustersClient::attachedClusterName( + '[PROJECT]', + '[LOCATION]', + '[ATTACHED_CLUSTER]' + ); + + delete_attached_cluster_sample($formattedName); +} +// [END gkemulticloud_v1_generated_AttachedClusters_DeleteAttachedCluster_sync] diff --git a/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AttachedClustersClient/generate_attached_cluster_install_manifest.php b/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AttachedClustersClient/generate_attached_cluster_install_manifest.php new file mode 100644 index 000000000000..cf483a4552e3 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AttachedClustersClient/generate_attached_cluster_install_manifest.php @@ -0,0 +1,109 @@ +/locations/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. Please see + * {@see AttachedClustersClient::locationName()} for help formatting this field. + * @param string $attachedClusterId A client provided ID of the resource. Must be unique within the + * parent resource. + * + * The provided ID will be part of the + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource + * name formatted as + * `projects//locations//attachedClusters/`. + * + * Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. + * + * When generating an install manifest for importing an existing Membership + * resource, the attached_cluster_id field must be the Membership id. + * + * Membership names are formatted as + * `projects//locations//memberships/`. + * @param string $platformVersion The platform version for the cluster (e.g. `1.19.0-gke.1000`). + * + * You can list all supported versions on a given Google Cloud region by + * calling + * [GetAttachedServerConfig][google.cloud.gkemulticloud.v1.AttachedClusters.GetAttachedServerConfig]. + */ +function generate_attached_cluster_install_manifest_sample( + string $formattedParent, + string $attachedClusterId, + string $platformVersion +): void { + // Create a client. + $attachedClustersClient = new AttachedClustersClient(); + + // Prepare the request message. + $request = (new GenerateAttachedClusterInstallManifestRequest()) + ->setParent($formattedParent) + ->setAttachedClusterId($attachedClusterId) + ->setPlatformVersion($platformVersion); + + // Call the API and handle any network failures. + try { + /** @var GenerateAttachedClusterInstallManifestResponse $response */ + $response = $attachedClustersClient->generateAttachedClusterInstallManifest($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 = AttachedClustersClient::locationName('[PROJECT]', '[LOCATION]'); + $attachedClusterId = '[ATTACHED_CLUSTER_ID]'; + $platformVersion = '[PLATFORM_VERSION]'; + + generate_attached_cluster_install_manifest_sample( + $formattedParent, + $attachedClusterId, + $platformVersion + ); +} +// [END gkemulticloud_v1_generated_AttachedClusters_GenerateAttachedClusterInstallManifest_sync] diff --git a/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AttachedClustersClient/get_attached_cluster.php b/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AttachedClustersClient/get_attached_cluster.php new file mode 100644 index 000000000000..21825508bbc6 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AttachedClustersClient/get_attached_cluster.php @@ -0,0 +1,84 @@ +/locations//attachedClusters/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. Please see + * {@see AttachedClustersClient::attachedClusterName()} for help formatting this field. + */ +function get_attached_cluster_sample(string $formattedName): void +{ + // Create a client. + $attachedClustersClient = new AttachedClustersClient(); + + // Prepare the request message. + $request = (new GetAttachedClusterRequest()) + ->setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var AttachedCluster $response */ + $response = $attachedClustersClient->getAttachedCluster($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 = AttachedClustersClient::attachedClusterName( + '[PROJECT]', + '[LOCATION]', + '[ATTACHED_CLUSTER]' + ); + + get_attached_cluster_sample($formattedName); +} +// [END gkemulticloud_v1_generated_AttachedClusters_GetAttachedCluster_sync] diff --git a/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AttachedClustersClient/get_attached_server_config.php b/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AttachedClustersClient/get_attached_server_config.php new file mode 100644 index 000000000000..99f834a49d4c --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AttachedClustersClient/get_attached_server_config.php @@ -0,0 +1,80 @@ +/locations//attachedServerConfig`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. Please see + * {@see AttachedClustersClient::attachedServerConfigName()} for help formatting this field. + */ +function get_attached_server_config_sample(string $formattedName): void +{ + // Create a client. + $attachedClustersClient = new AttachedClustersClient(); + + // Prepare the request message. + $request = (new GetAttachedServerConfigRequest()) + ->setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var AttachedServerConfig $response */ + $response = $attachedClustersClient->getAttachedServerConfig($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 = AttachedClustersClient::attachedServerConfigName('[PROJECT]', '[LOCATION]'); + + get_attached_server_config_sample($formattedName); +} +// [END gkemulticloud_v1_generated_AttachedClusters_GetAttachedServerConfig_sync] diff --git a/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AttachedClustersClient/import_attached_cluster.php b/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AttachedClustersClient/import_attached_cluster.php new file mode 100644 index 000000000000..6e935b3a2d9e --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AttachedClustersClient/import_attached_cluster.php @@ -0,0 +1,118 @@ +/locations/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. Please see + * {@see AttachedClustersClient::locationName()} for help formatting this field. + * @param string $fleetMembership The name of the fleet membership resource to import. + * @param string $platformVersion The platform version for the cluster (e.g. `1.19.0-gke.1000`). + * + * You can list all supported versions on a given Google Cloud region by + * calling + * [GetAttachedServerConfig][google.cloud.gkemulticloud.v1.AttachedClusters.GetAttachedServerConfig]. + * @param string $distribution The Kubernetes distribution of the underlying attached cluster. + * + * Supported values: ["eks", "aks"]. + */ +function import_attached_cluster_sample( + string $formattedParent, + string $fleetMembership, + string $platformVersion, + string $distribution +): void { + // Create a client. + $attachedClustersClient = new AttachedClustersClient(); + + // Prepare the request message. + $request = (new ImportAttachedClusterRequest()) + ->setParent($formattedParent) + ->setFleetMembership($fleetMembership) + ->setPlatformVersion($platformVersion) + ->setDistribution($distribution); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $attachedClustersClient->importAttachedCluster($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var AttachedCluster $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 +{ + $formattedParent = AttachedClustersClient::locationName('[PROJECT]', '[LOCATION]'); + $fleetMembership = '[FLEET_MEMBERSHIP]'; + $platformVersion = '[PLATFORM_VERSION]'; + $distribution = '[DISTRIBUTION]'; + + import_attached_cluster_sample($formattedParent, $fleetMembership, $platformVersion, $distribution); +} +// [END gkemulticloud_v1_generated_AttachedClusters_ImportAttachedCluster_sync] diff --git a/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AttachedClustersClient/list_attached_clusters.php b/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AttachedClustersClient/list_attached_clusters.php new file mode 100644 index 000000000000..b9fabcf1a3b4 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AttachedClustersClient/list_attached_clusters.php @@ -0,0 +1,83 @@ +/locations/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. Please see + * {@see AttachedClustersClient::locationName()} for help formatting this field. + */ +function list_attached_clusters_sample(string $formattedParent): void +{ + // Create a client. + $attachedClustersClient = new AttachedClustersClient(); + + // Prepare the request message. + $request = (new ListAttachedClustersRequest()) + ->setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $attachedClustersClient->listAttachedClusters($request); + + /** @var AttachedCluster $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 = AttachedClustersClient::locationName('[PROJECT]', '[LOCATION]'); + + list_attached_clusters_sample($formattedParent); +} +// [END gkemulticloud_v1_generated_AttachedClusters_ListAttachedClusters_sync] diff --git a/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AttachedClustersClient/update_attached_cluster.php b/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AttachedClustersClient/update_attached_cluster.php new file mode 100644 index 000000000000..0ffa370eb458 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AttachedClustersClient/update_attached_cluster.php @@ -0,0 +1,117 @@ +`. + */ +function update_attached_cluster_sample( + string $attachedClusterPlatformVersion, + string $attachedClusterDistribution, + string $attachedClusterFleetProject +): void { + // Create a client. + $attachedClustersClient = new AttachedClustersClient(); + + // Prepare the request message. + $attachedClusterOidcConfig = new AttachedOidcConfig(); + $attachedClusterFleet = (new Fleet()) + ->setProject($attachedClusterFleetProject); + $attachedCluster = (new AttachedCluster()) + ->setOidcConfig($attachedClusterOidcConfig) + ->setPlatformVersion($attachedClusterPlatformVersion) + ->setDistribution($attachedClusterDistribution) + ->setFleet($attachedClusterFleet); + $updateMask = new FieldMask(); + $request = (new UpdateAttachedClusterRequest()) + ->setAttachedCluster($attachedCluster) + ->setUpdateMask($updateMask); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $attachedClustersClient->updateAttachedCluster($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var AttachedCluster $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 +{ + $attachedClusterPlatformVersion = '[PLATFORM_VERSION]'; + $attachedClusterDistribution = '[DISTRIBUTION]'; + $attachedClusterFleetProject = '[PROJECT]'; + + update_attached_cluster_sample( + $attachedClusterPlatformVersion, + $attachedClusterDistribution, + $attachedClusterFleetProject + ); +} +// [END gkemulticloud_v1_generated_AttachedClusters_UpdateAttachedCluster_sync] diff --git a/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AwsClustersClient/create_aws_cluster.php b/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AwsClustersClient/create_aws_cluster.php new file mode 100644 index 000000000000..aacc45be2aa5 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AwsClustersClient/create_aws_cluster.php @@ -0,0 +1,229 @@ +/locations/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. Please see + * {@see AwsClustersClient::locationName()} for help formatting this field. + * @param string $awsClusterNetworkingVpcId The VPC associated with the cluster. All component clusters + * (i.e. control plane and node pools) run on a single VPC. + * + * This field cannot be changed after creation. + * @param string $awsClusterNetworkingPodAddressCidrBlocksElement All pods in the cluster are assigned an IPv4 address from these + * ranges. Only a single range is supported. This field cannot be changed + * after creation. + * @param string $awsClusterNetworkingServiceAddressCidrBlocksElement All services in the cluster are assigned an IPv4 address from + * these ranges. Only a single range is supported. This field cannot be + * changed after creation. + * @param string $awsClusterAwsRegion The AWS region where the cluster runs. + * + * Each Google Cloud region supports a subset of nearby AWS regions. + * You can call + * [GetAwsServerConfig][google.cloud.gkemulticloud.v1.AwsClusters.GetAwsServerConfig] + * to list all supported AWS regions within a given Google Cloud region. + * @param string $awsClusterControlPlaneVersion The Kubernetes version to run on control plane replicas + * (e.g. `1.19.10-gke.1000`). + * + * You can list all supported versions on a given Google Cloud region by + * calling + * [GetAwsServerConfig][google.cloud.gkemulticloud.v1.AwsClusters.GetAwsServerConfig]. + * @param string $awsClusterControlPlaneSubnetIdsElement The list of subnets where control plane replicas will run. + * A replica will be provisioned on each subnet and up to three values + * can be provided. + * Each subnet must be in a different AWS Availability Zone (AZ). + * @param string $awsClusterControlPlaneIamInstanceProfile The name or ARN of the AWS IAM instance profile to assign to each + * control plane replica. + * @param string $awsClusterControlPlaneDatabaseEncryptionKmsKeyArn The ARN of the AWS KMS key used to encrypt cluster secrets. + * @param string $awsClusterControlPlaneAwsServicesAuthenticationRoleArn The Amazon Resource Name (ARN) of the role that the Anthos + * Multi-Cloud API will assume when managing AWS resources on your account. + * @param string $awsClusterControlPlaneConfigEncryptionKmsKeyArn The ARN of the AWS KMS key used to encrypt user data. + * @param string $awsClusterAuthorizationAdminUsersUsername The name of the user, e.g. `my-gcp-id@gmail.com`. + * @param string $awsClusterFleetProject The name of the Fleet host project where this cluster will be + * registered. + * + * Project names are formatted as + * `projects/`. + * @param string $awsClusterId A client provided ID the resource. Must be unique within the + * parent resource. + * + * The provided ID will be part of the + * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resource name + * formatted as + * `projects//locations//awsClusters/`. + * + * Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. + */ +function create_aws_cluster_sample( + string $formattedParent, + string $awsClusterNetworkingVpcId, + string $awsClusterNetworkingPodAddressCidrBlocksElement, + string $awsClusterNetworkingServiceAddressCidrBlocksElement, + string $awsClusterAwsRegion, + string $awsClusterControlPlaneVersion, + string $awsClusterControlPlaneSubnetIdsElement, + string $awsClusterControlPlaneIamInstanceProfile, + string $awsClusterControlPlaneDatabaseEncryptionKmsKeyArn, + string $awsClusterControlPlaneAwsServicesAuthenticationRoleArn, + string $awsClusterControlPlaneConfigEncryptionKmsKeyArn, + string $awsClusterAuthorizationAdminUsersUsername, + string $awsClusterFleetProject, + string $awsClusterId +): void { + // Create a client. + $awsClustersClient = new AwsClustersClient(); + + // Prepare the request message. + $awsClusterNetworkingPodAddressCidrBlocks = [$awsClusterNetworkingPodAddressCidrBlocksElement,]; + $awsClusterNetworkingServiceAddressCidrBlocks = [ + $awsClusterNetworkingServiceAddressCidrBlocksElement, + ]; + $awsClusterNetworking = (new AwsClusterNetworking()) + ->setVpcId($awsClusterNetworkingVpcId) + ->setPodAddressCidrBlocks($awsClusterNetworkingPodAddressCidrBlocks) + ->setServiceAddressCidrBlocks($awsClusterNetworkingServiceAddressCidrBlocks); + $awsClusterControlPlaneSubnetIds = [$awsClusterControlPlaneSubnetIdsElement,]; + $awsClusterControlPlaneDatabaseEncryption = (new AwsDatabaseEncryption()) + ->setKmsKeyArn($awsClusterControlPlaneDatabaseEncryptionKmsKeyArn); + $awsClusterControlPlaneAwsServicesAuthentication = (new AwsServicesAuthentication()) + ->setRoleArn($awsClusterControlPlaneAwsServicesAuthenticationRoleArn); + $awsClusterControlPlaneConfigEncryption = (new AwsConfigEncryption()) + ->setKmsKeyArn($awsClusterControlPlaneConfigEncryptionKmsKeyArn); + $awsClusterControlPlane = (new AwsControlPlane()) + ->setVersion($awsClusterControlPlaneVersion) + ->setSubnetIds($awsClusterControlPlaneSubnetIds) + ->setIamInstanceProfile($awsClusterControlPlaneIamInstanceProfile) + ->setDatabaseEncryption($awsClusterControlPlaneDatabaseEncryption) + ->setAwsServicesAuthentication($awsClusterControlPlaneAwsServicesAuthentication) + ->setConfigEncryption($awsClusterControlPlaneConfigEncryption); + $awsClusterUser = (new AwsClusterUser()) + ->setUsername($awsClusterAuthorizationAdminUsersUsername); + $awsClusterAuthorizationAdminUsers = [$awsClusterUser,]; + $awsClusterAuthorization = (new AwsAuthorization()) + ->setAdminUsers($awsClusterAuthorizationAdminUsers); + $awsClusterFleet = (new Fleet()) + ->setProject($awsClusterFleetProject); + $awsCluster = (new AwsCluster()) + ->setNetworking($awsClusterNetworking) + ->setAwsRegion($awsClusterAwsRegion) + ->setControlPlane($awsClusterControlPlane) + ->setAuthorization($awsClusterAuthorization) + ->setFleet($awsClusterFleet); + $request = (new CreateAwsClusterRequest()) + ->setParent($formattedParent) + ->setAwsCluster($awsCluster) + ->setAwsClusterId($awsClusterId); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $awsClustersClient->createAwsCluster($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var AwsCluster $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 +{ + $formattedParent = AwsClustersClient::locationName('[PROJECT]', '[LOCATION]'); + $awsClusterNetworkingVpcId = '[VPC_ID]'; + $awsClusterNetworkingPodAddressCidrBlocksElement = '[POD_ADDRESS_CIDR_BLOCKS]'; + $awsClusterNetworkingServiceAddressCidrBlocksElement = '[SERVICE_ADDRESS_CIDR_BLOCKS]'; + $awsClusterAwsRegion = '[AWS_REGION]'; + $awsClusterControlPlaneVersion = '[VERSION]'; + $awsClusterControlPlaneSubnetIdsElement = '[SUBNET_IDS]'; + $awsClusterControlPlaneIamInstanceProfile = '[IAM_INSTANCE_PROFILE]'; + $awsClusterControlPlaneDatabaseEncryptionKmsKeyArn = '[KMS_KEY_ARN]'; + $awsClusterControlPlaneAwsServicesAuthenticationRoleArn = '[ROLE_ARN]'; + $awsClusterControlPlaneConfigEncryptionKmsKeyArn = '[KMS_KEY_ARN]'; + $awsClusterAuthorizationAdminUsersUsername = '[USERNAME]'; + $awsClusterFleetProject = '[PROJECT]'; + $awsClusterId = '[AWS_CLUSTER_ID]'; + + create_aws_cluster_sample( + $formattedParent, + $awsClusterNetworkingVpcId, + $awsClusterNetworkingPodAddressCidrBlocksElement, + $awsClusterNetworkingServiceAddressCidrBlocksElement, + $awsClusterAwsRegion, + $awsClusterControlPlaneVersion, + $awsClusterControlPlaneSubnetIdsElement, + $awsClusterControlPlaneIamInstanceProfile, + $awsClusterControlPlaneDatabaseEncryptionKmsKeyArn, + $awsClusterControlPlaneAwsServicesAuthenticationRoleArn, + $awsClusterControlPlaneConfigEncryptionKmsKeyArn, + $awsClusterAuthorizationAdminUsersUsername, + $awsClusterFleetProject, + $awsClusterId + ); +} +// [END gkemulticloud_v1_generated_AwsClusters_CreateAwsCluster_sync] diff --git a/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AwsClustersClient/create_aws_node_pool.php b/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AwsClustersClient/create_aws_node_pool.php new file mode 100644 index 000000000000..225e3f22700a --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AwsClustersClient/create_aws_node_pool.php @@ -0,0 +1,168 @@ +/locations//awsClusters/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. Please see + * {@see AwsClustersClient::awsClusterName()} for help formatting this field. + * @param string $awsNodePoolVersion The Kubernetes version to run on this node pool (e.g. + * `1.19.10-gke.1000`). + * + * You can list all supported versions on a given Google Cloud region by + * calling + * [GetAwsServerConfig][google.cloud.gkemulticloud.v1.AwsClusters.GetAwsServerConfig]. + * @param string $awsNodePoolConfigIamInstanceProfile The name or ARN of the AWS IAM role assigned to nodes in the + * pool. + * @param string $awsNodePoolConfigConfigEncryptionKmsKeyArn The ARN of the AWS KMS key used to encrypt user data. + * @param int $awsNodePoolAutoscalingMinNodeCount Minimum number of nodes in the node pool. Must be greater than or + * equal to 1 and less than or equal to max_node_count. + * @param int $awsNodePoolAutoscalingMaxNodeCount Maximum number of nodes in the node pool. Must be greater than or + * equal to min_node_count and less than or equal to 50. + * @param string $awsNodePoolSubnetId The subnet where the node pool node run. + * @param int $awsNodePoolMaxPodsConstraintMaxPodsPerNode The maximum number of pods to schedule on a single node. + * @param string $awsNodePoolId A client provided ID the resource. Must be unique within the + * parent resource. + * + * The provided ID will be part of the + * [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] resource name + * formatted as + * `projects//locations//awsClusters//awsNodePools/`. + * + * Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. + */ +function create_aws_node_pool_sample( + string $formattedParent, + string $awsNodePoolVersion, + string $awsNodePoolConfigIamInstanceProfile, + string $awsNodePoolConfigConfigEncryptionKmsKeyArn, + int $awsNodePoolAutoscalingMinNodeCount, + int $awsNodePoolAutoscalingMaxNodeCount, + string $awsNodePoolSubnetId, + int $awsNodePoolMaxPodsConstraintMaxPodsPerNode, + string $awsNodePoolId +): void { + // Create a client. + $awsClustersClient = new AwsClustersClient(); + + // Prepare the request message. + $awsNodePoolConfigConfigEncryption = (new AwsConfigEncryption()) + ->setKmsKeyArn($awsNodePoolConfigConfigEncryptionKmsKeyArn); + $awsNodePoolConfig = (new AwsNodeConfig()) + ->setIamInstanceProfile($awsNodePoolConfigIamInstanceProfile) + ->setConfigEncryption($awsNodePoolConfigConfigEncryption); + $awsNodePoolAutoscaling = (new AwsNodePoolAutoscaling()) + ->setMinNodeCount($awsNodePoolAutoscalingMinNodeCount) + ->setMaxNodeCount($awsNodePoolAutoscalingMaxNodeCount); + $awsNodePoolMaxPodsConstraint = (new MaxPodsConstraint()) + ->setMaxPodsPerNode($awsNodePoolMaxPodsConstraintMaxPodsPerNode); + $awsNodePool = (new AwsNodePool()) + ->setVersion($awsNodePoolVersion) + ->setConfig($awsNodePoolConfig) + ->setAutoscaling($awsNodePoolAutoscaling) + ->setSubnetId($awsNodePoolSubnetId) + ->setMaxPodsConstraint($awsNodePoolMaxPodsConstraint); + $request = (new CreateAwsNodePoolRequest()) + ->setParent($formattedParent) + ->setAwsNodePool($awsNodePool) + ->setAwsNodePoolId($awsNodePoolId); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $awsClustersClient->createAwsNodePool($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var AwsNodePool $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 +{ + $formattedParent = AwsClustersClient::awsClusterName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]'); + $awsNodePoolVersion = '[VERSION]'; + $awsNodePoolConfigIamInstanceProfile = '[IAM_INSTANCE_PROFILE]'; + $awsNodePoolConfigConfigEncryptionKmsKeyArn = '[KMS_KEY_ARN]'; + $awsNodePoolAutoscalingMinNodeCount = 0; + $awsNodePoolAutoscalingMaxNodeCount = 0; + $awsNodePoolSubnetId = '[SUBNET_ID]'; + $awsNodePoolMaxPodsConstraintMaxPodsPerNode = 0; + $awsNodePoolId = '[AWS_NODE_POOL_ID]'; + + create_aws_node_pool_sample( + $formattedParent, + $awsNodePoolVersion, + $awsNodePoolConfigIamInstanceProfile, + $awsNodePoolConfigConfigEncryptionKmsKeyArn, + $awsNodePoolAutoscalingMinNodeCount, + $awsNodePoolAutoscalingMaxNodeCount, + $awsNodePoolSubnetId, + $awsNodePoolMaxPodsConstraintMaxPodsPerNode, + $awsNodePoolId + ); +} +// [END gkemulticloud_v1_generated_AwsClusters_CreateAwsNodePool_sync] diff --git a/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AwsClustersClient/delete_aws_cluster.php b/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AwsClustersClient/delete_aws_cluster.php new file mode 100644 index 000000000000..60b7bd24972c --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AwsClustersClient/delete_aws_cluster.php @@ -0,0 +1,95 @@ +/locations//awsClusters/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. Please see + * {@see AwsClustersClient::awsClusterName()} for help formatting this field. + */ +function delete_aws_cluster_sample(string $formattedName): void +{ + // Create a client. + $awsClustersClient = new AwsClustersClient(); + + // Prepare the request message. + $request = (new DeleteAwsClusterRequest()) + ->setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $awsClustersClient->deleteAwsCluster($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + printf('Operation completed successfully.' . PHP_EOL); + } 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 = AwsClustersClient::awsClusterName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]'); + + delete_aws_cluster_sample($formattedName); +} +// [END gkemulticloud_v1_generated_AwsClusters_DeleteAwsCluster_sync] diff --git a/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AwsClustersClient/delete_aws_node_pool.php b/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AwsClustersClient/delete_aws_node_pool.php new file mode 100644 index 000000000000..394f463f21e8 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AwsClustersClient/delete_aws_node_pool.php @@ -0,0 +1,97 @@ +/locations//awsClusters//awsNodePools/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. Please see + * {@see AwsClustersClient::awsNodePoolName()} for help formatting this field. + */ +function delete_aws_node_pool_sample(string $formattedName): void +{ + // Create a client. + $awsClustersClient = new AwsClustersClient(); + + // Prepare the request message. + $request = (new DeleteAwsNodePoolRequest()) + ->setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $awsClustersClient->deleteAwsNodePool($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + printf('Operation completed successfully.' . PHP_EOL); + } 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 = AwsClustersClient::awsNodePoolName( + '[PROJECT]', + '[LOCATION]', + '[AWS_CLUSTER]', + '[AWS_NODE_POOL]' + ); + + delete_aws_node_pool_sample($formattedName); +} +// [END gkemulticloud_v1_generated_AwsClusters_DeleteAwsNodePool_sync] diff --git a/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AwsClustersClient/generate_aws_access_token.php b/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AwsClustersClient/generate_aws_access_token.php new file mode 100644 index 000000000000..22f65a87c014 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AwsClustersClient/generate_aws_access_token.php @@ -0,0 +1,84 @@ +/locations//awsClusters/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. Please see + * {@see AwsClustersClient::awsClusterName()} for help formatting this field. + */ +function generate_aws_access_token_sample(string $formattedAwsCluster): void +{ + // Create a client. + $awsClustersClient = new AwsClustersClient(); + + // Prepare the request message. + $request = (new GenerateAwsAccessTokenRequest()) + ->setAwsCluster($formattedAwsCluster); + + // Call the API and handle any network failures. + try { + /** @var GenerateAwsAccessTokenResponse $response */ + $response = $awsClustersClient->generateAwsAccessToken($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 +{ + $formattedAwsCluster = AwsClustersClient::awsClusterName( + '[PROJECT]', + '[LOCATION]', + '[AWS_CLUSTER]' + ); + + generate_aws_access_token_sample($formattedAwsCluster); +} +// [END gkemulticloud_v1_generated_AwsClusters_GenerateAwsAccessToken_sync] diff --git a/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AwsClustersClient/get_aws_cluster.php b/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AwsClustersClient/get_aws_cluster.php new file mode 100644 index 000000000000..8274cfa21370 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AwsClustersClient/get_aws_cluster.php @@ -0,0 +1,80 @@ +/locations//awsClusters/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. Please see + * {@see AwsClustersClient::awsClusterName()} for help formatting this field. + */ +function get_aws_cluster_sample(string $formattedName): void +{ + // Create a client. + $awsClustersClient = new AwsClustersClient(); + + // Prepare the request message. + $request = (new GetAwsClusterRequest()) + ->setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var AwsCluster $response */ + $response = $awsClustersClient->getAwsCluster($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 = AwsClustersClient::awsClusterName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]'); + + get_aws_cluster_sample($formattedName); +} +// [END gkemulticloud_v1_generated_AwsClusters_GetAwsCluster_sync] diff --git a/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AwsClustersClient/get_aws_node_pool.php b/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AwsClustersClient/get_aws_node_pool.php new file mode 100644 index 000000000000..b3b8771c0b23 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AwsClustersClient/get_aws_node_pool.php @@ -0,0 +1,85 @@ +/locations//awsClusters//awsNodePools/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. Please see + * {@see AwsClustersClient::awsNodePoolName()} for help formatting this field. + */ +function get_aws_node_pool_sample(string $formattedName): void +{ + // Create a client. + $awsClustersClient = new AwsClustersClient(); + + // Prepare the request message. + $request = (new GetAwsNodePoolRequest()) + ->setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var AwsNodePool $response */ + $response = $awsClustersClient->getAwsNodePool($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 = AwsClustersClient::awsNodePoolName( + '[PROJECT]', + '[LOCATION]', + '[AWS_CLUSTER]', + '[AWS_NODE_POOL]' + ); + + get_aws_node_pool_sample($formattedName); +} +// [END gkemulticloud_v1_generated_AwsClusters_GetAwsNodePool_sync] diff --git a/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AwsClustersClient/get_aws_server_config.php b/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AwsClustersClient/get_aws_server_config.php new file mode 100644 index 000000000000..c450dd0bcef3 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AwsClustersClient/get_aws_server_config.php @@ -0,0 +1,80 @@ +/locations//awsServerConfig`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. Please see + * {@see AwsClustersClient::awsServerConfigName()} for help formatting this field. + */ +function get_aws_server_config_sample(string $formattedName): void +{ + // Create a client. + $awsClustersClient = new AwsClustersClient(); + + // Prepare the request message. + $request = (new GetAwsServerConfigRequest()) + ->setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var AwsServerConfig $response */ + $response = $awsClustersClient->getAwsServerConfig($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 = AwsClustersClient::awsServerConfigName('[PROJECT]', '[LOCATION]'); + + get_aws_server_config_sample($formattedName); +} +// [END gkemulticloud_v1_generated_AwsClusters_GetAwsServerConfig_sync] diff --git a/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AwsClustersClient/list_aws_clusters.php b/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AwsClustersClient/list_aws_clusters.php new file mode 100644 index 000000000000..7f82224f8ca8 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AwsClustersClient/list_aws_clusters.php @@ -0,0 +1,83 @@ +/locations/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. Please see + * {@see AwsClustersClient::locationName()} for help formatting this field. + */ +function list_aws_clusters_sample(string $formattedParent): void +{ + // Create a client. + $awsClustersClient = new AwsClustersClient(); + + // Prepare the request message. + $request = (new ListAwsClustersRequest()) + ->setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $awsClustersClient->listAwsClusters($request); + + /** @var AwsCluster $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 = AwsClustersClient::locationName('[PROJECT]', '[LOCATION]'); + + list_aws_clusters_sample($formattedParent); +} +// [END gkemulticloud_v1_generated_AwsClusters_ListAwsClusters_sync] diff --git a/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AwsClustersClient/list_aws_node_pools.php b/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AwsClustersClient/list_aws_node_pools.php new file mode 100644 index 000000000000..9d94de3abcb2 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AwsClustersClient/list_aws_node_pools.php @@ -0,0 +1,85 @@ +/locations//awsClusters/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. Please see + * {@see AwsClustersClient::awsClusterName()} for help formatting this field. + */ +function list_aws_node_pools_sample(string $formattedParent): void +{ + // Create a client. + $awsClustersClient = new AwsClustersClient(); + + // Prepare the request message. + $request = (new ListAwsNodePoolsRequest()) + ->setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $awsClustersClient->listAwsNodePools($request); + + /** @var AwsNodePool $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 = AwsClustersClient::awsClusterName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]'); + + list_aws_node_pools_sample($formattedParent); +} +// [END gkemulticloud_v1_generated_AwsClusters_ListAwsNodePools_sync] diff --git a/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AwsClustersClient/update_aws_cluster.php b/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AwsClustersClient/update_aws_cluster.php new file mode 100644 index 000000000000..9a20d247d121 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AwsClustersClient/update_aws_cluster.php @@ -0,0 +1,201 @@ +`. + */ +function update_aws_cluster_sample( + string $awsClusterNetworkingVpcId, + string $awsClusterNetworkingPodAddressCidrBlocksElement, + string $awsClusterNetworkingServiceAddressCidrBlocksElement, + string $awsClusterAwsRegion, + string $awsClusterControlPlaneVersion, + string $awsClusterControlPlaneSubnetIdsElement, + string $awsClusterControlPlaneIamInstanceProfile, + string $awsClusterControlPlaneDatabaseEncryptionKmsKeyArn, + string $awsClusterControlPlaneAwsServicesAuthenticationRoleArn, + string $awsClusterControlPlaneConfigEncryptionKmsKeyArn, + string $awsClusterAuthorizationAdminUsersUsername, + string $awsClusterFleetProject +): void { + // Create a client. + $awsClustersClient = new AwsClustersClient(); + + // Prepare the request message. + $awsClusterNetworkingPodAddressCidrBlocks = [$awsClusterNetworkingPodAddressCidrBlocksElement,]; + $awsClusterNetworkingServiceAddressCidrBlocks = [ + $awsClusterNetworkingServiceAddressCidrBlocksElement, + ]; + $awsClusterNetworking = (new AwsClusterNetworking()) + ->setVpcId($awsClusterNetworkingVpcId) + ->setPodAddressCidrBlocks($awsClusterNetworkingPodAddressCidrBlocks) + ->setServiceAddressCidrBlocks($awsClusterNetworkingServiceAddressCidrBlocks); + $awsClusterControlPlaneSubnetIds = [$awsClusterControlPlaneSubnetIdsElement,]; + $awsClusterControlPlaneDatabaseEncryption = (new AwsDatabaseEncryption()) + ->setKmsKeyArn($awsClusterControlPlaneDatabaseEncryptionKmsKeyArn); + $awsClusterControlPlaneAwsServicesAuthentication = (new AwsServicesAuthentication()) + ->setRoleArn($awsClusterControlPlaneAwsServicesAuthenticationRoleArn); + $awsClusterControlPlaneConfigEncryption = (new AwsConfigEncryption()) + ->setKmsKeyArn($awsClusterControlPlaneConfigEncryptionKmsKeyArn); + $awsClusterControlPlane = (new AwsControlPlane()) + ->setVersion($awsClusterControlPlaneVersion) + ->setSubnetIds($awsClusterControlPlaneSubnetIds) + ->setIamInstanceProfile($awsClusterControlPlaneIamInstanceProfile) + ->setDatabaseEncryption($awsClusterControlPlaneDatabaseEncryption) + ->setAwsServicesAuthentication($awsClusterControlPlaneAwsServicesAuthentication) + ->setConfigEncryption($awsClusterControlPlaneConfigEncryption); + $awsClusterUser = (new AwsClusterUser()) + ->setUsername($awsClusterAuthorizationAdminUsersUsername); + $awsClusterAuthorizationAdminUsers = [$awsClusterUser,]; + $awsClusterAuthorization = (new AwsAuthorization()) + ->setAdminUsers($awsClusterAuthorizationAdminUsers); + $awsClusterFleet = (new Fleet()) + ->setProject($awsClusterFleetProject); + $awsCluster = (new AwsCluster()) + ->setNetworking($awsClusterNetworking) + ->setAwsRegion($awsClusterAwsRegion) + ->setControlPlane($awsClusterControlPlane) + ->setAuthorization($awsClusterAuthorization) + ->setFleet($awsClusterFleet); + $updateMask = new FieldMask(); + $request = (new UpdateAwsClusterRequest()) + ->setAwsCluster($awsCluster) + ->setUpdateMask($updateMask); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $awsClustersClient->updateAwsCluster($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var AwsCluster $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 +{ + $awsClusterNetworkingVpcId = '[VPC_ID]'; + $awsClusterNetworkingPodAddressCidrBlocksElement = '[POD_ADDRESS_CIDR_BLOCKS]'; + $awsClusterNetworkingServiceAddressCidrBlocksElement = '[SERVICE_ADDRESS_CIDR_BLOCKS]'; + $awsClusterAwsRegion = '[AWS_REGION]'; + $awsClusterControlPlaneVersion = '[VERSION]'; + $awsClusterControlPlaneSubnetIdsElement = '[SUBNET_IDS]'; + $awsClusterControlPlaneIamInstanceProfile = '[IAM_INSTANCE_PROFILE]'; + $awsClusterControlPlaneDatabaseEncryptionKmsKeyArn = '[KMS_KEY_ARN]'; + $awsClusterControlPlaneAwsServicesAuthenticationRoleArn = '[ROLE_ARN]'; + $awsClusterControlPlaneConfigEncryptionKmsKeyArn = '[KMS_KEY_ARN]'; + $awsClusterAuthorizationAdminUsersUsername = '[USERNAME]'; + $awsClusterFleetProject = '[PROJECT]'; + + update_aws_cluster_sample( + $awsClusterNetworkingVpcId, + $awsClusterNetworkingPodAddressCidrBlocksElement, + $awsClusterNetworkingServiceAddressCidrBlocksElement, + $awsClusterAwsRegion, + $awsClusterControlPlaneVersion, + $awsClusterControlPlaneSubnetIdsElement, + $awsClusterControlPlaneIamInstanceProfile, + $awsClusterControlPlaneDatabaseEncryptionKmsKeyArn, + $awsClusterControlPlaneAwsServicesAuthenticationRoleArn, + $awsClusterControlPlaneConfigEncryptionKmsKeyArn, + $awsClusterAuthorizationAdminUsersUsername, + $awsClusterFleetProject + ); +} +// [END gkemulticloud_v1_generated_AwsClusters_UpdateAwsCluster_sync] diff --git a/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AwsClustersClient/update_aws_node_pool.php b/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AwsClustersClient/update_aws_node_pool.php new file mode 100644 index 000000000000..b3ca4e0cc0c7 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AwsClustersClient/update_aws_node_pool.php @@ -0,0 +1,140 @@ +setKmsKeyArn($awsNodePoolConfigConfigEncryptionKmsKeyArn); + $awsNodePoolConfig = (new AwsNodeConfig()) + ->setIamInstanceProfile($awsNodePoolConfigIamInstanceProfile) + ->setConfigEncryption($awsNodePoolConfigConfigEncryption); + $awsNodePoolAutoscaling = (new AwsNodePoolAutoscaling()) + ->setMinNodeCount($awsNodePoolAutoscalingMinNodeCount) + ->setMaxNodeCount($awsNodePoolAutoscalingMaxNodeCount); + $awsNodePoolMaxPodsConstraint = (new MaxPodsConstraint()) + ->setMaxPodsPerNode($awsNodePoolMaxPodsConstraintMaxPodsPerNode); + $awsNodePool = (new AwsNodePool()) + ->setVersion($awsNodePoolVersion) + ->setConfig($awsNodePoolConfig) + ->setAutoscaling($awsNodePoolAutoscaling) + ->setSubnetId($awsNodePoolSubnetId) + ->setMaxPodsConstraint($awsNodePoolMaxPodsConstraint); + $updateMask = new FieldMask(); + $request = (new UpdateAwsNodePoolRequest()) + ->setAwsNodePool($awsNodePool) + ->setUpdateMask($updateMask); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $awsClustersClient->updateAwsNodePool($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var AwsNodePool $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 +{ + $awsNodePoolVersion = '[VERSION]'; + $awsNodePoolConfigIamInstanceProfile = '[IAM_INSTANCE_PROFILE]'; + $awsNodePoolConfigConfigEncryptionKmsKeyArn = '[KMS_KEY_ARN]'; + $awsNodePoolAutoscalingMinNodeCount = 0; + $awsNodePoolAutoscalingMaxNodeCount = 0; + $awsNodePoolSubnetId = '[SUBNET_ID]'; + $awsNodePoolMaxPodsConstraintMaxPodsPerNode = 0; + + update_aws_node_pool_sample( + $awsNodePoolVersion, + $awsNodePoolConfigIamInstanceProfile, + $awsNodePoolConfigConfigEncryptionKmsKeyArn, + $awsNodePoolAutoscalingMinNodeCount, + $awsNodePoolAutoscalingMaxNodeCount, + $awsNodePoolSubnetId, + $awsNodePoolMaxPodsConstraintMaxPodsPerNode + ); +} +// [END gkemulticloud_v1_generated_AwsClusters_UpdateAwsNodePool_sync] diff --git a/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AzureClustersClient/create_azure_client.php b/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AzureClustersClient/create_azure_client.php new file mode 100644 index 000000000000..1bd2f69f9612 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AzureClustersClient/create_azure_client.php @@ -0,0 +1,127 @@ +/locations/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. Please see + * {@see AzureClustersClient::locationName()} for help formatting this field. + * @param string $azureClientTenantId The Azure Active Directory Tenant ID. + * @param string $azureClientApplicationId The Azure Active Directory Application ID. + * @param string $azureClientId A client provided ID the resource. Must be unique within the + * parent resource. + * + * The provided ID will be part of the + * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] resource name + * formatted as + * `projects//locations//azureClients/`. + * + * Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. + */ +function create_azure_client_sample( + string $formattedParent, + string $azureClientTenantId, + string $azureClientApplicationId, + string $azureClientId +): void { + // Create a client. + $azureClustersClient = new AzureClustersClient(); + + // Prepare the request message. + $azureClient = (new AzureClient()) + ->setTenantId($azureClientTenantId) + ->setApplicationId($azureClientApplicationId); + $request = (new CreateAzureClientRequest()) + ->setParent($formattedParent) + ->setAzureClient($azureClient) + ->setAzureClientId($azureClientId); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $azureClustersClient->createAzureClient($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var AzureClient $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 +{ + $formattedParent = AzureClustersClient::locationName('[PROJECT]', '[LOCATION]'); + $azureClientTenantId = '[TENANT_ID]'; + $azureClientApplicationId = '[APPLICATION_ID]'; + $azureClientId = '[AZURE_CLIENT_ID]'; + + create_azure_client_sample( + $formattedParent, + $azureClientTenantId, + $azureClientApplicationId, + $azureClientId + ); +} +// [END gkemulticloud_v1_generated_AzureClusters_CreateAzureClient_sync] diff --git a/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AzureClustersClient/create_azure_cluster.php b/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AzureClustersClient/create_azure_cluster.php new file mode 100644 index 000000000000..f18995544639 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AzureClustersClient/create_azure_cluster.php @@ -0,0 +1,222 @@ +/locations/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. Please see + * {@see AzureClustersClient::locationName()} for help formatting this field. + * @param string $azureClusterAzureRegion The Azure region where the cluster runs. + * + * Each Google Cloud region supports a subset of nearby Azure regions. + * You can call + * [GetAzureServerConfig][google.cloud.gkemulticloud.v1.AzureClusters.GetAzureServerConfig] + * to list all supported Azure regions within a given Google Cloud region. + * @param string $azureClusterResourceGroupId The ARM ID of the resource group where the cluster resources are + * deployed. For example: + * `/subscriptions//resourceGroups/` + * @param string $azureClusterNetworkingVirtualNetworkId The Azure Resource Manager (ARM) ID of the VNet associated with + * your cluster. + * + * All components in the cluster (i.e. control plane and node pools) run on a + * single VNet. + * + * Example: + * `/subscriptions//resourceGroups//providers/Microsoft.Network/virtualNetworks/` + * + * This field cannot be changed after creation. + * @param string $azureClusterNetworkingPodAddressCidrBlocksElement The IP address range of the pods in this cluster, in CIDR + * notation (e.g. `10.96.0.0/14`). + * + * All pods in the cluster get assigned a unique IPv4 address from these + * ranges. Only a single range is supported. + * + * This field cannot be changed after creation. + * @param string $azureClusterNetworkingServiceAddressCidrBlocksElement The IP address range for services in this cluster, in CIDR + * notation (e.g. `10.96.0.0/14`). + * + * All services in the cluster get assigned a unique IPv4 address from these + * ranges. Only a single range is supported. + * + * This field cannot be changed after creating a cluster. + * @param string $azureClusterControlPlaneVersion The Kubernetes version to run on control plane replicas + * (e.g. `1.19.10-gke.1000`). + * + * You can list all supported versions on a given Google Cloud region by + * calling + * [GetAzureServerConfig][google.cloud.gkemulticloud.v1.AzureClusters.GetAzureServerConfig]. + * @param string $azureClusterControlPlaneSshConfigAuthorizedKey The SSH public key data for VMs managed by Anthos. This accepts + * the authorized_keys file format used in OpenSSH according to the sshd(8) + * manual page. + * @param string $azureClusterAuthorizationAdminUsersUsername The name of the user, e.g. `my-gcp-id@gmail.com`. + * @param string $azureClusterFleetProject The name of the Fleet host project where this cluster will be + * registered. + * + * Project names are formatted as + * `projects/`. + * @param string $azureClusterId A client provided ID the resource. Must be unique within the + * parent resource. + * + * The provided ID will be part of the + * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource name + * formatted as + * `projects//locations//azureClusters/`. + * + * Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. + */ +function create_azure_cluster_sample( + string $formattedParent, + string $azureClusterAzureRegion, + string $azureClusterResourceGroupId, + string $azureClusterNetworkingVirtualNetworkId, + string $azureClusterNetworkingPodAddressCidrBlocksElement, + string $azureClusterNetworkingServiceAddressCidrBlocksElement, + string $azureClusterControlPlaneVersion, + string $azureClusterControlPlaneSshConfigAuthorizedKey, + string $azureClusterAuthorizationAdminUsersUsername, + string $azureClusterFleetProject, + string $azureClusterId +): void { + // Create a client. + $azureClustersClient = new AzureClustersClient(); + + // Prepare the request message. + $azureClusterNetworkingPodAddressCidrBlocks = [ + $azureClusterNetworkingPodAddressCidrBlocksElement, + ]; + $azureClusterNetworkingServiceAddressCidrBlocks = [ + $azureClusterNetworkingServiceAddressCidrBlocksElement, + ]; + $azureClusterNetworking = (new AzureClusterNetworking()) + ->setVirtualNetworkId($azureClusterNetworkingVirtualNetworkId) + ->setPodAddressCidrBlocks($azureClusterNetworkingPodAddressCidrBlocks) + ->setServiceAddressCidrBlocks($azureClusterNetworkingServiceAddressCidrBlocks); + $azureClusterControlPlaneSshConfig = (new AzureSshConfig()) + ->setAuthorizedKey($azureClusterControlPlaneSshConfigAuthorizedKey); + $azureClusterControlPlane = (new AzureControlPlane()) + ->setVersion($azureClusterControlPlaneVersion) + ->setSshConfig($azureClusterControlPlaneSshConfig); + $azureClusterUser = (new AzureClusterUser()) + ->setUsername($azureClusterAuthorizationAdminUsersUsername); + $azureClusterAuthorizationAdminUsers = [$azureClusterUser,]; + $azureClusterAuthorization = (new AzureAuthorization()) + ->setAdminUsers($azureClusterAuthorizationAdminUsers); + $azureClusterFleet = (new Fleet()) + ->setProject($azureClusterFleetProject); + $azureCluster = (new AzureCluster()) + ->setAzureRegion($azureClusterAzureRegion) + ->setResourceGroupId($azureClusterResourceGroupId) + ->setNetworking($azureClusterNetworking) + ->setControlPlane($azureClusterControlPlane) + ->setAuthorization($azureClusterAuthorization) + ->setFleet($azureClusterFleet); + $request = (new CreateAzureClusterRequest()) + ->setParent($formattedParent) + ->setAzureCluster($azureCluster) + ->setAzureClusterId($azureClusterId); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $azureClustersClient->createAzureCluster($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var AzureCluster $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 +{ + $formattedParent = AzureClustersClient::locationName('[PROJECT]', '[LOCATION]'); + $azureClusterAzureRegion = '[AZURE_REGION]'; + $azureClusterResourceGroupId = '[RESOURCE_GROUP_ID]'; + $azureClusterNetworkingVirtualNetworkId = '[VIRTUAL_NETWORK_ID]'; + $azureClusterNetworkingPodAddressCidrBlocksElement = '[POD_ADDRESS_CIDR_BLOCKS]'; + $azureClusterNetworkingServiceAddressCidrBlocksElement = '[SERVICE_ADDRESS_CIDR_BLOCKS]'; + $azureClusterControlPlaneVersion = '[VERSION]'; + $azureClusterControlPlaneSshConfigAuthorizedKey = '[AUTHORIZED_KEY]'; + $azureClusterAuthorizationAdminUsersUsername = '[USERNAME]'; + $azureClusterFleetProject = '[PROJECT]'; + $azureClusterId = '[AZURE_CLUSTER_ID]'; + + create_azure_cluster_sample( + $formattedParent, + $azureClusterAzureRegion, + $azureClusterResourceGroupId, + $azureClusterNetworkingVirtualNetworkId, + $azureClusterNetworkingPodAddressCidrBlocksElement, + $azureClusterNetworkingServiceAddressCidrBlocksElement, + $azureClusterControlPlaneVersion, + $azureClusterControlPlaneSshConfigAuthorizedKey, + $azureClusterAuthorizationAdminUsersUsername, + $azureClusterFleetProject, + $azureClusterId + ); +} +// [END gkemulticloud_v1_generated_AzureClusters_CreateAzureCluster_sync] diff --git a/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AzureClustersClient/create_azure_node_pool.php b/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AzureClustersClient/create_azure_node_pool.php new file mode 100644 index 000000000000..b2ae81b84fd0 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AzureClustersClient/create_azure_node_pool.php @@ -0,0 +1,165 @@ +/locations/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. Please see + * {@see AzureClustersClient::azureClusterName()} for help formatting this field. + * @param string $azureNodePoolVersion The Kubernetes version (e.g. `1.19.10-gke.1000`) running on this + * node pool. + * @param string $azureNodePoolConfigSshConfigAuthorizedKey The SSH public key data for VMs managed by Anthos. This accepts + * the authorized_keys file format used in OpenSSH according to the sshd(8) + * manual page. + * @param string $azureNodePoolSubnetId The ARM ID of the subnet where the node pool VMs run. Make sure + * it's a subnet under the virtual network in the cluster configuration. + * @param int $azureNodePoolAutoscalingMinNodeCount Minimum number of nodes in the node pool. Must be greater than or + * equal to 1 and less than or equal to max_node_count. + * @param int $azureNodePoolAutoscalingMaxNodeCount Maximum number of nodes in the node pool. Must be greater than or + * equal to min_node_count and less than or equal to 50. + * @param int $azureNodePoolMaxPodsConstraintMaxPodsPerNode The maximum number of pods to schedule on a single node. + * @param string $azureNodePoolId A client provided ID the resource. Must be unique within the + * parent resource. + * + * The provided ID will be part of the + * [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] resource name + * formatted as + * `projects//locations//azureClusters//azureNodePools/`. + * + * Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. + */ +function create_azure_node_pool_sample( + string $formattedParent, + string $azureNodePoolVersion, + string $azureNodePoolConfigSshConfigAuthorizedKey, + string $azureNodePoolSubnetId, + int $azureNodePoolAutoscalingMinNodeCount, + int $azureNodePoolAutoscalingMaxNodeCount, + int $azureNodePoolMaxPodsConstraintMaxPodsPerNode, + string $azureNodePoolId +): void { + // Create a client. + $azureClustersClient = new AzureClustersClient(); + + // Prepare the request message. + $azureNodePoolConfigSshConfig = (new AzureSshConfig()) + ->setAuthorizedKey($azureNodePoolConfigSshConfigAuthorizedKey); + $azureNodePoolConfig = (new AzureNodeConfig()) + ->setSshConfig($azureNodePoolConfigSshConfig); + $azureNodePoolAutoscaling = (new AzureNodePoolAutoscaling()) + ->setMinNodeCount($azureNodePoolAutoscalingMinNodeCount) + ->setMaxNodeCount($azureNodePoolAutoscalingMaxNodeCount); + $azureNodePoolMaxPodsConstraint = (new MaxPodsConstraint()) + ->setMaxPodsPerNode($azureNodePoolMaxPodsConstraintMaxPodsPerNode); + $azureNodePool = (new AzureNodePool()) + ->setVersion($azureNodePoolVersion) + ->setConfig($azureNodePoolConfig) + ->setSubnetId($azureNodePoolSubnetId) + ->setAutoscaling($azureNodePoolAutoscaling) + ->setMaxPodsConstraint($azureNodePoolMaxPodsConstraint); + $request = (new CreateAzureNodePoolRequest()) + ->setParent($formattedParent) + ->setAzureNodePool($azureNodePool) + ->setAzureNodePoolId($azureNodePoolId); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $azureClustersClient->createAzureNodePool($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var AzureNodePool $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 +{ + $formattedParent = AzureClustersClient::azureClusterName( + '[PROJECT]', + '[LOCATION]', + '[AZURE_CLUSTER]' + ); + $azureNodePoolVersion = '[VERSION]'; + $azureNodePoolConfigSshConfigAuthorizedKey = '[AUTHORIZED_KEY]'; + $azureNodePoolSubnetId = '[SUBNET_ID]'; + $azureNodePoolAutoscalingMinNodeCount = 0; + $azureNodePoolAutoscalingMaxNodeCount = 0; + $azureNodePoolMaxPodsConstraintMaxPodsPerNode = 0; + $azureNodePoolId = '[AZURE_NODE_POOL_ID]'; + + create_azure_node_pool_sample( + $formattedParent, + $azureNodePoolVersion, + $azureNodePoolConfigSshConfigAuthorizedKey, + $azureNodePoolSubnetId, + $azureNodePoolAutoscalingMinNodeCount, + $azureNodePoolAutoscalingMaxNodeCount, + $azureNodePoolMaxPodsConstraintMaxPodsPerNode, + $azureNodePoolId + ); +} +// [END gkemulticloud_v1_generated_AzureClusters_CreateAzureNodePool_sync] diff --git a/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AzureClustersClient/delete_azure_client.php b/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AzureClustersClient/delete_azure_client.php new file mode 100644 index 000000000000..73cd6815764b --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AzureClustersClient/delete_azure_client.php @@ -0,0 +1,96 @@ +/locations//azureClients/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. Please see + * {@see AzureClustersClient::azureClientName()} for help formatting this field. + */ +function delete_azure_client_sample(string $formattedName): void +{ + // Create a client. + $azureClustersClient = new AzureClustersClient(); + + // Prepare the request message. + $request = (new DeleteAzureClientRequest()) + ->setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $azureClustersClient->deleteAzureClient($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + printf('Operation completed successfully.' . PHP_EOL); + } 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 = AzureClustersClient::azureClientName('[PROJECT]', '[LOCATION]', '[AZURE_CLIENT]'); + + delete_azure_client_sample($formattedName); +} +// [END gkemulticloud_v1_generated_AzureClusters_DeleteAzureClient_sync] diff --git a/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AzureClustersClient/delete_azure_cluster.php b/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AzureClustersClient/delete_azure_cluster.php new file mode 100644 index 000000000000..3db6efc56b76 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AzureClustersClient/delete_azure_cluster.php @@ -0,0 +1,99 @@ +/locations//azureClusters/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. Please see + * {@see AzureClustersClient::azureClusterName()} for help formatting this field. + */ +function delete_azure_cluster_sample(string $formattedName): void +{ + // Create a client. + $azureClustersClient = new AzureClustersClient(); + + // Prepare the request message. + $request = (new DeleteAzureClusterRequest()) + ->setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $azureClustersClient->deleteAzureCluster($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + printf('Operation completed successfully.' . PHP_EOL); + } 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 = AzureClustersClient::azureClusterName( + '[PROJECT]', + '[LOCATION]', + '[AZURE_CLUSTER]' + ); + + delete_azure_cluster_sample($formattedName); +} +// [END gkemulticloud_v1_generated_AzureClusters_DeleteAzureCluster_sync] diff --git a/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AzureClustersClient/delete_azure_node_pool.php b/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AzureClustersClient/delete_azure_node_pool.php new file mode 100644 index 000000000000..09682cc45c23 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AzureClustersClient/delete_azure_node_pool.php @@ -0,0 +1,97 @@ +/locations//azureClusters//azureNodePools/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. Please see + * {@see AzureClustersClient::azureNodePoolName()} for help formatting this field. + */ +function delete_azure_node_pool_sample(string $formattedName): void +{ + // Create a client. + $azureClustersClient = new AzureClustersClient(); + + // Prepare the request message. + $request = (new DeleteAzureNodePoolRequest()) + ->setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $azureClustersClient->deleteAzureNodePool($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + printf('Operation completed successfully.' . PHP_EOL); + } 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 = AzureClustersClient::azureNodePoolName( + '[PROJECT]', + '[LOCATION]', + '[AZURE_CLUSTER]', + '[AZURE_NODE_POOL]' + ); + + delete_azure_node_pool_sample($formattedName); +} +// [END gkemulticloud_v1_generated_AzureClusters_DeleteAzureNodePool_sync] diff --git a/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AzureClustersClient/generate_azure_access_token.php b/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AzureClustersClient/generate_azure_access_token.php new file mode 100644 index 000000000000..007c109faea2 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AzureClustersClient/generate_azure_access_token.php @@ -0,0 +1,84 @@ +/locations//AzureClusters/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. Please see + * {@see AzureClustersClient::azureClusterName()} for help formatting this field. + */ +function generate_azure_access_token_sample(string $formattedAzureCluster): void +{ + // Create a client. + $azureClustersClient = new AzureClustersClient(); + + // Prepare the request message. + $request = (new GenerateAzureAccessTokenRequest()) + ->setAzureCluster($formattedAzureCluster); + + // Call the API and handle any network failures. + try { + /** @var GenerateAzureAccessTokenResponse $response */ + $response = $azureClustersClient->generateAzureAccessToken($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 +{ + $formattedAzureCluster = AzureClustersClient::azureClusterName( + '[PROJECT]', + '[LOCATION]', + '[AZURE_CLUSTER]' + ); + + generate_azure_access_token_sample($formattedAzureCluster); +} +// [END gkemulticloud_v1_generated_AzureClusters_GenerateAzureAccessToken_sync] diff --git a/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AzureClustersClient/get_azure_client.php b/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AzureClustersClient/get_azure_client.php new file mode 100644 index 000000000000..d5c76b39d6ed --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AzureClustersClient/get_azure_client.php @@ -0,0 +1,81 @@ +/locations//azureClients/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. Please see + * {@see AzureClustersClient::azureClientName()} for help formatting this field. + */ +function get_azure_client_sample(string $formattedName): void +{ + // Create a client. + $azureClustersClient = new AzureClustersClient(); + + // Prepare the request message. + $request = (new GetAzureClientRequest()) + ->setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var AzureClient $response */ + $response = $azureClustersClient->getAzureClient($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 = AzureClustersClient::azureClientName('[PROJECT]', '[LOCATION]', '[AZURE_CLIENT]'); + + get_azure_client_sample($formattedName); +} +// [END gkemulticloud_v1_generated_AzureClusters_GetAzureClient_sync] diff --git a/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AzureClustersClient/get_azure_cluster.php b/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AzureClustersClient/get_azure_cluster.php new file mode 100644 index 000000000000..50e98138ea61 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AzureClustersClient/get_azure_cluster.php @@ -0,0 +1,84 @@ +/locations//azureClusters/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. Please see + * {@see AzureClustersClient::azureClusterName()} for help formatting this field. + */ +function get_azure_cluster_sample(string $formattedName): void +{ + // Create a client. + $azureClustersClient = new AzureClustersClient(); + + // Prepare the request message. + $request = (new GetAzureClusterRequest()) + ->setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var AzureCluster $response */ + $response = $azureClustersClient->getAzureCluster($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 = AzureClustersClient::azureClusterName( + '[PROJECT]', + '[LOCATION]', + '[AZURE_CLUSTER]' + ); + + get_azure_cluster_sample($formattedName); +} +// [END gkemulticloud_v1_generated_AzureClusters_GetAzureCluster_sync] diff --git a/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AzureClustersClient/get_azure_node_pool.php b/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AzureClustersClient/get_azure_node_pool.php new file mode 100644 index 000000000000..320c19e99bbe --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AzureClustersClient/get_azure_node_pool.php @@ -0,0 +1,85 @@ +/locations//azureClusters//azureNodePools/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. Please see + * {@see AzureClustersClient::azureNodePoolName()} for help formatting this field. + */ +function get_azure_node_pool_sample(string $formattedName): void +{ + // Create a client. + $azureClustersClient = new AzureClustersClient(); + + // Prepare the request message. + $request = (new GetAzureNodePoolRequest()) + ->setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var AzureNodePool $response */ + $response = $azureClustersClient->getAzureNodePool($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 = AzureClustersClient::azureNodePoolName( + '[PROJECT]', + '[LOCATION]', + '[AZURE_CLUSTER]', + '[AZURE_NODE_POOL]' + ); + + get_azure_node_pool_sample($formattedName); +} +// [END gkemulticloud_v1_generated_AzureClusters_GetAzureNodePool_sync] diff --git a/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AzureClustersClient/get_azure_server_config.php b/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AzureClustersClient/get_azure_server_config.php new file mode 100644 index 000000000000..ac90912218ec --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AzureClustersClient/get_azure_server_config.php @@ -0,0 +1,80 @@ +/locations//azureServerConfig`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. Please see + * {@see AzureClustersClient::azureServerConfigName()} for help formatting this field. + */ +function get_azure_server_config_sample(string $formattedName): void +{ + // Create a client. + $azureClustersClient = new AzureClustersClient(); + + // Prepare the request message. + $request = (new GetAzureServerConfigRequest()) + ->setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var AzureServerConfig $response */ + $response = $azureClustersClient->getAzureServerConfig($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 = AzureClustersClient::azureServerConfigName('[PROJECT]', '[LOCATION]'); + + get_azure_server_config_sample($formattedName); +} +// [END gkemulticloud_v1_generated_AzureClusters_GetAzureServerConfig_sync] diff --git a/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AzureClustersClient/list_azure_clients.php b/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AzureClustersClient/list_azure_clients.php new file mode 100644 index 000000000000..b9ae19b630d4 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AzureClustersClient/list_azure_clients.php @@ -0,0 +1,83 @@ +/locations/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. Please see + * {@see AzureClustersClient::locationName()} for help formatting this field. + */ +function list_azure_clients_sample(string $formattedParent): void +{ + // Create a client. + $azureClustersClient = new AzureClustersClient(); + + // Prepare the request message. + $request = (new ListAzureClientsRequest()) + ->setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $azureClustersClient->listAzureClients($request); + + /** @var AzureClient $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 = AzureClustersClient::locationName('[PROJECT]', '[LOCATION]'); + + list_azure_clients_sample($formattedParent); +} +// [END gkemulticloud_v1_generated_AzureClusters_ListAzureClients_sync] diff --git a/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AzureClustersClient/list_azure_clusters.php b/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AzureClustersClient/list_azure_clusters.php new file mode 100644 index 000000000000..084c07a5e087 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AzureClustersClient/list_azure_clusters.php @@ -0,0 +1,83 @@ +/locations/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. Please see + * {@see AzureClustersClient::locationName()} for help formatting this field. + */ +function list_azure_clusters_sample(string $formattedParent): void +{ + // Create a client. + $azureClustersClient = new AzureClustersClient(); + + // Prepare the request message. + $request = (new ListAzureClustersRequest()) + ->setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $azureClustersClient->listAzureClusters($request); + + /** @var AzureCluster $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 = AzureClustersClient::locationName('[PROJECT]', '[LOCATION]'); + + list_azure_clusters_sample($formattedParent); +} +// [END gkemulticloud_v1_generated_AzureClusters_ListAzureClusters_sync] diff --git a/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AzureClustersClient/list_azure_node_pools.php b/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AzureClustersClient/list_azure_node_pools.php new file mode 100644 index 000000000000..7678ac764a00 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AzureClustersClient/list_azure_node_pools.php @@ -0,0 +1,89 @@ +/locations//azureClusters/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. Please see + * {@see AzureClustersClient::azureClusterName()} for help formatting this field. + */ +function list_azure_node_pools_sample(string $formattedParent): void +{ + // Create a client. + $azureClustersClient = new AzureClustersClient(); + + // Prepare the request message. + $request = (new ListAzureNodePoolsRequest()) + ->setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $azureClustersClient->listAzureNodePools($request); + + /** @var AzureNodePool $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 = AzureClustersClient::azureClusterName( + '[PROJECT]', + '[LOCATION]', + '[AZURE_CLUSTER]' + ); + + list_azure_node_pools_sample($formattedParent); +} +// [END gkemulticloud_v1_generated_AzureClusters_ListAzureNodePools_sync] diff --git a/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AzureClustersClient/update_azure_cluster.php b/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AzureClustersClient/update_azure_cluster.php new file mode 100644 index 000000000000..4661e913243c --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AzureClustersClient/update_azure_cluster.php @@ -0,0 +1,194 @@ +/resourceGroups/` + * @param string $azureClusterNetworkingVirtualNetworkId The Azure Resource Manager (ARM) ID of the VNet associated with + * your cluster. + * + * All components in the cluster (i.e. control plane and node pools) run on a + * single VNet. + * + * Example: + * `/subscriptions//resourceGroups//providers/Microsoft.Network/virtualNetworks/` + * + * This field cannot be changed after creation. + * @param string $azureClusterNetworkingPodAddressCidrBlocksElement The IP address range of the pods in this cluster, in CIDR + * notation (e.g. `10.96.0.0/14`). + * + * All pods in the cluster get assigned a unique IPv4 address from these + * ranges. Only a single range is supported. + * + * This field cannot be changed after creation. + * @param string $azureClusterNetworkingServiceAddressCidrBlocksElement The IP address range for services in this cluster, in CIDR + * notation (e.g. `10.96.0.0/14`). + * + * All services in the cluster get assigned a unique IPv4 address from these + * ranges. Only a single range is supported. + * + * This field cannot be changed after creating a cluster. + * @param string $azureClusterControlPlaneVersion The Kubernetes version to run on control plane replicas + * (e.g. `1.19.10-gke.1000`). + * + * You can list all supported versions on a given Google Cloud region by + * calling + * [GetAzureServerConfig][google.cloud.gkemulticloud.v1.AzureClusters.GetAzureServerConfig]. + * @param string $azureClusterControlPlaneSshConfigAuthorizedKey The SSH public key data for VMs managed by Anthos. This accepts + * the authorized_keys file format used in OpenSSH according to the sshd(8) + * manual page. + * @param string $azureClusterAuthorizationAdminUsersUsername The name of the user, e.g. `my-gcp-id@gmail.com`. + * @param string $azureClusterFleetProject The name of the Fleet host project where this cluster will be + * registered. + * + * Project names are formatted as + * `projects/`. + */ +function update_azure_cluster_sample( + string $azureClusterAzureRegion, + string $azureClusterResourceGroupId, + string $azureClusterNetworkingVirtualNetworkId, + string $azureClusterNetworkingPodAddressCidrBlocksElement, + string $azureClusterNetworkingServiceAddressCidrBlocksElement, + string $azureClusterControlPlaneVersion, + string $azureClusterControlPlaneSshConfigAuthorizedKey, + string $azureClusterAuthorizationAdminUsersUsername, + string $azureClusterFleetProject +): void { + // Create a client. + $azureClustersClient = new AzureClustersClient(); + + // Prepare the request message. + $azureClusterNetworkingPodAddressCidrBlocks = [ + $azureClusterNetworkingPodAddressCidrBlocksElement, + ]; + $azureClusterNetworkingServiceAddressCidrBlocks = [ + $azureClusterNetworkingServiceAddressCidrBlocksElement, + ]; + $azureClusterNetworking = (new AzureClusterNetworking()) + ->setVirtualNetworkId($azureClusterNetworkingVirtualNetworkId) + ->setPodAddressCidrBlocks($azureClusterNetworkingPodAddressCidrBlocks) + ->setServiceAddressCidrBlocks($azureClusterNetworkingServiceAddressCidrBlocks); + $azureClusterControlPlaneSshConfig = (new AzureSshConfig()) + ->setAuthorizedKey($azureClusterControlPlaneSshConfigAuthorizedKey); + $azureClusterControlPlane = (new AzureControlPlane()) + ->setVersion($azureClusterControlPlaneVersion) + ->setSshConfig($azureClusterControlPlaneSshConfig); + $azureClusterUser = (new AzureClusterUser()) + ->setUsername($azureClusterAuthorizationAdminUsersUsername); + $azureClusterAuthorizationAdminUsers = [$azureClusterUser,]; + $azureClusterAuthorization = (new AzureAuthorization()) + ->setAdminUsers($azureClusterAuthorizationAdminUsers); + $azureClusterFleet = (new Fleet()) + ->setProject($azureClusterFleetProject); + $azureCluster = (new AzureCluster()) + ->setAzureRegion($azureClusterAzureRegion) + ->setResourceGroupId($azureClusterResourceGroupId) + ->setNetworking($azureClusterNetworking) + ->setControlPlane($azureClusterControlPlane) + ->setAuthorization($azureClusterAuthorization) + ->setFleet($azureClusterFleet); + $updateMask = new FieldMask(); + $request = (new UpdateAzureClusterRequest()) + ->setAzureCluster($azureCluster) + ->setUpdateMask($updateMask); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $azureClustersClient->updateAzureCluster($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var AzureCluster $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 +{ + $azureClusterAzureRegion = '[AZURE_REGION]'; + $azureClusterResourceGroupId = '[RESOURCE_GROUP_ID]'; + $azureClusterNetworkingVirtualNetworkId = '[VIRTUAL_NETWORK_ID]'; + $azureClusterNetworkingPodAddressCidrBlocksElement = '[POD_ADDRESS_CIDR_BLOCKS]'; + $azureClusterNetworkingServiceAddressCidrBlocksElement = '[SERVICE_ADDRESS_CIDR_BLOCKS]'; + $azureClusterControlPlaneVersion = '[VERSION]'; + $azureClusterControlPlaneSshConfigAuthorizedKey = '[AUTHORIZED_KEY]'; + $azureClusterAuthorizationAdminUsersUsername = '[USERNAME]'; + $azureClusterFleetProject = '[PROJECT]'; + + update_azure_cluster_sample( + $azureClusterAzureRegion, + $azureClusterResourceGroupId, + $azureClusterNetworkingVirtualNetworkId, + $azureClusterNetworkingPodAddressCidrBlocksElement, + $azureClusterNetworkingServiceAddressCidrBlocksElement, + $azureClusterControlPlaneVersion, + $azureClusterControlPlaneSshConfigAuthorizedKey, + $azureClusterAuthorizationAdminUsersUsername, + $azureClusterFleetProject + ); +} +// [END gkemulticloud_v1_generated_AzureClusters_UpdateAzureCluster_sync] diff --git a/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AzureClustersClient/update_azure_node_pool.php b/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AzureClustersClient/update_azure_node_pool.php new file mode 100644 index 000000000000..875782246004 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/samples/V1/AzureClustersClient/update_azure_node_pool.php @@ -0,0 +1,133 @@ +setAuthorizedKey($azureNodePoolConfigSshConfigAuthorizedKey); + $azureNodePoolConfig = (new AzureNodeConfig()) + ->setSshConfig($azureNodePoolConfigSshConfig); + $azureNodePoolAutoscaling = (new AzureNodePoolAutoscaling()) + ->setMinNodeCount($azureNodePoolAutoscalingMinNodeCount) + ->setMaxNodeCount($azureNodePoolAutoscalingMaxNodeCount); + $azureNodePoolMaxPodsConstraint = (new MaxPodsConstraint()) + ->setMaxPodsPerNode($azureNodePoolMaxPodsConstraintMaxPodsPerNode); + $azureNodePool = (new AzureNodePool()) + ->setVersion($azureNodePoolVersion) + ->setConfig($azureNodePoolConfig) + ->setSubnetId($azureNodePoolSubnetId) + ->setAutoscaling($azureNodePoolAutoscaling) + ->setMaxPodsConstraint($azureNodePoolMaxPodsConstraint); + $updateMask = new FieldMask(); + $request = (new UpdateAzureNodePoolRequest()) + ->setAzureNodePool($azureNodePool) + ->setUpdateMask($updateMask); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $azureClustersClient->updateAzureNodePool($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var AzureNodePool $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 +{ + $azureNodePoolVersion = '[VERSION]'; + $azureNodePoolConfigSshConfigAuthorizedKey = '[AUTHORIZED_KEY]'; + $azureNodePoolSubnetId = '[SUBNET_ID]'; + $azureNodePoolAutoscalingMinNodeCount = 0; + $azureNodePoolAutoscalingMaxNodeCount = 0; + $azureNodePoolMaxPodsConstraintMaxPodsPerNode = 0; + + update_azure_node_pool_sample( + $azureNodePoolVersion, + $azureNodePoolConfigSshConfigAuthorizedKey, + $azureNodePoolSubnetId, + $azureNodePoolAutoscalingMinNodeCount, + $azureNodePoolAutoscalingMaxNodeCount, + $azureNodePoolMaxPodsConstraintMaxPodsPerNode + ); +} +// [END gkemulticloud_v1_generated_AzureClusters_UpdateAzureNodePool_sync] diff --git a/owl-bot-staging/GkeMultiCloud/v1/src/V1/AttachedClustersClient.php b/owl-bot-staging/GkeMultiCloud/v1/src/V1/AttachedClustersClient.php new file mode 100644 index 000000000000..e8d698f9abe6 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/src/V1/AttachedClustersClient.php @@ -0,0 +1,34 @@ + self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../../resources/attached_clusters_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../../resources/attached_clusters_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../../resources/attached_clusters_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../../resources/attached_clusters_rest_client_config.php', + ], + ], + ]; + } + + /** + * 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 + * attached_cluster resource. + * + * @param string $project + * @param string $location + * @param string $attachedCluster + * + * @return string The formatted attached_cluster resource. + */ + public static function attachedClusterName(string $project, string $location, string $attachedCluster): string + { + return self::getPathTemplate('attachedCluster')->render([ + 'project' => $project, + 'location' => $location, + 'attached_cluster' => $attachedCluster, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * attached_server_config resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted attached_server_config resource. + */ + public static function attachedServerConfigName(string $project, string $location): string + { + return self::getPathTemplate('attachedServerConfig')->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a location + * resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted location resource. + */ + public static function locationName(string $project, string $location): string + { + return self::getPathTemplate('location')->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - attachedCluster: projects/{project}/locations/{location}/attachedClusters/{attached_cluster} + * - attachedServerConfig: projects/{project}/locations/{location}/attachedServerConfig + * - location: projects/{project}/locations/{location} + * + * 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 'gkemulticloud.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. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *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' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods 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 + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource + * on a given Google Cloud Platform project and region. + * + * If successful, the response contains a newly created + * [Operation][google.longrunning.Operation] resource that can be + * described to track the status of the operation. + * + * The async variant is {@see self::createAttachedClusterAsync()} . + * + * @param CreateAttachedClusterRequest $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 createAttachedCluster(CreateAttachedClusterRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('CreateAttachedCluster', $request, $callOptions)->wait(); + } + + /** + * Deletes a specific + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource. + * + * If successful, the response contains a newly created + * [Operation][google.longrunning.Operation] resource that can be + * described to track the status of the operation. + * + * The async variant is {@see self::deleteAttachedClusterAsync()} . + * + * @param DeleteAttachedClusterRequest $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 deleteAttachedCluster(DeleteAttachedClusterRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('DeleteAttachedCluster', $request, $callOptions)->wait(); + } + + /** + * Generates the install manifest to be installed on the target cluster. + * + * The async variant is {@see self::generateAttachedClusterInstallManifestAsync()} + * . + * + * @param GenerateAttachedClusterInstallManifestRequest $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 GenerateAttachedClusterInstallManifestResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function generateAttachedClusterInstallManifest(GenerateAttachedClusterInstallManifestRequest $request, array $callOptions = []): GenerateAttachedClusterInstallManifestResponse + { + return $this->startApiCall('GenerateAttachedClusterInstallManifest', $request, $callOptions)->wait(); + } + + /** + * Describes a specific + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource. + * + * The async variant is {@see self::getAttachedClusterAsync()} . + * + * @param GetAttachedClusterRequest $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 AttachedCluster + * + * @throws ApiException Thrown if the API call fails. + */ + public function getAttachedCluster(GetAttachedClusterRequest $request, array $callOptions = []): AttachedCluster + { + return $this->startApiCall('GetAttachedCluster', $request, $callOptions)->wait(); + } + + /** + * Returns information, such as supported Kubernetes versions, on a given + * Google Cloud location. + * + * The async variant is {@see self::getAttachedServerConfigAsync()} . + * + * @param GetAttachedServerConfigRequest $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 AttachedServerConfig + * + * @throws ApiException Thrown if the API call fails. + */ + public function getAttachedServerConfig(GetAttachedServerConfigRequest $request, array $callOptions = []): AttachedServerConfig + { + return $this->startApiCall('GetAttachedServerConfig', $request, $callOptions)->wait(); + } + + /** + * Imports creates a new + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource + * by importing an existing Fleet Membership resource. + * + * Attached Clusters created before the introduction of the Anthos Multi-Cloud + * API can be imported through this method. + * + * If successful, the response contains a newly created + * [Operation][google.longrunning.Operation] resource that can be + * described to track the status of the operation. + * + * The async variant is {@see self::importAttachedClusterAsync()} . + * + * @param ImportAttachedClusterRequest $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 importAttachedCluster(ImportAttachedClusterRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('ImportAttachedCluster', $request, $callOptions)->wait(); + } + + /** + * Lists all [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] + * resources on a given Google Cloud project and region. + * + * The async variant is {@see self::listAttachedClustersAsync()} . + * + * @param ListAttachedClustersRequest $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 listAttachedClusters(ListAttachedClustersRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListAttachedClusters', $request, $callOptions); + } + + /** + * Updates an + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster]. + * + * The async variant is {@see self::updateAttachedClusterAsync()} . + * + * @param UpdateAttachedClusterRequest $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 updateAttachedCluster(UpdateAttachedClusterRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('UpdateAttachedCluster', $request, $callOptions)->wait(); + } +} diff --git a/owl-bot-staging/GkeMultiCloud/v1/src/V1/Client/BaseClient/AwsClustersBaseClient.php b/owl-bot-staging/GkeMultiCloud/v1/src/V1/Client/BaseClient/AwsClustersBaseClient.php new file mode 100644 index 000000000000..9111531aee67 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/src/V1/Client/BaseClient/AwsClustersBaseClient.php @@ -0,0 +1,650 @@ + self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../../resources/aws_clusters_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../../resources/aws_clusters_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../../resources/aws_clusters_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../../resources/aws_clusters_rest_client_config.php', + ], + ], + ]; + } + + /** + * 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 aws_cluster + * resource. + * + * @param string $project + * @param string $location + * @param string $awsCluster + * + * @return string The formatted aws_cluster resource. + */ + public static function awsClusterName(string $project, string $location, string $awsCluster): string + { + return self::getPathTemplate('awsCluster')->render([ + 'project' => $project, + 'location' => $location, + 'aws_cluster' => $awsCluster, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * aws_node_pool resource. + * + * @param string $project + * @param string $location + * @param string $awsCluster + * @param string $awsNodePool + * + * @return string The formatted aws_node_pool resource. + */ + public static function awsNodePoolName(string $project, string $location, string $awsCluster, string $awsNodePool): string + { + return self::getPathTemplate('awsNodePool')->render([ + 'project' => $project, + 'location' => $location, + 'aws_cluster' => $awsCluster, + 'aws_node_pool' => $awsNodePool, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * aws_server_config resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted aws_server_config resource. + */ + public static function awsServerConfigName(string $project, string $location): string + { + return self::getPathTemplate('awsServerConfig')->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a location + * resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted location resource. + */ + public static function locationName(string $project, string $location): string + { + return self::getPathTemplate('location')->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - awsCluster: projects/{project}/locations/{location}/awsClusters/{aws_cluster} + * - awsNodePool: projects/{project}/locations/{location}/awsClusters/{aws_cluster}/awsNodePools/{aws_node_pool} + * - awsServerConfig: projects/{project}/locations/{location}/awsServerConfig + * - location: projects/{project}/locations/{location} + * + * 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 'gkemulticloud.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. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *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' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods 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 [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] + * resource on a given Google Cloud Platform project and region. + * + * If successful, the response contains a newly created + * [Operation][google.longrunning.Operation] resource that can be + * described to track the status of the operation. + * + * The async variant is {@see self::createAwsClusterAsync()} . + * + * @param CreateAwsClusterRequest $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 createAwsCluster(CreateAwsClusterRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('CreateAwsCluster', $request, $callOptions)->wait(); + } + + /** + * Creates a new [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool], + * attached to a given [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster]. + * + * If successful, the response contains a newly created + * [Operation][google.longrunning.Operation] resource that can be + * described to track the status of the operation. + * + * The async variant is {@see self::createAwsNodePoolAsync()} . + * + * @param CreateAwsNodePoolRequest $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 createAwsNodePool(CreateAwsNodePoolRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('CreateAwsNodePool', $request, $callOptions)->wait(); + } + + /** + * Deletes a specific [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] + * resource. + * + * Fails if the cluster has one or more associated + * [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] resources. + * + * If successful, the response contains a newly created + * [Operation][google.longrunning.Operation] resource that can be + * described to track the status of the operation. + * + * The async variant is {@see self::deleteAwsClusterAsync()} . + * + * @param DeleteAwsClusterRequest $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 deleteAwsCluster(DeleteAwsClusterRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('DeleteAwsCluster', $request, $callOptions)->wait(); + } + + /** + * Deletes a specific [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] + * resource. + * + * If successful, the response contains a newly created + * [Operation][google.longrunning.Operation] resource that can be + * described to track the status of the operation. + * + * The async variant is {@see self::deleteAwsNodePoolAsync()} . + * + * @param DeleteAwsNodePoolRequest $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 deleteAwsNodePool(DeleteAwsNodePoolRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('DeleteAwsNodePool', $request, $callOptions)->wait(); + } + + /** + * Generates a short-lived access token to authenticate to a given + * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resource. + * + * The async variant is {@see self::generateAwsAccessTokenAsync()} . + * + * @param GenerateAwsAccessTokenRequest $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 GenerateAwsAccessTokenResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function generateAwsAccessToken(GenerateAwsAccessTokenRequest $request, array $callOptions = []): GenerateAwsAccessTokenResponse + { + return $this->startApiCall('GenerateAwsAccessToken', $request, $callOptions)->wait(); + } + + /** + * Describes a specific [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] + * resource. + * + * The async variant is {@see self::getAwsClusterAsync()} . + * + * @param GetAwsClusterRequest $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 AwsCluster + * + * @throws ApiException Thrown if the API call fails. + */ + public function getAwsCluster(GetAwsClusterRequest $request, array $callOptions = []): AwsCluster + { + return $this->startApiCall('GetAwsCluster', $request, $callOptions)->wait(); + } + + /** + * Describes a specific + * [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] resource. + * + * The async variant is {@see self::getAwsNodePoolAsync()} . + * + * @param GetAwsNodePoolRequest $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 AwsNodePool + * + * @throws ApiException Thrown if the API call fails. + */ + public function getAwsNodePool(GetAwsNodePoolRequest $request, array $callOptions = []): AwsNodePool + { + return $this->startApiCall('GetAwsNodePool', $request, $callOptions)->wait(); + } + + /** + * Returns information, such as supported AWS regions and Kubernetes + * versions, on a given Google Cloud location. + * + * The async variant is {@see self::getAwsServerConfigAsync()} . + * + * @param GetAwsServerConfigRequest $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 AwsServerConfig + * + * @throws ApiException Thrown if the API call fails. + */ + public function getAwsServerConfig(GetAwsServerConfigRequest $request, array $callOptions = []): AwsServerConfig + { + return $this->startApiCall('GetAwsServerConfig', $request, $callOptions)->wait(); + } + + /** + * Lists all [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resources + * on a given Google Cloud project and region. + * + * The async variant is {@see self::listAwsClustersAsync()} . + * + * @param ListAwsClustersRequest $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 listAwsClusters(ListAwsClustersRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListAwsClusters', $request, $callOptions); + } + + /** + * Lists all [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] + * resources on a given + * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster]. + * + * The async variant is {@see self::listAwsNodePoolsAsync()} . + * + * @param ListAwsNodePoolsRequest $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 listAwsNodePools(ListAwsNodePoolsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListAwsNodePools', $request, $callOptions); + } + + /** + * Updates an [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster]. + * + * The async variant is {@see self::updateAwsClusterAsync()} . + * + * @param UpdateAwsClusterRequest $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 updateAwsCluster(UpdateAwsClusterRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('UpdateAwsCluster', $request, $callOptions)->wait(); + } + + /** + * Updates an [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool]. + * + * The async variant is {@see self::updateAwsNodePoolAsync()} . + * + * @param UpdateAwsNodePoolRequest $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 updateAwsNodePool(UpdateAwsNodePoolRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('UpdateAwsNodePool', $request, $callOptions)->wait(); + } +} diff --git a/owl-bot-staging/GkeMultiCloud/v1/src/V1/Client/BaseClient/AzureClustersBaseClient.php b/owl-bot-staging/GkeMultiCloud/v1/src/V1/Client/BaseClient/AzureClustersBaseClient.php new file mode 100644 index 000000000000..c38fee4c9c8e --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/src/V1/Client/BaseClient/AzureClustersBaseClient.php @@ -0,0 +1,795 @@ + self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../../resources/azure_clusters_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../../resources/azure_clusters_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../../resources/azure_clusters_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../../resources/azure_clusters_rest_client_config.php', + ], + ], + ]; + } + + /** + * 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 azure_client + * resource. + * + * @param string $project + * @param string $location + * @param string $azureClient + * + * @return string The formatted azure_client resource. + */ + public static function azureClientName(string $project, string $location, string $azureClient): string + { + return self::getPathTemplate('azureClient')->render([ + 'project' => $project, + 'location' => $location, + 'azure_client' => $azureClient, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * azure_cluster resource. + * + * @param string $project + * @param string $location + * @param string $azureCluster + * + * @return string The formatted azure_cluster resource. + */ + public static function azureClusterName(string $project, string $location, string $azureCluster): string + { + return self::getPathTemplate('azureCluster')->render([ + 'project' => $project, + 'location' => $location, + 'azure_cluster' => $azureCluster, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * azure_node_pool resource. + * + * @param string $project + * @param string $location + * @param string $azureCluster + * @param string $azureNodePool + * + * @return string The formatted azure_node_pool resource. + */ + public static function azureNodePoolName(string $project, string $location, string $azureCluster, string $azureNodePool): string + { + return self::getPathTemplate('azureNodePool')->render([ + 'project' => $project, + 'location' => $location, + 'azure_cluster' => $azureCluster, + 'azure_node_pool' => $azureNodePool, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * azure_server_config resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted azure_server_config resource. + */ + public static function azureServerConfigName(string $project, string $location): string + { + return self::getPathTemplate('azureServerConfig')->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a location + * resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted location resource. + */ + public static function locationName(string $project, string $location): string + { + return self::getPathTemplate('location')->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - azureClient: projects/{project}/locations/{location}/azureClients/{azure_client} + * - azureCluster: projects/{project}/locations/{location}/azureClusters/{azure_cluster} + * - azureNodePool: projects/{project}/locations/{location}/azureClusters/{azure_cluster}/azureNodePools/{azure_node_pool} + * - azureServerConfig: projects/{project}/locations/{location}/azureServerConfig + * - location: projects/{project}/locations/{location} + * + * 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 'gkemulticloud.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. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *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' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods 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 [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] + * resource on a given Google Cloud project and region. + * + * `AzureClient` resources hold client authentication + * information needed by the Anthos Multicloud API to manage Azure resources + * on your Azure subscription on your behalf. + * + * If successful, the response contains a newly created + * [Operation][google.longrunning.Operation] resource that can be + * described to track the status of the operation. + * + * The async variant is {@see self::createAzureClientAsync()} . + * + * @param CreateAzureClientRequest $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 createAzureClient(CreateAzureClientRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('CreateAzureClient', $request, $callOptions)->wait(); + } + + /** + * Creates a new [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] + * resource on a given Google Cloud Platform project and region. + * + * If successful, the response contains a newly created + * [Operation][google.longrunning.Operation] resource that can be + * described to track the status of the operation. + * + * The async variant is {@see self::createAzureClusterAsync()} . + * + * @param CreateAzureClusterRequest $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 createAzureCluster(CreateAzureClusterRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('CreateAzureCluster', $request, $callOptions)->wait(); + } + + /** + * Creates a new [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool], + * attached to a given + * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster]. + * + * If successful, the response contains a newly created + * [Operation][google.longrunning.Operation] resource that can be + * described to track the status of the operation. + * + * The async variant is {@see self::createAzureNodePoolAsync()} . + * + * @param CreateAzureNodePoolRequest $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 createAzureNodePool(CreateAzureNodePoolRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('CreateAzureNodePool', $request, $callOptions)->wait(); + } + + /** + * Deletes a specific [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] + * resource. + * + * If the client is used by one or more clusters, deletion will + * fail and a `FAILED_PRECONDITION` error will be returned. + * + * If successful, the response contains a newly created + * [Operation][google.longrunning.Operation] resource that can be + * described to track the status of the operation. + * + * The async variant is {@see self::deleteAzureClientAsync()} . + * + * @param DeleteAzureClientRequest $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 deleteAzureClient(DeleteAzureClientRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('DeleteAzureClient', $request, $callOptions)->wait(); + } + + /** + * Deletes a specific + * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource. + * + * Fails if the cluster has one or more associated + * [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] resources. + * + * If successful, the response contains a newly created + * [Operation][google.longrunning.Operation] resource that can be + * described to track the status of the operation. + * + * The async variant is {@see self::deleteAzureClusterAsync()} . + * + * @param DeleteAzureClusterRequest $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 deleteAzureCluster(DeleteAzureClusterRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('DeleteAzureCluster', $request, $callOptions)->wait(); + } + + /** + * Deletes a specific + * [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] resource. + * + * If successful, the response contains a newly created + * [Operation][google.longrunning.Operation] resource that can be + * described to track the status of the operation. + * + * The async variant is {@see self::deleteAzureNodePoolAsync()} . + * + * @param DeleteAzureNodePoolRequest $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 deleteAzureNodePool(DeleteAzureNodePoolRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('DeleteAzureNodePool', $request, $callOptions)->wait(); + } + + /** + * Generates a short-lived access token to authenticate to a given + * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource. + * + * The async variant is {@see self::generateAzureAccessTokenAsync()} . + * + * @param GenerateAzureAccessTokenRequest $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 GenerateAzureAccessTokenResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function generateAzureAccessToken(GenerateAzureAccessTokenRequest $request, array $callOptions = []): GenerateAzureAccessTokenResponse + { + return $this->startApiCall('GenerateAzureAccessToken', $request, $callOptions)->wait(); + } + + /** + * Describes a specific + * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] resource. + * + * The async variant is {@see self::getAzureClientAsync()} . + * + * @param GetAzureClientRequest $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 AzureClient + * + * @throws ApiException Thrown if the API call fails. + */ + public function getAzureClient(GetAzureClientRequest $request, array $callOptions = []): AzureClient + { + return $this->startApiCall('GetAzureClient', $request, $callOptions)->wait(); + } + + /** + * Describes a specific + * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource. + * + * The async variant is {@see self::getAzureClusterAsync()} . + * + * @param GetAzureClusterRequest $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 AzureCluster + * + * @throws ApiException Thrown if the API call fails. + */ + public function getAzureCluster(GetAzureClusterRequest $request, array $callOptions = []): AzureCluster + { + return $this->startApiCall('GetAzureCluster', $request, $callOptions)->wait(); + } + + /** + * Describes a specific + * [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] resource. + * + * The async variant is {@see self::getAzureNodePoolAsync()} . + * + * @param GetAzureNodePoolRequest $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 AzureNodePool + * + * @throws ApiException Thrown if the API call fails. + */ + public function getAzureNodePool(GetAzureNodePoolRequest $request, array $callOptions = []): AzureNodePool + { + return $this->startApiCall('GetAzureNodePool', $request, $callOptions)->wait(); + } + + /** + * Returns information, such as supported Azure regions and Kubernetes + * versions, on a given Google Cloud location. + * + * The async variant is {@see self::getAzureServerConfigAsync()} . + * + * @param GetAzureServerConfigRequest $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 AzureServerConfig + * + * @throws ApiException Thrown if the API call fails. + */ + public function getAzureServerConfig(GetAzureServerConfigRequest $request, array $callOptions = []): AzureServerConfig + { + return $this->startApiCall('GetAzureServerConfig', $request, $callOptions)->wait(); + } + + /** + * Lists all [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] + * resources on a given Google Cloud project and region. + * + * The async variant is {@see self::listAzureClientsAsync()} . + * + * @param ListAzureClientsRequest $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 listAzureClients(ListAzureClientsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListAzureClients', $request, $callOptions); + } + + /** + * Lists all [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] + * resources on a given Google Cloud project and region. + * + * The async variant is {@see self::listAzureClustersAsync()} . + * + * @param ListAzureClustersRequest $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 listAzureClusters(ListAzureClustersRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListAzureClusters', $request, $callOptions); + } + + /** + * Lists all [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] + * resources on a given + * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster]. + * + * The async variant is {@see self::listAzureNodePoolsAsync()} . + * + * @param ListAzureNodePoolsRequest $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 listAzureNodePools(ListAzureNodePoolsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListAzureNodePools', $request, $callOptions); + } + + /** + * Updates an [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster]. + * + * The async variant is {@see self::updateAzureClusterAsync()} . + * + * @param UpdateAzureClusterRequest $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 updateAzureCluster(UpdateAzureClusterRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('UpdateAzureCluster', $request, $callOptions)->wait(); + } + + /** + * Updates an [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool]. + * + * The async variant is {@see self::updateAzureNodePoolAsync()} . + * + * @param UpdateAzureNodePoolRequest $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 updateAzureNodePool(UpdateAzureNodePoolRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('UpdateAzureNodePool', $request, $callOptions)->wait(); + } +} diff --git a/owl-bot-staging/GkeMultiCloud/v1/src/V1/Gapic/AttachedClustersGapicClient.php b/owl-bot-staging/GkeMultiCloud/v1/src/V1/Gapic/AttachedClustersGapicClient.php new file mode 100644 index 000000000000..3fae99c9a417 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/src/V1/Gapic/AttachedClustersGapicClient.php @@ -0,0 +1,1017 @@ +locationName('[PROJECT]', '[LOCATION]'); + * $attachedCluster = new AttachedCluster(); + * $attachedClusterId = 'attached_cluster_id'; + * $operationResponse = $attachedClustersClient->createAttachedCluster($formattedParent, $attachedCluster, $attachedClusterId); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $attachedClustersClient->createAttachedCluster($formattedParent, $attachedCluster, $attachedClusterId); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $attachedClustersClient->resumeOperation($operationName, 'createAttachedCluster'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $attachedClustersClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + */ +class AttachedClustersGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.gkemulticloud.v1.AttachedClusters'; + + /** The default address of the service. */ + const SERVICE_ADDRESS = 'gkemulticloud.googleapis.com'; + + /** The default port of the service. */ + const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + ]; + + private static $attachedClusterNameTemplate; + + private static $attachedServerConfigNameTemplate; + + private static $locationNameTemplate; + + private static $pathTemplateMap; + + private $operationsClient; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/attached_clusters_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/attached_clusters_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/attached_clusters_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/attached_clusters_rest_client_config.php', + ], + ], + ]; + } + + private static function getAttachedClusterNameTemplate() + { + if (self::$attachedClusterNameTemplate == null) { + self::$attachedClusterNameTemplate = new PathTemplate('projects/{project}/locations/{location}/attachedClusters/{attached_cluster}'); + } + + return self::$attachedClusterNameTemplate; + } + + private static function getAttachedServerConfigNameTemplate() + { + if (self::$attachedServerConfigNameTemplate == null) { + self::$attachedServerConfigNameTemplate = new PathTemplate('projects/{project}/locations/{location}/attachedServerConfig'); + } + + return self::$attachedServerConfigNameTemplate; + } + + private static function getLocationNameTemplate() + { + if (self::$locationNameTemplate == null) { + self::$locationNameTemplate = new PathTemplate('projects/{project}/locations/{location}'); + } + + return self::$locationNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'attachedCluster' => self::getAttachedClusterNameTemplate(), + 'attachedServerConfig' => self::getAttachedServerConfigNameTemplate(), + 'location' => self::getLocationNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a + * attached_cluster resource. + * + * @param string $project + * @param string $location + * @param string $attachedCluster + * + * @return string The formatted attached_cluster resource. + */ + public static function attachedClusterName($project, $location, $attachedCluster) + { + return self::getAttachedClusterNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'attached_cluster' => $attachedCluster, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * attached_server_config resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted attached_server_config resource. + */ + public static function attachedServerConfigName($project, $location) + { + return self::getAttachedServerConfigNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a location + * resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted location resource. + */ + public static function locationName($project, $location) + { + return self::getLocationNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - attachedCluster: projects/{project}/locations/{location}/attachedClusters/{attached_cluster} + * - attachedServerConfig: projects/{project}/locations/{location}/attachedServerConfig + * - location: projects/{project}/locations/{location} + * + * 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($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * 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; + } + + /** + * 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 'gkemulticloud.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. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *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' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods 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); + } + + /** + * Creates a new + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource + * on a given Google Cloud Platform project and region. + * + * If successful, the response contains a newly created + * [Operation][google.longrunning.Operation] resource that can be + * described to track the status of the operation. + * + * Sample code: + * ``` + * $attachedClustersClient = new AttachedClustersClient(); + * try { + * $formattedParent = $attachedClustersClient->locationName('[PROJECT]', '[LOCATION]'); + * $attachedCluster = new AttachedCluster(); + * $attachedClusterId = 'attached_cluster_id'; + * $operationResponse = $attachedClustersClient->createAttachedCluster($formattedParent, $attachedCluster, $attachedClusterId); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $attachedClustersClient->createAttachedCluster($formattedParent, $attachedCluster, $attachedClusterId); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $attachedClustersClient->resumeOperation($operationName, 'createAttachedCluster'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $attachedClustersClient->close(); + * } + * ``` + * + * @param string $parent Required. The parent location where this + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource + * will be created. + * + * Location names are formatted as `projects//locations/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * @param AttachedCluster $attachedCluster Required. The specification of the + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] to create. + * @param string $attachedClusterId Required. A client provided ID the resource. Must be unique within the + * parent resource. + * + * The provided ID will be part of the + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource + * name formatted as + * `projects//locations//attachedClusters/`. + * + * Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. + * @param array $optionalArgs { + * Optional. + * + * @type bool $validateOnly + * If set, only validate the request, but do not actually create the cluster. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function createAttachedCluster($parent, $attachedCluster, $attachedClusterId, array $optionalArgs = []) + { + $request = new CreateAttachedClusterRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setAttachedCluster($attachedCluster); + $request->setAttachedClusterId($attachedClusterId); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['validateOnly'])) { + $request->setValidateOnly($optionalArgs['validateOnly']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateAttachedCluster', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Deletes a specific + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource. + * + * If successful, the response contains a newly created + * [Operation][google.longrunning.Operation] resource that can be + * described to track the status of the operation. + * + * Sample code: + * ``` + * $attachedClustersClient = new AttachedClustersClient(); + * try { + * $formattedName = $attachedClustersClient->attachedClusterName('[PROJECT]', '[LOCATION]', '[ATTACHED_CLUSTER]'); + * $operationResponse = $attachedClustersClient->deleteAttachedCluster($formattedName); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $attachedClustersClient->deleteAttachedCluster($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $attachedClustersClient->resumeOperation($operationName, 'deleteAttachedCluster'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $attachedClustersClient->close(); + * } + * ``` + * + * @param string $name Required. The resource name the + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] to delete. + * + * `AttachedCluster` names are formatted as + * `projects//locations//attachedClusters/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * @param array $optionalArgs { + * Optional. + * + * @type bool $validateOnly + * If set, only validate the request, but do not actually delete the resource. + * @type bool $allowMissing + * If set to true, and the + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource + * is not found, the request will succeed but no action will be taken on the + * server and a completed [Operation][google.longrunning.Operation] will be + * returned. + * + * Useful for idempotent deletion. + * @type bool $ignoreErrors + * If set to true, the deletion of + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource + * will succeed even if errors occur during deleting in cluster resources. + * Using this parameter may result in orphaned resources in the cluster. + * @type string $etag + * The current etag of the + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster]. + * + * Allows clients to perform deletions through optimistic concurrency control. + * + * If the provided etag does not match the current etag of the cluster, + * the request will fail and an ABORTED error will be returned. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function deleteAttachedCluster($name, array $optionalArgs = []) + { + $request = new DeleteAttachedClusterRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['validateOnly'])) { + $request->setValidateOnly($optionalArgs['validateOnly']); + } + + if (isset($optionalArgs['allowMissing'])) { + $request->setAllowMissing($optionalArgs['allowMissing']); + } + + if (isset($optionalArgs['ignoreErrors'])) { + $request->setIgnoreErrors($optionalArgs['ignoreErrors']); + } + + if (isset($optionalArgs['etag'])) { + $request->setEtag($optionalArgs['etag']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('DeleteAttachedCluster', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Generates the install manifest to be installed on the target cluster. + * + * Sample code: + * ``` + * $attachedClustersClient = new AttachedClustersClient(); + * try { + * $formattedParent = $attachedClustersClient->locationName('[PROJECT]', '[LOCATION]'); + * $attachedClusterId = 'attached_cluster_id'; + * $platformVersion = 'platform_version'; + * $response = $attachedClustersClient->generateAttachedClusterInstallManifest($formattedParent, $attachedClusterId, $platformVersion); + * } finally { + * $attachedClustersClient->close(); + * } + * ``` + * + * @param string $parent Required. The parent location where this + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource + * will be created. + * + * Location names are formatted as `projects//locations/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * @param string $attachedClusterId Required. A client provided ID of the resource. Must be unique within the + * parent resource. + * + * The provided ID will be part of the + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource + * name formatted as + * `projects//locations//attachedClusters/`. + * + * Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. + * + * When generating an install manifest for importing an existing Membership + * resource, the attached_cluster_id field must be the Membership id. + * + * Membership names are formatted as + * `projects//locations//memberships/`. + * @param string $platformVersion Required. The platform version for the cluster (e.g. `1.19.0-gke.1000`). + * + * You can list all supported versions on a given Google Cloud region by + * calling + * [GetAttachedServerConfig][google.cloud.gkemulticloud.v1.AttachedClusters.GetAttachedServerConfig]. + * @param array $optionalArgs { + * 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 \Google\Cloud\GkeMultiCloud\V1\GenerateAttachedClusterInstallManifestResponse + * + * @throws ApiException if the remote call fails + */ + public function generateAttachedClusterInstallManifest($parent, $attachedClusterId, $platformVersion, array $optionalArgs = []) + { + $request = new GenerateAttachedClusterInstallManifestRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setAttachedClusterId($attachedClusterId); + $request->setPlatformVersion($platformVersion); + $requestParamHeaders['parent'] = $parent; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GenerateAttachedClusterInstallManifest', GenerateAttachedClusterInstallManifestResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Describes a specific + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource. + * + * Sample code: + * ``` + * $attachedClustersClient = new AttachedClustersClient(); + * try { + * $formattedName = $attachedClustersClient->attachedClusterName('[PROJECT]', '[LOCATION]', '[ATTACHED_CLUSTER]'); + * $response = $attachedClustersClient->getAttachedCluster($formattedName); + * } finally { + * $attachedClustersClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource + * to describe. + * + * `AttachedCluster` names are formatted as + * `projects//locations//attachedClusters/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * @param array $optionalArgs { + * 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 \Google\Cloud\GkeMultiCloud\V1\AttachedCluster + * + * @throws ApiException if the remote call fails + */ + public function getAttachedCluster($name, array $optionalArgs = []) + { + $request = new GetAttachedClusterRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetAttachedCluster', AttachedCluster::class, $optionalArgs, $request)->wait(); + } + + /** + * Returns information, such as supported Kubernetes versions, on a given + * Google Cloud location. + * + * Sample code: + * ``` + * $attachedClustersClient = new AttachedClustersClient(); + * try { + * $formattedName = $attachedClustersClient->attachedServerConfigName('[PROJECT]', '[LOCATION]'); + * $response = $attachedClustersClient->getAttachedServerConfig($formattedName); + * } finally { + * $attachedClustersClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the + * [AttachedServerConfig][google.cloud.gkemulticloud.v1.AttachedServerConfig] + * resource to describe. + * + * `AttachedServerConfig` names are formatted as + * `projects//locations//attachedServerConfig`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * @param array $optionalArgs { + * 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 \Google\Cloud\GkeMultiCloud\V1\AttachedServerConfig + * + * @throws ApiException if the remote call fails + */ + public function getAttachedServerConfig($name, array $optionalArgs = []) + { + $request = new GetAttachedServerConfigRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetAttachedServerConfig', AttachedServerConfig::class, $optionalArgs, $request)->wait(); + } + + /** + * Imports creates a new + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource + * by importing an existing Fleet Membership resource. + * + * Attached Clusters created before the introduction of the Anthos Multi-Cloud + * API can be imported through this method. + * + * If successful, the response contains a newly created + * [Operation][google.longrunning.Operation] resource that can be + * described to track the status of the operation. + * + * Sample code: + * ``` + * $attachedClustersClient = new AttachedClustersClient(); + * try { + * $formattedParent = $attachedClustersClient->locationName('[PROJECT]', '[LOCATION]'); + * $fleetMembership = 'fleet_membership'; + * $platformVersion = 'platform_version'; + * $distribution = 'distribution'; + * $operationResponse = $attachedClustersClient->importAttachedCluster($formattedParent, $fleetMembership, $platformVersion, $distribution); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $attachedClustersClient->importAttachedCluster($formattedParent, $fleetMembership, $platformVersion, $distribution); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $attachedClustersClient->resumeOperation($operationName, 'importAttachedCluster'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $attachedClustersClient->close(); + * } + * ``` + * + * @param string $parent Required. The parent location where this + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource + * will be created. + * + * Location names are formatted as `projects//locations/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * @param string $fleetMembership Required. The name of the fleet membership resource to import. + * @param string $platformVersion Required. The platform version for the cluster (e.g. `1.19.0-gke.1000`). + * + * You can list all supported versions on a given Google Cloud region by + * calling + * [GetAttachedServerConfig][google.cloud.gkemulticloud.v1.AttachedClusters.GetAttachedServerConfig]. + * @param string $distribution Required. The Kubernetes distribution of the underlying attached cluster. + * + * Supported values: ["eks", "aks"]. + * @param array $optionalArgs { + * Optional. + * + * @type bool $validateOnly + * If set, only validate the request, but do not actually import the cluster. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function importAttachedCluster($parent, $fleetMembership, $platformVersion, $distribution, array $optionalArgs = []) + { + $request = new ImportAttachedClusterRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setFleetMembership($fleetMembership); + $request->setPlatformVersion($platformVersion); + $request->setDistribution($distribution); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['validateOnly'])) { + $request->setValidateOnly($optionalArgs['validateOnly']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('ImportAttachedCluster', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Lists all [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] + * resources on a given Google Cloud project and region. + * + * Sample code: + * ``` + * $attachedClustersClient = new AttachedClustersClient(); + * try { + * $formattedParent = $attachedClustersClient->locationName('[PROJECT]', '[LOCATION]'); + * // Iterate over pages of elements + * $pagedResponse = $attachedClustersClient->listAttachedClusters($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $attachedClustersClient->listAttachedClusters($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $attachedClustersClient->close(); + * } + * ``` + * + * @param string $parent Required. The parent location which owns this collection of + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resources. + * + * Location names are formatted as `projects//locations/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @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 \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listAttachedClusters($parent, array $optionalArgs = []) + { + $request = new ListAttachedClustersRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListAttachedClusters', $optionalArgs, ListAttachedClustersResponse::class, $request); + } + + /** + * Updates an + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster]. + * + * Sample code: + * ``` + * $attachedClustersClient = new AttachedClustersClient(); + * try { + * $attachedCluster = new AttachedCluster(); + * $updateMask = new FieldMask(); + * $operationResponse = $attachedClustersClient->updateAttachedCluster($attachedCluster, $updateMask); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $attachedClustersClient->updateAttachedCluster($attachedCluster, $updateMask); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $attachedClustersClient->resumeOperation($operationName, 'updateAttachedCluster'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $attachedClustersClient->close(); + * } + * ``` + * + * @param AttachedCluster $attachedCluster Required. The + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource + * to update. + * @param FieldMask $updateMask Required. Mask of fields to update. At least one path must be supplied in + * this field. The elements of the repeated paths field can only include these + * fields from + * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster]: + * + * * `description`. + * * `annotations`. + * * `platform_version`. + * * `authorization.admin_users`. + * * `logging_config.component_config.enable_components`. + * * `monitoring_config.managed_prometheus_config.enabled`. + * @param array $optionalArgs { + * Optional. + * + * @type bool $validateOnly + * If set, only validate the request, but do not actually update the cluster. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function updateAttachedCluster($attachedCluster, $updateMask, array $optionalArgs = []) + { + $request = new UpdateAttachedClusterRequest(); + $requestParamHeaders = []; + $request->setAttachedCluster($attachedCluster); + $request->setUpdateMask($updateMask); + $requestParamHeaders['attached_cluster.name'] = $attachedCluster->getName(); + if (isset($optionalArgs['validateOnly'])) { + $request->setValidateOnly($optionalArgs['validateOnly']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('UpdateAttachedCluster', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } +} diff --git a/owl-bot-staging/GkeMultiCloud/v1/src/V1/Gapic/AwsClustersGapicClient.php b/owl-bot-staging/GkeMultiCloud/v1/src/V1/Gapic/AwsClustersGapicClient.php new file mode 100644 index 000000000000..4337875c6d11 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/src/V1/Gapic/AwsClustersGapicClient.php @@ -0,0 +1,1365 @@ +locationName('[PROJECT]', '[LOCATION]'); + * $awsCluster = new AwsCluster(); + * $awsClusterId = 'aws_cluster_id'; + * $operationResponse = $awsClustersClient->createAwsCluster($formattedParent, $awsCluster, $awsClusterId); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $awsClustersClient->createAwsCluster($formattedParent, $awsCluster, $awsClusterId); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $awsClustersClient->resumeOperation($operationName, 'createAwsCluster'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $awsClustersClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + */ +class AwsClustersGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.gkemulticloud.v1.AwsClusters'; + + /** The default address of the service. */ + const SERVICE_ADDRESS = 'gkemulticloud.googleapis.com'; + + /** The default port of the service. */ + const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + ]; + + private static $awsClusterNameTemplate; + + private static $awsNodePoolNameTemplate; + + private static $awsServerConfigNameTemplate; + + private static $locationNameTemplate; + + private static $pathTemplateMap; + + private $operationsClient; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/aws_clusters_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/aws_clusters_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/aws_clusters_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/aws_clusters_rest_client_config.php', + ], + ], + ]; + } + + private static function getAwsClusterNameTemplate() + { + if (self::$awsClusterNameTemplate == null) { + self::$awsClusterNameTemplate = new PathTemplate('projects/{project}/locations/{location}/awsClusters/{aws_cluster}'); + } + + return self::$awsClusterNameTemplate; + } + + private static function getAwsNodePoolNameTemplate() + { + if (self::$awsNodePoolNameTemplate == null) { + self::$awsNodePoolNameTemplate = new PathTemplate('projects/{project}/locations/{location}/awsClusters/{aws_cluster}/awsNodePools/{aws_node_pool}'); + } + + return self::$awsNodePoolNameTemplate; + } + + private static function getAwsServerConfigNameTemplate() + { + if (self::$awsServerConfigNameTemplate == null) { + self::$awsServerConfigNameTemplate = new PathTemplate('projects/{project}/locations/{location}/awsServerConfig'); + } + + return self::$awsServerConfigNameTemplate; + } + + private static function getLocationNameTemplate() + { + if (self::$locationNameTemplate == null) { + self::$locationNameTemplate = new PathTemplate('projects/{project}/locations/{location}'); + } + + return self::$locationNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'awsCluster' => self::getAwsClusterNameTemplate(), + 'awsNodePool' => self::getAwsNodePoolNameTemplate(), + 'awsServerConfig' => self::getAwsServerConfigNameTemplate(), + 'location' => self::getLocationNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a aws_cluster + * resource. + * + * @param string $project + * @param string $location + * @param string $awsCluster + * + * @return string The formatted aws_cluster resource. + */ + public static function awsClusterName($project, $location, $awsCluster) + { + return self::getAwsClusterNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'aws_cluster' => $awsCluster, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * aws_node_pool resource. + * + * @param string $project + * @param string $location + * @param string $awsCluster + * @param string $awsNodePool + * + * @return string The formatted aws_node_pool resource. + */ + public static function awsNodePoolName($project, $location, $awsCluster, $awsNodePool) + { + return self::getAwsNodePoolNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'aws_cluster' => $awsCluster, + 'aws_node_pool' => $awsNodePool, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * aws_server_config resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted aws_server_config resource. + */ + public static function awsServerConfigName($project, $location) + { + return self::getAwsServerConfigNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a location + * resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted location resource. + */ + public static function locationName($project, $location) + { + return self::getLocationNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - awsCluster: projects/{project}/locations/{location}/awsClusters/{aws_cluster} + * - awsNodePool: projects/{project}/locations/{location}/awsClusters/{aws_cluster}/awsNodePools/{aws_node_pool} + * - awsServerConfig: projects/{project}/locations/{location}/awsServerConfig + * - location: projects/{project}/locations/{location} + * + * 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($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * 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; + } + + /** + * 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 'gkemulticloud.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. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *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' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods 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); + } + + /** + * Creates a new [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] + * resource on a given Google Cloud Platform project and region. + * + * If successful, the response contains a newly created + * [Operation][google.longrunning.Operation] resource that can be + * described to track the status of the operation. + * + * Sample code: + * ``` + * $awsClustersClient = new AwsClustersClient(); + * try { + * $formattedParent = $awsClustersClient->locationName('[PROJECT]', '[LOCATION]'); + * $awsCluster = new AwsCluster(); + * $awsClusterId = 'aws_cluster_id'; + * $operationResponse = $awsClustersClient->createAwsCluster($formattedParent, $awsCluster, $awsClusterId); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $awsClustersClient->createAwsCluster($formattedParent, $awsCluster, $awsClusterId); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $awsClustersClient->resumeOperation($operationName, 'createAwsCluster'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $awsClustersClient->close(); + * } + * ``` + * + * @param string $parent Required. The parent location where this + * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resource will be + * created. + * + * Location names are formatted as `projects//locations/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * @param AwsCluster $awsCluster Required. The specification of the + * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] to create. + * @param string $awsClusterId Required. A client provided ID the resource. Must be unique within the + * parent resource. + * + * The provided ID will be part of the + * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resource name + * formatted as + * `projects//locations//awsClusters/`. + * + * Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. + * @param array $optionalArgs { + * Optional. + * + * @type bool $validateOnly + * If set, only validate the request, but do not actually create the cluster. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function createAwsCluster($parent, $awsCluster, $awsClusterId, array $optionalArgs = []) + { + $request = new CreateAwsClusterRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setAwsCluster($awsCluster); + $request->setAwsClusterId($awsClusterId); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['validateOnly'])) { + $request->setValidateOnly($optionalArgs['validateOnly']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateAwsCluster', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Creates a new [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool], + * attached to a given [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster]. + * + * If successful, the response contains a newly created + * [Operation][google.longrunning.Operation] resource that can be + * described to track the status of the operation. + * + * Sample code: + * ``` + * $awsClustersClient = new AwsClustersClient(); + * try { + * $formattedParent = $awsClustersClient->awsClusterName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]'); + * $awsNodePool = new AwsNodePool(); + * $awsNodePoolId = 'aws_node_pool_id'; + * $operationResponse = $awsClustersClient->createAwsNodePool($formattedParent, $awsNodePool, $awsNodePoolId); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $awsClustersClient->createAwsNodePool($formattedParent, $awsNodePool, $awsNodePoolId); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $awsClustersClient->resumeOperation($operationName, 'createAwsNodePool'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $awsClustersClient->close(); + * } + * ``` + * + * @param string $parent Required. The [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] + * resource where this node pool will be created. + * + * `AwsCluster` names are formatted as + * `projects//locations//awsClusters/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * @param AwsNodePool $awsNodePool Required. The specification of the + * [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] to create. + * @param string $awsNodePoolId Required. A client provided ID the resource. Must be unique within the + * parent resource. + * + * The provided ID will be part of the + * [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] resource name + * formatted as + * `projects//locations//awsClusters//awsNodePools/`. + * + * Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. + * @param array $optionalArgs { + * Optional. + * + * @type bool $validateOnly + * If set, only validate the request, but do not actually create the node + * pool. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function createAwsNodePool($parent, $awsNodePool, $awsNodePoolId, array $optionalArgs = []) + { + $request = new CreateAwsNodePoolRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setAwsNodePool($awsNodePool); + $request->setAwsNodePoolId($awsNodePoolId); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['validateOnly'])) { + $request->setValidateOnly($optionalArgs['validateOnly']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateAwsNodePool', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Deletes a specific [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] + * resource. + * + * Fails if the cluster has one or more associated + * [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] resources. + * + * If successful, the response contains a newly created + * [Operation][google.longrunning.Operation] resource that can be + * described to track the status of the operation. + * + * Sample code: + * ``` + * $awsClustersClient = new AwsClustersClient(); + * try { + * $formattedName = $awsClustersClient->awsClusterName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]'); + * $operationResponse = $awsClustersClient->deleteAwsCluster($formattedName); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $awsClustersClient->deleteAwsCluster($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $awsClustersClient->resumeOperation($operationName, 'deleteAwsCluster'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $awsClustersClient->close(); + * } + * ``` + * + * @param string $name Required. The resource name the + * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] to delete. + * + * `AwsCluster` names are formatted as + * `projects//locations//awsClusters/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * @param array $optionalArgs { + * Optional. + * + * @type bool $validateOnly + * If set, only validate the request, but do not actually delete the resource. + * @type bool $allowMissing + * If set to true, and the + * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resource is not + * found, the request will succeed but no action will be taken on the server + * and a completed [Operation][google.longrunning.Operation] will be returned. + * + * Useful for idempotent deletion. + * @type string $etag + * The current etag of the + * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster]. + * + * Allows clients to perform deletions through optimistic concurrency control. + * + * If the provided etag does not match the current etag of the cluster, + * the request will fail and an ABORTED error will be returned. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function deleteAwsCluster($name, array $optionalArgs = []) + { + $request = new DeleteAwsClusterRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['validateOnly'])) { + $request->setValidateOnly($optionalArgs['validateOnly']); + } + + if (isset($optionalArgs['allowMissing'])) { + $request->setAllowMissing($optionalArgs['allowMissing']); + } + + if (isset($optionalArgs['etag'])) { + $request->setEtag($optionalArgs['etag']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('DeleteAwsCluster', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Deletes a specific [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] + * resource. + * + * If successful, the response contains a newly created + * [Operation][google.longrunning.Operation] resource that can be + * described to track the status of the operation. + * + * Sample code: + * ``` + * $awsClustersClient = new AwsClustersClient(); + * try { + * $formattedName = $awsClustersClient->awsNodePoolName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]', '[AWS_NODE_POOL]'); + * $operationResponse = $awsClustersClient->deleteAwsNodePool($formattedName); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $awsClustersClient->deleteAwsNodePool($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $awsClustersClient->resumeOperation($operationName, 'deleteAwsNodePool'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $awsClustersClient->close(); + * } + * ``` + * + * @param string $name Required. The resource name the + * [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] to delete. + * + * `AwsNodePool` names are formatted as + * `projects//locations//awsClusters//awsNodePools/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * @param array $optionalArgs { + * Optional. + * + * @type bool $validateOnly + * If set, only validate the request, but do not actually delete the node + * pool. + * @type bool $allowMissing + * If set to true, and the + * [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] resource is not + * found, the request will succeed but no action will be taken on the server + * and a completed [Operation][google.longrunning.Operation] will be returned. + * + * Useful for idempotent deletion. + * @type string $etag + * The current ETag of the + * [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool]. + * + * Allows clients to perform deletions through optimistic concurrency control. + * + * If the provided ETag does not match the current etag of the node pool, + * the request will fail and an ABORTED error will be returned. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function deleteAwsNodePool($name, array $optionalArgs = []) + { + $request = new DeleteAwsNodePoolRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['validateOnly'])) { + $request->setValidateOnly($optionalArgs['validateOnly']); + } + + if (isset($optionalArgs['allowMissing'])) { + $request->setAllowMissing($optionalArgs['allowMissing']); + } + + if (isset($optionalArgs['etag'])) { + $request->setEtag($optionalArgs['etag']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('DeleteAwsNodePool', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Generates a short-lived access token to authenticate to a given + * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resource. + * + * Sample code: + * ``` + * $awsClustersClient = new AwsClustersClient(); + * try { + * $formattedAwsCluster = $awsClustersClient->awsClusterName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]'); + * $response = $awsClustersClient->generateAwsAccessToken($formattedAwsCluster); + * } finally { + * $awsClustersClient->close(); + * } + * ``` + * + * @param string $awsCluster Required. The name of the + * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resource to + * authenticate to. + * + * `AwsCluster` names are formatted as + * `projects//locations//awsClusters/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * @param array $optionalArgs { + * 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 \Google\Cloud\GkeMultiCloud\V1\GenerateAwsAccessTokenResponse + * + * @throws ApiException if the remote call fails + */ + public function generateAwsAccessToken($awsCluster, array $optionalArgs = []) + { + $request = new GenerateAwsAccessTokenRequest(); + $requestParamHeaders = []; + $request->setAwsCluster($awsCluster); + $requestParamHeaders['aws_cluster'] = $awsCluster; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GenerateAwsAccessToken', GenerateAwsAccessTokenResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Describes a specific [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] + * resource. + * + * Sample code: + * ``` + * $awsClustersClient = new AwsClustersClient(); + * try { + * $formattedName = $awsClustersClient->awsClusterName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]'); + * $response = $awsClustersClient->getAwsCluster($formattedName); + * } finally { + * $awsClustersClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the + * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resource to + * describe. + * + * `AwsCluster` names are formatted as + * `projects//locations//awsClusters/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * @param array $optionalArgs { + * 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 \Google\Cloud\GkeMultiCloud\V1\AwsCluster + * + * @throws ApiException if the remote call fails + */ + public function getAwsCluster($name, array $optionalArgs = []) + { + $request = new GetAwsClusterRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetAwsCluster', AwsCluster::class, $optionalArgs, $request)->wait(); + } + + /** + * Describes a specific + * [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] resource. + * + * Sample code: + * ``` + * $awsClustersClient = new AwsClustersClient(); + * try { + * $formattedName = $awsClustersClient->awsNodePoolName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]', '[AWS_NODE_POOL]'); + * $response = $awsClustersClient->getAwsNodePool($formattedName); + * } finally { + * $awsClustersClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the + * [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] resource to + * describe. + * + * `AwsNodePool` names are formatted as + * `projects//locations//awsClusters//awsNodePools/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * @param array $optionalArgs { + * 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 \Google\Cloud\GkeMultiCloud\V1\AwsNodePool + * + * @throws ApiException if the remote call fails + */ + public function getAwsNodePool($name, array $optionalArgs = []) + { + $request = new GetAwsNodePoolRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetAwsNodePool', AwsNodePool::class, $optionalArgs, $request)->wait(); + } + + /** + * Returns information, such as supported AWS regions and Kubernetes + * versions, on a given Google Cloud location. + * + * Sample code: + * ``` + * $awsClustersClient = new AwsClustersClient(); + * try { + * $formattedName = $awsClustersClient->awsServerConfigName('[PROJECT]', '[LOCATION]'); + * $response = $awsClustersClient->getAwsServerConfig($formattedName); + * } finally { + * $awsClustersClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the + * [AwsServerConfig][google.cloud.gkemulticloud.v1.AwsServerConfig] resource + * to describe. + * + * `AwsServerConfig` names are formatted as + * `projects//locations//awsServerConfig`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * @param array $optionalArgs { + * 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 \Google\Cloud\GkeMultiCloud\V1\AwsServerConfig + * + * @throws ApiException if the remote call fails + */ + public function getAwsServerConfig($name, array $optionalArgs = []) + { + $request = new GetAwsServerConfigRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetAwsServerConfig', AwsServerConfig::class, $optionalArgs, $request)->wait(); + } + + /** + * Lists all [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resources + * on a given Google Cloud project and region. + * + * Sample code: + * ``` + * $awsClustersClient = new AwsClustersClient(); + * try { + * $formattedParent = $awsClustersClient->locationName('[PROJECT]', '[LOCATION]'); + * // Iterate over pages of elements + * $pagedResponse = $awsClustersClient->listAwsClusters($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $awsClustersClient->listAwsClusters($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $awsClustersClient->close(); + * } + * ``` + * + * @param string $parent Required. The parent location which owns this collection of + * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resources. + * + * Location names are formatted as `projects//locations/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @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 \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listAwsClusters($parent, array $optionalArgs = []) + { + $request = new ListAwsClustersRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListAwsClusters', $optionalArgs, ListAwsClustersResponse::class, $request); + } + + /** + * Lists all [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] + * resources on a given + * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster]. + * + * Sample code: + * ``` + * $awsClustersClient = new AwsClustersClient(); + * try { + * $formattedParent = $awsClustersClient->awsClusterName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]'); + * // Iterate over pages of elements + * $pagedResponse = $awsClustersClient->listAwsNodePools($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $awsClustersClient->listAwsNodePools($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $awsClustersClient->close(); + * } + * ``` + * + * @param string $parent Required. The parent `AwsCluster` which owns this collection of + * [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] resources. + * + * `AwsCluster` names are formatted as + * `projects//locations//awsClusters/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @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 \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listAwsNodePools($parent, array $optionalArgs = []) + { + $request = new ListAwsNodePoolsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListAwsNodePools', $optionalArgs, ListAwsNodePoolsResponse::class, $request); + } + + /** + * Updates an [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster]. + * + * Sample code: + * ``` + * $awsClustersClient = new AwsClustersClient(); + * try { + * $awsCluster = new AwsCluster(); + * $updateMask = new FieldMask(); + * $operationResponse = $awsClustersClient->updateAwsCluster($awsCluster, $updateMask); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $awsClustersClient->updateAwsCluster($awsCluster, $updateMask); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $awsClustersClient->resumeOperation($operationName, 'updateAwsCluster'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $awsClustersClient->close(); + * } + * ``` + * + * @param AwsCluster $awsCluster Required. The [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] + * resource to update. + * @param FieldMask $updateMask Required. Mask of fields to update. At least one path must be supplied in + * this field. The elements of the repeated paths field can only include these + * fields from [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster]: + * + * * `description`. + * * `annotations`. + * * `control_plane.version`. + * * `authorization.admin_users`. + * * `control_plane.aws_services_authentication.role_arn`. + * * `control_plane.aws_services_authentication.role_session_name`. + * * `control_plane.config_encryption.kms_key_arn`. + * * `control_plane.instance_type`. + * * `control_plane.security_group_ids`. + * * `control_plane.proxy_config`. + * * `control_plane.proxy_config.secret_arn`. + * * `control_plane.proxy_config.secret_version`. + * * `control_plane.root_volume.size_gib`. + * * `control_plane.root_volume.volume_type`. + * * `control_plane.root_volume.iops`. + * * `control_plane.root_volume.kms_key_arn`. + * * `control_plane.ssh_config`. + * * `control_plane.ssh_config.ec2_key_pair`. + * * `control_plane.instance_placement.tenancy`. + * * `control_plane.iam_instance_profile`. + * * `logging_config.component_config.enable_components`. + * * `control_plane.tags`. + * * `monitoring_config.managed_prometheus_config.enabled`. + * @param array $optionalArgs { + * Optional. + * + * @type bool $validateOnly + * If set, only validate the request, but do not actually update the cluster. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function updateAwsCluster($awsCluster, $updateMask, array $optionalArgs = []) + { + $request = new UpdateAwsClusterRequest(); + $requestParamHeaders = []; + $request->setAwsCluster($awsCluster); + $request->setUpdateMask($updateMask); + $requestParamHeaders['aws_cluster.name'] = $awsCluster->getName(); + if (isset($optionalArgs['validateOnly'])) { + $request->setValidateOnly($optionalArgs['validateOnly']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('UpdateAwsCluster', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Updates an [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool]. + * + * Sample code: + * ``` + * $awsClustersClient = new AwsClustersClient(); + * try { + * $awsNodePool = new AwsNodePool(); + * $updateMask = new FieldMask(); + * $operationResponse = $awsClustersClient->updateAwsNodePool($awsNodePool, $updateMask); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $awsClustersClient->updateAwsNodePool($awsNodePool, $updateMask); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $awsClustersClient->resumeOperation($operationName, 'updateAwsNodePool'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $awsClustersClient->close(); + * } + * ``` + * + * @param AwsNodePool $awsNodePool Required. The [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] + * resource to update. + * @param FieldMask $updateMask Required. Mask of fields to update. At least one path must be supplied in + * this field. The elements of the repeated paths field can only include these + * fields from [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool]: + * + * * `annotations`. + * * `version`. + * * `autoscaling.min_node_count`. + * * `autoscaling.max_node_count`. + * * `config.config_encryption.kms_key_arn`. + * * `config.security_group_ids`. + * * `config.root_volume.iops`. + * * `config.root_volume.kms_key_arn`. + * * `config.root_volume.volume_type`. + * * `config.root_volume.size_gib`. + * * `config.proxy_config`. + * * `config.proxy_config.secret_arn`. + * * `config.proxy_config.secret_version`. + * * `config.ssh_config`. + * * `config.ssh_config.ec2_key_pair`. + * * `config.instance_placement.tenancy`. + * * `config.iam_instance_profile`. + * * `config.labels`. + * * `config.tags`. + * * `config.autoscaling_metrics_collection`. + * * `config.autoscaling_metrics_collection.granularity`. + * * `config.autoscaling_metrics_collection.metrics`. + * @param array $optionalArgs { + * Optional. + * + * @type bool $validateOnly + * If set, only validate the request, but don't actually update the node pool. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function updateAwsNodePool($awsNodePool, $updateMask, array $optionalArgs = []) + { + $request = new UpdateAwsNodePoolRequest(); + $requestParamHeaders = []; + $request->setAwsNodePool($awsNodePool); + $request->setUpdateMask($updateMask); + $requestParamHeaders['aws_node_pool.name'] = $awsNodePool->getName(); + if (isset($optionalArgs['validateOnly'])) { + $request->setValidateOnly($optionalArgs['validateOnly']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('UpdateAwsNodePool', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } +} diff --git a/owl-bot-staging/GkeMultiCloud/v1/src/V1/Gapic/AzureClustersGapicClient.php b/owl-bot-staging/GkeMultiCloud/v1/src/V1/Gapic/AzureClustersGapicClient.php new file mode 100644 index 000000000000..f5c728938629 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/src/V1/Gapic/AzureClustersGapicClient.php @@ -0,0 +1,1700 @@ +locationName('[PROJECT]', '[LOCATION]'); + * $azureClient = new AzureClient(); + * $azureClientId = 'azure_client_id'; + * $operationResponse = $azureClustersClient->createAzureClient($formattedParent, $azureClient, $azureClientId); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $azureClustersClient->createAzureClient($formattedParent, $azureClient, $azureClientId); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $azureClustersClient->resumeOperation($operationName, 'createAzureClient'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $azureClustersClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + */ +class AzureClustersGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.gkemulticloud.v1.AzureClusters'; + + /** The default address of the service. */ + const SERVICE_ADDRESS = 'gkemulticloud.googleapis.com'; + + /** The default port of the service. */ + const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + ]; + + private static $azureClientNameTemplate; + + private static $azureClusterNameTemplate; + + private static $azureNodePoolNameTemplate; + + private static $azureServerConfigNameTemplate; + + private static $locationNameTemplate; + + private static $pathTemplateMap; + + private $operationsClient; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/azure_clusters_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/azure_clusters_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/azure_clusters_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/azure_clusters_rest_client_config.php', + ], + ], + ]; + } + + private static function getAzureClientNameTemplate() + { + if (self::$azureClientNameTemplate == null) { + self::$azureClientNameTemplate = new PathTemplate('projects/{project}/locations/{location}/azureClients/{azure_client}'); + } + + return self::$azureClientNameTemplate; + } + + private static function getAzureClusterNameTemplate() + { + if (self::$azureClusterNameTemplate == null) { + self::$azureClusterNameTemplate = new PathTemplate('projects/{project}/locations/{location}/azureClusters/{azure_cluster}'); + } + + return self::$azureClusterNameTemplate; + } + + private static function getAzureNodePoolNameTemplate() + { + if (self::$azureNodePoolNameTemplate == null) { + self::$azureNodePoolNameTemplate = new PathTemplate('projects/{project}/locations/{location}/azureClusters/{azure_cluster}/azureNodePools/{azure_node_pool}'); + } + + return self::$azureNodePoolNameTemplate; + } + + private static function getAzureServerConfigNameTemplate() + { + if (self::$azureServerConfigNameTemplate == null) { + self::$azureServerConfigNameTemplate = new PathTemplate('projects/{project}/locations/{location}/azureServerConfig'); + } + + return self::$azureServerConfigNameTemplate; + } + + private static function getLocationNameTemplate() + { + if (self::$locationNameTemplate == null) { + self::$locationNameTemplate = new PathTemplate('projects/{project}/locations/{location}'); + } + + return self::$locationNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'azureClient' => self::getAzureClientNameTemplate(), + 'azureCluster' => self::getAzureClusterNameTemplate(), + 'azureNodePool' => self::getAzureNodePoolNameTemplate(), + 'azureServerConfig' => self::getAzureServerConfigNameTemplate(), + 'location' => self::getLocationNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a azure_client + * resource. + * + * @param string $project + * @param string $location + * @param string $azureClient + * + * @return string The formatted azure_client resource. + */ + public static function azureClientName($project, $location, $azureClient) + { + return self::getAzureClientNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'azure_client' => $azureClient, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * azure_cluster resource. + * + * @param string $project + * @param string $location + * @param string $azureCluster + * + * @return string The formatted azure_cluster resource. + */ + public static function azureClusterName($project, $location, $azureCluster) + { + return self::getAzureClusterNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'azure_cluster' => $azureCluster, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * azure_node_pool resource. + * + * @param string $project + * @param string $location + * @param string $azureCluster + * @param string $azureNodePool + * + * @return string The formatted azure_node_pool resource. + */ + public static function azureNodePoolName($project, $location, $azureCluster, $azureNodePool) + { + return self::getAzureNodePoolNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'azure_cluster' => $azureCluster, + 'azure_node_pool' => $azureNodePool, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * azure_server_config resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted azure_server_config resource. + */ + public static function azureServerConfigName($project, $location) + { + return self::getAzureServerConfigNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a location + * resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted location resource. + */ + public static function locationName($project, $location) + { + return self::getLocationNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - azureClient: projects/{project}/locations/{location}/azureClients/{azure_client} + * - azureCluster: projects/{project}/locations/{location}/azureClusters/{azure_cluster} + * - azureNodePool: projects/{project}/locations/{location}/azureClusters/{azure_cluster}/azureNodePools/{azure_node_pool} + * - azureServerConfig: projects/{project}/locations/{location}/azureServerConfig + * - location: projects/{project}/locations/{location} + * + * 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($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * 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; + } + + /** + * 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 'gkemulticloud.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. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *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' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods 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); + } + + /** + * Creates a new [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] + * resource on a given Google Cloud project and region. + * + * `AzureClient` resources hold client authentication + * information needed by the Anthos Multicloud API to manage Azure resources + * on your Azure subscription on your behalf. + * + * If successful, the response contains a newly created + * [Operation][google.longrunning.Operation] resource that can be + * described to track the status of the operation. + * + * Sample code: + * ``` + * $azureClustersClient = new AzureClustersClient(); + * try { + * $formattedParent = $azureClustersClient->locationName('[PROJECT]', '[LOCATION]'); + * $azureClient = new AzureClient(); + * $azureClientId = 'azure_client_id'; + * $operationResponse = $azureClustersClient->createAzureClient($formattedParent, $azureClient, $azureClientId); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $azureClustersClient->createAzureClient($formattedParent, $azureClient, $azureClientId); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $azureClustersClient->resumeOperation($operationName, 'createAzureClient'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $azureClustersClient->close(); + * } + * ``` + * + * @param string $parent Required. The parent location where this + * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] resource will be + * created. + * + * Location names are formatted as `projects//locations/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * @param AzureClient $azureClient Required. The specification of the + * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] to create. + * @param string $azureClientId Required. A client provided ID the resource. Must be unique within the + * parent resource. + * + * The provided ID will be part of the + * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] resource name + * formatted as + * `projects//locations//azureClients/`. + * + * Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. + * @param array $optionalArgs { + * Optional. + * + * @type bool $validateOnly + * If set, only validate the request, but do not actually create the client. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function createAzureClient($parent, $azureClient, $azureClientId, array $optionalArgs = []) + { + $request = new CreateAzureClientRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setAzureClient($azureClient); + $request->setAzureClientId($azureClientId); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['validateOnly'])) { + $request->setValidateOnly($optionalArgs['validateOnly']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateAzureClient', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Creates a new [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] + * resource on a given Google Cloud Platform project and region. + * + * If successful, the response contains a newly created + * [Operation][google.longrunning.Operation] resource that can be + * described to track the status of the operation. + * + * Sample code: + * ``` + * $azureClustersClient = new AzureClustersClient(); + * try { + * $formattedParent = $azureClustersClient->locationName('[PROJECT]', '[LOCATION]'); + * $azureCluster = new AzureCluster(); + * $azureClusterId = 'azure_cluster_id'; + * $operationResponse = $azureClustersClient->createAzureCluster($formattedParent, $azureCluster, $azureClusterId); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $azureClustersClient->createAzureCluster($formattedParent, $azureCluster, $azureClusterId); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $azureClustersClient->resumeOperation($operationName, 'createAzureCluster'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $azureClustersClient->close(); + * } + * ``` + * + * @param string $parent Required. The parent location where this + * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource will be + * created. + * + * Location names are formatted as `projects//locations/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * @param AzureCluster $azureCluster Required. The specification of the + * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] to create. + * @param string $azureClusterId Required. A client provided ID the resource. Must be unique within the + * parent resource. + * + * The provided ID will be part of the + * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource name + * formatted as + * `projects//locations//azureClusters/`. + * + * Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. + * @param array $optionalArgs { + * Optional. + * + * @type bool $validateOnly + * If set, only validate the request, but do not actually create the cluster. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function createAzureCluster($parent, $azureCluster, $azureClusterId, array $optionalArgs = []) + { + $request = new CreateAzureClusterRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setAzureCluster($azureCluster); + $request->setAzureClusterId($azureClusterId); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['validateOnly'])) { + $request->setValidateOnly($optionalArgs['validateOnly']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateAzureCluster', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Creates a new [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool], + * attached to a given + * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster]. + * + * If successful, the response contains a newly created + * [Operation][google.longrunning.Operation] resource that can be + * described to track the status of the operation. + * + * Sample code: + * ``` + * $azureClustersClient = new AzureClustersClient(); + * try { + * $formattedParent = $azureClustersClient->azureClusterName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]'); + * $azureNodePool = new AzureNodePool(); + * $azureNodePoolId = 'azure_node_pool_id'; + * $operationResponse = $azureClustersClient->createAzureNodePool($formattedParent, $azureNodePool, $azureNodePoolId); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $azureClustersClient->createAzureNodePool($formattedParent, $azureNodePool, $azureNodePoolId); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $azureClustersClient->resumeOperation($operationName, 'createAzureNodePool'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $azureClustersClient->close(); + * } + * ``` + * + * @param string $parent Required. The [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] + * resource where this node pool will be created. + * + * Location names are formatted as `projects//locations/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * @param AzureNodePool $azureNodePool Required. The specification of the + * [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] to create. + * @param string $azureNodePoolId Required. A client provided ID the resource. Must be unique within the + * parent resource. + * + * The provided ID will be part of the + * [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] resource name + * formatted as + * `projects//locations//azureClusters//azureNodePools/`. + * + * Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. + * @param array $optionalArgs { + * Optional. + * + * @type bool $validateOnly + * If set, only validate the request, but do not actually create the node + * pool. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function createAzureNodePool($parent, $azureNodePool, $azureNodePoolId, array $optionalArgs = []) + { + $request = new CreateAzureNodePoolRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setAzureNodePool($azureNodePool); + $request->setAzureNodePoolId($azureNodePoolId); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['validateOnly'])) { + $request->setValidateOnly($optionalArgs['validateOnly']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateAzureNodePool', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Deletes a specific [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] + * resource. + * + * If the client is used by one or more clusters, deletion will + * fail and a `FAILED_PRECONDITION` error will be returned. + * + * If successful, the response contains a newly created + * [Operation][google.longrunning.Operation] resource that can be + * described to track the status of the operation. + * + * Sample code: + * ``` + * $azureClustersClient = new AzureClustersClient(); + * try { + * $formattedName = $azureClustersClient->azureClientName('[PROJECT]', '[LOCATION]', '[AZURE_CLIENT]'); + * $operationResponse = $azureClustersClient->deleteAzureClient($formattedName); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $azureClustersClient->deleteAzureClient($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $azureClustersClient->resumeOperation($operationName, 'deleteAzureClient'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $azureClustersClient->close(); + * } + * ``` + * + * @param string $name Required. The resource name the + * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] to delete. + * + * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] names are + * formatted as + * `projects//locations//azureClients/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * @param array $optionalArgs { + * Optional. + * + * @type bool $allowMissing + * If set to true, and the + * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] resource is not + * found, the request will succeed but no action will be taken on the server + * and a completed [Operation][google.longrunning.Operation] will be returned. + * + * Useful for idempotent deletion. + * @type bool $validateOnly + * If set, only validate the request, but do not actually delete the resource. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function deleteAzureClient($name, array $optionalArgs = []) + { + $request = new DeleteAzureClientRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['allowMissing'])) { + $request->setAllowMissing($optionalArgs['allowMissing']); + } + + if (isset($optionalArgs['validateOnly'])) { + $request->setValidateOnly($optionalArgs['validateOnly']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('DeleteAzureClient', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Deletes a specific + * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource. + * + * Fails if the cluster has one or more associated + * [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] resources. + * + * If successful, the response contains a newly created + * [Operation][google.longrunning.Operation] resource that can be + * described to track the status of the operation. + * + * Sample code: + * ``` + * $azureClustersClient = new AzureClustersClient(); + * try { + * $formattedName = $azureClustersClient->azureClusterName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]'); + * $operationResponse = $azureClustersClient->deleteAzureCluster($formattedName); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $azureClustersClient->deleteAzureCluster($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $azureClustersClient->resumeOperation($operationName, 'deleteAzureCluster'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $azureClustersClient->close(); + * } + * ``` + * + * @param string $name Required. The resource name the + * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] to delete. + * + * `AzureCluster` names are formatted as + * `projects//locations//azureClusters/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * @param array $optionalArgs { + * Optional. + * + * @type bool $allowMissing + * If set to true, and the + * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource is not + * found, the request will succeed but no action will be taken on the server + * and a completed [Operation][google.longrunning.Operation] will be returned. + * + * Useful for idempotent deletion. + * @type bool $validateOnly + * If set, only validate the request, but do not actually delete the resource. + * @type string $etag + * The current etag of the + * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster]. + * + * Allows clients to perform deletions through optimistic concurrency control. + * + * If the provided etag does not match the current etag of the cluster, + * the request will fail and an ABORTED error will be returned. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function deleteAzureCluster($name, array $optionalArgs = []) + { + $request = new DeleteAzureClusterRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['allowMissing'])) { + $request->setAllowMissing($optionalArgs['allowMissing']); + } + + if (isset($optionalArgs['validateOnly'])) { + $request->setValidateOnly($optionalArgs['validateOnly']); + } + + if (isset($optionalArgs['etag'])) { + $request->setEtag($optionalArgs['etag']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('DeleteAzureCluster', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Deletes a specific + * [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] resource. + * + * If successful, the response contains a newly created + * [Operation][google.longrunning.Operation] resource that can be + * described to track the status of the operation. + * + * Sample code: + * ``` + * $azureClustersClient = new AzureClustersClient(); + * try { + * $formattedName = $azureClustersClient->azureNodePoolName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]', '[AZURE_NODE_POOL]'); + * $operationResponse = $azureClustersClient->deleteAzureNodePool($formattedName); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $azureClustersClient->deleteAzureNodePool($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $azureClustersClient->resumeOperation($operationName, 'deleteAzureNodePool'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $azureClustersClient->close(); + * } + * ``` + * + * @param string $name Required. The resource name the + * [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] to delete. + * + * `AzureNodePool` names are formatted as + * `projects//locations//azureClusters//azureNodePools/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * @param array $optionalArgs { + * Optional. + * + * @type bool $validateOnly + * If set, only validate the request, but do not actually delete the node + * pool. + * @type bool $allowMissing + * If set to true, and the + * [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] resource is + * not found, the request will succeed but no action will be taken on the + * server and a completed [Operation][google.longrunning.Operation] will be + * returned. + * + * Useful for idempotent deletion. + * @type string $etag + * The current ETag of the + * [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool]. + * + * Allows clients to perform deletions through optimistic concurrency control. + * + * If the provided ETag does not match the current etag of the node pool, + * the request will fail and an ABORTED error will be returned. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function deleteAzureNodePool($name, array $optionalArgs = []) + { + $request = new DeleteAzureNodePoolRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['validateOnly'])) { + $request->setValidateOnly($optionalArgs['validateOnly']); + } + + if (isset($optionalArgs['allowMissing'])) { + $request->setAllowMissing($optionalArgs['allowMissing']); + } + + if (isset($optionalArgs['etag'])) { + $request->setEtag($optionalArgs['etag']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('DeleteAzureNodePool', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Generates a short-lived access token to authenticate to a given + * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource. + * + * Sample code: + * ``` + * $azureClustersClient = new AzureClustersClient(); + * try { + * $formattedAzureCluster = $azureClustersClient->azureClusterName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]'); + * $response = $azureClustersClient->generateAzureAccessToken($formattedAzureCluster); + * } finally { + * $azureClustersClient->close(); + * } + * ``` + * + * @param string $azureCluster Required. The name of the + * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource to + * authenticate to. + * + * `AzureCluster` names are formatted as + * `projects//locations//AzureClusters/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * @param array $optionalArgs { + * 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 \Google\Cloud\GkeMultiCloud\V1\GenerateAzureAccessTokenResponse + * + * @throws ApiException if the remote call fails + */ + public function generateAzureAccessToken($azureCluster, array $optionalArgs = []) + { + $request = new GenerateAzureAccessTokenRequest(); + $requestParamHeaders = []; + $request->setAzureCluster($azureCluster); + $requestParamHeaders['azure_cluster'] = $azureCluster; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GenerateAzureAccessToken', GenerateAzureAccessTokenResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Describes a specific + * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] resource. + * + * Sample code: + * ``` + * $azureClustersClient = new AzureClustersClient(); + * try { + * $formattedName = $azureClustersClient->azureClientName('[PROJECT]', '[LOCATION]', '[AZURE_CLIENT]'); + * $response = $azureClustersClient->getAzureClient($formattedName); + * } finally { + * $azureClustersClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the + * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] resource to + * describe. + * + * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] names are + * formatted as + * `projects//locations//azureClients/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * @param array $optionalArgs { + * 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 \Google\Cloud\GkeMultiCloud\V1\AzureClient + * + * @throws ApiException if the remote call fails + */ + public function getAzureClient($name, array $optionalArgs = []) + { + $request = new GetAzureClientRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetAzureClient', AzureClient::class, $optionalArgs, $request)->wait(); + } + + /** + * Describes a specific + * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource. + * + * Sample code: + * ``` + * $azureClustersClient = new AzureClustersClient(); + * try { + * $formattedName = $azureClustersClient->azureClusterName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]'); + * $response = $azureClustersClient->getAzureCluster($formattedName); + * } finally { + * $azureClustersClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the + * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource to + * describe. + * + * `AzureCluster` names are formatted as + * `projects//locations//azureClusters/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * @param array $optionalArgs { + * 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 \Google\Cloud\GkeMultiCloud\V1\AzureCluster + * + * @throws ApiException if the remote call fails + */ + public function getAzureCluster($name, array $optionalArgs = []) + { + $request = new GetAzureClusterRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetAzureCluster', AzureCluster::class, $optionalArgs, $request)->wait(); + } + + /** + * Describes a specific + * [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] resource. + * + * Sample code: + * ``` + * $azureClustersClient = new AzureClustersClient(); + * try { + * $formattedName = $azureClustersClient->azureNodePoolName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]', '[AZURE_NODE_POOL]'); + * $response = $azureClustersClient->getAzureNodePool($formattedName); + * } finally { + * $azureClustersClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the + * [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] resource to + * describe. + * + * `AzureNodePool` names are formatted as + * `projects//locations//azureClusters//azureNodePools/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * @param array $optionalArgs { + * 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 \Google\Cloud\GkeMultiCloud\V1\AzureNodePool + * + * @throws ApiException if the remote call fails + */ + public function getAzureNodePool($name, array $optionalArgs = []) + { + $request = new GetAzureNodePoolRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetAzureNodePool', AzureNodePool::class, $optionalArgs, $request)->wait(); + } + + /** + * Returns information, such as supported Azure regions and Kubernetes + * versions, on a given Google Cloud location. + * + * Sample code: + * ``` + * $azureClustersClient = new AzureClustersClient(); + * try { + * $formattedName = $azureClustersClient->azureServerConfigName('[PROJECT]', '[LOCATION]'); + * $response = $azureClustersClient->getAzureServerConfig($formattedName); + * } finally { + * $azureClustersClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the + * [AzureServerConfig][google.cloud.gkemulticloud.v1.AzureServerConfig] + * resource to describe. + * + * `AzureServerConfig` names are formatted as + * `projects//locations//azureServerConfig`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * @param array $optionalArgs { + * 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 \Google\Cloud\GkeMultiCloud\V1\AzureServerConfig + * + * @throws ApiException if the remote call fails + */ + public function getAzureServerConfig($name, array $optionalArgs = []) + { + $request = new GetAzureServerConfigRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetAzureServerConfig', AzureServerConfig::class, $optionalArgs, $request)->wait(); + } + + /** + * Lists all [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] + * resources on a given Google Cloud project and region. + * + * Sample code: + * ``` + * $azureClustersClient = new AzureClustersClient(); + * try { + * $formattedParent = $azureClustersClient->locationName('[PROJECT]', '[LOCATION]'); + * // Iterate over pages of elements + * $pagedResponse = $azureClustersClient->listAzureClients($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $azureClustersClient->listAzureClients($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $azureClustersClient->close(); + * } + * ``` + * + * @param string $parent Required. The parent location which owns this collection of + * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] resources. + * + * Location names are formatted as `projects//locations/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @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 \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listAzureClients($parent, array $optionalArgs = []) + { + $request = new ListAzureClientsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListAzureClients', $optionalArgs, ListAzureClientsResponse::class, $request); + } + + /** + * Lists all [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] + * resources on a given Google Cloud project and region. + * + * Sample code: + * ``` + * $azureClustersClient = new AzureClustersClient(); + * try { + * $formattedParent = $azureClustersClient->locationName('[PROJECT]', '[LOCATION]'); + * // Iterate over pages of elements + * $pagedResponse = $azureClustersClient->listAzureClusters($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $azureClustersClient->listAzureClusters($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $azureClustersClient->close(); + * } + * ``` + * + * @param string $parent Required. The parent location which owns this collection of + * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resources. + * + * Location names are formatted as `projects//locations/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @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 \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listAzureClusters($parent, array $optionalArgs = []) + { + $request = new ListAzureClustersRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListAzureClusters', $optionalArgs, ListAzureClustersResponse::class, $request); + } + + /** + * Lists all [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] + * resources on a given + * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster]. + * + * Sample code: + * ``` + * $azureClustersClient = new AzureClustersClient(); + * try { + * $formattedParent = $azureClustersClient->azureClusterName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]'); + * // Iterate over pages of elements + * $pagedResponse = $azureClustersClient->listAzureNodePools($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $azureClustersClient->listAzureNodePools($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $azureClustersClient->close(); + * } + * ``` + * + * @param string $parent Required. The parent `AzureCluster` which owns this collection of + * [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] resources. + * + * `AzureCluster` names are formatted as + * `projects//locations//azureClusters/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @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 \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listAzureNodePools($parent, array $optionalArgs = []) + { + $request = new ListAzureNodePoolsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListAzureNodePools', $optionalArgs, ListAzureNodePoolsResponse::class, $request); + } + + /** + * Updates an [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster]. + * + * Sample code: + * ``` + * $azureClustersClient = new AzureClustersClient(); + * try { + * $azureCluster = new AzureCluster(); + * $updateMask = new FieldMask(); + * $operationResponse = $azureClustersClient->updateAzureCluster($azureCluster, $updateMask); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $azureClustersClient->updateAzureCluster($azureCluster, $updateMask); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $azureClustersClient->resumeOperation($operationName, 'updateAzureCluster'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $azureClustersClient->close(); + * } + * ``` + * + * @param AzureCluster $azureCluster Required. The [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] + * resource to update. + * @param FieldMask $updateMask Required. Mask of fields to update. At least one path must be supplied in + * this field. The elements of the repeated paths field can only include these + * fields from [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster]: + * + * * `description`. + * * `azureClient`. + * * `control_plane.version`. + * * `control_plane.vm_size`. + * * `annotations`. + * * `authorization.admin_users`. + * * `control_plane.root_volume.size_gib`. + * * `azure_services_authentication`. + * * `azure_services_authentication.tenant_id`. + * * `azure_services_authentication.application_id`. + * * `control_plane.proxy_config`. + * * `control_plane.proxy_config.resource_group_id`. + * * `control_plane.proxy_config.secret_id`. + * * `control_plane.ssh_config.authorized_key`. + * * `logging_config.component_config.enable_components` + * * `monitoring_config.managed_prometheus_config.enabled`. + * @param array $optionalArgs { + * Optional. + * + * @type bool $validateOnly + * If set, only validate the request, but do not actually update the cluster. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function updateAzureCluster($azureCluster, $updateMask, array $optionalArgs = []) + { + $request = new UpdateAzureClusterRequest(); + $requestParamHeaders = []; + $request->setAzureCluster($azureCluster); + $request->setUpdateMask($updateMask); + $requestParamHeaders['azure_cluster.name'] = $azureCluster->getName(); + if (isset($optionalArgs['validateOnly'])) { + $request->setValidateOnly($optionalArgs['validateOnly']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('UpdateAzureCluster', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Updates an [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool]. + * + * Sample code: + * ``` + * $azureClustersClient = new AzureClustersClient(); + * try { + * $azureNodePool = new AzureNodePool(); + * $updateMask = new FieldMask(); + * $operationResponse = $azureClustersClient->updateAzureNodePool($azureNodePool, $updateMask); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $azureClustersClient->updateAzureNodePool($azureNodePool, $updateMask); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $azureClustersClient->resumeOperation($operationName, 'updateAzureNodePool'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $azureClustersClient->close(); + * } + * ``` + * + * @param AzureNodePool $azureNodePool Required. The [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] + * resource to update. + * @param FieldMask $updateMask Required. Mask of fields to update. At least one path must be supplied in + * this field. The elements of the repeated paths field can only include these + * fields from [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool]: + * + * *. `annotations`. + * * `version`. + * * `autoscaling.min_node_count`. + * * `autoscaling.max_node_count`. + * * `config.ssh_config.authorized_key`. + * @param array $optionalArgs { + * Optional. + * + * @type bool $validateOnly + * If set, only validate the request, but don't actually update the node pool. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function updateAzureNodePool($azureNodePool, $updateMask, array $optionalArgs = []) + { + $request = new UpdateAzureNodePoolRequest(); + $requestParamHeaders = []; + $request->setAzureNodePool($azureNodePool); + $request->setUpdateMask($updateMask); + $requestParamHeaders['azure_node_pool.name'] = $azureNodePool->getName(); + if (isset($optionalArgs['validateOnly'])) { + $request->setValidateOnly($optionalArgs['validateOnly']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('UpdateAzureNodePool', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } +} diff --git a/owl-bot-staging/GkeMultiCloud/v1/src/V1/gapic_metadata.json b/owl-bot-staging/GkeMultiCloud/v1/src/V1/gapic_metadata.json new file mode 100644 index 000000000000..a69240b06fba --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/src/V1/gapic_metadata.json @@ -0,0 +1,216 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services\/RPCs to the corresponding library clients\/methods", + "language": "php", + "protoPackage": "google.cloud.gkemulticloud.v1", + "libraryPackage": "Google\\Cloud\\GkeMultiCloud\\V1", + "services": { + "AttachedClusters": { + "clients": { + "grpc": { + "libraryClient": "AttachedClustersGapicClient", + "rpcs": { + "CreateAttachedCluster": { + "methods": [ + "createAttachedCluster" + ] + }, + "DeleteAttachedCluster": { + "methods": [ + "deleteAttachedCluster" + ] + }, + "GenerateAttachedClusterInstallManifest": { + "methods": [ + "generateAttachedClusterInstallManifest" + ] + }, + "GetAttachedCluster": { + "methods": [ + "getAttachedCluster" + ] + }, + "GetAttachedServerConfig": { + "methods": [ + "getAttachedServerConfig" + ] + }, + "ImportAttachedCluster": { + "methods": [ + "importAttachedCluster" + ] + }, + "ListAttachedClusters": { + "methods": [ + "listAttachedClusters" + ] + }, + "UpdateAttachedCluster": { + "methods": [ + "updateAttachedCluster" + ] + } + } + } + } + }, + "AwsClusters": { + "clients": { + "grpc": { + "libraryClient": "AwsClustersGapicClient", + "rpcs": { + "CreateAwsCluster": { + "methods": [ + "createAwsCluster" + ] + }, + "CreateAwsNodePool": { + "methods": [ + "createAwsNodePool" + ] + }, + "DeleteAwsCluster": { + "methods": [ + "deleteAwsCluster" + ] + }, + "DeleteAwsNodePool": { + "methods": [ + "deleteAwsNodePool" + ] + }, + "GenerateAwsAccessToken": { + "methods": [ + "generateAwsAccessToken" + ] + }, + "GetAwsCluster": { + "methods": [ + "getAwsCluster" + ] + }, + "GetAwsNodePool": { + "methods": [ + "getAwsNodePool" + ] + }, + "GetAwsServerConfig": { + "methods": [ + "getAwsServerConfig" + ] + }, + "ListAwsClusters": { + "methods": [ + "listAwsClusters" + ] + }, + "ListAwsNodePools": { + "methods": [ + "listAwsNodePools" + ] + }, + "UpdateAwsCluster": { + "methods": [ + "updateAwsCluster" + ] + }, + "UpdateAwsNodePool": { + "methods": [ + "updateAwsNodePool" + ] + } + } + } + } + }, + "AzureClusters": { + "clients": { + "grpc": { + "libraryClient": "AzureClustersGapicClient", + "rpcs": { + "CreateAzureClient": { + "methods": [ + "createAzureClient" + ] + }, + "CreateAzureCluster": { + "methods": [ + "createAzureCluster" + ] + }, + "CreateAzureNodePool": { + "methods": [ + "createAzureNodePool" + ] + }, + "DeleteAzureClient": { + "methods": [ + "deleteAzureClient" + ] + }, + "DeleteAzureCluster": { + "methods": [ + "deleteAzureCluster" + ] + }, + "DeleteAzureNodePool": { + "methods": [ + "deleteAzureNodePool" + ] + }, + "GenerateAzureAccessToken": { + "methods": [ + "generateAzureAccessToken" + ] + }, + "GetAzureClient": { + "methods": [ + "getAzureClient" + ] + }, + "GetAzureCluster": { + "methods": [ + "getAzureCluster" + ] + }, + "GetAzureNodePool": { + "methods": [ + "getAzureNodePool" + ] + }, + "GetAzureServerConfig": { + "methods": [ + "getAzureServerConfig" + ] + }, + "ListAzureClients": { + "methods": [ + "listAzureClients" + ] + }, + "ListAzureClusters": { + "methods": [ + "listAzureClusters" + ] + }, + "ListAzureNodePools": { + "methods": [ + "listAzureNodePools" + ] + }, + "UpdateAzureCluster": { + "methods": [ + "updateAzureCluster" + ] + }, + "UpdateAzureNodePool": { + "methods": [ + "updateAzureNodePool" + ] + } + } + } + } + } + } +} \ No newline at end of file diff --git a/owl-bot-staging/GkeMultiCloud/v1/src/V1/resources/attached_clusters_client_config.json b/owl-bot-staging/GkeMultiCloud/v1/src/V1/resources/attached_clusters_client_config.json new file mode 100644 index 000000000000..79c17065c97a --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/src/V1/resources/attached_clusters_client_config.json @@ -0,0 +1,84 @@ +{ + "interfaces": { + "google.cloud.gkemulticloud.v1.AttachedClusters": { + "retry_codes": { + "no_retry_codes": [], + "retry_policy_1_codes": [ + "UNAVAILABLE" + ], + "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": 1.3, + "max_retry_delay_millis": 10000, + "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": { + "CreateAttachedCluster": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "DeleteAttachedCluster": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "GenerateAttachedClusterInstallManifest": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetAttachedCluster": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetAttachedServerConfig": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ImportAttachedCluster": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "ListAttachedClusters": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "UpdateAttachedCluster": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + } + } + } + } +} diff --git a/owl-bot-staging/GkeMultiCloud/v1/src/V1/resources/attached_clusters_descriptor_config.php b/owl-bot-staging/GkeMultiCloud/v1/src/V1/resources/attached_clusters_descriptor_config.php new file mode 100644 index 000000000000..ae4a8852eeec --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/src/V1/resources/attached_clusters_descriptor_config.php @@ -0,0 +1,146 @@ + [ + 'google.cloud.gkemulticloud.v1.AttachedClusters' => [ + 'CreateAttachedCluster' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\GkeMultiCloud\V1\AttachedCluster', + 'metadataReturnType' => '\Google\Cloud\GkeMultiCloud\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'DeleteAttachedCluster' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\GkeMultiCloud\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'ImportAttachedCluster' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\GkeMultiCloud\V1\AttachedCluster', + 'metadataReturnType' => '\Google\Cloud\GkeMultiCloud\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'UpdateAttachedCluster' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\GkeMultiCloud\V1\AttachedCluster', + 'metadataReturnType' => '\Google\Cloud\GkeMultiCloud\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'attached_cluster.name', + 'fieldAccessors' => [ + 'getAttachedCluster', + 'getName', + ], + ], + ], + ], + 'GenerateAttachedClusterInstallManifest' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\GkeMultiCloud\V1\GenerateAttachedClusterInstallManifestResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'GetAttachedCluster' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\GkeMultiCloud\V1\AttachedCluster', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetAttachedServerConfig' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\GkeMultiCloud\V1\AttachedServerConfig', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'ListAttachedClusters' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getAttachedClusters', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\GkeMultiCloud\V1\ListAttachedClustersResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'templateMap' => [ + 'attachedCluster' => 'projects/{project}/locations/{location}/attachedClusters/{attached_cluster}', + 'attachedServerConfig' => 'projects/{project}/locations/{location}/attachedServerConfig', + 'location' => 'projects/{project}/locations/{location}', + ], + ], + ], +]; diff --git a/owl-bot-staging/GkeMultiCloud/v1/src/V1/resources/attached_clusters_rest_client_config.php b/owl-bot-staging/GkeMultiCloud/v1/src/V1/resources/attached_clusters_rest_client_config.php new file mode 100644 index 000000000000..5d9c3003ee17 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/src/V1/resources/attached_clusters_rest_client_config.php @@ -0,0 +1,153 @@ + [ + 'google.cloud.gkemulticloud.v1.AttachedClusters' => [ + 'CreateAttachedCluster' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/attachedClusters', + 'body' => 'attached_cluster', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'attached_cluster_id', + ], + ], + 'DeleteAttachedCluster' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/attachedClusters/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GenerateAttachedClusterInstallManifest' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}:generateAttachedClusterInstallManifest', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'GetAttachedCluster' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/attachedClusters/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetAttachedServerConfig' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/attachedServerConfig}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ImportAttachedCluster' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/attachedClusters:import', + 'body' => '*', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListAttachedClusters' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/attachedClusters', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'UpdateAttachedCluster' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{attached_cluster.name=projects/*/locations/*/attachedClusters/*}', + 'body' => 'attached_cluster', + 'placeholders' => [ + 'attached_cluster.name' => [ + 'getters' => [ + 'getAttachedCluster', + 'getName', + ], + ], + ], + 'queryParams' => [ + 'update_mask', + ], + ], + ], + 'google.longrunning.Operations' => [ + 'CancelOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}:cancel', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteOperation' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetOperation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListOperations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*}/operations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + ], +]; diff --git a/owl-bot-staging/GkeMultiCloud/v1/src/V1/resources/aws_clusters_client_config.json b/owl-bot-staging/GkeMultiCloud/v1/src/V1/resources/aws_clusters_client_config.json new file mode 100644 index 000000000000..c7c0634a0a98 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/src/V1/resources/aws_clusters_client_config.json @@ -0,0 +1,104 @@ +{ + "interfaces": { + "google.cloud.gkemulticloud.v1.AwsClusters": { + "retry_codes": { + "no_retry_codes": [], + "retry_policy_1_codes": [ + "UNAVAILABLE" + ], + "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": 1.3, + "max_retry_delay_millis": 10000, + "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": { + "CreateAwsCluster": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "CreateAwsNodePool": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "DeleteAwsCluster": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "DeleteAwsNodePool": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "GenerateAwsAccessToken": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetAwsCluster": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetAwsNodePool": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetAwsServerConfig": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListAwsClusters": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListAwsNodePools": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "UpdateAwsCluster": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "UpdateAwsNodePool": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + } + } + } + } +} diff --git a/owl-bot-staging/GkeMultiCloud/v1/src/V1/resources/aws_clusters_descriptor_config.php b/owl-bot-staging/GkeMultiCloud/v1/src/V1/resources/aws_clusters_descriptor_config.php new file mode 100644 index 000000000000..96093aa25a3c --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/src/V1/resources/aws_clusters_descriptor_config.php @@ -0,0 +1,218 @@ + [ + 'google.cloud.gkemulticloud.v1.AwsClusters' => [ + 'CreateAwsCluster' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\GkeMultiCloud\V1\AwsCluster', + 'metadataReturnType' => '\Google\Cloud\GkeMultiCloud\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'CreateAwsNodePool' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\GkeMultiCloud\V1\AwsNodePool', + 'metadataReturnType' => '\Google\Cloud\GkeMultiCloud\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'DeleteAwsCluster' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\GkeMultiCloud\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'DeleteAwsNodePool' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\GkeMultiCloud\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'UpdateAwsCluster' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\GkeMultiCloud\V1\AwsCluster', + 'metadataReturnType' => '\Google\Cloud\GkeMultiCloud\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'aws_cluster.name', + 'fieldAccessors' => [ + 'getAwsCluster', + 'getName', + ], + ], + ], + ], + 'UpdateAwsNodePool' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\GkeMultiCloud\V1\AwsNodePool', + 'metadataReturnType' => '\Google\Cloud\GkeMultiCloud\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'aws_node_pool.name', + 'fieldAccessors' => [ + 'getAwsNodePool', + 'getName', + ], + ], + ], + ], + 'GenerateAwsAccessToken' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\GkeMultiCloud\V1\GenerateAwsAccessTokenResponse', + 'headerParams' => [ + [ + 'keyName' => 'aws_cluster', + 'fieldAccessors' => [ + 'getAwsCluster', + ], + ], + ], + ], + 'GetAwsCluster' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\GkeMultiCloud\V1\AwsCluster', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetAwsNodePool' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\GkeMultiCloud\V1\AwsNodePool', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetAwsServerConfig' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\GkeMultiCloud\V1\AwsServerConfig', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'ListAwsClusters' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getAwsClusters', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\GkeMultiCloud\V1\ListAwsClustersResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListAwsNodePools' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getAwsNodePools', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\GkeMultiCloud\V1\ListAwsNodePoolsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'templateMap' => [ + 'awsCluster' => 'projects/{project}/locations/{location}/awsClusters/{aws_cluster}', + 'awsNodePool' => 'projects/{project}/locations/{location}/awsClusters/{aws_cluster}/awsNodePools/{aws_node_pool}', + 'awsServerConfig' => 'projects/{project}/locations/{location}/awsServerConfig', + 'location' => 'projects/{project}/locations/{location}', + ], + ], + ], +]; diff --git a/owl-bot-staging/GkeMultiCloud/v1/src/V1/resources/aws_clusters_rest_client_config.php b/owl-bot-staging/GkeMultiCloud/v1/src/V1/resources/aws_clusters_rest_client_config.php new file mode 100644 index 000000000000..e61743f714aa --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/src/V1/resources/aws_clusters_rest_client_config.php @@ -0,0 +1,205 @@ + [ + 'google.cloud.gkemulticloud.v1.AwsClusters' => [ + 'CreateAwsCluster' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/awsClusters', + 'body' => 'aws_cluster', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'aws_cluster_id', + ], + ], + 'CreateAwsNodePool' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/awsClusters/*}/awsNodePools', + 'body' => 'aws_node_pool', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'aws_node_pool_id', + ], + ], + 'DeleteAwsCluster' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/awsClusters/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteAwsNodePool' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/awsClusters/*/awsNodePools/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GenerateAwsAccessToken' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{aws_cluster=projects/*/locations/*/awsClusters/*}:generateAwsAccessToken', + 'placeholders' => [ + 'aws_cluster' => [ + 'getters' => [ + 'getAwsCluster', + ], + ], + ], + ], + 'GetAwsCluster' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/awsClusters/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetAwsNodePool' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/awsClusters/*/awsNodePools/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetAwsServerConfig' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/awsServerConfig}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListAwsClusters' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/awsClusters', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListAwsNodePools' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/awsClusters/*}/awsNodePools', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'UpdateAwsCluster' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{aws_cluster.name=projects/*/locations/*/awsClusters/*}', + 'body' => 'aws_cluster', + 'placeholders' => [ + 'aws_cluster.name' => [ + 'getters' => [ + 'getAwsCluster', + 'getName', + ], + ], + ], + 'queryParams' => [ + 'update_mask', + ], + ], + 'UpdateAwsNodePool' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{aws_node_pool.name=projects/*/locations/*/awsClusters/*/awsNodePools/*}', + 'body' => 'aws_node_pool', + 'placeholders' => [ + 'aws_node_pool.name' => [ + 'getters' => [ + 'getAwsNodePool', + 'getName', + ], + ], + ], + 'queryParams' => [ + 'update_mask', + ], + ], + ], + 'google.longrunning.Operations' => [ + 'CancelOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}:cancel', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteOperation' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetOperation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListOperations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*}/operations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + ], +]; diff --git a/owl-bot-staging/GkeMultiCloud/v1/src/V1/resources/azure_clusters_client_config.json b/owl-bot-staging/GkeMultiCloud/v1/src/V1/resources/azure_clusters_client_config.json new file mode 100644 index 000000000000..fae6b0761556 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/src/V1/resources/azure_clusters_client_config.json @@ -0,0 +1,124 @@ +{ + "interfaces": { + "google.cloud.gkemulticloud.v1.AzureClusters": { + "retry_codes": { + "no_retry_codes": [], + "retry_policy_1_codes": [ + "UNAVAILABLE" + ], + "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": 1.3, + "max_retry_delay_millis": 10000, + "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": { + "CreateAzureClient": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "CreateAzureCluster": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "CreateAzureNodePool": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "DeleteAzureClient": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "DeleteAzureCluster": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "DeleteAzureNodePool": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "GenerateAzureAccessToken": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetAzureClient": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetAzureCluster": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetAzureNodePool": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetAzureServerConfig": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListAzureClients": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListAzureClusters": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListAzureNodePools": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "UpdateAzureCluster": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "UpdateAzureNodePool": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + } + } + } + } +} diff --git a/owl-bot-staging/GkeMultiCloud/v1/src/V1/resources/azure_clusters_descriptor_config.php b/owl-bot-staging/GkeMultiCloud/v1/src/V1/resources/azure_clusters_descriptor_config.php new file mode 100644 index 000000000000..d2bb16b41b19 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/src/V1/resources/azure_clusters_descriptor_config.php @@ -0,0 +1,289 @@ + [ + 'google.cloud.gkemulticloud.v1.AzureClusters' => [ + 'CreateAzureClient' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\GkeMultiCloud\V1\AzureClient', + 'metadataReturnType' => '\Google\Cloud\GkeMultiCloud\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'CreateAzureCluster' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\GkeMultiCloud\V1\AzureCluster', + 'metadataReturnType' => '\Google\Cloud\GkeMultiCloud\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'CreateAzureNodePool' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\GkeMultiCloud\V1\AzureNodePool', + 'metadataReturnType' => '\Google\Cloud\GkeMultiCloud\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'DeleteAzureClient' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\GkeMultiCloud\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'DeleteAzureCluster' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\GkeMultiCloud\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'DeleteAzureNodePool' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\GkeMultiCloud\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'UpdateAzureCluster' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\GkeMultiCloud\V1\AzureCluster', + 'metadataReturnType' => '\Google\Cloud\GkeMultiCloud\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'azure_cluster.name', + 'fieldAccessors' => [ + 'getAzureCluster', + 'getName', + ], + ], + ], + ], + 'UpdateAzureNodePool' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\GkeMultiCloud\V1\AzureNodePool', + 'metadataReturnType' => '\Google\Cloud\GkeMultiCloud\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'azure_node_pool.name', + 'fieldAccessors' => [ + 'getAzureNodePool', + 'getName', + ], + ], + ], + ], + 'GenerateAzureAccessToken' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\GkeMultiCloud\V1\GenerateAzureAccessTokenResponse', + 'headerParams' => [ + [ + 'keyName' => 'azure_cluster', + 'fieldAccessors' => [ + 'getAzureCluster', + ], + ], + ], + ], + 'GetAzureClient' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\GkeMultiCloud\V1\AzureClient', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetAzureCluster' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\GkeMultiCloud\V1\AzureCluster', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetAzureNodePool' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\GkeMultiCloud\V1\AzureNodePool', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetAzureServerConfig' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\GkeMultiCloud\V1\AzureServerConfig', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'ListAzureClients' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getAzureClients', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\GkeMultiCloud\V1\ListAzureClientsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListAzureClusters' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getAzureClusters', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\GkeMultiCloud\V1\ListAzureClustersResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListAzureNodePools' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getAzureNodePools', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\GkeMultiCloud\V1\ListAzureNodePoolsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'templateMap' => [ + 'azureClient' => 'projects/{project}/locations/{location}/azureClients/{azure_client}', + 'azureCluster' => 'projects/{project}/locations/{location}/azureClusters/{azure_cluster}', + 'azureNodePool' => 'projects/{project}/locations/{location}/azureClusters/{azure_cluster}/azureNodePools/{azure_node_pool}', + 'azureServerConfig' => 'projects/{project}/locations/{location}/azureServerConfig', + 'location' => 'projects/{project}/locations/{location}', + ], + ], + ], +]; diff --git a/owl-bot-staging/GkeMultiCloud/v1/src/V1/resources/azure_clusters_rest_client_config.php b/owl-bot-staging/GkeMultiCloud/v1/src/V1/resources/azure_clusters_rest_client_config.php new file mode 100644 index 000000000000..76e3adfb1baf --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/src/V1/resources/azure_clusters_rest_client_config.php @@ -0,0 +1,253 @@ + [ + 'google.cloud.gkemulticloud.v1.AzureClusters' => [ + 'CreateAzureClient' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/azureClients', + 'body' => 'azure_client', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'azure_client_id', + ], + ], + 'CreateAzureCluster' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/azureClusters', + 'body' => 'azure_cluster', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'azure_cluster_id', + ], + ], + 'CreateAzureNodePool' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/azureClusters/*}/azureNodePools', + 'body' => 'azure_node_pool', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'azure_node_pool_id', + ], + ], + 'DeleteAzureClient' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/azureClients/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteAzureCluster' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/azureClusters/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteAzureNodePool' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/azureClusters/*/azureNodePools/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GenerateAzureAccessToken' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{azure_cluster=projects/*/locations/*/azureClusters/*}:generateAzureAccessToken', + 'placeholders' => [ + 'azure_cluster' => [ + 'getters' => [ + 'getAzureCluster', + ], + ], + ], + ], + 'GetAzureClient' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/azureClients/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetAzureCluster' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/azureClusters/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetAzureNodePool' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/azureClusters/*/azureNodePools/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetAzureServerConfig' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/azureServerConfig}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListAzureClients' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/azureClients', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListAzureClusters' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/azureClusters', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListAzureNodePools' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/azureClusters/*}/azureNodePools', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'UpdateAzureCluster' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{azure_cluster.name=projects/*/locations/*/azureClusters/*}', + 'body' => 'azure_cluster', + 'placeholders' => [ + 'azure_cluster.name' => [ + 'getters' => [ + 'getAzureCluster', + 'getName', + ], + ], + ], + 'queryParams' => [ + 'update_mask', + ], + ], + 'UpdateAzureNodePool' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{azure_node_pool.name=projects/*/locations/*/azureClusters/*/azureNodePools/*}', + 'body' => 'azure_node_pool', + 'placeholders' => [ + 'azure_node_pool.name' => [ + 'getters' => [ + 'getAzureNodePool', + 'getName', + ], + ], + ], + 'queryParams' => [ + 'update_mask', + ], + ], + ], + 'google.longrunning.Operations' => [ + 'CancelOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}:cancel', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteOperation' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetOperation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListOperations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*}/operations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + ], +]; diff --git a/owl-bot-staging/GkeMultiCloud/v1/tests/Unit/V1/AttachedClustersClientTest.php b/owl-bot-staging/GkeMultiCloud/v1/tests/Unit/V1/AttachedClustersClientTest.php new file mode 100644 index 000000000000..30127c7b4ac0 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/tests/Unit/V1/AttachedClustersClientTest.php @@ -0,0 +1,930 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return AttachedClustersClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new AttachedClustersClient($options); + } + + /** @test */ + public function createAttachedClusterTest() + { + $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/createAttachedClusterTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $platformVersion = 'platformVersion1813514508'; + $distribution = 'distribution-1580708220'; + $clusterRegion = 'clusterRegion993903833'; + $uid = 'uid115792'; + $reconciling = false; + $etag = 'etag3123477'; + $kubernetesVersion = 'kubernetesVersion50850015'; + $expectedResponse = new AttachedCluster(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $expectedResponse->setPlatformVersion($platformVersion); + $expectedResponse->setDistribution($distribution); + $expectedResponse->setClusterRegion($clusterRegion); + $expectedResponse->setUid($uid); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setEtag($etag); + $expectedResponse->setKubernetesVersion($kubernetesVersion); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createAttachedClusterTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $attachedCluster = new AttachedCluster(); + $attachedClusterOidcConfig = new AttachedOidcConfig(); + $attachedCluster->setOidcConfig($attachedClusterOidcConfig); + $attachedClusterPlatformVersion = 'attachedClusterPlatformVersion-208126385'; + $attachedCluster->setPlatformVersion($attachedClusterPlatformVersion); + $attachedClusterDistribution = 'attachedClusterDistribution1692601690'; + $attachedCluster->setDistribution($attachedClusterDistribution); + $attachedClusterFleet = new Fleet(); + $fleetProject = 'fleetProject604893675'; + $attachedClusterFleet->setProject($fleetProject); + $attachedCluster->setFleet($attachedClusterFleet); + $attachedClusterId = 'attachedClusterId-249426181'; + $response = $gapicClient->createAttachedCluster($formattedParent, $attachedCluster, $attachedClusterId); + $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.cloud.gkemulticloud.v1.AttachedClusters/CreateAttachedCluster', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getAttachedCluster(); + $this->assertProtobufEquals($attachedCluster, $actualValue); + $actualValue = $actualApiRequestObject->getAttachedClusterId(); + $this->assertProtobufEquals($attachedClusterId, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createAttachedClusterTest'); + $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 createAttachedClusterExceptionTest() + { + $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/createAttachedClusterTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $attachedCluster = new AttachedCluster(); + $attachedClusterOidcConfig = new AttachedOidcConfig(); + $attachedCluster->setOidcConfig($attachedClusterOidcConfig); + $attachedClusterPlatformVersion = 'attachedClusterPlatformVersion-208126385'; + $attachedCluster->setPlatformVersion($attachedClusterPlatformVersion); + $attachedClusterDistribution = 'attachedClusterDistribution1692601690'; + $attachedCluster->setDistribution($attachedClusterDistribution); + $attachedClusterFleet = new Fleet(); + $fleetProject = 'fleetProject604893675'; + $attachedClusterFleet->setProject($fleetProject); + $attachedCluster->setFleet($attachedClusterFleet); + $attachedClusterId = 'attachedClusterId-249426181'; + $response = $gapicClient->createAttachedCluster($formattedParent, $attachedCluster, $attachedClusterId); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createAttachedClusterTest'); + 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 deleteAttachedClusterTest() + { + $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/deleteAttachedClusterTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteAttachedClusterTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->attachedClusterName('[PROJECT]', '[LOCATION]', '[ATTACHED_CLUSTER]'); + $response = $gapicClient->deleteAttachedCluster($formattedName); + $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.cloud.gkemulticloud.v1.AttachedClusters/DeleteAttachedCluster', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteAttachedClusterTest'); + $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 deleteAttachedClusterExceptionTest() + { + $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/deleteAttachedClusterTest'); + $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->attachedClusterName('[PROJECT]', '[LOCATION]', '[ATTACHED_CLUSTER]'); + $response = $gapicClient->deleteAttachedCluster($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteAttachedClusterTest'); + 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 generateAttachedClusterInstallManifestTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $manifest = 'manifest130625071'; + $expectedResponse = new GenerateAttachedClusterInstallManifestResponse(); + $expectedResponse->setManifest($manifest); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $attachedClusterId = 'attachedClusterId-249426181'; + $platformVersion = 'platformVersion1813514508'; + $response = $gapicClient->generateAttachedClusterInstallManifest($formattedParent, $attachedClusterId, $platformVersion); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkemulticloud.v1.AttachedClusters/GenerateAttachedClusterInstallManifest', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getAttachedClusterId(); + $this->assertProtobufEquals($attachedClusterId, $actualValue); + $actualValue = $actualRequestObject->getPlatformVersion(); + $this->assertProtobufEquals($platformVersion, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function generateAttachedClusterInstallManifestExceptionTest() + { + $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->locationName('[PROJECT]', '[LOCATION]'); + $attachedClusterId = 'attachedClusterId-249426181'; + $platformVersion = 'platformVersion1813514508'; + try { + $gapicClient->generateAttachedClusterInstallManifest($formattedParent, $attachedClusterId, $platformVersion); + // 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 getAttachedClusterTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $description = 'description-1724546052'; + $platformVersion = 'platformVersion1813514508'; + $distribution = 'distribution-1580708220'; + $clusterRegion = 'clusterRegion993903833'; + $uid = 'uid115792'; + $reconciling = false; + $etag = 'etag3123477'; + $kubernetesVersion = 'kubernetesVersion50850015'; + $expectedResponse = new AttachedCluster(); + $expectedResponse->setName($name2); + $expectedResponse->setDescription($description); + $expectedResponse->setPlatformVersion($platformVersion); + $expectedResponse->setDistribution($distribution); + $expectedResponse->setClusterRegion($clusterRegion); + $expectedResponse->setUid($uid); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setEtag($etag); + $expectedResponse->setKubernetesVersion($kubernetesVersion); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->attachedClusterName('[PROJECT]', '[LOCATION]', '[ATTACHED_CLUSTER]'); + $response = $gapicClient->getAttachedCluster($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkemulticloud.v1.AttachedClusters/GetAttachedCluster', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getAttachedClusterExceptionTest() + { + $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->attachedClusterName('[PROJECT]', '[LOCATION]', '[ATTACHED_CLUSTER]'); + try { + $gapicClient->getAttachedCluster($formattedName); + // 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 getAttachedServerConfigTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $expectedResponse = new AttachedServerConfig(); + $expectedResponse->setName($name2); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->attachedServerConfigName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->getAttachedServerConfig($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkemulticloud.v1.AttachedClusters/GetAttachedServerConfig', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getAttachedServerConfigExceptionTest() + { + $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->attachedServerConfigName('[PROJECT]', '[LOCATION]'); + try { + $gapicClient->getAttachedServerConfig($formattedName); + // 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 importAttachedClusterTest() + { + $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/importAttachedClusterTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $platformVersion2 = 'platformVersion2-969276993'; + $distribution2 = 'distribution21357826359'; + $clusterRegion = 'clusterRegion993903833'; + $uid = 'uid115792'; + $reconciling = false; + $etag = 'etag3123477'; + $kubernetesVersion = 'kubernetesVersion50850015'; + $expectedResponse = new AttachedCluster(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $expectedResponse->setPlatformVersion($platformVersion2); + $expectedResponse->setDistribution($distribution2); + $expectedResponse->setClusterRegion($clusterRegion); + $expectedResponse->setUid($uid); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setEtag($etag); + $expectedResponse->setKubernetesVersion($kubernetesVersion); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/importAttachedClusterTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $fleetMembership = 'fleetMembership1817977703'; + $platformVersion = 'platformVersion1813514508'; + $distribution = 'distribution-1580708220'; + $response = $gapicClient->importAttachedCluster($formattedParent, $fleetMembership, $platformVersion, $distribution); + $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.cloud.gkemulticloud.v1.AttachedClusters/ImportAttachedCluster', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getFleetMembership(); + $this->assertProtobufEquals($fleetMembership, $actualValue); + $actualValue = $actualApiRequestObject->getPlatformVersion(); + $this->assertProtobufEquals($platformVersion, $actualValue); + $actualValue = $actualApiRequestObject->getDistribution(); + $this->assertProtobufEquals($distribution, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/importAttachedClusterTest'); + $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 importAttachedClusterExceptionTest() + { + $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/importAttachedClusterTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $fleetMembership = 'fleetMembership1817977703'; + $platformVersion = 'platformVersion1813514508'; + $distribution = 'distribution-1580708220'; + $response = $gapicClient->importAttachedCluster($formattedParent, $fleetMembership, $platformVersion, $distribution); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/importAttachedClusterTest'); + 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 listAttachedClustersTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $attachedClustersElement = new AttachedCluster(); + $attachedClusters = [ + $attachedClustersElement, + ]; + $expectedResponse = new ListAttachedClustersResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setAttachedClusters($attachedClusters); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->listAttachedClusters($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getAttachedClusters()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkemulticloud.v1.AttachedClusters/ListAttachedClusters', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listAttachedClustersExceptionTest() + { + $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->locationName('[PROJECT]', '[LOCATION]'); + try { + $gapicClient->listAttachedClusters($formattedParent); + // 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 updateAttachedClusterTest() + { + $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/updateAttachedClusterTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $platformVersion = 'platformVersion1813514508'; + $distribution = 'distribution-1580708220'; + $clusterRegion = 'clusterRegion993903833'; + $uid = 'uid115792'; + $reconciling = false; + $etag = 'etag3123477'; + $kubernetesVersion = 'kubernetesVersion50850015'; + $expectedResponse = new AttachedCluster(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $expectedResponse->setPlatformVersion($platformVersion); + $expectedResponse->setDistribution($distribution); + $expectedResponse->setClusterRegion($clusterRegion); + $expectedResponse->setUid($uid); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setEtag($etag); + $expectedResponse->setKubernetesVersion($kubernetesVersion); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateAttachedClusterTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $attachedCluster = new AttachedCluster(); + $attachedClusterOidcConfig = new AttachedOidcConfig(); + $attachedCluster->setOidcConfig($attachedClusterOidcConfig); + $attachedClusterPlatformVersion = 'attachedClusterPlatformVersion-208126385'; + $attachedCluster->setPlatformVersion($attachedClusterPlatformVersion); + $attachedClusterDistribution = 'attachedClusterDistribution1692601690'; + $attachedCluster->setDistribution($attachedClusterDistribution); + $attachedClusterFleet = new Fleet(); + $fleetProject = 'fleetProject604893675'; + $attachedClusterFleet->setProject($fleetProject); + $attachedCluster->setFleet($attachedClusterFleet); + $updateMask = new FieldMask(); + $response = $gapicClient->updateAttachedCluster($attachedCluster, $updateMask); + $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.cloud.gkemulticloud.v1.AttachedClusters/UpdateAttachedCluster', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getAttachedCluster(); + $this->assertProtobufEquals($attachedCluster, $actualValue); + $actualValue = $actualApiRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateAttachedClusterTest'); + $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 updateAttachedClusterExceptionTest() + { + $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/updateAttachedClusterTest'); + $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 + $attachedCluster = new AttachedCluster(); + $attachedClusterOidcConfig = new AttachedOidcConfig(); + $attachedCluster->setOidcConfig($attachedClusterOidcConfig); + $attachedClusterPlatformVersion = 'attachedClusterPlatformVersion-208126385'; + $attachedCluster->setPlatformVersion($attachedClusterPlatformVersion); + $attachedClusterDistribution = 'attachedClusterDistribution1692601690'; + $attachedCluster->setDistribution($attachedClusterDistribution); + $attachedClusterFleet = new Fleet(); + $fleetProject = 'fleetProject604893675'; + $attachedClusterFleet->setProject($fleetProject); + $attachedCluster->setFleet($attachedClusterFleet); + $updateMask = new FieldMask(); + $response = $gapicClient->updateAttachedCluster($attachedCluster, $updateMask); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateAttachedClusterTest'); + 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()); + } +} diff --git a/owl-bot-staging/GkeMultiCloud/v1/tests/Unit/V1/AwsClustersClientTest.php b/owl-bot-staging/GkeMultiCloud/v1/tests/Unit/V1/AwsClustersClientTest.php new file mode 100644 index 000000000000..92b2818d919e --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/tests/Unit/V1/AwsClustersClientTest.php @@ -0,0 +1,1504 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return AwsClustersClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new AwsClustersClient($options); + } + + /** @test */ + public function createAwsClusterTest() + { + $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/createAwsClusterTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $awsRegion = 'awsRegion-1887255946'; + $endpoint = 'endpoint1741102485'; + $uid = 'uid115792'; + $reconciling = false; + $etag = 'etag3123477'; + $clusterCaCertificate = 'clusterCaCertificate1324742683'; + $expectedResponse = new AwsCluster(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $expectedResponse->setAwsRegion($awsRegion); + $expectedResponse->setEndpoint($endpoint); + $expectedResponse->setUid($uid); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setEtag($etag); + $expectedResponse->setClusterCaCertificate($clusterCaCertificate); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createAwsClusterTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $awsCluster = new AwsCluster(); + $awsClusterNetworking = new AwsClusterNetworking(); + $networkingVpcId = 'networkingVpcId-1154507440'; + $awsClusterNetworking->setVpcId($networkingVpcId); + $networkingPodAddressCidrBlocks = []; + $awsClusterNetworking->setPodAddressCidrBlocks($networkingPodAddressCidrBlocks); + $networkingServiceAddressCidrBlocks = []; + $awsClusterNetworking->setServiceAddressCidrBlocks($networkingServiceAddressCidrBlocks); + $awsCluster->setNetworking($awsClusterNetworking); + $awsClusterAwsRegion = 'awsClusterAwsRegion574122132'; + $awsCluster->setAwsRegion($awsClusterAwsRegion); + $awsClusterControlPlane = new AwsControlPlane(); + $controlPlaneVersion = 'controlPlaneVersion648040665'; + $awsClusterControlPlane->setVersion($controlPlaneVersion); + $controlPlaneSubnetIds = []; + $awsClusterControlPlane->setSubnetIds($controlPlaneSubnetIds); + $controlPlaneIamInstanceProfile = 'controlPlaneIamInstanceProfile1905273246'; + $awsClusterControlPlane->setIamInstanceProfile($controlPlaneIamInstanceProfile); + $controlPlaneDatabaseEncryption = new AwsDatabaseEncryption(); + $databaseEncryptionKmsKeyArn = 'databaseEncryptionKmsKeyArn1858324593'; + $controlPlaneDatabaseEncryption->setKmsKeyArn($databaseEncryptionKmsKeyArn); + $awsClusterControlPlane->setDatabaseEncryption($controlPlaneDatabaseEncryption); + $controlPlaneAwsServicesAuthentication = new AwsServicesAuthentication(); + $awsServicesAuthenticationRoleArn = 'awsServicesAuthenticationRoleArn1905212596'; + $controlPlaneAwsServicesAuthentication->setRoleArn($awsServicesAuthenticationRoleArn); + $awsClusterControlPlane->setAwsServicesAuthentication($controlPlaneAwsServicesAuthentication); + $controlPlaneConfigEncryption = new AwsConfigEncryption(); + $configEncryptionKmsKeyArn = 'configEncryptionKmsKeyArn-992257206'; + $controlPlaneConfigEncryption->setKmsKeyArn($configEncryptionKmsKeyArn); + $awsClusterControlPlane->setConfigEncryption($controlPlaneConfigEncryption); + $awsCluster->setControlPlane($awsClusterControlPlane); + $awsClusterAuthorization = new AwsAuthorization(); + $authorizationAdminUsers = []; + $awsClusterAuthorization->setAdminUsers($authorizationAdminUsers); + $awsCluster->setAuthorization($awsClusterAuthorization); + $awsClusterFleet = new Fleet(); + $fleetProject = 'fleetProject604893675'; + $awsClusterFleet->setProject($fleetProject); + $awsCluster->setFleet($awsClusterFleet); + $awsClusterId = 'awsClusterId938438658'; + $response = $gapicClient->createAwsCluster($formattedParent, $awsCluster, $awsClusterId); + $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.cloud.gkemulticloud.v1.AwsClusters/CreateAwsCluster', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getAwsCluster(); + $this->assertProtobufEquals($awsCluster, $actualValue); + $actualValue = $actualApiRequestObject->getAwsClusterId(); + $this->assertProtobufEquals($awsClusterId, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createAwsClusterTest'); + $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 createAwsClusterExceptionTest() + { + $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/createAwsClusterTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $awsCluster = new AwsCluster(); + $awsClusterNetworking = new AwsClusterNetworking(); + $networkingVpcId = 'networkingVpcId-1154507440'; + $awsClusterNetworking->setVpcId($networkingVpcId); + $networkingPodAddressCidrBlocks = []; + $awsClusterNetworking->setPodAddressCidrBlocks($networkingPodAddressCidrBlocks); + $networkingServiceAddressCidrBlocks = []; + $awsClusterNetworking->setServiceAddressCidrBlocks($networkingServiceAddressCidrBlocks); + $awsCluster->setNetworking($awsClusterNetworking); + $awsClusterAwsRegion = 'awsClusterAwsRegion574122132'; + $awsCluster->setAwsRegion($awsClusterAwsRegion); + $awsClusterControlPlane = new AwsControlPlane(); + $controlPlaneVersion = 'controlPlaneVersion648040665'; + $awsClusterControlPlane->setVersion($controlPlaneVersion); + $controlPlaneSubnetIds = []; + $awsClusterControlPlane->setSubnetIds($controlPlaneSubnetIds); + $controlPlaneIamInstanceProfile = 'controlPlaneIamInstanceProfile1905273246'; + $awsClusterControlPlane->setIamInstanceProfile($controlPlaneIamInstanceProfile); + $controlPlaneDatabaseEncryption = new AwsDatabaseEncryption(); + $databaseEncryptionKmsKeyArn = 'databaseEncryptionKmsKeyArn1858324593'; + $controlPlaneDatabaseEncryption->setKmsKeyArn($databaseEncryptionKmsKeyArn); + $awsClusterControlPlane->setDatabaseEncryption($controlPlaneDatabaseEncryption); + $controlPlaneAwsServicesAuthentication = new AwsServicesAuthentication(); + $awsServicesAuthenticationRoleArn = 'awsServicesAuthenticationRoleArn1905212596'; + $controlPlaneAwsServicesAuthentication->setRoleArn($awsServicesAuthenticationRoleArn); + $awsClusterControlPlane->setAwsServicesAuthentication($controlPlaneAwsServicesAuthentication); + $controlPlaneConfigEncryption = new AwsConfigEncryption(); + $configEncryptionKmsKeyArn = 'configEncryptionKmsKeyArn-992257206'; + $controlPlaneConfigEncryption->setKmsKeyArn($configEncryptionKmsKeyArn); + $awsClusterControlPlane->setConfigEncryption($controlPlaneConfigEncryption); + $awsCluster->setControlPlane($awsClusterControlPlane); + $awsClusterAuthorization = new AwsAuthorization(); + $authorizationAdminUsers = []; + $awsClusterAuthorization->setAdminUsers($authorizationAdminUsers); + $awsCluster->setAuthorization($awsClusterAuthorization); + $awsClusterFleet = new Fleet(); + $fleetProject = 'fleetProject604893675'; + $awsClusterFleet->setProject($fleetProject); + $awsCluster->setFleet($awsClusterFleet); + $awsClusterId = 'awsClusterId938438658'; + $response = $gapicClient->createAwsCluster($formattedParent, $awsCluster, $awsClusterId); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createAwsClusterTest'); + 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 createAwsNodePoolTest() + { + $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/createAwsNodePoolTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $version = 'version351608024'; + $subnetId = 'subnetId373593405'; + $uid = 'uid115792'; + $reconciling = false; + $etag = 'etag3123477'; + $expectedResponse = new AwsNodePool(); + $expectedResponse->setName($name); + $expectedResponse->setVersion($version); + $expectedResponse->setSubnetId($subnetId); + $expectedResponse->setUid($uid); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setEtag($etag); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createAwsNodePoolTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->awsClusterName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]'); + $awsNodePool = new AwsNodePool(); + $awsNodePoolVersion = 'awsNodePoolVersion-617231107'; + $awsNodePool->setVersion($awsNodePoolVersion); + $awsNodePoolConfig = new AwsNodeConfig(); + $configIamInstanceProfile = 'configIamInstanceProfile805825313'; + $awsNodePoolConfig->setIamInstanceProfile($configIamInstanceProfile); + $configConfigEncryption = new AwsConfigEncryption(); + $configEncryptionKmsKeyArn = 'configEncryptionKmsKeyArn-992257206'; + $configConfigEncryption->setKmsKeyArn($configEncryptionKmsKeyArn); + $awsNodePoolConfig->setConfigEncryption($configConfigEncryption); + $awsNodePool->setConfig($awsNodePoolConfig); + $awsNodePoolAutoscaling = new AwsNodePoolAutoscaling(); + $autoscalingMinNodeCount = 1464441581; + $awsNodePoolAutoscaling->setMinNodeCount($autoscalingMinNodeCount); + $autoscalingMaxNodeCount = 1938867647; + $awsNodePoolAutoscaling->setMaxNodeCount($autoscalingMaxNodeCount); + $awsNodePool->setAutoscaling($awsNodePoolAutoscaling); + $awsNodePoolSubnetId = 'awsNodePoolSubnetId-2035401261'; + $awsNodePool->setSubnetId($awsNodePoolSubnetId); + $awsNodePoolMaxPodsConstraint = new MaxPodsConstraint(); + $maxPodsConstraintMaxPodsPerNode = 1072618940; + $awsNodePoolMaxPodsConstraint->setMaxPodsPerNode($maxPodsConstraintMaxPodsPerNode); + $awsNodePool->setMaxPodsConstraint($awsNodePoolMaxPodsConstraint); + $awsNodePoolId = 'awsNodePoolId1958033635'; + $response = $gapicClient->createAwsNodePool($formattedParent, $awsNodePool, $awsNodePoolId); + $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.cloud.gkemulticloud.v1.AwsClusters/CreateAwsNodePool', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getAwsNodePool(); + $this->assertProtobufEquals($awsNodePool, $actualValue); + $actualValue = $actualApiRequestObject->getAwsNodePoolId(); + $this->assertProtobufEquals($awsNodePoolId, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createAwsNodePoolTest'); + $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 createAwsNodePoolExceptionTest() + { + $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/createAwsNodePoolTest'); + $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 + $formattedParent = $gapicClient->awsClusterName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]'); + $awsNodePool = new AwsNodePool(); + $awsNodePoolVersion = 'awsNodePoolVersion-617231107'; + $awsNodePool->setVersion($awsNodePoolVersion); + $awsNodePoolConfig = new AwsNodeConfig(); + $configIamInstanceProfile = 'configIamInstanceProfile805825313'; + $awsNodePoolConfig->setIamInstanceProfile($configIamInstanceProfile); + $configConfigEncryption = new AwsConfigEncryption(); + $configEncryptionKmsKeyArn = 'configEncryptionKmsKeyArn-992257206'; + $configConfigEncryption->setKmsKeyArn($configEncryptionKmsKeyArn); + $awsNodePoolConfig->setConfigEncryption($configConfigEncryption); + $awsNodePool->setConfig($awsNodePoolConfig); + $awsNodePoolAutoscaling = new AwsNodePoolAutoscaling(); + $autoscalingMinNodeCount = 1464441581; + $awsNodePoolAutoscaling->setMinNodeCount($autoscalingMinNodeCount); + $autoscalingMaxNodeCount = 1938867647; + $awsNodePoolAutoscaling->setMaxNodeCount($autoscalingMaxNodeCount); + $awsNodePool->setAutoscaling($awsNodePoolAutoscaling); + $awsNodePoolSubnetId = 'awsNodePoolSubnetId-2035401261'; + $awsNodePool->setSubnetId($awsNodePoolSubnetId); + $awsNodePoolMaxPodsConstraint = new MaxPodsConstraint(); + $maxPodsConstraintMaxPodsPerNode = 1072618940; + $awsNodePoolMaxPodsConstraint->setMaxPodsPerNode($maxPodsConstraintMaxPodsPerNode); + $awsNodePool->setMaxPodsConstraint($awsNodePoolMaxPodsConstraint); + $awsNodePoolId = 'awsNodePoolId1958033635'; + $response = $gapicClient->createAwsNodePool($formattedParent, $awsNodePool, $awsNodePoolId); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createAwsNodePoolTest'); + 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 deleteAwsClusterTest() + { + $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/deleteAwsClusterTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteAwsClusterTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->awsClusterName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]'); + $response = $gapicClient->deleteAwsCluster($formattedName); + $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.cloud.gkemulticloud.v1.AwsClusters/DeleteAwsCluster', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteAwsClusterTest'); + $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 deleteAwsClusterExceptionTest() + { + $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/deleteAwsClusterTest'); + $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->awsClusterName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]'); + $response = $gapicClient->deleteAwsCluster($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteAwsClusterTest'); + 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 deleteAwsNodePoolTest() + { + $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/deleteAwsNodePoolTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteAwsNodePoolTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->awsNodePoolName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]', '[AWS_NODE_POOL]'); + $response = $gapicClient->deleteAwsNodePool($formattedName); + $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.cloud.gkemulticloud.v1.AwsClusters/DeleteAwsNodePool', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteAwsNodePoolTest'); + $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 deleteAwsNodePoolExceptionTest() + { + $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/deleteAwsNodePoolTest'); + $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->awsNodePoolName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]', '[AWS_NODE_POOL]'); + $response = $gapicClient->deleteAwsNodePool($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteAwsNodePoolTest'); + 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 generateAwsAccessTokenTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $accessToken = 'accessToken-1938933922'; + $expectedResponse = new GenerateAwsAccessTokenResponse(); + $expectedResponse->setAccessToken($accessToken); + $transport->addResponse($expectedResponse); + // Mock request + $formattedAwsCluster = $gapicClient->awsClusterName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]'); + $response = $gapicClient->generateAwsAccessToken($formattedAwsCluster); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkemulticloud.v1.AwsClusters/GenerateAwsAccessToken', $actualFuncCall); + $actualValue = $actualRequestObject->getAwsCluster(); + $this->assertProtobufEquals($formattedAwsCluster, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function generateAwsAccessTokenExceptionTest() + { + $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 + $formattedAwsCluster = $gapicClient->awsClusterName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]'); + try { + $gapicClient->generateAwsAccessToken($formattedAwsCluster); + // 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 getAwsClusterTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $description = 'description-1724546052'; + $awsRegion = 'awsRegion-1887255946'; + $endpoint = 'endpoint1741102485'; + $uid = 'uid115792'; + $reconciling = false; + $etag = 'etag3123477'; + $clusterCaCertificate = 'clusterCaCertificate1324742683'; + $expectedResponse = new AwsCluster(); + $expectedResponse->setName($name2); + $expectedResponse->setDescription($description); + $expectedResponse->setAwsRegion($awsRegion); + $expectedResponse->setEndpoint($endpoint); + $expectedResponse->setUid($uid); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setEtag($etag); + $expectedResponse->setClusterCaCertificate($clusterCaCertificate); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->awsClusterName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]'); + $response = $gapicClient->getAwsCluster($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkemulticloud.v1.AwsClusters/GetAwsCluster', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getAwsClusterExceptionTest() + { + $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->awsClusterName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]'); + try { + $gapicClient->getAwsCluster($formattedName); + // 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 getAwsNodePoolTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $version = 'version351608024'; + $subnetId = 'subnetId373593405'; + $uid = 'uid115792'; + $reconciling = false; + $etag = 'etag3123477'; + $expectedResponse = new AwsNodePool(); + $expectedResponse->setName($name2); + $expectedResponse->setVersion($version); + $expectedResponse->setSubnetId($subnetId); + $expectedResponse->setUid($uid); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->awsNodePoolName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]', '[AWS_NODE_POOL]'); + $response = $gapicClient->getAwsNodePool($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkemulticloud.v1.AwsClusters/GetAwsNodePool', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getAwsNodePoolExceptionTest() + { + $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->awsNodePoolName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]', '[AWS_NODE_POOL]'); + try { + $gapicClient->getAwsNodePool($formattedName); + // 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 getAwsServerConfigTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $expectedResponse = new AwsServerConfig(); + $expectedResponse->setName($name2); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->awsServerConfigName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->getAwsServerConfig($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkemulticloud.v1.AwsClusters/GetAwsServerConfig', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getAwsServerConfigExceptionTest() + { + $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->awsServerConfigName('[PROJECT]', '[LOCATION]'); + try { + $gapicClient->getAwsServerConfig($formattedName); + // 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 listAwsClustersTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $awsClustersElement = new AwsCluster(); + $awsClusters = [ + $awsClustersElement, + ]; + $expectedResponse = new ListAwsClustersResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setAwsClusters($awsClusters); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->listAwsClusters($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getAwsClusters()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkemulticloud.v1.AwsClusters/ListAwsClusters', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listAwsClustersExceptionTest() + { + $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->locationName('[PROJECT]', '[LOCATION]'); + try { + $gapicClient->listAwsClusters($formattedParent); + // 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 listAwsNodePoolsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $awsNodePoolsElement = new AwsNodePool(); + $awsNodePools = [ + $awsNodePoolsElement, + ]; + $expectedResponse = new ListAwsNodePoolsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setAwsNodePools($awsNodePools); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->awsClusterName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]'); + $response = $gapicClient->listAwsNodePools($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getAwsNodePools()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkemulticloud.v1.AwsClusters/ListAwsNodePools', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listAwsNodePoolsExceptionTest() + { + $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->awsClusterName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]'); + try { + $gapicClient->listAwsNodePools($formattedParent); + // 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 updateAwsClusterTest() + { + $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/updateAwsClusterTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $awsRegion = 'awsRegion-1887255946'; + $endpoint = 'endpoint1741102485'; + $uid = 'uid115792'; + $reconciling = false; + $etag = 'etag3123477'; + $clusterCaCertificate = 'clusterCaCertificate1324742683'; + $expectedResponse = new AwsCluster(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $expectedResponse->setAwsRegion($awsRegion); + $expectedResponse->setEndpoint($endpoint); + $expectedResponse->setUid($uid); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setEtag($etag); + $expectedResponse->setClusterCaCertificate($clusterCaCertificate); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateAwsClusterTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $awsCluster = new AwsCluster(); + $awsClusterNetworking = new AwsClusterNetworking(); + $networkingVpcId = 'networkingVpcId-1154507440'; + $awsClusterNetworking->setVpcId($networkingVpcId); + $networkingPodAddressCidrBlocks = []; + $awsClusterNetworking->setPodAddressCidrBlocks($networkingPodAddressCidrBlocks); + $networkingServiceAddressCidrBlocks = []; + $awsClusterNetworking->setServiceAddressCidrBlocks($networkingServiceAddressCidrBlocks); + $awsCluster->setNetworking($awsClusterNetworking); + $awsClusterAwsRegion = 'awsClusterAwsRegion574122132'; + $awsCluster->setAwsRegion($awsClusterAwsRegion); + $awsClusterControlPlane = new AwsControlPlane(); + $controlPlaneVersion = 'controlPlaneVersion648040665'; + $awsClusterControlPlane->setVersion($controlPlaneVersion); + $controlPlaneSubnetIds = []; + $awsClusterControlPlane->setSubnetIds($controlPlaneSubnetIds); + $controlPlaneIamInstanceProfile = 'controlPlaneIamInstanceProfile1905273246'; + $awsClusterControlPlane->setIamInstanceProfile($controlPlaneIamInstanceProfile); + $controlPlaneDatabaseEncryption = new AwsDatabaseEncryption(); + $databaseEncryptionKmsKeyArn = 'databaseEncryptionKmsKeyArn1858324593'; + $controlPlaneDatabaseEncryption->setKmsKeyArn($databaseEncryptionKmsKeyArn); + $awsClusterControlPlane->setDatabaseEncryption($controlPlaneDatabaseEncryption); + $controlPlaneAwsServicesAuthentication = new AwsServicesAuthentication(); + $awsServicesAuthenticationRoleArn = 'awsServicesAuthenticationRoleArn1905212596'; + $controlPlaneAwsServicesAuthentication->setRoleArn($awsServicesAuthenticationRoleArn); + $awsClusterControlPlane->setAwsServicesAuthentication($controlPlaneAwsServicesAuthentication); + $controlPlaneConfigEncryption = new AwsConfigEncryption(); + $configEncryptionKmsKeyArn = 'configEncryptionKmsKeyArn-992257206'; + $controlPlaneConfigEncryption->setKmsKeyArn($configEncryptionKmsKeyArn); + $awsClusterControlPlane->setConfigEncryption($controlPlaneConfigEncryption); + $awsCluster->setControlPlane($awsClusterControlPlane); + $awsClusterAuthorization = new AwsAuthorization(); + $authorizationAdminUsers = []; + $awsClusterAuthorization->setAdminUsers($authorizationAdminUsers); + $awsCluster->setAuthorization($awsClusterAuthorization); + $awsClusterFleet = new Fleet(); + $fleetProject = 'fleetProject604893675'; + $awsClusterFleet->setProject($fleetProject); + $awsCluster->setFleet($awsClusterFleet); + $updateMask = new FieldMask(); + $response = $gapicClient->updateAwsCluster($awsCluster, $updateMask); + $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.cloud.gkemulticloud.v1.AwsClusters/UpdateAwsCluster', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getAwsCluster(); + $this->assertProtobufEquals($awsCluster, $actualValue); + $actualValue = $actualApiRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateAwsClusterTest'); + $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 updateAwsClusterExceptionTest() + { + $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/updateAwsClusterTest'); + $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 + $awsCluster = new AwsCluster(); + $awsClusterNetworking = new AwsClusterNetworking(); + $networkingVpcId = 'networkingVpcId-1154507440'; + $awsClusterNetworking->setVpcId($networkingVpcId); + $networkingPodAddressCidrBlocks = []; + $awsClusterNetworking->setPodAddressCidrBlocks($networkingPodAddressCidrBlocks); + $networkingServiceAddressCidrBlocks = []; + $awsClusterNetworking->setServiceAddressCidrBlocks($networkingServiceAddressCidrBlocks); + $awsCluster->setNetworking($awsClusterNetworking); + $awsClusterAwsRegion = 'awsClusterAwsRegion574122132'; + $awsCluster->setAwsRegion($awsClusterAwsRegion); + $awsClusterControlPlane = new AwsControlPlane(); + $controlPlaneVersion = 'controlPlaneVersion648040665'; + $awsClusterControlPlane->setVersion($controlPlaneVersion); + $controlPlaneSubnetIds = []; + $awsClusterControlPlane->setSubnetIds($controlPlaneSubnetIds); + $controlPlaneIamInstanceProfile = 'controlPlaneIamInstanceProfile1905273246'; + $awsClusterControlPlane->setIamInstanceProfile($controlPlaneIamInstanceProfile); + $controlPlaneDatabaseEncryption = new AwsDatabaseEncryption(); + $databaseEncryptionKmsKeyArn = 'databaseEncryptionKmsKeyArn1858324593'; + $controlPlaneDatabaseEncryption->setKmsKeyArn($databaseEncryptionKmsKeyArn); + $awsClusterControlPlane->setDatabaseEncryption($controlPlaneDatabaseEncryption); + $controlPlaneAwsServicesAuthentication = new AwsServicesAuthentication(); + $awsServicesAuthenticationRoleArn = 'awsServicesAuthenticationRoleArn1905212596'; + $controlPlaneAwsServicesAuthentication->setRoleArn($awsServicesAuthenticationRoleArn); + $awsClusterControlPlane->setAwsServicesAuthentication($controlPlaneAwsServicesAuthentication); + $controlPlaneConfigEncryption = new AwsConfigEncryption(); + $configEncryptionKmsKeyArn = 'configEncryptionKmsKeyArn-992257206'; + $controlPlaneConfigEncryption->setKmsKeyArn($configEncryptionKmsKeyArn); + $awsClusterControlPlane->setConfigEncryption($controlPlaneConfigEncryption); + $awsCluster->setControlPlane($awsClusterControlPlane); + $awsClusterAuthorization = new AwsAuthorization(); + $authorizationAdminUsers = []; + $awsClusterAuthorization->setAdminUsers($authorizationAdminUsers); + $awsCluster->setAuthorization($awsClusterAuthorization); + $awsClusterFleet = new Fleet(); + $fleetProject = 'fleetProject604893675'; + $awsClusterFleet->setProject($fleetProject); + $awsCluster->setFleet($awsClusterFleet); + $updateMask = new FieldMask(); + $response = $gapicClient->updateAwsCluster($awsCluster, $updateMask); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateAwsClusterTest'); + 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 updateAwsNodePoolTest() + { + $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/updateAwsNodePoolTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $version = 'version351608024'; + $subnetId = 'subnetId373593405'; + $uid = 'uid115792'; + $reconciling = false; + $etag = 'etag3123477'; + $expectedResponse = new AwsNodePool(); + $expectedResponse->setName($name); + $expectedResponse->setVersion($version); + $expectedResponse->setSubnetId($subnetId); + $expectedResponse->setUid($uid); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setEtag($etag); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateAwsNodePoolTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $awsNodePool = new AwsNodePool(); + $awsNodePoolVersion = 'awsNodePoolVersion-617231107'; + $awsNodePool->setVersion($awsNodePoolVersion); + $awsNodePoolConfig = new AwsNodeConfig(); + $configIamInstanceProfile = 'configIamInstanceProfile805825313'; + $awsNodePoolConfig->setIamInstanceProfile($configIamInstanceProfile); + $configConfigEncryption = new AwsConfigEncryption(); + $configEncryptionKmsKeyArn = 'configEncryptionKmsKeyArn-992257206'; + $configConfigEncryption->setKmsKeyArn($configEncryptionKmsKeyArn); + $awsNodePoolConfig->setConfigEncryption($configConfigEncryption); + $awsNodePool->setConfig($awsNodePoolConfig); + $awsNodePoolAutoscaling = new AwsNodePoolAutoscaling(); + $autoscalingMinNodeCount = 1464441581; + $awsNodePoolAutoscaling->setMinNodeCount($autoscalingMinNodeCount); + $autoscalingMaxNodeCount = 1938867647; + $awsNodePoolAutoscaling->setMaxNodeCount($autoscalingMaxNodeCount); + $awsNodePool->setAutoscaling($awsNodePoolAutoscaling); + $awsNodePoolSubnetId = 'awsNodePoolSubnetId-2035401261'; + $awsNodePool->setSubnetId($awsNodePoolSubnetId); + $awsNodePoolMaxPodsConstraint = new MaxPodsConstraint(); + $maxPodsConstraintMaxPodsPerNode = 1072618940; + $awsNodePoolMaxPodsConstraint->setMaxPodsPerNode($maxPodsConstraintMaxPodsPerNode); + $awsNodePool->setMaxPodsConstraint($awsNodePoolMaxPodsConstraint); + $updateMask = new FieldMask(); + $response = $gapicClient->updateAwsNodePool($awsNodePool, $updateMask); + $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.cloud.gkemulticloud.v1.AwsClusters/UpdateAwsNodePool', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getAwsNodePool(); + $this->assertProtobufEquals($awsNodePool, $actualValue); + $actualValue = $actualApiRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateAwsNodePoolTest'); + $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 updateAwsNodePoolExceptionTest() + { + $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/updateAwsNodePoolTest'); + $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 + $awsNodePool = new AwsNodePool(); + $awsNodePoolVersion = 'awsNodePoolVersion-617231107'; + $awsNodePool->setVersion($awsNodePoolVersion); + $awsNodePoolConfig = new AwsNodeConfig(); + $configIamInstanceProfile = 'configIamInstanceProfile805825313'; + $awsNodePoolConfig->setIamInstanceProfile($configIamInstanceProfile); + $configConfigEncryption = new AwsConfigEncryption(); + $configEncryptionKmsKeyArn = 'configEncryptionKmsKeyArn-992257206'; + $configConfigEncryption->setKmsKeyArn($configEncryptionKmsKeyArn); + $awsNodePoolConfig->setConfigEncryption($configConfigEncryption); + $awsNodePool->setConfig($awsNodePoolConfig); + $awsNodePoolAutoscaling = new AwsNodePoolAutoscaling(); + $autoscalingMinNodeCount = 1464441581; + $awsNodePoolAutoscaling->setMinNodeCount($autoscalingMinNodeCount); + $autoscalingMaxNodeCount = 1938867647; + $awsNodePoolAutoscaling->setMaxNodeCount($autoscalingMaxNodeCount); + $awsNodePool->setAutoscaling($awsNodePoolAutoscaling); + $awsNodePoolSubnetId = 'awsNodePoolSubnetId-2035401261'; + $awsNodePool->setSubnetId($awsNodePoolSubnetId); + $awsNodePoolMaxPodsConstraint = new MaxPodsConstraint(); + $maxPodsConstraintMaxPodsPerNode = 1072618940; + $awsNodePoolMaxPodsConstraint->setMaxPodsPerNode($maxPodsConstraintMaxPodsPerNode); + $awsNodePool->setMaxPodsConstraint($awsNodePoolMaxPodsConstraint); + $updateMask = new FieldMask(); + $response = $gapicClient->updateAwsNodePool($awsNodePool, $updateMask); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateAwsNodePoolTest'); + 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()); + } +} diff --git a/owl-bot-staging/GkeMultiCloud/v1/tests/Unit/V1/AzureClustersClientTest.php b/owl-bot-staging/GkeMultiCloud/v1/tests/Unit/V1/AzureClustersClientTest.php new file mode 100644 index 000000000000..ab3e34b6e358 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/tests/Unit/V1/AzureClustersClientTest.php @@ -0,0 +1,1874 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return AzureClustersClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new AzureClustersClient($options); + } + + /** @test */ + public function createAzureClientTest() + { + $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/createAzureClientTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $tenantId = 'tenantId-1852780336'; + $applicationId = 'applicationId-1287148950'; + $reconciling = false; + $pemCertificate = 'pemCertificate1234463984'; + $uid = 'uid115792'; + $expectedResponse = new AzureClient(); + $expectedResponse->setName($name); + $expectedResponse->setTenantId($tenantId); + $expectedResponse->setApplicationId($applicationId); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setPemCertificate($pemCertificate); + $expectedResponse->setUid($uid); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createAzureClientTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $azureClient = new AzureClient(); + $azureClientTenantId = 'azureClientTenantId-567307073'; + $azureClient->setTenantId($azureClientTenantId); + $azureClientApplicationId = 'azureClientApplicationId264838513'; + $azureClient->setApplicationId($azureClientApplicationId); + $azureClientId = 'azureClientId315645023'; + $response = $gapicClient->createAzureClient($formattedParent, $azureClient, $azureClientId); + $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.cloud.gkemulticloud.v1.AzureClusters/CreateAzureClient', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getAzureClient(); + $this->assertProtobufEquals($azureClient, $actualValue); + $actualValue = $actualApiRequestObject->getAzureClientId(); + $this->assertProtobufEquals($azureClientId, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createAzureClientTest'); + $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 createAzureClientExceptionTest() + { + $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/createAzureClientTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $azureClient = new AzureClient(); + $azureClientTenantId = 'azureClientTenantId-567307073'; + $azureClient->setTenantId($azureClientTenantId); + $azureClientApplicationId = 'azureClientApplicationId264838513'; + $azureClient->setApplicationId($azureClientApplicationId); + $azureClientId = 'azureClientId315645023'; + $response = $gapicClient->createAzureClient($formattedParent, $azureClient, $azureClientId); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createAzureClientTest'); + 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 createAzureClusterTest() + { + $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/createAzureClusterTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $azureRegion = 'azureRegion-253373788'; + $resourceGroupId = 'resourceGroupId-1092054036'; + $azureClient = 'azureClient-676290693'; + $endpoint = 'endpoint1741102485'; + $uid = 'uid115792'; + $reconciling = false; + $etag = 'etag3123477'; + $clusterCaCertificate = 'clusterCaCertificate1324742683'; + $expectedResponse = new AzureCluster(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $expectedResponse->setAzureRegion($azureRegion); + $expectedResponse->setResourceGroupId($resourceGroupId); + $expectedResponse->setAzureClient($azureClient); + $expectedResponse->setEndpoint($endpoint); + $expectedResponse->setUid($uid); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setEtag($etag); + $expectedResponse->setClusterCaCertificate($clusterCaCertificate); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createAzureClusterTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $azureCluster = new AzureCluster(); + $azureClusterAzureRegion = 'azureClusterAzureRegion-1036501768'; + $azureCluster->setAzureRegion($azureClusterAzureRegion); + $azureClusterResourceGroupId = 'azureClusterResourceGroupId-1683734495'; + $azureCluster->setResourceGroupId($azureClusterResourceGroupId); + $azureClusterNetworking = new AzureClusterNetworking(); + $networkingVirtualNetworkId = 'networkingVirtualNetworkId-516550606'; + $azureClusterNetworking->setVirtualNetworkId($networkingVirtualNetworkId); + $networkingPodAddressCidrBlocks = []; + $azureClusterNetworking->setPodAddressCidrBlocks($networkingPodAddressCidrBlocks); + $networkingServiceAddressCidrBlocks = []; + $azureClusterNetworking->setServiceAddressCidrBlocks($networkingServiceAddressCidrBlocks); + $azureCluster->setNetworking($azureClusterNetworking); + $azureClusterControlPlane = new AzureControlPlane(); + $controlPlaneVersion = 'controlPlaneVersion648040665'; + $azureClusterControlPlane->setVersion($controlPlaneVersion); + $controlPlaneSshConfig = new AzureSshConfig(); + $sshConfigAuthorizedKey = 'sshConfigAuthorizedKey1626409850'; + $controlPlaneSshConfig->setAuthorizedKey($sshConfigAuthorizedKey); + $azureClusterControlPlane->setSshConfig($controlPlaneSshConfig); + $azureCluster->setControlPlane($azureClusterControlPlane); + $azureClusterAuthorization = new AzureAuthorization(); + $authorizationAdminUsers = []; + $azureClusterAuthorization->setAdminUsers($authorizationAdminUsers); + $azureCluster->setAuthorization($azureClusterAuthorization); + $azureClusterFleet = new Fleet(); + $fleetProject = 'fleetProject604893675'; + $azureClusterFleet->setProject($fleetProject); + $azureCluster->setFleet($azureClusterFleet); + $azureClusterId = 'azureClusterId332577072'; + $response = $gapicClient->createAzureCluster($formattedParent, $azureCluster, $azureClusterId); + $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.cloud.gkemulticloud.v1.AzureClusters/CreateAzureCluster', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getAzureCluster(); + $this->assertProtobufEquals($azureCluster, $actualValue); + $actualValue = $actualApiRequestObject->getAzureClusterId(); + $this->assertProtobufEquals($azureClusterId, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createAzureClusterTest'); + $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 createAzureClusterExceptionTest() + { + $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/createAzureClusterTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $azureCluster = new AzureCluster(); + $azureClusterAzureRegion = 'azureClusterAzureRegion-1036501768'; + $azureCluster->setAzureRegion($azureClusterAzureRegion); + $azureClusterResourceGroupId = 'azureClusterResourceGroupId-1683734495'; + $azureCluster->setResourceGroupId($azureClusterResourceGroupId); + $azureClusterNetworking = new AzureClusterNetworking(); + $networkingVirtualNetworkId = 'networkingVirtualNetworkId-516550606'; + $azureClusterNetworking->setVirtualNetworkId($networkingVirtualNetworkId); + $networkingPodAddressCidrBlocks = []; + $azureClusterNetworking->setPodAddressCidrBlocks($networkingPodAddressCidrBlocks); + $networkingServiceAddressCidrBlocks = []; + $azureClusterNetworking->setServiceAddressCidrBlocks($networkingServiceAddressCidrBlocks); + $azureCluster->setNetworking($azureClusterNetworking); + $azureClusterControlPlane = new AzureControlPlane(); + $controlPlaneVersion = 'controlPlaneVersion648040665'; + $azureClusterControlPlane->setVersion($controlPlaneVersion); + $controlPlaneSshConfig = new AzureSshConfig(); + $sshConfigAuthorizedKey = 'sshConfigAuthorizedKey1626409850'; + $controlPlaneSshConfig->setAuthorizedKey($sshConfigAuthorizedKey); + $azureClusterControlPlane->setSshConfig($controlPlaneSshConfig); + $azureCluster->setControlPlane($azureClusterControlPlane); + $azureClusterAuthorization = new AzureAuthorization(); + $authorizationAdminUsers = []; + $azureClusterAuthorization->setAdminUsers($authorizationAdminUsers); + $azureCluster->setAuthorization($azureClusterAuthorization); + $azureClusterFleet = new Fleet(); + $fleetProject = 'fleetProject604893675'; + $azureClusterFleet->setProject($fleetProject); + $azureCluster->setFleet($azureClusterFleet); + $azureClusterId = 'azureClusterId332577072'; + $response = $gapicClient->createAzureCluster($formattedParent, $azureCluster, $azureClusterId); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createAzureClusterTest'); + 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 createAzureNodePoolTest() + { + $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/createAzureNodePoolTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $version = 'version351608024'; + $subnetId = 'subnetId373593405'; + $uid = 'uid115792'; + $reconciling = false; + $etag = 'etag3123477'; + $azureAvailabilityZone = 'azureAvailabilityZone541920864'; + $expectedResponse = new AzureNodePool(); + $expectedResponse->setName($name); + $expectedResponse->setVersion($version); + $expectedResponse->setSubnetId($subnetId); + $expectedResponse->setUid($uid); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setEtag($etag); + $expectedResponse->setAzureAvailabilityZone($azureAvailabilityZone); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createAzureNodePoolTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->azureClusterName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]'); + $azureNodePool = new AzureNodePool(); + $azureNodePoolVersion = 'azureNodePoolVersion349490987'; + $azureNodePool->setVersion($azureNodePoolVersion); + $azureNodePoolConfig = new AzureNodeConfig(); + $configSshConfig = new AzureSshConfig(); + $sshConfigAuthorizedKey = 'sshConfigAuthorizedKey1626409850'; + $configSshConfig->setAuthorizedKey($sshConfigAuthorizedKey); + $azureNodePoolConfig->setSshConfig($configSshConfig); + $azureNodePool->setConfig($azureNodePoolConfig); + $azureNodePoolSubnetId = 'azureNodePoolSubnetId-2131787419'; + $azureNodePool->setSubnetId($azureNodePoolSubnetId); + $azureNodePoolAutoscaling = new AzureNodePoolAutoscaling(); + $autoscalingMinNodeCount = 1464441581; + $azureNodePoolAutoscaling->setMinNodeCount($autoscalingMinNodeCount); + $autoscalingMaxNodeCount = 1938867647; + $azureNodePoolAutoscaling->setMaxNodeCount($autoscalingMaxNodeCount); + $azureNodePool->setAutoscaling($azureNodePoolAutoscaling); + $azureNodePoolMaxPodsConstraint = new MaxPodsConstraint(); + $maxPodsConstraintMaxPodsPerNode = 1072618940; + $azureNodePoolMaxPodsConstraint->setMaxPodsPerNode($maxPodsConstraintMaxPodsPerNode); + $azureNodePool->setMaxPodsConstraint($azureNodePoolMaxPodsConstraint); + $azureNodePoolId = 'azureNodePoolId-454365551'; + $response = $gapicClient->createAzureNodePool($formattedParent, $azureNodePool, $azureNodePoolId); + $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.cloud.gkemulticloud.v1.AzureClusters/CreateAzureNodePool', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getAzureNodePool(); + $this->assertProtobufEquals($azureNodePool, $actualValue); + $actualValue = $actualApiRequestObject->getAzureNodePoolId(); + $this->assertProtobufEquals($azureNodePoolId, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createAzureNodePoolTest'); + $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 createAzureNodePoolExceptionTest() + { + $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/createAzureNodePoolTest'); + $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 + $formattedParent = $gapicClient->azureClusterName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]'); + $azureNodePool = new AzureNodePool(); + $azureNodePoolVersion = 'azureNodePoolVersion349490987'; + $azureNodePool->setVersion($azureNodePoolVersion); + $azureNodePoolConfig = new AzureNodeConfig(); + $configSshConfig = new AzureSshConfig(); + $sshConfigAuthorizedKey = 'sshConfigAuthorizedKey1626409850'; + $configSshConfig->setAuthorizedKey($sshConfigAuthorizedKey); + $azureNodePoolConfig->setSshConfig($configSshConfig); + $azureNodePool->setConfig($azureNodePoolConfig); + $azureNodePoolSubnetId = 'azureNodePoolSubnetId-2131787419'; + $azureNodePool->setSubnetId($azureNodePoolSubnetId); + $azureNodePoolAutoscaling = new AzureNodePoolAutoscaling(); + $autoscalingMinNodeCount = 1464441581; + $azureNodePoolAutoscaling->setMinNodeCount($autoscalingMinNodeCount); + $autoscalingMaxNodeCount = 1938867647; + $azureNodePoolAutoscaling->setMaxNodeCount($autoscalingMaxNodeCount); + $azureNodePool->setAutoscaling($azureNodePoolAutoscaling); + $azureNodePoolMaxPodsConstraint = new MaxPodsConstraint(); + $maxPodsConstraintMaxPodsPerNode = 1072618940; + $azureNodePoolMaxPodsConstraint->setMaxPodsPerNode($maxPodsConstraintMaxPodsPerNode); + $azureNodePool->setMaxPodsConstraint($azureNodePoolMaxPodsConstraint); + $azureNodePoolId = 'azureNodePoolId-454365551'; + $response = $gapicClient->createAzureNodePool($formattedParent, $azureNodePool, $azureNodePoolId); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createAzureNodePoolTest'); + 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 deleteAzureClientTest() + { + $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/deleteAzureClientTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteAzureClientTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->azureClientName('[PROJECT]', '[LOCATION]', '[AZURE_CLIENT]'); + $response = $gapicClient->deleteAzureClient($formattedName); + $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.cloud.gkemulticloud.v1.AzureClusters/DeleteAzureClient', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteAzureClientTest'); + $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 deleteAzureClientExceptionTest() + { + $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/deleteAzureClientTest'); + $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->azureClientName('[PROJECT]', '[LOCATION]', '[AZURE_CLIENT]'); + $response = $gapicClient->deleteAzureClient($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteAzureClientTest'); + 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 deleteAzureClusterTest() + { + $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/deleteAzureClusterTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteAzureClusterTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->azureClusterName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]'); + $response = $gapicClient->deleteAzureCluster($formattedName); + $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.cloud.gkemulticloud.v1.AzureClusters/DeleteAzureCluster', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteAzureClusterTest'); + $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 deleteAzureClusterExceptionTest() + { + $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/deleteAzureClusterTest'); + $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->azureClusterName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]'); + $response = $gapicClient->deleteAzureCluster($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteAzureClusterTest'); + 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 deleteAzureNodePoolTest() + { + $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/deleteAzureNodePoolTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteAzureNodePoolTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->azureNodePoolName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]', '[AZURE_NODE_POOL]'); + $response = $gapicClient->deleteAzureNodePool($formattedName); + $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.cloud.gkemulticloud.v1.AzureClusters/DeleteAzureNodePool', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteAzureNodePoolTest'); + $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 deleteAzureNodePoolExceptionTest() + { + $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/deleteAzureNodePoolTest'); + $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->azureNodePoolName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]', '[AZURE_NODE_POOL]'); + $response = $gapicClient->deleteAzureNodePool($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteAzureNodePoolTest'); + 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 generateAzureAccessTokenTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $accessToken = 'accessToken-1938933922'; + $expectedResponse = new GenerateAzureAccessTokenResponse(); + $expectedResponse->setAccessToken($accessToken); + $transport->addResponse($expectedResponse); + // Mock request + $formattedAzureCluster = $gapicClient->azureClusterName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]'); + $response = $gapicClient->generateAzureAccessToken($formattedAzureCluster); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkemulticloud.v1.AzureClusters/GenerateAzureAccessToken', $actualFuncCall); + $actualValue = $actualRequestObject->getAzureCluster(); + $this->assertProtobufEquals($formattedAzureCluster, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function generateAzureAccessTokenExceptionTest() + { + $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 + $formattedAzureCluster = $gapicClient->azureClusterName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]'); + try { + $gapicClient->generateAzureAccessToken($formattedAzureCluster); + // 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 getAzureClientTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $tenantId = 'tenantId-1852780336'; + $applicationId = 'applicationId-1287148950'; + $reconciling = false; + $pemCertificate = 'pemCertificate1234463984'; + $uid = 'uid115792'; + $expectedResponse = new AzureClient(); + $expectedResponse->setName($name2); + $expectedResponse->setTenantId($tenantId); + $expectedResponse->setApplicationId($applicationId); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setPemCertificate($pemCertificate); + $expectedResponse->setUid($uid); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->azureClientName('[PROJECT]', '[LOCATION]', '[AZURE_CLIENT]'); + $response = $gapicClient->getAzureClient($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkemulticloud.v1.AzureClusters/GetAzureClient', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getAzureClientExceptionTest() + { + $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->azureClientName('[PROJECT]', '[LOCATION]', '[AZURE_CLIENT]'); + try { + $gapicClient->getAzureClient($formattedName); + // 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 getAzureClusterTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $description = 'description-1724546052'; + $azureRegion = 'azureRegion-253373788'; + $resourceGroupId = 'resourceGroupId-1092054036'; + $azureClient = 'azureClient-676290693'; + $endpoint = 'endpoint1741102485'; + $uid = 'uid115792'; + $reconciling = false; + $etag = 'etag3123477'; + $clusterCaCertificate = 'clusterCaCertificate1324742683'; + $expectedResponse = new AzureCluster(); + $expectedResponse->setName($name2); + $expectedResponse->setDescription($description); + $expectedResponse->setAzureRegion($azureRegion); + $expectedResponse->setResourceGroupId($resourceGroupId); + $expectedResponse->setAzureClient($azureClient); + $expectedResponse->setEndpoint($endpoint); + $expectedResponse->setUid($uid); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setEtag($etag); + $expectedResponse->setClusterCaCertificate($clusterCaCertificate); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->azureClusterName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]'); + $response = $gapicClient->getAzureCluster($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkemulticloud.v1.AzureClusters/GetAzureCluster', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getAzureClusterExceptionTest() + { + $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->azureClusterName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]'); + try { + $gapicClient->getAzureCluster($formattedName); + // 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 getAzureNodePoolTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $version = 'version351608024'; + $subnetId = 'subnetId373593405'; + $uid = 'uid115792'; + $reconciling = false; + $etag = 'etag3123477'; + $azureAvailabilityZone = 'azureAvailabilityZone541920864'; + $expectedResponse = new AzureNodePool(); + $expectedResponse->setName($name2); + $expectedResponse->setVersion($version); + $expectedResponse->setSubnetId($subnetId); + $expectedResponse->setUid($uid); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setEtag($etag); + $expectedResponse->setAzureAvailabilityZone($azureAvailabilityZone); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->azureNodePoolName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]', '[AZURE_NODE_POOL]'); + $response = $gapicClient->getAzureNodePool($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkemulticloud.v1.AzureClusters/GetAzureNodePool', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getAzureNodePoolExceptionTest() + { + $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->azureNodePoolName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]', '[AZURE_NODE_POOL]'); + try { + $gapicClient->getAzureNodePool($formattedName); + // 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 getAzureServerConfigTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $expectedResponse = new AzureServerConfig(); + $expectedResponse->setName($name2); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->azureServerConfigName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->getAzureServerConfig($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkemulticloud.v1.AzureClusters/GetAzureServerConfig', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getAzureServerConfigExceptionTest() + { + $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->azureServerConfigName('[PROJECT]', '[LOCATION]'); + try { + $gapicClient->getAzureServerConfig($formattedName); + // 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 listAzureClientsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $azureClientsElement = new AzureClient(); + $azureClients = [ + $azureClientsElement, + ]; + $expectedResponse = new ListAzureClientsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setAzureClients($azureClients); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->listAzureClients($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getAzureClients()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkemulticloud.v1.AzureClusters/ListAzureClients', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listAzureClientsExceptionTest() + { + $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->locationName('[PROJECT]', '[LOCATION]'); + try { + $gapicClient->listAzureClients($formattedParent); + // 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 listAzureClustersTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $azureClustersElement = new AzureCluster(); + $azureClusters = [ + $azureClustersElement, + ]; + $expectedResponse = new ListAzureClustersResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setAzureClusters($azureClusters); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->listAzureClusters($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getAzureClusters()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkemulticloud.v1.AzureClusters/ListAzureClusters', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listAzureClustersExceptionTest() + { + $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->locationName('[PROJECT]', '[LOCATION]'); + try { + $gapicClient->listAzureClusters($formattedParent); + // 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 listAzureNodePoolsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $azureNodePoolsElement = new AzureNodePool(); + $azureNodePools = [ + $azureNodePoolsElement, + ]; + $expectedResponse = new ListAzureNodePoolsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setAzureNodePools($azureNodePools); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->azureClusterName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]'); + $response = $gapicClient->listAzureNodePools($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getAzureNodePools()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkemulticloud.v1.AzureClusters/ListAzureNodePools', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listAzureNodePoolsExceptionTest() + { + $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->azureClusterName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]'); + try { + $gapicClient->listAzureNodePools($formattedParent); + // 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 updateAzureClusterTest() + { + $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/updateAzureClusterTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $azureRegion = 'azureRegion-253373788'; + $resourceGroupId = 'resourceGroupId-1092054036'; + $azureClient = 'azureClient-676290693'; + $endpoint = 'endpoint1741102485'; + $uid = 'uid115792'; + $reconciling = false; + $etag = 'etag3123477'; + $clusterCaCertificate = 'clusterCaCertificate1324742683'; + $expectedResponse = new AzureCluster(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $expectedResponse->setAzureRegion($azureRegion); + $expectedResponse->setResourceGroupId($resourceGroupId); + $expectedResponse->setAzureClient($azureClient); + $expectedResponse->setEndpoint($endpoint); + $expectedResponse->setUid($uid); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setEtag($etag); + $expectedResponse->setClusterCaCertificate($clusterCaCertificate); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateAzureClusterTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $azureCluster = new AzureCluster(); + $azureClusterAzureRegion = 'azureClusterAzureRegion-1036501768'; + $azureCluster->setAzureRegion($azureClusterAzureRegion); + $azureClusterResourceGroupId = 'azureClusterResourceGroupId-1683734495'; + $azureCluster->setResourceGroupId($azureClusterResourceGroupId); + $azureClusterNetworking = new AzureClusterNetworking(); + $networkingVirtualNetworkId = 'networkingVirtualNetworkId-516550606'; + $azureClusterNetworking->setVirtualNetworkId($networkingVirtualNetworkId); + $networkingPodAddressCidrBlocks = []; + $azureClusterNetworking->setPodAddressCidrBlocks($networkingPodAddressCidrBlocks); + $networkingServiceAddressCidrBlocks = []; + $azureClusterNetworking->setServiceAddressCidrBlocks($networkingServiceAddressCidrBlocks); + $azureCluster->setNetworking($azureClusterNetworking); + $azureClusterControlPlane = new AzureControlPlane(); + $controlPlaneVersion = 'controlPlaneVersion648040665'; + $azureClusterControlPlane->setVersion($controlPlaneVersion); + $controlPlaneSshConfig = new AzureSshConfig(); + $sshConfigAuthorizedKey = 'sshConfigAuthorizedKey1626409850'; + $controlPlaneSshConfig->setAuthorizedKey($sshConfigAuthorizedKey); + $azureClusterControlPlane->setSshConfig($controlPlaneSshConfig); + $azureCluster->setControlPlane($azureClusterControlPlane); + $azureClusterAuthorization = new AzureAuthorization(); + $authorizationAdminUsers = []; + $azureClusterAuthorization->setAdminUsers($authorizationAdminUsers); + $azureCluster->setAuthorization($azureClusterAuthorization); + $azureClusterFleet = new Fleet(); + $fleetProject = 'fleetProject604893675'; + $azureClusterFleet->setProject($fleetProject); + $azureCluster->setFleet($azureClusterFleet); + $updateMask = new FieldMask(); + $response = $gapicClient->updateAzureCluster($azureCluster, $updateMask); + $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.cloud.gkemulticloud.v1.AzureClusters/UpdateAzureCluster', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getAzureCluster(); + $this->assertProtobufEquals($azureCluster, $actualValue); + $actualValue = $actualApiRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateAzureClusterTest'); + $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 updateAzureClusterExceptionTest() + { + $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/updateAzureClusterTest'); + $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 + $azureCluster = new AzureCluster(); + $azureClusterAzureRegion = 'azureClusterAzureRegion-1036501768'; + $azureCluster->setAzureRegion($azureClusterAzureRegion); + $azureClusterResourceGroupId = 'azureClusterResourceGroupId-1683734495'; + $azureCluster->setResourceGroupId($azureClusterResourceGroupId); + $azureClusterNetworking = new AzureClusterNetworking(); + $networkingVirtualNetworkId = 'networkingVirtualNetworkId-516550606'; + $azureClusterNetworking->setVirtualNetworkId($networkingVirtualNetworkId); + $networkingPodAddressCidrBlocks = []; + $azureClusterNetworking->setPodAddressCidrBlocks($networkingPodAddressCidrBlocks); + $networkingServiceAddressCidrBlocks = []; + $azureClusterNetworking->setServiceAddressCidrBlocks($networkingServiceAddressCidrBlocks); + $azureCluster->setNetworking($azureClusterNetworking); + $azureClusterControlPlane = new AzureControlPlane(); + $controlPlaneVersion = 'controlPlaneVersion648040665'; + $azureClusterControlPlane->setVersion($controlPlaneVersion); + $controlPlaneSshConfig = new AzureSshConfig(); + $sshConfigAuthorizedKey = 'sshConfigAuthorizedKey1626409850'; + $controlPlaneSshConfig->setAuthorizedKey($sshConfigAuthorizedKey); + $azureClusterControlPlane->setSshConfig($controlPlaneSshConfig); + $azureCluster->setControlPlane($azureClusterControlPlane); + $azureClusterAuthorization = new AzureAuthorization(); + $authorizationAdminUsers = []; + $azureClusterAuthorization->setAdminUsers($authorizationAdminUsers); + $azureCluster->setAuthorization($azureClusterAuthorization); + $azureClusterFleet = new Fleet(); + $fleetProject = 'fleetProject604893675'; + $azureClusterFleet->setProject($fleetProject); + $azureCluster->setFleet($azureClusterFleet); + $updateMask = new FieldMask(); + $response = $gapicClient->updateAzureCluster($azureCluster, $updateMask); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateAzureClusterTest'); + 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 updateAzureNodePoolTest() + { + $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/updateAzureNodePoolTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $version = 'version351608024'; + $subnetId = 'subnetId373593405'; + $uid = 'uid115792'; + $reconciling = false; + $etag = 'etag3123477'; + $azureAvailabilityZone = 'azureAvailabilityZone541920864'; + $expectedResponse = new AzureNodePool(); + $expectedResponse->setName($name); + $expectedResponse->setVersion($version); + $expectedResponse->setSubnetId($subnetId); + $expectedResponse->setUid($uid); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setEtag($etag); + $expectedResponse->setAzureAvailabilityZone($azureAvailabilityZone); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateAzureNodePoolTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $azureNodePool = new AzureNodePool(); + $azureNodePoolVersion = 'azureNodePoolVersion349490987'; + $azureNodePool->setVersion($azureNodePoolVersion); + $azureNodePoolConfig = new AzureNodeConfig(); + $configSshConfig = new AzureSshConfig(); + $sshConfigAuthorizedKey = 'sshConfigAuthorizedKey1626409850'; + $configSshConfig->setAuthorizedKey($sshConfigAuthorizedKey); + $azureNodePoolConfig->setSshConfig($configSshConfig); + $azureNodePool->setConfig($azureNodePoolConfig); + $azureNodePoolSubnetId = 'azureNodePoolSubnetId-2131787419'; + $azureNodePool->setSubnetId($azureNodePoolSubnetId); + $azureNodePoolAutoscaling = new AzureNodePoolAutoscaling(); + $autoscalingMinNodeCount = 1464441581; + $azureNodePoolAutoscaling->setMinNodeCount($autoscalingMinNodeCount); + $autoscalingMaxNodeCount = 1938867647; + $azureNodePoolAutoscaling->setMaxNodeCount($autoscalingMaxNodeCount); + $azureNodePool->setAutoscaling($azureNodePoolAutoscaling); + $azureNodePoolMaxPodsConstraint = new MaxPodsConstraint(); + $maxPodsConstraintMaxPodsPerNode = 1072618940; + $azureNodePoolMaxPodsConstraint->setMaxPodsPerNode($maxPodsConstraintMaxPodsPerNode); + $azureNodePool->setMaxPodsConstraint($azureNodePoolMaxPodsConstraint); + $updateMask = new FieldMask(); + $response = $gapicClient->updateAzureNodePool($azureNodePool, $updateMask); + $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.cloud.gkemulticloud.v1.AzureClusters/UpdateAzureNodePool', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getAzureNodePool(); + $this->assertProtobufEquals($azureNodePool, $actualValue); + $actualValue = $actualApiRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateAzureNodePoolTest'); + $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 updateAzureNodePoolExceptionTest() + { + $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/updateAzureNodePoolTest'); + $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 + $azureNodePool = new AzureNodePool(); + $azureNodePoolVersion = 'azureNodePoolVersion349490987'; + $azureNodePool->setVersion($azureNodePoolVersion); + $azureNodePoolConfig = new AzureNodeConfig(); + $configSshConfig = new AzureSshConfig(); + $sshConfigAuthorizedKey = 'sshConfigAuthorizedKey1626409850'; + $configSshConfig->setAuthorizedKey($sshConfigAuthorizedKey); + $azureNodePoolConfig->setSshConfig($configSshConfig); + $azureNodePool->setConfig($azureNodePoolConfig); + $azureNodePoolSubnetId = 'azureNodePoolSubnetId-2131787419'; + $azureNodePool->setSubnetId($azureNodePoolSubnetId); + $azureNodePoolAutoscaling = new AzureNodePoolAutoscaling(); + $autoscalingMinNodeCount = 1464441581; + $azureNodePoolAutoscaling->setMinNodeCount($autoscalingMinNodeCount); + $autoscalingMaxNodeCount = 1938867647; + $azureNodePoolAutoscaling->setMaxNodeCount($autoscalingMaxNodeCount); + $azureNodePool->setAutoscaling($azureNodePoolAutoscaling); + $azureNodePoolMaxPodsConstraint = new MaxPodsConstraint(); + $maxPodsConstraintMaxPodsPerNode = 1072618940; + $azureNodePoolMaxPodsConstraint->setMaxPodsPerNode($maxPodsConstraintMaxPodsPerNode); + $azureNodePool->setMaxPodsConstraint($azureNodePoolMaxPodsConstraint); + $updateMask = new FieldMask(); + $response = $gapicClient->updateAzureNodePool($azureNodePool, $updateMask); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateAzureNodePoolTest'); + 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()); + } +} diff --git a/owl-bot-staging/GkeMultiCloud/v1/tests/Unit/V1/Client/AttachedClustersClientTest.php b/owl-bot-staging/GkeMultiCloud/v1/tests/Unit/V1/Client/AttachedClustersClientTest.php new file mode 100644 index 000000000000..fd2d633592c2 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/tests/Unit/V1/Client/AttachedClustersClientTest.php @@ -0,0 +1,1086 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return AttachedClustersClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new AttachedClustersClient($options); + } + + /** @test */ + public function createAttachedClusterTest() + { + $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/createAttachedClusterTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $platformVersion = 'platformVersion1813514508'; + $distribution = 'distribution-1580708220'; + $clusterRegion = 'clusterRegion993903833'; + $uid = 'uid115792'; + $reconciling = false; + $etag = 'etag3123477'; + $kubernetesVersion = 'kubernetesVersion50850015'; + $expectedResponse = new AttachedCluster(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $expectedResponse->setPlatformVersion($platformVersion); + $expectedResponse->setDistribution($distribution); + $expectedResponse->setClusterRegion($clusterRegion); + $expectedResponse->setUid($uid); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setEtag($etag); + $expectedResponse->setKubernetesVersion($kubernetesVersion); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createAttachedClusterTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $attachedCluster = new AttachedCluster(); + $attachedClusterOidcConfig = new AttachedOidcConfig(); + $attachedCluster->setOidcConfig($attachedClusterOidcConfig); + $attachedClusterPlatformVersion = 'attachedClusterPlatformVersion-208126385'; + $attachedCluster->setPlatformVersion($attachedClusterPlatformVersion); + $attachedClusterDistribution = 'attachedClusterDistribution1692601690'; + $attachedCluster->setDistribution($attachedClusterDistribution); + $attachedClusterFleet = new Fleet(); + $fleetProject = 'fleetProject604893675'; + $attachedClusterFleet->setProject($fleetProject); + $attachedCluster->setFleet($attachedClusterFleet); + $attachedClusterId = 'attachedClusterId-249426181'; + $request = (new CreateAttachedClusterRequest()) + ->setParent($formattedParent) + ->setAttachedCluster($attachedCluster) + ->setAttachedClusterId($attachedClusterId); + $response = $gapicClient->createAttachedCluster($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.cloud.gkemulticloud.v1.AttachedClusters/CreateAttachedCluster', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getAttachedCluster(); + $this->assertProtobufEquals($attachedCluster, $actualValue); + $actualValue = $actualApiRequestObject->getAttachedClusterId(); + $this->assertProtobufEquals($attachedClusterId, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createAttachedClusterTest'); + $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 createAttachedClusterExceptionTest() + { + $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/createAttachedClusterTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $attachedCluster = new AttachedCluster(); + $attachedClusterOidcConfig = new AttachedOidcConfig(); + $attachedCluster->setOidcConfig($attachedClusterOidcConfig); + $attachedClusterPlatformVersion = 'attachedClusterPlatformVersion-208126385'; + $attachedCluster->setPlatformVersion($attachedClusterPlatformVersion); + $attachedClusterDistribution = 'attachedClusterDistribution1692601690'; + $attachedCluster->setDistribution($attachedClusterDistribution); + $attachedClusterFleet = new Fleet(); + $fleetProject = 'fleetProject604893675'; + $attachedClusterFleet->setProject($fleetProject); + $attachedCluster->setFleet($attachedClusterFleet); + $attachedClusterId = 'attachedClusterId-249426181'; + $request = (new CreateAttachedClusterRequest()) + ->setParent($formattedParent) + ->setAttachedCluster($attachedCluster) + ->setAttachedClusterId($attachedClusterId); + $response = $gapicClient->createAttachedCluster($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createAttachedClusterTest'); + 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 deleteAttachedClusterTest() + { + $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/deleteAttachedClusterTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteAttachedClusterTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->attachedClusterName('[PROJECT]', '[LOCATION]', '[ATTACHED_CLUSTER]'); + $request = (new DeleteAttachedClusterRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteAttachedCluster($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.cloud.gkemulticloud.v1.AttachedClusters/DeleteAttachedCluster', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteAttachedClusterTest'); + $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 deleteAttachedClusterExceptionTest() + { + $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/deleteAttachedClusterTest'); + $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->attachedClusterName('[PROJECT]', '[LOCATION]', '[ATTACHED_CLUSTER]'); + $request = (new DeleteAttachedClusterRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteAttachedCluster($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteAttachedClusterTest'); + 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 generateAttachedClusterInstallManifestTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $manifest = 'manifest130625071'; + $expectedResponse = new GenerateAttachedClusterInstallManifestResponse(); + $expectedResponse->setManifest($manifest); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $attachedClusterId = 'attachedClusterId-249426181'; + $platformVersion = 'platformVersion1813514508'; + $request = (new GenerateAttachedClusterInstallManifestRequest()) + ->setParent($formattedParent) + ->setAttachedClusterId($attachedClusterId) + ->setPlatformVersion($platformVersion); + $response = $gapicClient->generateAttachedClusterInstallManifest($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkemulticloud.v1.AttachedClusters/GenerateAttachedClusterInstallManifest', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getAttachedClusterId(); + $this->assertProtobufEquals($attachedClusterId, $actualValue); + $actualValue = $actualRequestObject->getPlatformVersion(); + $this->assertProtobufEquals($platformVersion, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function generateAttachedClusterInstallManifestExceptionTest() + { + $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->locationName('[PROJECT]', '[LOCATION]'); + $attachedClusterId = 'attachedClusterId-249426181'; + $platformVersion = 'platformVersion1813514508'; + $request = (new GenerateAttachedClusterInstallManifestRequest()) + ->setParent($formattedParent) + ->setAttachedClusterId($attachedClusterId) + ->setPlatformVersion($platformVersion); + try { + $gapicClient->generateAttachedClusterInstallManifest($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 getAttachedClusterTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $description = 'description-1724546052'; + $platformVersion = 'platformVersion1813514508'; + $distribution = 'distribution-1580708220'; + $clusterRegion = 'clusterRegion993903833'; + $uid = 'uid115792'; + $reconciling = false; + $etag = 'etag3123477'; + $kubernetesVersion = 'kubernetesVersion50850015'; + $expectedResponse = new AttachedCluster(); + $expectedResponse->setName($name2); + $expectedResponse->setDescription($description); + $expectedResponse->setPlatformVersion($platformVersion); + $expectedResponse->setDistribution($distribution); + $expectedResponse->setClusterRegion($clusterRegion); + $expectedResponse->setUid($uid); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setEtag($etag); + $expectedResponse->setKubernetesVersion($kubernetesVersion); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->attachedClusterName('[PROJECT]', '[LOCATION]', '[ATTACHED_CLUSTER]'); + $request = (new GetAttachedClusterRequest()) + ->setName($formattedName); + $response = $gapicClient->getAttachedCluster($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkemulticloud.v1.AttachedClusters/GetAttachedCluster', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getAttachedClusterExceptionTest() + { + $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->attachedClusterName('[PROJECT]', '[LOCATION]', '[ATTACHED_CLUSTER]'); + $request = (new GetAttachedClusterRequest()) + ->setName($formattedName); + try { + $gapicClient->getAttachedCluster($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 getAttachedServerConfigTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $expectedResponse = new AttachedServerConfig(); + $expectedResponse->setName($name2); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->attachedServerConfigName('[PROJECT]', '[LOCATION]'); + $request = (new GetAttachedServerConfigRequest()) + ->setName($formattedName); + $response = $gapicClient->getAttachedServerConfig($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkemulticloud.v1.AttachedClusters/GetAttachedServerConfig', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getAttachedServerConfigExceptionTest() + { + $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->attachedServerConfigName('[PROJECT]', '[LOCATION]'); + $request = (new GetAttachedServerConfigRequest()) + ->setName($formattedName); + try { + $gapicClient->getAttachedServerConfig($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 importAttachedClusterTest() + { + $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/importAttachedClusterTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $platformVersion2 = 'platformVersion2-969276993'; + $distribution2 = 'distribution21357826359'; + $clusterRegion = 'clusterRegion993903833'; + $uid = 'uid115792'; + $reconciling = false; + $etag = 'etag3123477'; + $kubernetesVersion = 'kubernetesVersion50850015'; + $expectedResponse = new AttachedCluster(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $expectedResponse->setPlatformVersion($platformVersion2); + $expectedResponse->setDistribution($distribution2); + $expectedResponse->setClusterRegion($clusterRegion); + $expectedResponse->setUid($uid); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setEtag($etag); + $expectedResponse->setKubernetesVersion($kubernetesVersion); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/importAttachedClusterTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $fleetMembership = 'fleetMembership1817977703'; + $platformVersion = 'platformVersion1813514508'; + $distribution = 'distribution-1580708220'; + $request = (new ImportAttachedClusterRequest()) + ->setParent($formattedParent) + ->setFleetMembership($fleetMembership) + ->setPlatformVersion($platformVersion) + ->setDistribution($distribution); + $response = $gapicClient->importAttachedCluster($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.cloud.gkemulticloud.v1.AttachedClusters/ImportAttachedCluster', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getFleetMembership(); + $this->assertProtobufEquals($fleetMembership, $actualValue); + $actualValue = $actualApiRequestObject->getPlatformVersion(); + $this->assertProtobufEquals($platformVersion, $actualValue); + $actualValue = $actualApiRequestObject->getDistribution(); + $this->assertProtobufEquals($distribution, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/importAttachedClusterTest'); + $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 importAttachedClusterExceptionTest() + { + $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/importAttachedClusterTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $fleetMembership = 'fleetMembership1817977703'; + $platformVersion = 'platformVersion1813514508'; + $distribution = 'distribution-1580708220'; + $request = (new ImportAttachedClusterRequest()) + ->setParent($formattedParent) + ->setFleetMembership($fleetMembership) + ->setPlatformVersion($platformVersion) + ->setDistribution($distribution); + $response = $gapicClient->importAttachedCluster($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/importAttachedClusterTest'); + 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 listAttachedClustersTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $attachedClustersElement = new AttachedCluster(); + $attachedClusters = [ + $attachedClustersElement, + ]; + $expectedResponse = new ListAttachedClustersResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setAttachedClusters($attachedClusters); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListAttachedClustersRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listAttachedClusters($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getAttachedClusters()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkemulticloud.v1.AttachedClusters/ListAttachedClusters', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listAttachedClustersExceptionTest() + { + $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->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListAttachedClustersRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listAttachedClusters($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 updateAttachedClusterTest() + { + $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/updateAttachedClusterTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $platformVersion = 'platformVersion1813514508'; + $distribution = 'distribution-1580708220'; + $clusterRegion = 'clusterRegion993903833'; + $uid = 'uid115792'; + $reconciling = false; + $etag = 'etag3123477'; + $kubernetesVersion = 'kubernetesVersion50850015'; + $expectedResponse = new AttachedCluster(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $expectedResponse->setPlatformVersion($platformVersion); + $expectedResponse->setDistribution($distribution); + $expectedResponse->setClusterRegion($clusterRegion); + $expectedResponse->setUid($uid); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setEtag($etag); + $expectedResponse->setKubernetesVersion($kubernetesVersion); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateAttachedClusterTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $attachedCluster = new AttachedCluster(); + $attachedClusterOidcConfig = new AttachedOidcConfig(); + $attachedCluster->setOidcConfig($attachedClusterOidcConfig); + $attachedClusterPlatformVersion = 'attachedClusterPlatformVersion-208126385'; + $attachedCluster->setPlatformVersion($attachedClusterPlatformVersion); + $attachedClusterDistribution = 'attachedClusterDistribution1692601690'; + $attachedCluster->setDistribution($attachedClusterDistribution); + $attachedClusterFleet = new Fleet(); + $fleetProject = 'fleetProject604893675'; + $attachedClusterFleet->setProject($fleetProject); + $attachedCluster->setFleet($attachedClusterFleet); + $updateMask = new FieldMask(); + $request = (new UpdateAttachedClusterRequest()) + ->setAttachedCluster($attachedCluster) + ->setUpdateMask($updateMask); + $response = $gapicClient->updateAttachedCluster($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.cloud.gkemulticloud.v1.AttachedClusters/UpdateAttachedCluster', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getAttachedCluster(); + $this->assertProtobufEquals($attachedCluster, $actualValue); + $actualValue = $actualApiRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateAttachedClusterTest'); + $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 updateAttachedClusterExceptionTest() + { + $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/updateAttachedClusterTest'); + $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 + $attachedCluster = new AttachedCluster(); + $attachedClusterOidcConfig = new AttachedOidcConfig(); + $attachedCluster->setOidcConfig($attachedClusterOidcConfig); + $attachedClusterPlatformVersion = 'attachedClusterPlatformVersion-208126385'; + $attachedCluster->setPlatformVersion($attachedClusterPlatformVersion); + $attachedClusterDistribution = 'attachedClusterDistribution1692601690'; + $attachedCluster->setDistribution($attachedClusterDistribution); + $attachedClusterFleet = new Fleet(); + $fleetProject = 'fleetProject604893675'; + $attachedClusterFleet->setProject($fleetProject); + $attachedCluster->setFleet($attachedClusterFleet); + $updateMask = new FieldMask(); + $request = (new UpdateAttachedClusterRequest()) + ->setAttachedCluster($attachedCluster) + ->setUpdateMask($updateMask); + $response = $gapicClient->updateAttachedCluster($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateAttachedClusterTest'); + 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 createAttachedClusterAsyncTest() + { + $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/createAttachedClusterTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $platformVersion = 'platformVersion1813514508'; + $distribution = 'distribution-1580708220'; + $clusterRegion = 'clusterRegion993903833'; + $uid = 'uid115792'; + $reconciling = false; + $etag = 'etag3123477'; + $kubernetesVersion = 'kubernetesVersion50850015'; + $expectedResponse = new AttachedCluster(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $expectedResponse->setPlatformVersion($platformVersion); + $expectedResponse->setDistribution($distribution); + $expectedResponse->setClusterRegion($clusterRegion); + $expectedResponse->setUid($uid); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setEtag($etag); + $expectedResponse->setKubernetesVersion($kubernetesVersion); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createAttachedClusterTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $attachedCluster = new AttachedCluster(); + $attachedClusterOidcConfig = new AttachedOidcConfig(); + $attachedCluster->setOidcConfig($attachedClusterOidcConfig); + $attachedClusterPlatformVersion = 'attachedClusterPlatformVersion-208126385'; + $attachedCluster->setPlatformVersion($attachedClusterPlatformVersion); + $attachedClusterDistribution = 'attachedClusterDistribution1692601690'; + $attachedCluster->setDistribution($attachedClusterDistribution); + $attachedClusterFleet = new Fleet(); + $fleetProject = 'fleetProject604893675'; + $attachedClusterFleet->setProject($fleetProject); + $attachedCluster->setFleet($attachedClusterFleet); + $attachedClusterId = 'attachedClusterId-249426181'; + $request = (new CreateAttachedClusterRequest()) + ->setParent($formattedParent) + ->setAttachedCluster($attachedCluster) + ->setAttachedClusterId($attachedClusterId); + $response = $gapicClient->createAttachedClusterAsync($request)->wait(); + $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.cloud.gkemulticloud.v1.AttachedClusters/CreateAttachedCluster', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getAttachedCluster(); + $this->assertProtobufEquals($attachedCluster, $actualValue); + $actualValue = $actualApiRequestObject->getAttachedClusterId(); + $this->assertProtobufEquals($attachedClusterId, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createAttachedClusterTest'); + $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()); + } +} diff --git a/owl-bot-staging/GkeMultiCloud/v1/tests/Unit/V1/Client/AwsClustersClientTest.php b/owl-bot-staging/GkeMultiCloud/v1/tests/Unit/V1/Client/AwsClustersClientTest.php new file mode 100644 index 000000000000..1a0aed506d8f --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/tests/Unit/V1/Client/AwsClustersClientTest.php @@ -0,0 +1,1702 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return AwsClustersClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new AwsClustersClient($options); + } + + /** @test */ + public function createAwsClusterTest() + { + $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/createAwsClusterTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $awsRegion = 'awsRegion-1887255946'; + $endpoint = 'endpoint1741102485'; + $uid = 'uid115792'; + $reconciling = false; + $etag = 'etag3123477'; + $clusterCaCertificate = 'clusterCaCertificate1324742683'; + $expectedResponse = new AwsCluster(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $expectedResponse->setAwsRegion($awsRegion); + $expectedResponse->setEndpoint($endpoint); + $expectedResponse->setUid($uid); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setEtag($etag); + $expectedResponse->setClusterCaCertificate($clusterCaCertificate); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createAwsClusterTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $awsCluster = new AwsCluster(); + $awsClusterNetworking = new AwsClusterNetworking(); + $networkingVpcId = 'networkingVpcId-1154507440'; + $awsClusterNetworking->setVpcId($networkingVpcId); + $networkingPodAddressCidrBlocks = []; + $awsClusterNetworking->setPodAddressCidrBlocks($networkingPodAddressCidrBlocks); + $networkingServiceAddressCidrBlocks = []; + $awsClusterNetworking->setServiceAddressCidrBlocks($networkingServiceAddressCidrBlocks); + $awsCluster->setNetworking($awsClusterNetworking); + $awsClusterAwsRegion = 'awsClusterAwsRegion574122132'; + $awsCluster->setAwsRegion($awsClusterAwsRegion); + $awsClusterControlPlane = new AwsControlPlane(); + $controlPlaneVersion = 'controlPlaneVersion648040665'; + $awsClusterControlPlane->setVersion($controlPlaneVersion); + $controlPlaneSubnetIds = []; + $awsClusterControlPlane->setSubnetIds($controlPlaneSubnetIds); + $controlPlaneIamInstanceProfile = 'controlPlaneIamInstanceProfile1905273246'; + $awsClusterControlPlane->setIamInstanceProfile($controlPlaneIamInstanceProfile); + $controlPlaneDatabaseEncryption = new AwsDatabaseEncryption(); + $databaseEncryptionKmsKeyArn = 'databaseEncryptionKmsKeyArn1858324593'; + $controlPlaneDatabaseEncryption->setKmsKeyArn($databaseEncryptionKmsKeyArn); + $awsClusterControlPlane->setDatabaseEncryption($controlPlaneDatabaseEncryption); + $controlPlaneAwsServicesAuthentication = new AwsServicesAuthentication(); + $awsServicesAuthenticationRoleArn = 'awsServicesAuthenticationRoleArn1905212596'; + $controlPlaneAwsServicesAuthentication->setRoleArn($awsServicesAuthenticationRoleArn); + $awsClusterControlPlane->setAwsServicesAuthentication($controlPlaneAwsServicesAuthentication); + $controlPlaneConfigEncryption = new AwsConfigEncryption(); + $configEncryptionKmsKeyArn = 'configEncryptionKmsKeyArn-992257206'; + $controlPlaneConfigEncryption->setKmsKeyArn($configEncryptionKmsKeyArn); + $awsClusterControlPlane->setConfigEncryption($controlPlaneConfigEncryption); + $awsCluster->setControlPlane($awsClusterControlPlane); + $awsClusterAuthorization = new AwsAuthorization(); + $authorizationAdminUsers = []; + $awsClusterAuthorization->setAdminUsers($authorizationAdminUsers); + $awsCluster->setAuthorization($awsClusterAuthorization); + $awsClusterFleet = new Fleet(); + $fleetProject = 'fleetProject604893675'; + $awsClusterFleet->setProject($fleetProject); + $awsCluster->setFleet($awsClusterFleet); + $awsClusterId = 'awsClusterId938438658'; + $request = (new CreateAwsClusterRequest()) + ->setParent($formattedParent) + ->setAwsCluster($awsCluster) + ->setAwsClusterId($awsClusterId); + $response = $gapicClient->createAwsCluster($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.cloud.gkemulticloud.v1.AwsClusters/CreateAwsCluster', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getAwsCluster(); + $this->assertProtobufEquals($awsCluster, $actualValue); + $actualValue = $actualApiRequestObject->getAwsClusterId(); + $this->assertProtobufEquals($awsClusterId, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createAwsClusterTest'); + $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 createAwsClusterExceptionTest() + { + $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/createAwsClusterTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $awsCluster = new AwsCluster(); + $awsClusterNetworking = new AwsClusterNetworking(); + $networkingVpcId = 'networkingVpcId-1154507440'; + $awsClusterNetworking->setVpcId($networkingVpcId); + $networkingPodAddressCidrBlocks = []; + $awsClusterNetworking->setPodAddressCidrBlocks($networkingPodAddressCidrBlocks); + $networkingServiceAddressCidrBlocks = []; + $awsClusterNetworking->setServiceAddressCidrBlocks($networkingServiceAddressCidrBlocks); + $awsCluster->setNetworking($awsClusterNetworking); + $awsClusterAwsRegion = 'awsClusterAwsRegion574122132'; + $awsCluster->setAwsRegion($awsClusterAwsRegion); + $awsClusterControlPlane = new AwsControlPlane(); + $controlPlaneVersion = 'controlPlaneVersion648040665'; + $awsClusterControlPlane->setVersion($controlPlaneVersion); + $controlPlaneSubnetIds = []; + $awsClusterControlPlane->setSubnetIds($controlPlaneSubnetIds); + $controlPlaneIamInstanceProfile = 'controlPlaneIamInstanceProfile1905273246'; + $awsClusterControlPlane->setIamInstanceProfile($controlPlaneIamInstanceProfile); + $controlPlaneDatabaseEncryption = new AwsDatabaseEncryption(); + $databaseEncryptionKmsKeyArn = 'databaseEncryptionKmsKeyArn1858324593'; + $controlPlaneDatabaseEncryption->setKmsKeyArn($databaseEncryptionKmsKeyArn); + $awsClusterControlPlane->setDatabaseEncryption($controlPlaneDatabaseEncryption); + $controlPlaneAwsServicesAuthentication = new AwsServicesAuthentication(); + $awsServicesAuthenticationRoleArn = 'awsServicesAuthenticationRoleArn1905212596'; + $controlPlaneAwsServicesAuthentication->setRoleArn($awsServicesAuthenticationRoleArn); + $awsClusterControlPlane->setAwsServicesAuthentication($controlPlaneAwsServicesAuthentication); + $controlPlaneConfigEncryption = new AwsConfigEncryption(); + $configEncryptionKmsKeyArn = 'configEncryptionKmsKeyArn-992257206'; + $controlPlaneConfigEncryption->setKmsKeyArn($configEncryptionKmsKeyArn); + $awsClusterControlPlane->setConfigEncryption($controlPlaneConfigEncryption); + $awsCluster->setControlPlane($awsClusterControlPlane); + $awsClusterAuthorization = new AwsAuthorization(); + $authorizationAdminUsers = []; + $awsClusterAuthorization->setAdminUsers($authorizationAdminUsers); + $awsCluster->setAuthorization($awsClusterAuthorization); + $awsClusterFleet = new Fleet(); + $fleetProject = 'fleetProject604893675'; + $awsClusterFleet->setProject($fleetProject); + $awsCluster->setFleet($awsClusterFleet); + $awsClusterId = 'awsClusterId938438658'; + $request = (new CreateAwsClusterRequest()) + ->setParent($formattedParent) + ->setAwsCluster($awsCluster) + ->setAwsClusterId($awsClusterId); + $response = $gapicClient->createAwsCluster($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createAwsClusterTest'); + 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 createAwsNodePoolTest() + { + $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/createAwsNodePoolTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $version = 'version351608024'; + $subnetId = 'subnetId373593405'; + $uid = 'uid115792'; + $reconciling = false; + $etag = 'etag3123477'; + $expectedResponse = new AwsNodePool(); + $expectedResponse->setName($name); + $expectedResponse->setVersion($version); + $expectedResponse->setSubnetId($subnetId); + $expectedResponse->setUid($uid); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setEtag($etag); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createAwsNodePoolTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->awsClusterName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]'); + $awsNodePool = new AwsNodePool(); + $awsNodePoolVersion = 'awsNodePoolVersion-617231107'; + $awsNodePool->setVersion($awsNodePoolVersion); + $awsNodePoolConfig = new AwsNodeConfig(); + $configIamInstanceProfile = 'configIamInstanceProfile805825313'; + $awsNodePoolConfig->setIamInstanceProfile($configIamInstanceProfile); + $configConfigEncryption = new AwsConfigEncryption(); + $configEncryptionKmsKeyArn = 'configEncryptionKmsKeyArn-992257206'; + $configConfigEncryption->setKmsKeyArn($configEncryptionKmsKeyArn); + $awsNodePoolConfig->setConfigEncryption($configConfigEncryption); + $awsNodePool->setConfig($awsNodePoolConfig); + $awsNodePoolAutoscaling = new AwsNodePoolAutoscaling(); + $autoscalingMinNodeCount = 1464441581; + $awsNodePoolAutoscaling->setMinNodeCount($autoscalingMinNodeCount); + $autoscalingMaxNodeCount = 1938867647; + $awsNodePoolAutoscaling->setMaxNodeCount($autoscalingMaxNodeCount); + $awsNodePool->setAutoscaling($awsNodePoolAutoscaling); + $awsNodePoolSubnetId = 'awsNodePoolSubnetId-2035401261'; + $awsNodePool->setSubnetId($awsNodePoolSubnetId); + $awsNodePoolMaxPodsConstraint = new MaxPodsConstraint(); + $maxPodsConstraintMaxPodsPerNode = 1072618940; + $awsNodePoolMaxPodsConstraint->setMaxPodsPerNode($maxPodsConstraintMaxPodsPerNode); + $awsNodePool->setMaxPodsConstraint($awsNodePoolMaxPodsConstraint); + $awsNodePoolId = 'awsNodePoolId1958033635'; + $request = (new CreateAwsNodePoolRequest()) + ->setParent($formattedParent) + ->setAwsNodePool($awsNodePool) + ->setAwsNodePoolId($awsNodePoolId); + $response = $gapicClient->createAwsNodePool($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.cloud.gkemulticloud.v1.AwsClusters/CreateAwsNodePool', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getAwsNodePool(); + $this->assertProtobufEquals($awsNodePool, $actualValue); + $actualValue = $actualApiRequestObject->getAwsNodePoolId(); + $this->assertProtobufEquals($awsNodePoolId, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createAwsNodePoolTest'); + $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 createAwsNodePoolExceptionTest() + { + $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/createAwsNodePoolTest'); + $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 + $formattedParent = $gapicClient->awsClusterName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]'); + $awsNodePool = new AwsNodePool(); + $awsNodePoolVersion = 'awsNodePoolVersion-617231107'; + $awsNodePool->setVersion($awsNodePoolVersion); + $awsNodePoolConfig = new AwsNodeConfig(); + $configIamInstanceProfile = 'configIamInstanceProfile805825313'; + $awsNodePoolConfig->setIamInstanceProfile($configIamInstanceProfile); + $configConfigEncryption = new AwsConfigEncryption(); + $configEncryptionKmsKeyArn = 'configEncryptionKmsKeyArn-992257206'; + $configConfigEncryption->setKmsKeyArn($configEncryptionKmsKeyArn); + $awsNodePoolConfig->setConfigEncryption($configConfigEncryption); + $awsNodePool->setConfig($awsNodePoolConfig); + $awsNodePoolAutoscaling = new AwsNodePoolAutoscaling(); + $autoscalingMinNodeCount = 1464441581; + $awsNodePoolAutoscaling->setMinNodeCount($autoscalingMinNodeCount); + $autoscalingMaxNodeCount = 1938867647; + $awsNodePoolAutoscaling->setMaxNodeCount($autoscalingMaxNodeCount); + $awsNodePool->setAutoscaling($awsNodePoolAutoscaling); + $awsNodePoolSubnetId = 'awsNodePoolSubnetId-2035401261'; + $awsNodePool->setSubnetId($awsNodePoolSubnetId); + $awsNodePoolMaxPodsConstraint = new MaxPodsConstraint(); + $maxPodsConstraintMaxPodsPerNode = 1072618940; + $awsNodePoolMaxPodsConstraint->setMaxPodsPerNode($maxPodsConstraintMaxPodsPerNode); + $awsNodePool->setMaxPodsConstraint($awsNodePoolMaxPodsConstraint); + $awsNodePoolId = 'awsNodePoolId1958033635'; + $request = (new CreateAwsNodePoolRequest()) + ->setParent($formattedParent) + ->setAwsNodePool($awsNodePool) + ->setAwsNodePoolId($awsNodePoolId); + $response = $gapicClient->createAwsNodePool($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createAwsNodePoolTest'); + 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 deleteAwsClusterTest() + { + $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/deleteAwsClusterTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteAwsClusterTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->awsClusterName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]'); + $request = (new DeleteAwsClusterRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteAwsCluster($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.cloud.gkemulticloud.v1.AwsClusters/DeleteAwsCluster', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteAwsClusterTest'); + $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 deleteAwsClusterExceptionTest() + { + $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/deleteAwsClusterTest'); + $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->awsClusterName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]'); + $request = (new DeleteAwsClusterRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteAwsCluster($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteAwsClusterTest'); + 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 deleteAwsNodePoolTest() + { + $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/deleteAwsNodePoolTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteAwsNodePoolTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->awsNodePoolName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]', '[AWS_NODE_POOL]'); + $request = (new DeleteAwsNodePoolRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteAwsNodePool($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.cloud.gkemulticloud.v1.AwsClusters/DeleteAwsNodePool', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteAwsNodePoolTest'); + $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 deleteAwsNodePoolExceptionTest() + { + $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/deleteAwsNodePoolTest'); + $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->awsNodePoolName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]', '[AWS_NODE_POOL]'); + $request = (new DeleteAwsNodePoolRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteAwsNodePool($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteAwsNodePoolTest'); + 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 generateAwsAccessTokenTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $accessToken = 'accessToken-1938933922'; + $expectedResponse = new GenerateAwsAccessTokenResponse(); + $expectedResponse->setAccessToken($accessToken); + $transport->addResponse($expectedResponse); + // Mock request + $formattedAwsCluster = $gapicClient->awsClusterName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]'); + $request = (new GenerateAwsAccessTokenRequest()) + ->setAwsCluster($formattedAwsCluster); + $response = $gapicClient->generateAwsAccessToken($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkemulticloud.v1.AwsClusters/GenerateAwsAccessToken', $actualFuncCall); + $actualValue = $actualRequestObject->getAwsCluster(); + $this->assertProtobufEquals($formattedAwsCluster, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function generateAwsAccessTokenExceptionTest() + { + $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 + $formattedAwsCluster = $gapicClient->awsClusterName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]'); + $request = (new GenerateAwsAccessTokenRequest()) + ->setAwsCluster($formattedAwsCluster); + try { + $gapicClient->generateAwsAccessToken($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 getAwsClusterTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $description = 'description-1724546052'; + $awsRegion = 'awsRegion-1887255946'; + $endpoint = 'endpoint1741102485'; + $uid = 'uid115792'; + $reconciling = false; + $etag = 'etag3123477'; + $clusterCaCertificate = 'clusterCaCertificate1324742683'; + $expectedResponse = new AwsCluster(); + $expectedResponse->setName($name2); + $expectedResponse->setDescription($description); + $expectedResponse->setAwsRegion($awsRegion); + $expectedResponse->setEndpoint($endpoint); + $expectedResponse->setUid($uid); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setEtag($etag); + $expectedResponse->setClusterCaCertificate($clusterCaCertificate); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->awsClusterName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]'); + $request = (new GetAwsClusterRequest()) + ->setName($formattedName); + $response = $gapicClient->getAwsCluster($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkemulticloud.v1.AwsClusters/GetAwsCluster', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getAwsClusterExceptionTest() + { + $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->awsClusterName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]'); + $request = (new GetAwsClusterRequest()) + ->setName($formattedName); + try { + $gapicClient->getAwsCluster($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 getAwsNodePoolTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $version = 'version351608024'; + $subnetId = 'subnetId373593405'; + $uid = 'uid115792'; + $reconciling = false; + $etag = 'etag3123477'; + $expectedResponse = new AwsNodePool(); + $expectedResponse->setName($name2); + $expectedResponse->setVersion($version); + $expectedResponse->setSubnetId($subnetId); + $expectedResponse->setUid($uid); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->awsNodePoolName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]', '[AWS_NODE_POOL]'); + $request = (new GetAwsNodePoolRequest()) + ->setName($formattedName); + $response = $gapicClient->getAwsNodePool($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkemulticloud.v1.AwsClusters/GetAwsNodePool', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getAwsNodePoolExceptionTest() + { + $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->awsNodePoolName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]', '[AWS_NODE_POOL]'); + $request = (new GetAwsNodePoolRequest()) + ->setName($formattedName); + try { + $gapicClient->getAwsNodePool($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 getAwsServerConfigTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $expectedResponse = new AwsServerConfig(); + $expectedResponse->setName($name2); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->awsServerConfigName('[PROJECT]', '[LOCATION]'); + $request = (new GetAwsServerConfigRequest()) + ->setName($formattedName); + $response = $gapicClient->getAwsServerConfig($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkemulticloud.v1.AwsClusters/GetAwsServerConfig', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getAwsServerConfigExceptionTest() + { + $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->awsServerConfigName('[PROJECT]', '[LOCATION]'); + $request = (new GetAwsServerConfigRequest()) + ->setName($formattedName); + try { + $gapicClient->getAwsServerConfig($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 listAwsClustersTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $awsClustersElement = new AwsCluster(); + $awsClusters = [ + $awsClustersElement, + ]; + $expectedResponse = new ListAwsClustersResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setAwsClusters($awsClusters); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListAwsClustersRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listAwsClusters($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getAwsClusters()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkemulticloud.v1.AwsClusters/ListAwsClusters', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listAwsClustersExceptionTest() + { + $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->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListAwsClustersRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listAwsClusters($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 listAwsNodePoolsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $awsNodePoolsElement = new AwsNodePool(); + $awsNodePools = [ + $awsNodePoolsElement, + ]; + $expectedResponse = new ListAwsNodePoolsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setAwsNodePools($awsNodePools); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->awsClusterName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]'); + $request = (new ListAwsNodePoolsRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listAwsNodePools($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getAwsNodePools()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkemulticloud.v1.AwsClusters/ListAwsNodePools', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listAwsNodePoolsExceptionTest() + { + $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->awsClusterName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]'); + $request = (new ListAwsNodePoolsRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listAwsNodePools($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 updateAwsClusterTest() + { + $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/updateAwsClusterTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $awsRegion = 'awsRegion-1887255946'; + $endpoint = 'endpoint1741102485'; + $uid = 'uid115792'; + $reconciling = false; + $etag = 'etag3123477'; + $clusterCaCertificate = 'clusterCaCertificate1324742683'; + $expectedResponse = new AwsCluster(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $expectedResponse->setAwsRegion($awsRegion); + $expectedResponse->setEndpoint($endpoint); + $expectedResponse->setUid($uid); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setEtag($etag); + $expectedResponse->setClusterCaCertificate($clusterCaCertificate); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateAwsClusterTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $awsCluster = new AwsCluster(); + $awsClusterNetworking = new AwsClusterNetworking(); + $networkingVpcId = 'networkingVpcId-1154507440'; + $awsClusterNetworking->setVpcId($networkingVpcId); + $networkingPodAddressCidrBlocks = []; + $awsClusterNetworking->setPodAddressCidrBlocks($networkingPodAddressCidrBlocks); + $networkingServiceAddressCidrBlocks = []; + $awsClusterNetworking->setServiceAddressCidrBlocks($networkingServiceAddressCidrBlocks); + $awsCluster->setNetworking($awsClusterNetworking); + $awsClusterAwsRegion = 'awsClusterAwsRegion574122132'; + $awsCluster->setAwsRegion($awsClusterAwsRegion); + $awsClusterControlPlane = new AwsControlPlane(); + $controlPlaneVersion = 'controlPlaneVersion648040665'; + $awsClusterControlPlane->setVersion($controlPlaneVersion); + $controlPlaneSubnetIds = []; + $awsClusterControlPlane->setSubnetIds($controlPlaneSubnetIds); + $controlPlaneIamInstanceProfile = 'controlPlaneIamInstanceProfile1905273246'; + $awsClusterControlPlane->setIamInstanceProfile($controlPlaneIamInstanceProfile); + $controlPlaneDatabaseEncryption = new AwsDatabaseEncryption(); + $databaseEncryptionKmsKeyArn = 'databaseEncryptionKmsKeyArn1858324593'; + $controlPlaneDatabaseEncryption->setKmsKeyArn($databaseEncryptionKmsKeyArn); + $awsClusterControlPlane->setDatabaseEncryption($controlPlaneDatabaseEncryption); + $controlPlaneAwsServicesAuthentication = new AwsServicesAuthentication(); + $awsServicesAuthenticationRoleArn = 'awsServicesAuthenticationRoleArn1905212596'; + $controlPlaneAwsServicesAuthentication->setRoleArn($awsServicesAuthenticationRoleArn); + $awsClusterControlPlane->setAwsServicesAuthentication($controlPlaneAwsServicesAuthentication); + $controlPlaneConfigEncryption = new AwsConfigEncryption(); + $configEncryptionKmsKeyArn = 'configEncryptionKmsKeyArn-992257206'; + $controlPlaneConfigEncryption->setKmsKeyArn($configEncryptionKmsKeyArn); + $awsClusterControlPlane->setConfigEncryption($controlPlaneConfigEncryption); + $awsCluster->setControlPlane($awsClusterControlPlane); + $awsClusterAuthorization = new AwsAuthorization(); + $authorizationAdminUsers = []; + $awsClusterAuthorization->setAdminUsers($authorizationAdminUsers); + $awsCluster->setAuthorization($awsClusterAuthorization); + $awsClusterFleet = new Fleet(); + $fleetProject = 'fleetProject604893675'; + $awsClusterFleet->setProject($fleetProject); + $awsCluster->setFleet($awsClusterFleet); + $updateMask = new FieldMask(); + $request = (new UpdateAwsClusterRequest()) + ->setAwsCluster($awsCluster) + ->setUpdateMask($updateMask); + $response = $gapicClient->updateAwsCluster($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.cloud.gkemulticloud.v1.AwsClusters/UpdateAwsCluster', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getAwsCluster(); + $this->assertProtobufEquals($awsCluster, $actualValue); + $actualValue = $actualApiRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateAwsClusterTest'); + $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 updateAwsClusterExceptionTest() + { + $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/updateAwsClusterTest'); + $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 + $awsCluster = new AwsCluster(); + $awsClusterNetworking = new AwsClusterNetworking(); + $networkingVpcId = 'networkingVpcId-1154507440'; + $awsClusterNetworking->setVpcId($networkingVpcId); + $networkingPodAddressCidrBlocks = []; + $awsClusterNetworking->setPodAddressCidrBlocks($networkingPodAddressCidrBlocks); + $networkingServiceAddressCidrBlocks = []; + $awsClusterNetworking->setServiceAddressCidrBlocks($networkingServiceAddressCidrBlocks); + $awsCluster->setNetworking($awsClusterNetworking); + $awsClusterAwsRegion = 'awsClusterAwsRegion574122132'; + $awsCluster->setAwsRegion($awsClusterAwsRegion); + $awsClusterControlPlane = new AwsControlPlane(); + $controlPlaneVersion = 'controlPlaneVersion648040665'; + $awsClusterControlPlane->setVersion($controlPlaneVersion); + $controlPlaneSubnetIds = []; + $awsClusterControlPlane->setSubnetIds($controlPlaneSubnetIds); + $controlPlaneIamInstanceProfile = 'controlPlaneIamInstanceProfile1905273246'; + $awsClusterControlPlane->setIamInstanceProfile($controlPlaneIamInstanceProfile); + $controlPlaneDatabaseEncryption = new AwsDatabaseEncryption(); + $databaseEncryptionKmsKeyArn = 'databaseEncryptionKmsKeyArn1858324593'; + $controlPlaneDatabaseEncryption->setKmsKeyArn($databaseEncryptionKmsKeyArn); + $awsClusterControlPlane->setDatabaseEncryption($controlPlaneDatabaseEncryption); + $controlPlaneAwsServicesAuthentication = new AwsServicesAuthentication(); + $awsServicesAuthenticationRoleArn = 'awsServicesAuthenticationRoleArn1905212596'; + $controlPlaneAwsServicesAuthentication->setRoleArn($awsServicesAuthenticationRoleArn); + $awsClusterControlPlane->setAwsServicesAuthentication($controlPlaneAwsServicesAuthentication); + $controlPlaneConfigEncryption = new AwsConfigEncryption(); + $configEncryptionKmsKeyArn = 'configEncryptionKmsKeyArn-992257206'; + $controlPlaneConfigEncryption->setKmsKeyArn($configEncryptionKmsKeyArn); + $awsClusterControlPlane->setConfigEncryption($controlPlaneConfigEncryption); + $awsCluster->setControlPlane($awsClusterControlPlane); + $awsClusterAuthorization = new AwsAuthorization(); + $authorizationAdminUsers = []; + $awsClusterAuthorization->setAdminUsers($authorizationAdminUsers); + $awsCluster->setAuthorization($awsClusterAuthorization); + $awsClusterFleet = new Fleet(); + $fleetProject = 'fleetProject604893675'; + $awsClusterFleet->setProject($fleetProject); + $awsCluster->setFleet($awsClusterFleet); + $updateMask = new FieldMask(); + $request = (new UpdateAwsClusterRequest()) + ->setAwsCluster($awsCluster) + ->setUpdateMask($updateMask); + $response = $gapicClient->updateAwsCluster($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateAwsClusterTest'); + 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 updateAwsNodePoolTest() + { + $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/updateAwsNodePoolTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $version = 'version351608024'; + $subnetId = 'subnetId373593405'; + $uid = 'uid115792'; + $reconciling = false; + $etag = 'etag3123477'; + $expectedResponse = new AwsNodePool(); + $expectedResponse->setName($name); + $expectedResponse->setVersion($version); + $expectedResponse->setSubnetId($subnetId); + $expectedResponse->setUid($uid); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setEtag($etag); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateAwsNodePoolTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $awsNodePool = new AwsNodePool(); + $awsNodePoolVersion = 'awsNodePoolVersion-617231107'; + $awsNodePool->setVersion($awsNodePoolVersion); + $awsNodePoolConfig = new AwsNodeConfig(); + $configIamInstanceProfile = 'configIamInstanceProfile805825313'; + $awsNodePoolConfig->setIamInstanceProfile($configIamInstanceProfile); + $configConfigEncryption = new AwsConfigEncryption(); + $configEncryptionKmsKeyArn = 'configEncryptionKmsKeyArn-992257206'; + $configConfigEncryption->setKmsKeyArn($configEncryptionKmsKeyArn); + $awsNodePoolConfig->setConfigEncryption($configConfigEncryption); + $awsNodePool->setConfig($awsNodePoolConfig); + $awsNodePoolAutoscaling = new AwsNodePoolAutoscaling(); + $autoscalingMinNodeCount = 1464441581; + $awsNodePoolAutoscaling->setMinNodeCount($autoscalingMinNodeCount); + $autoscalingMaxNodeCount = 1938867647; + $awsNodePoolAutoscaling->setMaxNodeCount($autoscalingMaxNodeCount); + $awsNodePool->setAutoscaling($awsNodePoolAutoscaling); + $awsNodePoolSubnetId = 'awsNodePoolSubnetId-2035401261'; + $awsNodePool->setSubnetId($awsNodePoolSubnetId); + $awsNodePoolMaxPodsConstraint = new MaxPodsConstraint(); + $maxPodsConstraintMaxPodsPerNode = 1072618940; + $awsNodePoolMaxPodsConstraint->setMaxPodsPerNode($maxPodsConstraintMaxPodsPerNode); + $awsNodePool->setMaxPodsConstraint($awsNodePoolMaxPodsConstraint); + $updateMask = new FieldMask(); + $request = (new UpdateAwsNodePoolRequest()) + ->setAwsNodePool($awsNodePool) + ->setUpdateMask($updateMask); + $response = $gapicClient->updateAwsNodePool($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.cloud.gkemulticloud.v1.AwsClusters/UpdateAwsNodePool', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getAwsNodePool(); + $this->assertProtobufEquals($awsNodePool, $actualValue); + $actualValue = $actualApiRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateAwsNodePoolTest'); + $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 updateAwsNodePoolExceptionTest() + { + $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/updateAwsNodePoolTest'); + $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 + $awsNodePool = new AwsNodePool(); + $awsNodePoolVersion = 'awsNodePoolVersion-617231107'; + $awsNodePool->setVersion($awsNodePoolVersion); + $awsNodePoolConfig = new AwsNodeConfig(); + $configIamInstanceProfile = 'configIamInstanceProfile805825313'; + $awsNodePoolConfig->setIamInstanceProfile($configIamInstanceProfile); + $configConfigEncryption = new AwsConfigEncryption(); + $configEncryptionKmsKeyArn = 'configEncryptionKmsKeyArn-992257206'; + $configConfigEncryption->setKmsKeyArn($configEncryptionKmsKeyArn); + $awsNodePoolConfig->setConfigEncryption($configConfigEncryption); + $awsNodePool->setConfig($awsNodePoolConfig); + $awsNodePoolAutoscaling = new AwsNodePoolAutoscaling(); + $autoscalingMinNodeCount = 1464441581; + $awsNodePoolAutoscaling->setMinNodeCount($autoscalingMinNodeCount); + $autoscalingMaxNodeCount = 1938867647; + $awsNodePoolAutoscaling->setMaxNodeCount($autoscalingMaxNodeCount); + $awsNodePool->setAutoscaling($awsNodePoolAutoscaling); + $awsNodePoolSubnetId = 'awsNodePoolSubnetId-2035401261'; + $awsNodePool->setSubnetId($awsNodePoolSubnetId); + $awsNodePoolMaxPodsConstraint = new MaxPodsConstraint(); + $maxPodsConstraintMaxPodsPerNode = 1072618940; + $awsNodePoolMaxPodsConstraint->setMaxPodsPerNode($maxPodsConstraintMaxPodsPerNode); + $awsNodePool->setMaxPodsConstraint($awsNodePoolMaxPodsConstraint); + $updateMask = new FieldMask(); + $request = (new UpdateAwsNodePoolRequest()) + ->setAwsNodePool($awsNodePool) + ->setUpdateMask($updateMask); + $response = $gapicClient->updateAwsNodePool($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateAwsNodePoolTest'); + 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 createAwsClusterAsyncTest() + { + $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/createAwsClusterTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $awsRegion = 'awsRegion-1887255946'; + $endpoint = 'endpoint1741102485'; + $uid = 'uid115792'; + $reconciling = false; + $etag = 'etag3123477'; + $clusterCaCertificate = 'clusterCaCertificate1324742683'; + $expectedResponse = new AwsCluster(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $expectedResponse->setAwsRegion($awsRegion); + $expectedResponse->setEndpoint($endpoint); + $expectedResponse->setUid($uid); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setEtag($etag); + $expectedResponse->setClusterCaCertificate($clusterCaCertificate); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createAwsClusterTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $awsCluster = new AwsCluster(); + $awsClusterNetworking = new AwsClusterNetworking(); + $networkingVpcId = 'networkingVpcId-1154507440'; + $awsClusterNetworking->setVpcId($networkingVpcId); + $networkingPodAddressCidrBlocks = []; + $awsClusterNetworking->setPodAddressCidrBlocks($networkingPodAddressCidrBlocks); + $networkingServiceAddressCidrBlocks = []; + $awsClusterNetworking->setServiceAddressCidrBlocks($networkingServiceAddressCidrBlocks); + $awsCluster->setNetworking($awsClusterNetworking); + $awsClusterAwsRegion = 'awsClusterAwsRegion574122132'; + $awsCluster->setAwsRegion($awsClusterAwsRegion); + $awsClusterControlPlane = new AwsControlPlane(); + $controlPlaneVersion = 'controlPlaneVersion648040665'; + $awsClusterControlPlane->setVersion($controlPlaneVersion); + $controlPlaneSubnetIds = []; + $awsClusterControlPlane->setSubnetIds($controlPlaneSubnetIds); + $controlPlaneIamInstanceProfile = 'controlPlaneIamInstanceProfile1905273246'; + $awsClusterControlPlane->setIamInstanceProfile($controlPlaneIamInstanceProfile); + $controlPlaneDatabaseEncryption = new AwsDatabaseEncryption(); + $databaseEncryptionKmsKeyArn = 'databaseEncryptionKmsKeyArn1858324593'; + $controlPlaneDatabaseEncryption->setKmsKeyArn($databaseEncryptionKmsKeyArn); + $awsClusterControlPlane->setDatabaseEncryption($controlPlaneDatabaseEncryption); + $controlPlaneAwsServicesAuthentication = new AwsServicesAuthentication(); + $awsServicesAuthenticationRoleArn = 'awsServicesAuthenticationRoleArn1905212596'; + $controlPlaneAwsServicesAuthentication->setRoleArn($awsServicesAuthenticationRoleArn); + $awsClusterControlPlane->setAwsServicesAuthentication($controlPlaneAwsServicesAuthentication); + $controlPlaneConfigEncryption = new AwsConfigEncryption(); + $configEncryptionKmsKeyArn = 'configEncryptionKmsKeyArn-992257206'; + $controlPlaneConfigEncryption->setKmsKeyArn($configEncryptionKmsKeyArn); + $awsClusterControlPlane->setConfigEncryption($controlPlaneConfigEncryption); + $awsCluster->setControlPlane($awsClusterControlPlane); + $awsClusterAuthorization = new AwsAuthorization(); + $authorizationAdminUsers = []; + $awsClusterAuthorization->setAdminUsers($authorizationAdminUsers); + $awsCluster->setAuthorization($awsClusterAuthorization); + $awsClusterFleet = new Fleet(); + $fleetProject = 'fleetProject604893675'; + $awsClusterFleet->setProject($fleetProject); + $awsCluster->setFleet($awsClusterFleet); + $awsClusterId = 'awsClusterId938438658'; + $request = (new CreateAwsClusterRequest()) + ->setParent($formattedParent) + ->setAwsCluster($awsCluster) + ->setAwsClusterId($awsClusterId); + $response = $gapicClient->createAwsClusterAsync($request)->wait(); + $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.cloud.gkemulticloud.v1.AwsClusters/CreateAwsCluster', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getAwsCluster(); + $this->assertProtobufEquals($awsCluster, $actualValue); + $actualValue = $actualApiRequestObject->getAwsClusterId(); + $this->assertProtobufEquals($awsClusterId, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createAwsClusterTest'); + $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()); + } +} diff --git a/owl-bot-staging/GkeMultiCloud/v1/tests/Unit/V1/Client/AzureClustersClientTest.php b/owl-bot-staging/GkeMultiCloud/v1/tests/Unit/V1/Client/AzureClustersClientTest.php new file mode 100644 index 000000000000..f87b121c8274 --- /dev/null +++ b/owl-bot-staging/GkeMultiCloud/v1/tests/Unit/V1/Client/AzureClustersClientTest.php @@ -0,0 +1,2058 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return AzureClustersClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new AzureClustersClient($options); + } + + /** @test */ + public function createAzureClientTest() + { + $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/createAzureClientTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $tenantId = 'tenantId-1852780336'; + $applicationId = 'applicationId-1287148950'; + $reconciling = false; + $pemCertificate = 'pemCertificate1234463984'; + $uid = 'uid115792'; + $expectedResponse = new AzureClient(); + $expectedResponse->setName($name); + $expectedResponse->setTenantId($tenantId); + $expectedResponse->setApplicationId($applicationId); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setPemCertificate($pemCertificate); + $expectedResponse->setUid($uid); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createAzureClientTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $azureClient = new AzureClient(); + $azureClientTenantId = 'azureClientTenantId-567307073'; + $azureClient->setTenantId($azureClientTenantId); + $azureClientApplicationId = 'azureClientApplicationId264838513'; + $azureClient->setApplicationId($azureClientApplicationId); + $azureClientId = 'azureClientId315645023'; + $request = (new CreateAzureClientRequest()) + ->setParent($formattedParent) + ->setAzureClient($azureClient) + ->setAzureClientId($azureClientId); + $response = $gapicClient->createAzureClient($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.cloud.gkemulticloud.v1.AzureClusters/CreateAzureClient', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getAzureClient(); + $this->assertProtobufEquals($azureClient, $actualValue); + $actualValue = $actualApiRequestObject->getAzureClientId(); + $this->assertProtobufEquals($azureClientId, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createAzureClientTest'); + $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 createAzureClientExceptionTest() + { + $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/createAzureClientTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $azureClient = new AzureClient(); + $azureClientTenantId = 'azureClientTenantId-567307073'; + $azureClient->setTenantId($azureClientTenantId); + $azureClientApplicationId = 'azureClientApplicationId264838513'; + $azureClient->setApplicationId($azureClientApplicationId); + $azureClientId = 'azureClientId315645023'; + $request = (new CreateAzureClientRequest()) + ->setParent($formattedParent) + ->setAzureClient($azureClient) + ->setAzureClientId($azureClientId); + $response = $gapicClient->createAzureClient($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createAzureClientTest'); + 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 createAzureClusterTest() + { + $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/createAzureClusterTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $azureRegion = 'azureRegion-253373788'; + $resourceGroupId = 'resourceGroupId-1092054036'; + $azureClient = 'azureClient-676290693'; + $endpoint = 'endpoint1741102485'; + $uid = 'uid115792'; + $reconciling = false; + $etag = 'etag3123477'; + $clusterCaCertificate = 'clusterCaCertificate1324742683'; + $expectedResponse = new AzureCluster(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $expectedResponse->setAzureRegion($azureRegion); + $expectedResponse->setResourceGroupId($resourceGroupId); + $expectedResponse->setAzureClient($azureClient); + $expectedResponse->setEndpoint($endpoint); + $expectedResponse->setUid($uid); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setEtag($etag); + $expectedResponse->setClusterCaCertificate($clusterCaCertificate); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createAzureClusterTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $azureCluster = new AzureCluster(); + $azureClusterAzureRegion = 'azureClusterAzureRegion-1036501768'; + $azureCluster->setAzureRegion($azureClusterAzureRegion); + $azureClusterResourceGroupId = 'azureClusterResourceGroupId-1683734495'; + $azureCluster->setResourceGroupId($azureClusterResourceGroupId); + $azureClusterNetworking = new AzureClusterNetworking(); + $networkingVirtualNetworkId = 'networkingVirtualNetworkId-516550606'; + $azureClusterNetworking->setVirtualNetworkId($networkingVirtualNetworkId); + $networkingPodAddressCidrBlocks = []; + $azureClusterNetworking->setPodAddressCidrBlocks($networkingPodAddressCidrBlocks); + $networkingServiceAddressCidrBlocks = []; + $azureClusterNetworking->setServiceAddressCidrBlocks($networkingServiceAddressCidrBlocks); + $azureCluster->setNetworking($azureClusterNetworking); + $azureClusterControlPlane = new AzureControlPlane(); + $controlPlaneVersion = 'controlPlaneVersion648040665'; + $azureClusterControlPlane->setVersion($controlPlaneVersion); + $controlPlaneSshConfig = new AzureSshConfig(); + $sshConfigAuthorizedKey = 'sshConfigAuthorizedKey1626409850'; + $controlPlaneSshConfig->setAuthorizedKey($sshConfigAuthorizedKey); + $azureClusterControlPlane->setSshConfig($controlPlaneSshConfig); + $azureCluster->setControlPlane($azureClusterControlPlane); + $azureClusterAuthorization = new AzureAuthorization(); + $authorizationAdminUsers = []; + $azureClusterAuthorization->setAdminUsers($authorizationAdminUsers); + $azureCluster->setAuthorization($azureClusterAuthorization); + $azureClusterFleet = new Fleet(); + $fleetProject = 'fleetProject604893675'; + $azureClusterFleet->setProject($fleetProject); + $azureCluster->setFleet($azureClusterFleet); + $azureClusterId = 'azureClusterId332577072'; + $request = (new CreateAzureClusterRequest()) + ->setParent($formattedParent) + ->setAzureCluster($azureCluster) + ->setAzureClusterId($azureClusterId); + $response = $gapicClient->createAzureCluster($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.cloud.gkemulticloud.v1.AzureClusters/CreateAzureCluster', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getAzureCluster(); + $this->assertProtobufEquals($azureCluster, $actualValue); + $actualValue = $actualApiRequestObject->getAzureClusterId(); + $this->assertProtobufEquals($azureClusterId, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createAzureClusterTest'); + $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 createAzureClusterExceptionTest() + { + $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/createAzureClusterTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $azureCluster = new AzureCluster(); + $azureClusterAzureRegion = 'azureClusterAzureRegion-1036501768'; + $azureCluster->setAzureRegion($azureClusterAzureRegion); + $azureClusterResourceGroupId = 'azureClusterResourceGroupId-1683734495'; + $azureCluster->setResourceGroupId($azureClusterResourceGroupId); + $azureClusterNetworking = new AzureClusterNetworking(); + $networkingVirtualNetworkId = 'networkingVirtualNetworkId-516550606'; + $azureClusterNetworking->setVirtualNetworkId($networkingVirtualNetworkId); + $networkingPodAddressCidrBlocks = []; + $azureClusterNetworking->setPodAddressCidrBlocks($networkingPodAddressCidrBlocks); + $networkingServiceAddressCidrBlocks = []; + $azureClusterNetworking->setServiceAddressCidrBlocks($networkingServiceAddressCidrBlocks); + $azureCluster->setNetworking($azureClusterNetworking); + $azureClusterControlPlane = new AzureControlPlane(); + $controlPlaneVersion = 'controlPlaneVersion648040665'; + $azureClusterControlPlane->setVersion($controlPlaneVersion); + $controlPlaneSshConfig = new AzureSshConfig(); + $sshConfigAuthorizedKey = 'sshConfigAuthorizedKey1626409850'; + $controlPlaneSshConfig->setAuthorizedKey($sshConfigAuthorizedKey); + $azureClusterControlPlane->setSshConfig($controlPlaneSshConfig); + $azureCluster->setControlPlane($azureClusterControlPlane); + $azureClusterAuthorization = new AzureAuthorization(); + $authorizationAdminUsers = []; + $azureClusterAuthorization->setAdminUsers($authorizationAdminUsers); + $azureCluster->setAuthorization($azureClusterAuthorization); + $azureClusterFleet = new Fleet(); + $fleetProject = 'fleetProject604893675'; + $azureClusterFleet->setProject($fleetProject); + $azureCluster->setFleet($azureClusterFleet); + $azureClusterId = 'azureClusterId332577072'; + $request = (new CreateAzureClusterRequest()) + ->setParent($formattedParent) + ->setAzureCluster($azureCluster) + ->setAzureClusterId($azureClusterId); + $response = $gapicClient->createAzureCluster($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createAzureClusterTest'); + 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 createAzureNodePoolTest() + { + $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/createAzureNodePoolTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $version = 'version351608024'; + $subnetId = 'subnetId373593405'; + $uid = 'uid115792'; + $reconciling = false; + $etag = 'etag3123477'; + $azureAvailabilityZone = 'azureAvailabilityZone541920864'; + $expectedResponse = new AzureNodePool(); + $expectedResponse->setName($name); + $expectedResponse->setVersion($version); + $expectedResponse->setSubnetId($subnetId); + $expectedResponse->setUid($uid); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setEtag($etag); + $expectedResponse->setAzureAvailabilityZone($azureAvailabilityZone); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createAzureNodePoolTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->azureClusterName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]'); + $azureNodePool = new AzureNodePool(); + $azureNodePoolVersion = 'azureNodePoolVersion349490987'; + $azureNodePool->setVersion($azureNodePoolVersion); + $azureNodePoolConfig = new AzureNodeConfig(); + $configSshConfig = new AzureSshConfig(); + $sshConfigAuthorizedKey = 'sshConfigAuthorizedKey1626409850'; + $configSshConfig->setAuthorizedKey($sshConfigAuthorizedKey); + $azureNodePoolConfig->setSshConfig($configSshConfig); + $azureNodePool->setConfig($azureNodePoolConfig); + $azureNodePoolSubnetId = 'azureNodePoolSubnetId-2131787419'; + $azureNodePool->setSubnetId($azureNodePoolSubnetId); + $azureNodePoolAutoscaling = new AzureNodePoolAutoscaling(); + $autoscalingMinNodeCount = 1464441581; + $azureNodePoolAutoscaling->setMinNodeCount($autoscalingMinNodeCount); + $autoscalingMaxNodeCount = 1938867647; + $azureNodePoolAutoscaling->setMaxNodeCount($autoscalingMaxNodeCount); + $azureNodePool->setAutoscaling($azureNodePoolAutoscaling); + $azureNodePoolMaxPodsConstraint = new MaxPodsConstraint(); + $maxPodsConstraintMaxPodsPerNode = 1072618940; + $azureNodePoolMaxPodsConstraint->setMaxPodsPerNode($maxPodsConstraintMaxPodsPerNode); + $azureNodePool->setMaxPodsConstraint($azureNodePoolMaxPodsConstraint); + $azureNodePoolId = 'azureNodePoolId-454365551'; + $request = (new CreateAzureNodePoolRequest()) + ->setParent($formattedParent) + ->setAzureNodePool($azureNodePool) + ->setAzureNodePoolId($azureNodePoolId); + $response = $gapicClient->createAzureNodePool($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.cloud.gkemulticloud.v1.AzureClusters/CreateAzureNodePool', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getAzureNodePool(); + $this->assertProtobufEquals($azureNodePool, $actualValue); + $actualValue = $actualApiRequestObject->getAzureNodePoolId(); + $this->assertProtobufEquals($azureNodePoolId, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createAzureNodePoolTest'); + $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 createAzureNodePoolExceptionTest() + { + $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/createAzureNodePoolTest'); + $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 + $formattedParent = $gapicClient->azureClusterName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]'); + $azureNodePool = new AzureNodePool(); + $azureNodePoolVersion = 'azureNodePoolVersion349490987'; + $azureNodePool->setVersion($azureNodePoolVersion); + $azureNodePoolConfig = new AzureNodeConfig(); + $configSshConfig = new AzureSshConfig(); + $sshConfigAuthorizedKey = 'sshConfigAuthorizedKey1626409850'; + $configSshConfig->setAuthorizedKey($sshConfigAuthorizedKey); + $azureNodePoolConfig->setSshConfig($configSshConfig); + $azureNodePool->setConfig($azureNodePoolConfig); + $azureNodePoolSubnetId = 'azureNodePoolSubnetId-2131787419'; + $azureNodePool->setSubnetId($azureNodePoolSubnetId); + $azureNodePoolAutoscaling = new AzureNodePoolAutoscaling(); + $autoscalingMinNodeCount = 1464441581; + $azureNodePoolAutoscaling->setMinNodeCount($autoscalingMinNodeCount); + $autoscalingMaxNodeCount = 1938867647; + $azureNodePoolAutoscaling->setMaxNodeCount($autoscalingMaxNodeCount); + $azureNodePool->setAutoscaling($azureNodePoolAutoscaling); + $azureNodePoolMaxPodsConstraint = new MaxPodsConstraint(); + $maxPodsConstraintMaxPodsPerNode = 1072618940; + $azureNodePoolMaxPodsConstraint->setMaxPodsPerNode($maxPodsConstraintMaxPodsPerNode); + $azureNodePool->setMaxPodsConstraint($azureNodePoolMaxPodsConstraint); + $azureNodePoolId = 'azureNodePoolId-454365551'; + $request = (new CreateAzureNodePoolRequest()) + ->setParent($formattedParent) + ->setAzureNodePool($azureNodePool) + ->setAzureNodePoolId($azureNodePoolId); + $response = $gapicClient->createAzureNodePool($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createAzureNodePoolTest'); + 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 deleteAzureClientTest() + { + $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/deleteAzureClientTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteAzureClientTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->azureClientName('[PROJECT]', '[LOCATION]', '[AZURE_CLIENT]'); + $request = (new DeleteAzureClientRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteAzureClient($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.cloud.gkemulticloud.v1.AzureClusters/DeleteAzureClient', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteAzureClientTest'); + $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 deleteAzureClientExceptionTest() + { + $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/deleteAzureClientTest'); + $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->azureClientName('[PROJECT]', '[LOCATION]', '[AZURE_CLIENT]'); + $request = (new DeleteAzureClientRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteAzureClient($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteAzureClientTest'); + 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 deleteAzureClusterTest() + { + $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/deleteAzureClusterTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteAzureClusterTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->azureClusterName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]'); + $request = (new DeleteAzureClusterRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteAzureCluster($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.cloud.gkemulticloud.v1.AzureClusters/DeleteAzureCluster', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteAzureClusterTest'); + $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 deleteAzureClusterExceptionTest() + { + $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/deleteAzureClusterTest'); + $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->azureClusterName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]'); + $request = (new DeleteAzureClusterRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteAzureCluster($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteAzureClusterTest'); + 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 deleteAzureNodePoolTest() + { + $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/deleteAzureNodePoolTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteAzureNodePoolTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->azureNodePoolName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]', '[AZURE_NODE_POOL]'); + $request = (new DeleteAzureNodePoolRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteAzureNodePool($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.cloud.gkemulticloud.v1.AzureClusters/DeleteAzureNodePool', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteAzureNodePoolTest'); + $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 deleteAzureNodePoolExceptionTest() + { + $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/deleteAzureNodePoolTest'); + $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->azureNodePoolName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]', '[AZURE_NODE_POOL]'); + $request = (new DeleteAzureNodePoolRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteAzureNodePool($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteAzureNodePoolTest'); + 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 generateAzureAccessTokenTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $accessToken = 'accessToken-1938933922'; + $expectedResponse = new GenerateAzureAccessTokenResponse(); + $expectedResponse->setAccessToken($accessToken); + $transport->addResponse($expectedResponse); + // Mock request + $formattedAzureCluster = $gapicClient->azureClusterName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]'); + $request = (new GenerateAzureAccessTokenRequest()) + ->setAzureCluster($formattedAzureCluster); + $response = $gapicClient->generateAzureAccessToken($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkemulticloud.v1.AzureClusters/GenerateAzureAccessToken', $actualFuncCall); + $actualValue = $actualRequestObject->getAzureCluster(); + $this->assertProtobufEquals($formattedAzureCluster, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function generateAzureAccessTokenExceptionTest() + { + $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 + $formattedAzureCluster = $gapicClient->azureClusterName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]'); + $request = (new GenerateAzureAccessTokenRequest()) + ->setAzureCluster($formattedAzureCluster); + try { + $gapicClient->generateAzureAccessToken($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 getAzureClientTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $tenantId = 'tenantId-1852780336'; + $applicationId = 'applicationId-1287148950'; + $reconciling = false; + $pemCertificate = 'pemCertificate1234463984'; + $uid = 'uid115792'; + $expectedResponse = new AzureClient(); + $expectedResponse->setName($name2); + $expectedResponse->setTenantId($tenantId); + $expectedResponse->setApplicationId($applicationId); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setPemCertificate($pemCertificate); + $expectedResponse->setUid($uid); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->azureClientName('[PROJECT]', '[LOCATION]', '[AZURE_CLIENT]'); + $request = (new GetAzureClientRequest()) + ->setName($formattedName); + $response = $gapicClient->getAzureClient($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkemulticloud.v1.AzureClusters/GetAzureClient', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getAzureClientExceptionTest() + { + $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->azureClientName('[PROJECT]', '[LOCATION]', '[AZURE_CLIENT]'); + $request = (new GetAzureClientRequest()) + ->setName($formattedName); + try { + $gapicClient->getAzureClient($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 getAzureClusterTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $description = 'description-1724546052'; + $azureRegion = 'azureRegion-253373788'; + $resourceGroupId = 'resourceGroupId-1092054036'; + $azureClient = 'azureClient-676290693'; + $endpoint = 'endpoint1741102485'; + $uid = 'uid115792'; + $reconciling = false; + $etag = 'etag3123477'; + $clusterCaCertificate = 'clusterCaCertificate1324742683'; + $expectedResponse = new AzureCluster(); + $expectedResponse->setName($name2); + $expectedResponse->setDescription($description); + $expectedResponse->setAzureRegion($azureRegion); + $expectedResponse->setResourceGroupId($resourceGroupId); + $expectedResponse->setAzureClient($azureClient); + $expectedResponse->setEndpoint($endpoint); + $expectedResponse->setUid($uid); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setEtag($etag); + $expectedResponse->setClusterCaCertificate($clusterCaCertificate); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->azureClusterName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]'); + $request = (new GetAzureClusterRequest()) + ->setName($formattedName); + $response = $gapicClient->getAzureCluster($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkemulticloud.v1.AzureClusters/GetAzureCluster', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getAzureClusterExceptionTest() + { + $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->azureClusterName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]'); + $request = (new GetAzureClusterRequest()) + ->setName($formattedName); + try { + $gapicClient->getAzureCluster($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 getAzureNodePoolTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $version = 'version351608024'; + $subnetId = 'subnetId373593405'; + $uid = 'uid115792'; + $reconciling = false; + $etag = 'etag3123477'; + $azureAvailabilityZone = 'azureAvailabilityZone541920864'; + $expectedResponse = new AzureNodePool(); + $expectedResponse->setName($name2); + $expectedResponse->setVersion($version); + $expectedResponse->setSubnetId($subnetId); + $expectedResponse->setUid($uid); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setEtag($etag); + $expectedResponse->setAzureAvailabilityZone($azureAvailabilityZone); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->azureNodePoolName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]', '[AZURE_NODE_POOL]'); + $request = (new GetAzureNodePoolRequest()) + ->setName($formattedName); + $response = $gapicClient->getAzureNodePool($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkemulticloud.v1.AzureClusters/GetAzureNodePool', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getAzureNodePoolExceptionTest() + { + $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->azureNodePoolName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]', '[AZURE_NODE_POOL]'); + $request = (new GetAzureNodePoolRequest()) + ->setName($formattedName); + try { + $gapicClient->getAzureNodePool($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 getAzureServerConfigTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $expectedResponse = new AzureServerConfig(); + $expectedResponse->setName($name2); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->azureServerConfigName('[PROJECT]', '[LOCATION]'); + $request = (new GetAzureServerConfigRequest()) + ->setName($formattedName); + $response = $gapicClient->getAzureServerConfig($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkemulticloud.v1.AzureClusters/GetAzureServerConfig', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getAzureServerConfigExceptionTest() + { + $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->azureServerConfigName('[PROJECT]', '[LOCATION]'); + $request = (new GetAzureServerConfigRequest()) + ->setName($formattedName); + try { + $gapicClient->getAzureServerConfig($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 listAzureClientsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $azureClientsElement = new AzureClient(); + $azureClients = [ + $azureClientsElement, + ]; + $expectedResponse = new ListAzureClientsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setAzureClients($azureClients); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListAzureClientsRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listAzureClients($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getAzureClients()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkemulticloud.v1.AzureClusters/ListAzureClients', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listAzureClientsExceptionTest() + { + $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->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListAzureClientsRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listAzureClients($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 listAzureClustersTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $azureClustersElement = new AzureCluster(); + $azureClusters = [ + $azureClustersElement, + ]; + $expectedResponse = new ListAzureClustersResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setAzureClusters($azureClusters); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListAzureClustersRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listAzureClusters($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getAzureClusters()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkemulticloud.v1.AzureClusters/ListAzureClusters', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listAzureClustersExceptionTest() + { + $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->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListAzureClustersRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listAzureClusters($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 listAzureNodePoolsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $azureNodePoolsElement = new AzureNodePool(); + $azureNodePools = [ + $azureNodePoolsElement, + ]; + $expectedResponse = new ListAzureNodePoolsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setAzureNodePools($azureNodePools); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->azureClusterName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]'); + $request = (new ListAzureNodePoolsRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listAzureNodePools($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getAzureNodePools()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkemulticloud.v1.AzureClusters/ListAzureNodePools', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listAzureNodePoolsExceptionTest() + { + $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->azureClusterName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]'); + $request = (new ListAzureNodePoolsRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listAzureNodePools($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 updateAzureClusterTest() + { + $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/updateAzureClusterTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $azureRegion = 'azureRegion-253373788'; + $resourceGroupId = 'resourceGroupId-1092054036'; + $azureClient = 'azureClient-676290693'; + $endpoint = 'endpoint1741102485'; + $uid = 'uid115792'; + $reconciling = false; + $etag = 'etag3123477'; + $clusterCaCertificate = 'clusterCaCertificate1324742683'; + $expectedResponse = new AzureCluster(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $expectedResponse->setAzureRegion($azureRegion); + $expectedResponse->setResourceGroupId($resourceGroupId); + $expectedResponse->setAzureClient($azureClient); + $expectedResponse->setEndpoint($endpoint); + $expectedResponse->setUid($uid); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setEtag($etag); + $expectedResponse->setClusterCaCertificate($clusterCaCertificate); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateAzureClusterTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $azureCluster = new AzureCluster(); + $azureClusterAzureRegion = 'azureClusterAzureRegion-1036501768'; + $azureCluster->setAzureRegion($azureClusterAzureRegion); + $azureClusterResourceGroupId = 'azureClusterResourceGroupId-1683734495'; + $azureCluster->setResourceGroupId($azureClusterResourceGroupId); + $azureClusterNetworking = new AzureClusterNetworking(); + $networkingVirtualNetworkId = 'networkingVirtualNetworkId-516550606'; + $azureClusterNetworking->setVirtualNetworkId($networkingVirtualNetworkId); + $networkingPodAddressCidrBlocks = []; + $azureClusterNetworking->setPodAddressCidrBlocks($networkingPodAddressCidrBlocks); + $networkingServiceAddressCidrBlocks = []; + $azureClusterNetworking->setServiceAddressCidrBlocks($networkingServiceAddressCidrBlocks); + $azureCluster->setNetworking($azureClusterNetworking); + $azureClusterControlPlane = new AzureControlPlane(); + $controlPlaneVersion = 'controlPlaneVersion648040665'; + $azureClusterControlPlane->setVersion($controlPlaneVersion); + $controlPlaneSshConfig = new AzureSshConfig(); + $sshConfigAuthorizedKey = 'sshConfigAuthorizedKey1626409850'; + $controlPlaneSshConfig->setAuthorizedKey($sshConfigAuthorizedKey); + $azureClusterControlPlane->setSshConfig($controlPlaneSshConfig); + $azureCluster->setControlPlane($azureClusterControlPlane); + $azureClusterAuthorization = new AzureAuthorization(); + $authorizationAdminUsers = []; + $azureClusterAuthorization->setAdminUsers($authorizationAdminUsers); + $azureCluster->setAuthorization($azureClusterAuthorization); + $azureClusterFleet = new Fleet(); + $fleetProject = 'fleetProject604893675'; + $azureClusterFleet->setProject($fleetProject); + $azureCluster->setFleet($azureClusterFleet); + $updateMask = new FieldMask(); + $request = (new UpdateAzureClusterRequest()) + ->setAzureCluster($azureCluster) + ->setUpdateMask($updateMask); + $response = $gapicClient->updateAzureCluster($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.cloud.gkemulticloud.v1.AzureClusters/UpdateAzureCluster', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getAzureCluster(); + $this->assertProtobufEquals($azureCluster, $actualValue); + $actualValue = $actualApiRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateAzureClusterTest'); + $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 updateAzureClusterExceptionTest() + { + $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/updateAzureClusterTest'); + $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 + $azureCluster = new AzureCluster(); + $azureClusterAzureRegion = 'azureClusterAzureRegion-1036501768'; + $azureCluster->setAzureRegion($azureClusterAzureRegion); + $azureClusterResourceGroupId = 'azureClusterResourceGroupId-1683734495'; + $azureCluster->setResourceGroupId($azureClusterResourceGroupId); + $azureClusterNetworking = new AzureClusterNetworking(); + $networkingVirtualNetworkId = 'networkingVirtualNetworkId-516550606'; + $azureClusterNetworking->setVirtualNetworkId($networkingVirtualNetworkId); + $networkingPodAddressCidrBlocks = []; + $azureClusterNetworking->setPodAddressCidrBlocks($networkingPodAddressCidrBlocks); + $networkingServiceAddressCidrBlocks = []; + $azureClusterNetworking->setServiceAddressCidrBlocks($networkingServiceAddressCidrBlocks); + $azureCluster->setNetworking($azureClusterNetworking); + $azureClusterControlPlane = new AzureControlPlane(); + $controlPlaneVersion = 'controlPlaneVersion648040665'; + $azureClusterControlPlane->setVersion($controlPlaneVersion); + $controlPlaneSshConfig = new AzureSshConfig(); + $sshConfigAuthorizedKey = 'sshConfigAuthorizedKey1626409850'; + $controlPlaneSshConfig->setAuthorizedKey($sshConfigAuthorizedKey); + $azureClusterControlPlane->setSshConfig($controlPlaneSshConfig); + $azureCluster->setControlPlane($azureClusterControlPlane); + $azureClusterAuthorization = new AzureAuthorization(); + $authorizationAdminUsers = []; + $azureClusterAuthorization->setAdminUsers($authorizationAdminUsers); + $azureCluster->setAuthorization($azureClusterAuthorization); + $azureClusterFleet = new Fleet(); + $fleetProject = 'fleetProject604893675'; + $azureClusterFleet->setProject($fleetProject); + $azureCluster->setFleet($azureClusterFleet); + $updateMask = new FieldMask(); + $request = (new UpdateAzureClusterRequest()) + ->setAzureCluster($azureCluster) + ->setUpdateMask($updateMask); + $response = $gapicClient->updateAzureCluster($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateAzureClusterTest'); + 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 updateAzureNodePoolTest() + { + $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/updateAzureNodePoolTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $version = 'version351608024'; + $subnetId = 'subnetId373593405'; + $uid = 'uid115792'; + $reconciling = false; + $etag = 'etag3123477'; + $azureAvailabilityZone = 'azureAvailabilityZone541920864'; + $expectedResponse = new AzureNodePool(); + $expectedResponse->setName($name); + $expectedResponse->setVersion($version); + $expectedResponse->setSubnetId($subnetId); + $expectedResponse->setUid($uid); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setEtag($etag); + $expectedResponse->setAzureAvailabilityZone($azureAvailabilityZone); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateAzureNodePoolTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $azureNodePool = new AzureNodePool(); + $azureNodePoolVersion = 'azureNodePoolVersion349490987'; + $azureNodePool->setVersion($azureNodePoolVersion); + $azureNodePoolConfig = new AzureNodeConfig(); + $configSshConfig = new AzureSshConfig(); + $sshConfigAuthorizedKey = 'sshConfigAuthorizedKey1626409850'; + $configSshConfig->setAuthorizedKey($sshConfigAuthorizedKey); + $azureNodePoolConfig->setSshConfig($configSshConfig); + $azureNodePool->setConfig($azureNodePoolConfig); + $azureNodePoolSubnetId = 'azureNodePoolSubnetId-2131787419'; + $azureNodePool->setSubnetId($azureNodePoolSubnetId); + $azureNodePoolAutoscaling = new AzureNodePoolAutoscaling(); + $autoscalingMinNodeCount = 1464441581; + $azureNodePoolAutoscaling->setMinNodeCount($autoscalingMinNodeCount); + $autoscalingMaxNodeCount = 1938867647; + $azureNodePoolAutoscaling->setMaxNodeCount($autoscalingMaxNodeCount); + $azureNodePool->setAutoscaling($azureNodePoolAutoscaling); + $azureNodePoolMaxPodsConstraint = new MaxPodsConstraint(); + $maxPodsConstraintMaxPodsPerNode = 1072618940; + $azureNodePoolMaxPodsConstraint->setMaxPodsPerNode($maxPodsConstraintMaxPodsPerNode); + $azureNodePool->setMaxPodsConstraint($azureNodePoolMaxPodsConstraint); + $updateMask = new FieldMask(); + $request = (new UpdateAzureNodePoolRequest()) + ->setAzureNodePool($azureNodePool) + ->setUpdateMask($updateMask); + $response = $gapicClient->updateAzureNodePool($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.cloud.gkemulticloud.v1.AzureClusters/UpdateAzureNodePool', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getAzureNodePool(); + $this->assertProtobufEquals($azureNodePool, $actualValue); + $actualValue = $actualApiRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateAzureNodePoolTest'); + $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 updateAzureNodePoolExceptionTest() + { + $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/updateAzureNodePoolTest'); + $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 + $azureNodePool = new AzureNodePool(); + $azureNodePoolVersion = 'azureNodePoolVersion349490987'; + $azureNodePool->setVersion($azureNodePoolVersion); + $azureNodePoolConfig = new AzureNodeConfig(); + $configSshConfig = new AzureSshConfig(); + $sshConfigAuthorizedKey = 'sshConfigAuthorizedKey1626409850'; + $configSshConfig->setAuthorizedKey($sshConfigAuthorizedKey); + $azureNodePoolConfig->setSshConfig($configSshConfig); + $azureNodePool->setConfig($azureNodePoolConfig); + $azureNodePoolSubnetId = 'azureNodePoolSubnetId-2131787419'; + $azureNodePool->setSubnetId($azureNodePoolSubnetId); + $azureNodePoolAutoscaling = new AzureNodePoolAutoscaling(); + $autoscalingMinNodeCount = 1464441581; + $azureNodePoolAutoscaling->setMinNodeCount($autoscalingMinNodeCount); + $autoscalingMaxNodeCount = 1938867647; + $azureNodePoolAutoscaling->setMaxNodeCount($autoscalingMaxNodeCount); + $azureNodePool->setAutoscaling($azureNodePoolAutoscaling); + $azureNodePoolMaxPodsConstraint = new MaxPodsConstraint(); + $maxPodsConstraintMaxPodsPerNode = 1072618940; + $azureNodePoolMaxPodsConstraint->setMaxPodsPerNode($maxPodsConstraintMaxPodsPerNode); + $azureNodePool->setMaxPodsConstraint($azureNodePoolMaxPodsConstraint); + $updateMask = new FieldMask(); + $request = (new UpdateAzureNodePoolRequest()) + ->setAzureNodePool($azureNodePool) + ->setUpdateMask($updateMask); + $response = $gapicClient->updateAzureNodePool($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateAzureNodePoolTest'); + 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 createAzureClientAsyncTest() + { + $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/createAzureClientTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $tenantId = 'tenantId-1852780336'; + $applicationId = 'applicationId-1287148950'; + $reconciling = false; + $pemCertificate = 'pemCertificate1234463984'; + $uid = 'uid115792'; + $expectedResponse = new AzureClient(); + $expectedResponse->setName($name); + $expectedResponse->setTenantId($tenantId); + $expectedResponse->setApplicationId($applicationId); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setPemCertificate($pemCertificate); + $expectedResponse->setUid($uid); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createAzureClientTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $azureClient = new AzureClient(); + $azureClientTenantId = 'azureClientTenantId-567307073'; + $azureClient->setTenantId($azureClientTenantId); + $azureClientApplicationId = 'azureClientApplicationId264838513'; + $azureClient->setApplicationId($azureClientApplicationId); + $azureClientId = 'azureClientId315645023'; + $request = (new CreateAzureClientRequest()) + ->setParent($formattedParent) + ->setAzureClient($azureClient) + ->setAzureClientId($azureClientId); + $response = $gapicClient->createAzureClientAsync($request)->wait(); + $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.cloud.gkemulticloud.v1.AzureClusters/CreateAzureClient', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getAzureClient(); + $this->assertProtobufEquals($azureClient, $actualValue); + $actualValue = $actualApiRequestObject->getAzureClientId(); + $this->assertProtobufEquals($azureClientId, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createAzureClientTest'); + $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()); + } +} diff --git a/owl-bot-staging/Grafeas/v1/proto/src/GPBMetadata/Grafeas/V1/Attestation.php b/owl-bot-staging/Grafeas/v1/proto/src/GPBMetadata/Grafeas/V1/Attestation.php new file mode 100644 index 000000000000..8db0f36078c4 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/GPBMetadata/Grafeas/V1/Attestation.php @@ -0,0 +1,40 @@ +internalAddGeneratedFile( + ' +ˆ +grafeas/v1/attestation.proto +grafeas.v1"f +AttestationNote. +hint ( 2 .grafeas.v1.AttestationNote.Hint# +Hint +human_readable_name ( " +Jwt + compact_jwt ( "} +AttestationOccurrence +serialized_payload ( ) + +signatures ( 2.grafeas.v1.Signature +jwts ( 2.grafeas.v1.JwtBQ + io.grafeas.v1PZ8google.golang.org/genproto/googleapis/grafeas/v1;grafeas¢GRAbproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/GPBMetadata/Grafeas/V1/Build.php b/owl-bot-staging/Grafeas/v1/proto/src/GPBMetadata/Grafeas/V1/Build.php new file mode 100644 index 000000000000..6ab3907fa635 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/GPBMetadata/Grafeas/V1/Build.php @@ -0,0 +1,39 @@ +internalAddGeneratedFile( + ' +´ +grafeas/v1/build.proto +grafeas.v1!grafeas/v1/intoto_statement.protografeas/v1/provenance.proto"$ + BuildNote +builder_version ( "Ì +BuildOccurrence/ + +provenance ( 2.grafeas.v1.BuildProvenance +provenance_bytes ( 7 +intoto_provenance ( 2.grafeas.v1.InTotoProvenance5 +intoto_statement ( 2.grafeas.v1.InTotoStatementBQ + io.grafeas.v1PZ8google.golang.org/genproto/googleapis/grafeas/v1;grafeas¢GRAbproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/GPBMetadata/Grafeas/V1/Common.php b/owl-bot-staging/Grafeas/v1/proto/src/GPBMetadata/Grafeas/V1/Common.php new file mode 100644 index 000000000000..2cb169eb609a Binary files /dev/null and b/owl-bot-staging/Grafeas/v1/proto/src/GPBMetadata/Grafeas/V1/Common.php differ diff --git a/owl-bot-staging/Grafeas/v1/proto/src/GPBMetadata/Grafeas/V1/Compliance.php b/owl-bot-staging/Grafeas/v1/proto/src/GPBMetadata/Grafeas/V1/Compliance.php new file mode 100644 index 000000000000..192701307476 Binary files /dev/null and b/owl-bot-staging/Grafeas/v1/proto/src/GPBMetadata/Grafeas/V1/Compliance.php differ diff --git a/owl-bot-staging/Grafeas/v1/proto/src/GPBMetadata/Grafeas/V1/Cvss.php b/owl-bot-staging/Grafeas/v1/proto/src/GPBMetadata/Grafeas/V1/Cvss.php new file mode 100644 index 000000000000..53c421029b13 Binary files /dev/null and b/owl-bot-staging/Grafeas/v1/proto/src/GPBMetadata/Grafeas/V1/Cvss.php differ diff --git a/owl-bot-staging/Grafeas/v1/proto/src/GPBMetadata/Grafeas/V1/Deployment.php b/owl-bot-staging/Grafeas/v1/proto/src/GPBMetadata/Grafeas/V1/Deployment.php new file mode 100644 index 000000000000..4c9c49aad310 Binary files /dev/null and b/owl-bot-staging/Grafeas/v1/proto/src/GPBMetadata/Grafeas/V1/Deployment.php differ diff --git a/owl-bot-staging/Grafeas/v1/proto/src/GPBMetadata/Grafeas/V1/Discovery.php b/owl-bot-staging/Grafeas/v1/proto/src/GPBMetadata/Grafeas/V1/Discovery.php new file mode 100644 index 000000000000..e30dd10ccdb9 Binary files /dev/null and b/owl-bot-staging/Grafeas/v1/proto/src/GPBMetadata/Grafeas/V1/Discovery.php differ diff --git a/owl-bot-staging/Grafeas/v1/proto/src/GPBMetadata/Grafeas/V1/DsseAttestation.php b/owl-bot-staging/Grafeas/v1/proto/src/GPBMetadata/Grafeas/V1/DsseAttestation.php new file mode 100644 index 000000000000..ef80894effc9 Binary files /dev/null and b/owl-bot-staging/Grafeas/v1/proto/src/GPBMetadata/Grafeas/V1/DsseAttestation.php differ diff --git a/owl-bot-staging/Grafeas/v1/proto/src/GPBMetadata/Grafeas/V1/Grafeas.php b/owl-bot-staging/Grafeas/v1/proto/src/GPBMetadata/Grafeas/V1/Grafeas.php new file mode 100644 index 000000000000..b3a2600042b5 Binary files /dev/null and b/owl-bot-staging/Grafeas/v1/proto/src/GPBMetadata/Grafeas/V1/Grafeas.php differ diff --git a/owl-bot-staging/Grafeas/v1/proto/src/GPBMetadata/Grafeas/V1/Image.php b/owl-bot-staging/Grafeas/v1/proto/src/GPBMetadata/Grafeas/V1/Image.php new file mode 100644 index 000000000000..4756c06563d8 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/GPBMetadata/Grafeas/V1/Image.php @@ -0,0 +1,44 @@ +internalAddGeneratedFile( + ' +× +grafeas/v1/image.proto +grafeas.v1"- +Layer + directive (  + arguments ( "@ + Fingerprint +v1_name (  +v2_blob (  +v2_name ( "O + ImageNote + resource_url ( , + fingerprint ( 2.grafeas.v1.Fingerprint"“ +ImageOccurrence, + fingerprint ( 2.grafeas.v1.Fingerprint +distance (% + +layer_info ( 2.grafeas.v1.Layer +base_resource_url ( BQ + io.grafeas.v1PZ8google.golang.org/genproto/googleapis/grafeas/v1;grafeas¢GRAbproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/GPBMetadata/Grafeas/V1/IntotoProvenance.php b/owl-bot-staging/Grafeas/v1/proto/src/GPBMetadata/Grafeas/V1/IntotoProvenance.php new file mode 100644 index 000000000000..5861d7ce8a1b --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/GPBMetadata/Grafeas/V1/IntotoProvenance.php @@ -0,0 +1,54 @@ +internalAddGeneratedFile( + ' +Î +"grafeas/v1/intoto_provenance.proto +grafeas.v1google/protobuf/timestamp.proto"œ +Recipe +type (  +defined_in_material ( + entry_point ( \' + arguments ( 2.google.protobuf.Any) + environment ( 2.google.protobuf.Any"I + Completeness + arguments ( + environment ( + materials ("Ú +Metadata +build_invocation_id ( 4 +build_started_on ( 2.google.protobuf.Timestamp5 +build_finished_on ( 2.google.protobuf.Timestamp. + completeness ( 2.grafeas.v1.Completeness + reproducible (" + BuilderConfig + +id ( "¤ +InTotoProvenance1 +builder_config ( 2.grafeas.v1.BuilderConfig" +recipe ( 2.grafeas.v1.Recipe& +metadata ( 2.grafeas.v1.Metadata + materials ( Bh + io.grafeas.v1BInTotoProvenanceProtoPZ8google.golang.org/genproto/googleapis/grafeas/v1;grafeas¢GRAbproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/GPBMetadata/Grafeas/V1/IntotoStatement.php b/owl-bot-staging/Grafeas/v1/proto/src/GPBMetadata/Grafeas/V1/IntotoStatement.php new file mode 100644 index 000000000000..170908323f19 Binary files /dev/null and b/owl-bot-staging/Grafeas/v1/proto/src/GPBMetadata/Grafeas/V1/IntotoStatement.php differ diff --git a/owl-bot-staging/Grafeas/v1/proto/src/GPBMetadata/Grafeas/V1/Package.php b/owl-bot-staging/Grafeas/v1/proto/src/GPBMetadata/Grafeas/V1/Package.php new file mode 100644 index 000000000000..b9aecb5e41fd Binary files /dev/null and b/owl-bot-staging/Grafeas/v1/proto/src/GPBMetadata/Grafeas/V1/Package.php differ diff --git a/owl-bot-staging/Grafeas/v1/proto/src/GPBMetadata/Grafeas/V1/Provenance.php b/owl-bot-staging/Grafeas/v1/proto/src/GPBMetadata/Grafeas/V1/Provenance.php new file mode 100644 index 000000000000..26eac47b31ce Binary files /dev/null and b/owl-bot-staging/Grafeas/v1/proto/src/GPBMetadata/Grafeas/V1/Provenance.php differ diff --git a/owl-bot-staging/Grafeas/v1/proto/src/GPBMetadata/Grafeas/V1/Severity.php b/owl-bot-staging/Grafeas/v1/proto/src/GPBMetadata/Grafeas/V1/Severity.php new file mode 100644 index 000000000000..bd0c81933da8 Binary files /dev/null and b/owl-bot-staging/Grafeas/v1/proto/src/GPBMetadata/Grafeas/V1/Severity.php differ diff --git a/owl-bot-staging/Grafeas/v1/proto/src/GPBMetadata/Grafeas/V1/SlsaProvenance.php b/owl-bot-staging/Grafeas/v1/proto/src/GPBMetadata/Grafeas/V1/SlsaProvenance.php new file mode 100644 index 000000000000..0a0032106807 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/GPBMetadata/Grafeas/V1/SlsaProvenance.php @@ -0,0 +1,61 @@ +internalAddGeneratedFile( + ' +À + grafeas/v1/slsa_provenance.proto +grafeas.v1google/protobuf/timestamp.proto"þ +SlsaProvenance7 +builder ( 2&.grafeas.v1.SlsaProvenance.SlsaBuilder5 +recipe ( 2%.grafeas.v1.SlsaProvenance.SlsaRecipe9 +metadata ( 2\'.grafeas.v1.SlsaProvenance.SlsaMetadata6 + materials ( 2#.grafeas.v1.SlsaProvenance.Material  + +SlsaRecipe +type (  +defined_in_material ( + entry_point ( \' + arguments ( 2.google.protobuf.Any) + environment ( 2.google.protobuf.AnyM +SlsaCompleteness + arguments ( + environment ( + materials (ñ + SlsaMetadata +build_invocation_id ( 4 +build_started_on ( 2.google.protobuf.Timestamp5 +build_finished_on ( 2.google.protobuf.TimestampA + completeness ( 2+.grafeas.v1.SlsaProvenance.SlsaCompleteness + reproducible ( + SlsaBuilder + +id ( ‡ +Material +uri ( ? +digest ( 2/.grafeas.v1.SlsaProvenance.Material.DigestEntry- + DigestEntry +key (  +value ( :8Bf + io.grafeas.v1BSlsaProvenanceProtoPZ8google.golang.org/genproto/googleapis/grafeas/v1;grafeas¢GRAbproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/GPBMetadata/Grafeas/V1/SlsaProvenanceZeroTwo.php b/owl-bot-staging/Grafeas/v1/proto/src/GPBMetadata/Grafeas/V1/SlsaProvenanceZeroTwo.php new file mode 100644 index 000000000000..2df7242755b6 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/GPBMetadata/Grafeas/V1/SlsaProvenanceZeroTwo.php @@ -0,0 +1,71 @@ +internalAddGeneratedFile( + ' +¥ +)grafeas/v1/slsa_provenance_zero_two.proto +grafeas.v1google/protobuf/timestamp.proto"Ó +SlsaProvenanceZeroTwo> +builder ( 2-.grafeas.v1.SlsaProvenanceZeroTwo.SlsaBuilder + +build_type ( D + +invocation ( 20.grafeas.v1.SlsaProvenanceZeroTwo.SlsaInvocation- + build_config ( 2.google.protobuf.Struct@ +metadata ( 2..grafeas.v1.SlsaProvenanceZeroTwo.SlsaMetadataA + materials ( 2..grafeas.v1.SlsaProvenanceZeroTwo.SlsaMaterial + SlsaBuilder + +id ( – + SlsaMaterial +uri ( J +digest ( 2:.grafeas.v1.SlsaProvenanceZeroTwo.SlsaMaterial.DigestEntry- + DigestEntry +key (  +value ( :8¶ +SlsaInvocationI + config_source ( 22.grafeas.v1.SlsaProvenanceZeroTwo.SlsaConfigSource+ + +parameters ( 2.google.protobuf.Struct, + environment ( 2.google.protobuf.Struct³ +SlsaConfigSource +uri ( N +digest ( 2>.grafeas.v1.SlsaProvenanceZeroTwo.SlsaConfigSource.DigestEntry + entry_point ( - + DigestEntry +key (  +value ( :8ø + SlsaMetadata +build_invocation_id ( 4 +build_started_on ( 2.google.protobuf.Timestamp5 +build_finished_on ( 2.google.protobuf.TimestampH + completeness ( 22.grafeas.v1.SlsaProvenanceZeroTwo.SlsaCompleteness + reproducible (N +SlsaCompleteness + +parameters ( + environment ( + materials (Bm + io.grafeas.v1BSlsaProvenanceZeroTwoProtoPZ8google.golang.org/genproto/googleapis/grafeas/v1;grafeas¢GRAbproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/GPBMetadata/Grafeas/V1/Upgrade.php b/owl-bot-staging/Grafeas/v1/proto/src/GPBMetadata/Grafeas/V1/Upgrade.php new file mode 100644 index 000000000000..ccca29a0b7e1 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/GPBMetadata/Grafeas/V1/Upgrade.php @@ -0,0 +1,60 @@ +internalAddGeneratedFile( + ' +Ù +grafeas/v1/upgrade.proto +grafeas.v1grafeas/v1/package.proto"¯ + UpgradeNote +package ( $ +version ( 2.grafeas.v1.Version6 + distributions ( 2.grafeas.v1.UpgradeDistribution1 +windows_update ( 2.grafeas.v1.WindowsUpdate"] +UpgradeDistribution +cpe_uri (  +classification (  +severity (  +cve ( "ì + WindowsUpdate4 +identity ( 2".grafeas.v1.WindowsUpdate.Identity +title (  + description ( 6 + +categories ( 2".grafeas.v1.WindowsUpdate.Category +kb_article_ids (  + support_url ( < +last_published_timestamp ( 2.google.protobuf.Timestamp/ +Identity + update_id (  +revision (- +Category + category_id (  +name ( "» +UpgradeOccurrence +package ( + +parsed_version ( 2.grafeas.v1.Version5 + distribution ( 2.grafeas.v1.UpgradeDistribution1 +windows_update ( 2.grafeas.v1.WindowsUpdateBQ + io.grafeas.v1PZ8google.golang.org/genproto/googleapis/grafeas/v1;grafeas¢GRAbproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/GPBMetadata/Grafeas/V1/Vex.php b/owl-bot-staging/Grafeas/v1/proto/src/GPBMetadata/Grafeas/V1/Vex.php new file mode 100644 index 000000000000..4a915579a237 Binary files /dev/null and b/owl-bot-staging/Grafeas/v1/proto/src/GPBMetadata/Grafeas/V1/Vex.php differ diff --git a/owl-bot-staging/Grafeas/v1/proto/src/GPBMetadata/Grafeas/V1/Vulnerability.php b/owl-bot-staging/Grafeas/v1/proto/src/GPBMetadata/Grafeas/V1/Vulnerability.php new file mode 100644 index 000000000000..8886bd996b0f --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/GPBMetadata/Grafeas/V1/Vulnerability.php @@ -0,0 +1,106 @@ +internalAddGeneratedFile( + ' +ø +grafeas/v1/vulnerability.proto +grafeas.v1google/protobuf/timestamp.protografeas/v1/common.protografeas/v1/cvss.protografeas/v1/package.protografeas/v1/severity.protografeas/v1/vex.proto"ì +VulnerabilityNote + +cvss_score (& +severity (2.grafeas.v1.Severity5 +details ( 2$.grafeas.v1.VulnerabilityNote.Detail# +cvss_v3 ( 2.grafeas.v1.CVSSv3D +windows_details ( 2+.grafeas.v1.VulnerabilityNote.WindowsDetail6 +source_update_time ( 2.google.protobuf.Timestamp- + cvss_version (2.grafeas.v1.CVSSVersion! +cvss_v2 ( 2.grafeas.v1.CVSS­ +Detail + severity_name (  + description (  + package_type (  +affected_cpe_uri (  +affected_package ( 3 +affected_version_start ( 2.grafeas.v1.Version1 +affected_version_end ( 2.grafeas.v1.Version + fixed_cpe_uri (  + fixed_package ( * + fixed_version + ( 2.grafeas.v1.Version + is_obsolete (6 +source_update_time ( 2.google.protobuf.Timestamp +source (  +vendor ( ¾ + WindowsDetail +cpe_uri (  +name (  + description ( M + +fixing_kbs ( 29.grafeas.v1.VulnerabilityNote.WindowsDetail.KnowledgeBase* + KnowledgeBase +name (  +url ( "ã +VulnerabilityOccurrence +type ( & +severity (2.grafeas.v1.Severity + +cvss_score ( +cvssv3 + ( 2.grafeas.v1.CVSSG + package_issue ( 20.grafeas.v1.VulnerabilityOccurrence.PackageIssue +short_description (  +long_description ( , + related_urls ( 2.grafeas.v1.RelatedUrl0 +effective_severity (2.grafeas.v1.Severity + fix_available (- + cvss_version (2.grafeas.v1.CVSSVersion! +cvss_v2 ( 2.grafeas.v1.CVSSI +vex_assessment ( 21.grafeas.v1.VulnerabilityOccurrence.VexAssessmentà + PackageIssue +affected_cpe_uri (  +affected_package ( - +affected_version ( 2.grafeas.v1.Version + fixed_cpe_uri (  + fixed_package ( * + fixed_version ( 2.grafeas.v1.Version + fix_available ( + package_type ( 5 +effective_severity (2.grafeas.v1.SeverityBàA/ + file_location + ( 2.grafeas.v1.FileLocationæ + VexAssessment +cve ( , + related_uris ( 2.grafeas.v1.RelatedUrl + note_name ( G +state (28.grafeas.v1.VulnerabilityAssessmentNote.Assessment.State +impacts ( T + remediations ( 2>.grafeas.v1.VulnerabilityAssessmentNote.Assessment.RemediationW + justification ( 2@.grafeas.v1.VulnerabilityAssessmentNote.Assessment.JustificationBQ + io.grafeas.v1PZ8google.golang.org/genproto/googleapis/grafeas/v1;grafeas¢GRAbproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/AliasContext.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/AliasContext.php new file mode 100644 index 000000000000..36f9800b4f76 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/AliasContext.php @@ -0,0 +1,101 @@ +grafeas.v1.AliasContext + */ +class AliasContext extends \Google\Protobuf\Internal\Message +{ + /** + * The alias kind. + * + * Generated from protobuf field .grafeas.v1.AliasContext.Kind kind = 1; + */ + protected $kind = 0; + /** + * The alias name. + * + * Generated from protobuf field string name = 2; + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $kind + * The alias kind. + * @type string $name + * The alias name. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Provenance::initOnce(); + parent::__construct($data); + } + + /** + * The alias kind. + * + * Generated from protobuf field .grafeas.v1.AliasContext.Kind kind = 1; + * @return int + */ + public function getKind() + { + return $this->kind; + } + + /** + * The alias kind. + * + * Generated from protobuf field .grafeas.v1.AliasContext.Kind kind = 1; + * @param int $var + * @return $this + */ + public function setKind($var) + { + GPBUtil::checkEnum($var, \Grafeas\V1\AliasContext\Kind::class); + $this->kind = $var; + + return $this; + } + + /** + * The alias name. + * + * Generated from protobuf field string name = 2; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The alias name. + * + * Generated from protobuf field string name = 2; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/AliasContext/Kind.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/AliasContext/Kind.php new file mode 100644 index 000000000000..f46137817ef2 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/AliasContext/Kind.php @@ -0,0 +1,72 @@ +grafeas.v1.AliasContext.Kind + */ +class Kind +{ + /** + * Unknown. + * + * Generated from protobuf enum KIND_UNSPECIFIED = 0; + */ + const KIND_UNSPECIFIED = 0; + /** + * Git tag. + * + * Generated from protobuf enum FIXED = 1; + */ + const FIXED = 1; + /** + * Git branch. + * + * Generated from protobuf enum MOVABLE = 2; + */ + const MOVABLE = 2; + /** + * Used to specify non-standard aliases. For example, if a Git repo has a + * ref named "refs/foo/bar". + * + * Generated from protobuf enum OTHER = 4; + */ + const OTHER = 4; + + private static $valueToName = [ + self::KIND_UNSPECIFIED => 'KIND_UNSPECIFIED', + self::FIXED => 'FIXED', + self::MOVABLE => 'MOVABLE', + self::OTHER => 'OTHER', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Kind::class, \Grafeas\V1\AliasContext_Kind::class); + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/AliasContext_Kind.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/AliasContext_Kind.php new file mode 100644 index 000000000000..823c2dd74880 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/AliasContext_Kind.php @@ -0,0 +1,16 @@ +grafeas.v1.Architecture + */ +class Architecture +{ + /** + * Unknown architecture. + * + * Generated from protobuf enum ARCHITECTURE_UNSPECIFIED = 0; + */ + const ARCHITECTURE_UNSPECIFIED = 0; + /** + * X86 architecture. + * + * Generated from protobuf enum X86 = 1; + */ + const X86 = 1; + /** + * X64 architecture. + * + * Generated from protobuf enum X64 = 2; + */ + const X64 = 2; + + private static $valueToName = [ + self::ARCHITECTURE_UNSPECIFIED => 'ARCHITECTURE_UNSPECIFIED', + self::X86 => 'X86', + self::X64 => 'X64', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/Artifact.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/Artifact.php new file mode 100644 index 000000000000..ff6f4d0a38d3 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/Artifact.php @@ -0,0 +1,159 @@ +grafeas.v1.Artifact + */ +class Artifact extends \Google\Protobuf\Internal\Message +{ + /** + * Hash or checksum value of a binary, or Docker Registry 2.0 digest of a + * container. + * + * Generated from protobuf field string checksum = 1; + */ + protected $checksum = ''; + /** + * Artifact ID, if any; for container images, this will be a URL by digest + * like `gcr.io/projectID/imagename@sha256:123456`. + * + * Generated from protobuf field string id = 2; + */ + protected $id = ''; + /** + * Related artifact names. This may be the path to a binary or jar file, or in + * the case of a container build, the name used to push the container image to + * Google Container Registry, as presented to `docker push`. Note that a + * single Artifact ID can have multiple names, for example if two tags are + * applied to one image. + * + * Generated from protobuf field repeated string names = 3; + */ + private $names; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $checksum + * Hash or checksum value of a binary, or Docker Registry 2.0 digest of a + * container. + * @type string $id + * Artifact ID, if any; for container images, this will be a URL by digest + * like `gcr.io/projectID/imagename@sha256:123456`. + * @type array|\Google\Protobuf\Internal\RepeatedField $names + * Related artifact names. This may be the path to a binary or jar file, or in + * the case of a container build, the name used to push the container image to + * Google Container Registry, as presented to `docker push`. Note that a + * single Artifact ID can have multiple names, for example if two tags are + * applied to one image. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Provenance::initOnce(); + parent::__construct($data); + } + + /** + * Hash or checksum value of a binary, or Docker Registry 2.0 digest of a + * container. + * + * Generated from protobuf field string checksum = 1; + * @return string + */ + public function getChecksum() + { + return $this->checksum; + } + + /** + * Hash or checksum value of a binary, or Docker Registry 2.0 digest of a + * container. + * + * Generated from protobuf field string checksum = 1; + * @param string $var + * @return $this + */ + public function setChecksum($var) + { + GPBUtil::checkString($var, True); + $this->checksum = $var; + + return $this; + } + + /** + * Artifact ID, if any; for container images, this will be a URL by digest + * like `gcr.io/projectID/imagename@sha256:123456`. + * + * Generated from protobuf field string id = 2; + * @return string + */ + public function getId() + { + return $this->id; + } + + /** + * Artifact ID, if any; for container images, this will be a URL by digest + * like `gcr.io/projectID/imagename@sha256:123456`. + * + * Generated from protobuf field string id = 2; + * @param string $var + * @return $this + */ + public function setId($var) + { + GPBUtil::checkString($var, True); + $this->id = $var; + + return $this; + } + + /** + * Related artifact names. This may be the path to a binary or jar file, or in + * the case of a container build, the name used to push the container image to + * Google Container Registry, as presented to `docker push`. Note that a + * single Artifact ID can have multiple names, for example if two tags are + * applied to one image. + * + * Generated from protobuf field repeated string names = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getNames() + { + return $this->names; + } + + /** + * Related artifact names. This may be the path to a binary or jar file, or in + * the case of a container build, the name used to push the container image to + * Google Container Registry, as presented to `docker push`. Note that a + * single Artifact ID can have multiple names, for example if two tags are + * applied to one image. + * + * Generated from protobuf field repeated string names = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setNames($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->names = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/AttestationNote.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/AttestationNote.php new file mode 100644 index 000000000000..f6c61a7ac8f0 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/AttestationNote.php @@ -0,0 +1,84 @@ +grafeas.v1.AttestationNote + */ +class AttestationNote extends \Google\Protobuf\Internal\Message +{ + /** + * Hint hints at the purpose of the attestation authority. + * + * Generated from protobuf field .grafeas.v1.AttestationNote.Hint hint = 1; + */ + protected $hint = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Grafeas\V1\AttestationNote\Hint $hint + * Hint hints at the purpose of the attestation authority. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Attestation::initOnce(); + parent::__construct($data); + } + + /** + * Hint hints at the purpose of the attestation authority. + * + * Generated from protobuf field .grafeas.v1.AttestationNote.Hint hint = 1; + * @return \Grafeas\V1\AttestationNote\Hint|null + */ + public function getHint() + { + return $this->hint; + } + + public function hasHint() + { + return isset($this->hint); + } + + public function clearHint() + { + unset($this->hint); + } + + /** + * Hint hints at the purpose of the attestation authority. + * + * Generated from protobuf field .grafeas.v1.AttestationNote.Hint hint = 1; + * @param \Grafeas\V1\AttestationNote\Hint $var + * @return $this + */ + public function setHint($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\AttestationNote\Hint::class); + $this->hint = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/AttestationNote/Hint.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/AttestationNote/Hint.php new file mode 100644 index 000000000000..a9646f504708 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/AttestationNote/Hint.php @@ -0,0 +1,80 @@ +grafeas.v1.AttestationNote.Hint + */ +class Hint extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The human readable name of this attestation authority, for + * example "qa". + * + * Generated from protobuf field string human_readable_name = 1; + */ + protected $human_readable_name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $human_readable_name + * Required. The human readable name of this attestation authority, for + * example "qa". + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Attestation::initOnce(); + parent::__construct($data); + } + + /** + * Required. The human readable name of this attestation authority, for + * example "qa". + * + * Generated from protobuf field string human_readable_name = 1; + * @return string + */ + public function getHumanReadableName() + { + return $this->human_readable_name; + } + + /** + * Required. The human readable name of this attestation authority, for + * example "qa". + * + * Generated from protobuf field string human_readable_name = 1; + * @param string $var + * @return $this + */ + public function setHumanReadableName($var) + { + GPBUtil::checkString($var, True); + $this->human_readable_name = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Hint::class, \Grafeas\V1\AttestationNote_Hint::class); + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/AttestationNote_Hint.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/AttestationNote_Hint.php new file mode 100644 index 000000000000..ce2b4bc895f5 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/AttestationNote_Hint.php @@ -0,0 +1,16 @@ +grafeas.v1.AttestationOccurrence + */ +class AttestationOccurrence extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The serialized payload that is verified by one or more + * `signatures`. + * + * Generated from protobuf field bytes serialized_payload = 1; + */ + protected $serialized_payload = ''; + /** + * One or more signatures over `serialized_payload`. Verifier implementations + * should consider this attestation message verified if at least one + * `signature` verifies `serialized_payload`. See `Signature` in common.proto + * for more details on signature structure and verification. + * + * Generated from protobuf field repeated .grafeas.v1.Signature signatures = 2; + */ + private $signatures; + /** + * One or more JWTs encoding a self-contained attestation. + * Each JWT encodes the payload that it verifies within the JWT itself. + * Verifier implementation SHOULD ignore the `serialized_payload` field + * when verifying these JWTs. + * If only JWTs are present on this AttestationOccurrence, then the + * `serialized_payload` SHOULD be left empty. + * Each JWT SHOULD encode a claim specific to the `resource_uri` of this + * Occurrence, but this is not validated by Grafeas metadata API + * implementations. The JWT itself is opaque to Grafeas. + * + * Generated from protobuf field repeated .grafeas.v1.Jwt jwts = 3; + */ + private $jwts; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $serialized_payload + * Required. The serialized payload that is verified by one or more + * `signatures`. + * @type array<\Grafeas\V1\Signature>|\Google\Protobuf\Internal\RepeatedField $signatures + * One or more signatures over `serialized_payload`. Verifier implementations + * should consider this attestation message verified if at least one + * `signature` verifies `serialized_payload`. See `Signature` in common.proto + * for more details on signature structure and verification. + * @type array<\Grafeas\V1\Jwt>|\Google\Protobuf\Internal\RepeatedField $jwts + * One or more JWTs encoding a self-contained attestation. + * Each JWT encodes the payload that it verifies within the JWT itself. + * Verifier implementation SHOULD ignore the `serialized_payload` field + * when verifying these JWTs. + * If only JWTs are present on this AttestationOccurrence, then the + * `serialized_payload` SHOULD be left empty. + * Each JWT SHOULD encode a claim specific to the `resource_uri` of this + * Occurrence, but this is not validated by Grafeas metadata API + * implementations. The JWT itself is opaque to Grafeas. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Attestation::initOnce(); + parent::__construct($data); + } + + /** + * Required. The serialized payload that is verified by one or more + * `signatures`. + * + * Generated from protobuf field bytes serialized_payload = 1; + * @return string + */ + public function getSerializedPayload() + { + return $this->serialized_payload; + } + + /** + * Required. The serialized payload that is verified by one or more + * `signatures`. + * + * Generated from protobuf field bytes serialized_payload = 1; + * @param string $var + * @return $this + */ + public function setSerializedPayload($var) + { + GPBUtil::checkString($var, False); + $this->serialized_payload = $var; + + return $this; + } + + /** + * One or more signatures over `serialized_payload`. Verifier implementations + * should consider this attestation message verified if at least one + * `signature` verifies `serialized_payload`. See `Signature` in common.proto + * for more details on signature structure and verification. + * + * Generated from protobuf field repeated .grafeas.v1.Signature signatures = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSignatures() + { + return $this->signatures; + } + + /** + * One or more signatures over `serialized_payload`. Verifier implementations + * should consider this attestation message verified if at least one + * `signature` verifies `serialized_payload`. See `Signature` in common.proto + * for more details on signature structure and verification. + * + * Generated from protobuf field repeated .grafeas.v1.Signature signatures = 2; + * @param array<\Grafeas\V1\Signature>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSignatures($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Grafeas\V1\Signature::class); + $this->signatures = $arr; + + return $this; + } + + /** + * One or more JWTs encoding a self-contained attestation. + * Each JWT encodes the payload that it verifies within the JWT itself. + * Verifier implementation SHOULD ignore the `serialized_payload` field + * when verifying these JWTs. + * If only JWTs are present on this AttestationOccurrence, then the + * `serialized_payload` SHOULD be left empty. + * Each JWT SHOULD encode a claim specific to the `resource_uri` of this + * Occurrence, but this is not validated by Grafeas metadata API + * implementations. The JWT itself is opaque to Grafeas. + * + * Generated from protobuf field repeated .grafeas.v1.Jwt jwts = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getJwts() + { + return $this->jwts; + } + + /** + * One or more JWTs encoding a self-contained attestation. + * Each JWT encodes the payload that it verifies within the JWT itself. + * Verifier implementation SHOULD ignore the `serialized_payload` field + * when verifying these JWTs. + * If only JWTs are present on this AttestationOccurrence, then the + * `serialized_payload` SHOULD be left empty. + * Each JWT SHOULD encode a claim specific to the `resource_uri` of this + * Occurrence, but this is not validated by Grafeas metadata API + * implementations. The JWT itself is opaque to Grafeas. + * + * Generated from protobuf field repeated .grafeas.v1.Jwt jwts = 3; + * @param array<\Grafeas\V1\Jwt>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setJwts($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Grafeas\V1\Jwt::class); + $this->jwts = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/BatchCreateNotesRequest.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/BatchCreateNotesRequest.php new file mode 100644 index 000000000000..57d5ba438a91 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/BatchCreateNotesRequest.php @@ -0,0 +1,122 @@ +grafeas.v1.BatchCreateNotesRequest + */ +class BatchCreateNotesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the project in the form of `projects/[PROJECT_ID]`, under which + * the notes are to be created. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The notes to create. Max allowed length is 1000. + * + * Generated from protobuf field map notes = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + private $notes; + + /** + * @param string $parent The name of the project in the form of `projects/[PROJECT_ID]`, under which + * the notes are to be created. Please see + * {@see GrafeasClient::projectName()} for help formatting this field. + * @param array $notes The notes to create. Max allowed length is 1000. + * + * @return \Grafeas\V1\BatchCreateNotesRequest + * + * @experimental + */ + public static function build(string $parent, array $notes): self + { + return (new self()) + ->setParent($parent) + ->setNotes($notes); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * The name of the project in the form of `projects/[PROJECT_ID]`, under which + * the notes are to be created. + * @type array|\Google\Protobuf\Internal\MapField $notes + * The notes to create. Max allowed length is 1000. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Grafeas::initOnce(); + parent::__construct($data); + } + + /** + * The name of the project in the form of `projects/[PROJECT_ID]`, under which + * the notes are to be created. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * The name of the project in the form of `projects/[PROJECT_ID]`, under which + * the notes are to be created. + * + * 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; + } + + /** + * The notes to create. Max allowed length is 1000. + * + * Generated from protobuf field map notes = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\MapField + */ + public function getNotes() + { + return $this->notes; + } + + /** + * The notes to create. Max allowed length is 1000. + * + * Generated from protobuf field map notes = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setNotes($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Grafeas\V1\Note::class); + $this->notes = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/BatchCreateNotesResponse.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/BatchCreateNotesResponse.php new file mode 100644 index 000000000000..da4f910330f7 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/BatchCreateNotesResponse.php @@ -0,0 +1,67 @@ +grafeas.v1.BatchCreateNotesResponse + */ +class BatchCreateNotesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The notes that were created. + * + * Generated from protobuf field repeated .grafeas.v1.Note notes = 1; + */ + private $notes; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Grafeas\V1\Note>|\Google\Protobuf\Internal\RepeatedField $notes + * The notes that were created. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Grafeas::initOnce(); + parent::__construct($data); + } + + /** + * The notes that were created. + * + * Generated from protobuf field repeated .grafeas.v1.Note notes = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getNotes() + { + return $this->notes; + } + + /** + * The notes that were created. + * + * Generated from protobuf field repeated .grafeas.v1.Note notes = 1; + * @param array<\Grafeas\V1\Note>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setNotes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Grafeas\V1\Note::class); + $this->notes = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/BatchCreateOccurrencesRequest.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/BatchCreateOccurrencesRequest.php new file mode 100644 index 000000000000..353ab9a1b68f --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/BatchCreateOccurrencesRequest.php @@ -0,0 +1,122 @@ +grafeas.v1.BatchCreateOccurrencesRequest + */ +class BatchCreateOccurrencesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the project in the form of `projects/[PROJECT_ID]`, under which + * the occurrences are to be created. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The occurrences to create. Max allowed length is 1000. + * + * Generated from protobuf field repeated .grafeas.v1.Occurrence occurrences = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + private $occurrences; + + /** + * @param string $parent The name of the project in the form of `projects/[PROJECT_ID]`, under which + * the occurrences are to be created. Please see + * {@see GrafeasClient::projectName()} for help formatting this field. + * @param \Grafeas\V1\Occurrence[] $occurrences The occurrences to create. Max allowed length is 1000. + * + * @return \Grafeas\V1\BatchCreateOccurrencesRequest + * + * @experimental + */ + public static function build(string $parent, array $occurrences): self + { + return (new self()) + ->setParent($parent) + ->setOccurrences($occurrences); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * The name of the project in the form of `projects/[PROJECT_ID]`, under which + * the occurrences are to be created. + * @type array<\Grafeas\V1\Occurrence>|\Google\Protobuf\Internal\RepeatedField $occurrences + * The occurrences to create. Max allowed length is 1000. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Grafeas::initOnce(); + parent::__construct($data); + } + + /** + * The name of the project in the form of `projects/[PROJECT_ID]`, under which + * the occurrences are to be created. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * The name of the project in the form of `projects/[PROJECT_ID]`, under which + * the occurrences are to be created. + * + * 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; + } + + /** + * The occurrences to create. Max allowed length is 1000. + * + * Generated from protobuf field repeated .grafeas.v1.Occurrence occurrences = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getOccurrences() + { + return $this->occurrences; + } + + /** + * The occurrences to create. Max allowed length is 1000. + * + * Generated from protobuf field repeated .grafeas.v1.Occurrence occurrences = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param array<\Grafeas\V1\Occurrence>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setOccurrences($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Grafeas\V1\Occurrence::class); + $this->occurrences = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/BatchCreateOccurrencesResponse.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/BatchCreateOccurrencesResponse.php new file mode 100644 index 000000000000..ff03d5abda45 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/BatchCreateOccurrencesResponse.php @@ -0,0 +1,67 @@ +grafeas.v1.BatchCreateOccurrencesResponse + */ +class BatchCreateOccurrencesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The occurrences that were created. + * + * Generated from protobuf field repeated .grafeas.v1.Occurrence occurrences = 1; + */ + private $occurrences; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Grafeas\V1\Occurrence>|\Google\Protobuf\Internal\RepeatedField $occurrences + * The occurrences that were created. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Grafeas::initOnce(); + parent::__construct($data); + } + + /** + * The occurrences that were created. + * + * Generated from protobuf field repeated .grafeas.v1.Occurrence occurrences = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getOccurrences() + { + return $this->occurrences; + } + + /** + * The occurrences that were created. + * + * Generated from protobuf field repeated .grafeas.v1.Occurrence occurrences = 1; + * @param array<\Grafeas\V1\Occurrence>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setOccurrences($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Grafeas\V1\Occurrence::class); + $this->occurrences = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/BuildNote.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/BuildNote.php new file mode 100644 index 000000000000..033b8e22bb8c --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/BuildNote.php @@ -0,0 +1,68 @@ +grafeas.v1.BuildNote + */ +class BuildNote extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Immutable. Version of the builder which produced this build. + * + * Generated from protobuf field string builder_version = 1; + */ + protected $builder_version = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $builder_version + * Required. Immutable. Version of the builder which produced this build. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Build::initOnce(); + parent::__construct($data); + } + + /** + * Required. Immutable. Version of the builder which produced this build. + * + * Generated from protobuf field string builder_version = 1; + * @return string + */ + public function getBuilderVersion() + { + return $this->builder_version; + } + + /** + * Required. Immutable. Version of the builder which produced this build. + * + * Generated from protobuf field string builder_version = 1; + * @param string $var + * @return $this + */ + public function setBuilderVersion($var) + { + GPBUtil::checkString($var, True); + $this->builder_version = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/BuildOccurrence.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/BuildOccurrence.php new file mode 100644 index 000000000000..150d9122a82d --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/BuildOccurrence.php @@ -0,0 +1,251 @@ +grafeas.v1.BuildOccurrence + */ +class BuildOccurrence extends \Google\Protobuf\Internal\Message +{ + /** + * The actual provenance for the build. + * + * Generated from protobuf field .grafeas.v1.BuildProvenance provenance = 1; + */ + protected $provenance = null; + /** + * Serialized JSON representation of the provenance, used in generating the + * build signature in the corresponding build note. After verifying the + * signature, `provenance_bytes` can be unmarshalled and compared to the + * provenance to confirm that it is unchanged. A base64-encoded string + * representation of the provenance bytes is used for the signature in order + * to interoperate with openssl which expects this format for signature + * verification. + * The serialized form is captured both to avoid ambiguity in how the + * provenance is marshalled to json as well to prevent incompatibilities with + * future changes. + * + * Generated from protobuf field string provenance_bytes = 2; + */ + protected $provenance_bytes = ''; + /** + * Deprecated. See InTotoStatement for the replacement. + * In-toto Provenance representation as defined in spec. + * + * Generated from protobuf field .grafeas.v1.InTotoProvenance intoto_provenance = 3; + */ + protected $intoto_provenance = null; + /** + * In-toto Statement representation as defined in spec. + * The intoto_statement can contain any type of provenance. The serialized + * payload of the statement can be stored and signed in the Occurrence's + * envelope. + * + * Generated from protobuf field .grafeas.v1.InTotoStatement intoto_statement = 4; + */ + protected $intoto_statement = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Grafeas\V1\BuildProvenance $provenance + * The actual provenance for the build. + * @type string $provenance_bytes + * Serialized JSON representation of the provenance, used in generating the + * build signature in the corresponding build note. After verifying the + * signature, `provenance_bytes` can be unmarshalled and compared to the + * provenance to confirm that it is unchanged. A base64-encoded string + * representation of the provenance bytes is used for the signature in order + * to interoperate with openssl which expects this format for signature + * verification. + * The serialized form is captured both to avoid ambiguity in how the + * provenance is marshalled to json as well to prevent incompatibilities with + * future changes. + * @type \Grafeas\V1\InTotoProvenance $intoto_provenance + * Deprecated. See InTotoStatement for the replacement. + * In-toto Provenance representation as defined in spec. + * @type \Grafeas\V1\InTotoStatement $intoto_statement + * In-toto Statement representation as defined in spec. + * The intoto_statement can contain any type of provenance. The serialized + * payload of the statement can be stored and signed in the Occurrence's + * envelope. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Build::initOnce(); + parent::__construct($data); + } + + /** + * The actual provenance for the build. + * + * Generated from protobuf field .grafeas.v1.BuildProvenance provenance = 1; + * @return \Grafeas\V1\BuildProvenance|null + */ + public function getProvenance() + { + return $this->provenance; + } + + public function hasProvenance() + { + return isset($this->provenance); + } + + public function clearProvenance() + { + unset($this->provenance); + } + + /** + * The actual provenance for the build. + * + * Generated from protobuf field .grafeas.v1.BuildProvenance provenance = 1; + * @param \Grafeas\V1\BuildProvenance $var + * @return $this + */ + public function setProvenance($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\BuildProvenance::class); + $this->provenance = $var; + + return $this; + } + + /** + * Serialized JSON representation of the provenance, used in generating the + * build signature in the corresponding build note. After verifying the + * signature, `provenance_bytes` can be unmarshalled and compared to the + * provenance to confirm that it is unchanged. A base64-encoded string + * representation of the provenance bytes is used for the signature in order + * to interoperate with openssl which expects this format for signature + * verification. + * The serialized form is captured both to avoid ambiguity in how the + * provenance is marshalled to json as well to prevent incompatibilities with + * future changes. + * + * Generated from protobuf field string provenance_bytes = 2; + * @return string + */ + public function getProvenanceBytes() + { + return $this->provenance_bytes; + } + + /** + * Serialized JSON representation of the provenance, used in generating the + * build signature in the corresponding build note. After verifying the + * signature, `provenance_bytes` can be unmarshalled and compared to the + * provenance to confirm that it is unchanged. A base64-encoded string + * representation of the provenance bytes is used for the signature in order + * to interoperate with openssl which expects this format for signature + * verification. + * The serialized form is captured both to avoid ambiguity in how the + * provenance is marshalled to json as well to prevent incompatibilities with + * future changes. + * + * Generated from protobuf field string provenance_bytes = 2; + * @param string $var + * @return $this + */ + public function setProvenanceBytes($var) + { + GPBUtil::checkString($var, True); + $this->provenance_bytes = $var; + + return $this; + } + + /** + * Deprecated. See InTotoStatement for the replacement. + * In-toto Provenance representation as defined in spec. + * + * Generated from protobuf field .grafeas.v1.InTotoProvenance intoto_provenance = 3; + * @return \Grafeas\V1\InTotoProvenance|null + */ + public function getIntotoProvenance() + { + return $this->intoto_provenance; + } + + public function hasIntotoProvenance() + { + return isset($this->intoto_provenance); + } + + public function clearIntotoProvenance() + { + unset($this->intoto_provenance); + } + + /** + * Deprecated. See InTotoStatement for the replacement. + * In-toto Provenance representation as defined in spec. + * + * Generated from protobuf field .grafeas.v1.InTotoProvenance intoto_provenance = 3; + * @param \Grafeas\V1\InTotoProvenance $var + * @return $this + */ + public function setIntotoProvenance($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\InTotoProvenance::class); + $this->intoto_provenance = $var; + + return $this; + } + + /** + * In-toto Statement representation as defined in spec. + * The intoto_statement can contain any type of provenance. The serialized + * payload of the statement can be stored and signed in the Occurrence's + * envelope. + * + * Generated from protobuf field .grafeas.v1.InTotoStatement intoto_statement = 4; + * @return \Grafeas\V1\InTotoStatement|null + */ + public function getIntotoStatement() + { + return $this->intoto_statement; + } + + public function hasIntotoStatement() + { + return isset($this->intoto_statement); + } + + public function clearIntotoStatement() + { + unset($this->intoto_statement); + } + + /** + * In-toto Statement representation as defined in spec. + * The intoto_statement can contain any type of provenance. The serialized + * payload of the statement can be stored and signed in the Occurrence's + * envelope. + * + * Generated from protobuf field .grafeas.v1.InTotoStatement intoto_statement = 4; + * @param \Grafeas\V1\InTotoStatement $var + * @return $this + */ + public function setIntotoStatement($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\InTotoStatement::class); + $this->intoto_statement = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/BuildProvenance.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/BuildProvenance.php new file mode 100644 index 000000000000..8e8c3289d1ee --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/BuildProvenance.php @@ -0,0 +1,528 @@ +grafeas.v1.BuildProvenance + */ +class BuildProvenance extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Unique identifier of the build. + * + * Generated from protobuf field string id = 1; + */ + protected $id = ''; + /** + * ID of the project. + * + * Generated from protobuf field string project_id = 2; + */ + protected $project_id = ''; + /** + * Commands requested by the build. + * + * Generated from protobuf field repeated .grafeas.v1.Command commands = 3; + */ + private $commands; + /** + * Output of the build. + * + * Generated from protobuf field repeated .grafeas.v1.Artifact built_artifacts = 4; + */ + private $built_artifacts; + /** + * Time at which the build was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 5; + */ + protected $create_time = null; + /** + * Time at which execution of the build was started. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 6; + */ + protected $start_time = null; + /** + * Time at which execution of the build was finished. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 7; + */ + protected $end_time = null; + /** + * E-mail address of the user who initiated this build. Note that this was the + * user's e-mail address at the time the build was initiated; this address may + * not represent the same end-user for all time. + * + * Generated from protobuf field string creator = 8; + */ + protected $creator = ''; + /** + * URI where any logs for this provenance were written. + * + * Generated from protobuf field string logs_uri = 9; + */ + protected $logs_uri = ''; + /** + * Details of the Source input to the build. + * + * Generated from protobuf field .grafeas.v1.Source source_provenance = 10; + */ + protected $source_provenance = null; + /** + * Trigger identifier if the build was triggered automatically; empty if not. + * + * Generated from protobuf field string trigger_id = 11; + */ + protected $trigger_id = ''; + /** + * Special options applied to this build. This is a catch-all field where + * build providers can enter any desired additional details. + * + * Generated from protobuf field map build_options = 12; + */ + private $build_options; + /** + * Version string of the builder at the time this build was executed. + * + * Generated from protobuf field string builder_version = 13; + */ + protected $builder_version = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $id + * Required. Unique identifier of the build. + * @type string $project_id + * ID of the project. + * @type array<\Grafeas\V1\Command>|\Google\Protobuf\Internal\RepeatedField $commands + * Commands requested by the build. + * @type array<\Grafeas\V1\Artifact>|\Google\Protobuf\Internal\RepeatedField $built_artifacts + * Output of the build. + * @type \Google\Protobuf\Timestamp $create_time + * Time at which the build was created. + * @type \Google\Protobuf\Timestamp $start_time + * Time at which execution of the build was started. + * @type \Google\Protobuf\Timestamp $end_time + * Time at which execution of the build was finished. + * @type string $creator + * E-mail address of the user who initiated this build. Note that this was the + * user's e-mail address at the time the build was initiated; this address may + * not represent the same end-user for all time. + * @type string $logs_uri + * URI where any logs for this provenance were written. + * @type \Grafeas\V1\Source $source_provenance + * Details of the Source input to the build. + * @type string $trigger_id + * Trigger identifier if the build was triggered automatically; empty if not. + * @type array|\Google\Protobuf\Internal\MapField $build_options + * Special options applied to this build. This is a catch-all field where + * build providers can enter any desired additional details. + * @type string $builder_version + * Version string of the builder at the time this build was executed. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Provenance::initOnce(); + parent::__construct($data); + } + + /** + * Required. Unique identifier of the build. + * + * Generated from protobuf field string id = 1; + * @return string + */ + public function getId() + { + return $this->id; + } + + /** + * Required. Unique identifier of the build. + * + * Generated from protobuf field string id = 1; + * @param string $var + * @return $this + */ + public function setId($var) + { + GPBUtil::checkString($var, True); + $this->id = $var; + + return $this; + } + + /** + * ID of the project. + * + * Generated from protobuf field string project_id = 2; + * @return string + */ + public function getProjectId() + { + return $this->project_id; + } + + /** + * ID of the project. + * + * Generated from protobuf field string project_id = 2; + * @param string $var + * @return $this + */ + public function setProjectId($var) + { + GPBUtil::checkString($var, True); + $this->project_id = $var; + + return $this; + } + + /** + * Commands requested by the build. + * + * Generated from protobuf field repeated .grafeas.v1.Command commands = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getCommands() + { + return $this->commands; + } + + /** + * Commands requested by the build. + * + * Generated from protobuf field repeated .grafeas.v1.Command commands = 3; + * @param array<\Grafeas\V1\Command>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setCommands($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Grafeas\V1\Command::class); + $this->commands = $arr; + + return $this; + } + + /** + * Output of the build. + * + * Generated from protobuf field repeated .grafeas.v1.Artifact built_artifacts = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getBuiltArtifacts() + { + return $this->built_artifacts; + } + + /** + * Output of the build. + * + * Generated from protobuf field repeated .grafeas.v1.Artifact built_artifacts = 4; + * @param array<\Grafeas\V1\Artifact>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setBuiltArtifacts($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Grafeas\V1\Artifact::class); + $this->built_artifacts = $arr; + + return $this; + } + + /** + * Time at which the build was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 5; + * @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); + } + + /** + * Time at which the build was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 5; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Time at which execution of the build was started. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 6; + * @return \Google\Protobuf\Timestamp|null + */ + public function getStartTime() + { + return $this->start_time; + } + + public function hasStartTime() + { + return isset($this->start_time); + } + + public function clearStartTime() + { + unset($this->start_time); + } + + /** + * Time at which execution of the build was started. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 6; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setStartTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->start_time = $var; + + return $this; + } + + /** + * Time at which execution of the build was finished. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 7; + * @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); + } + + /** + * Time at which execution of the build was finished. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 7; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setEndTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->end_time = $var; + + return $this; + } + + /** + * E-mail address of the user who initiated this build. Note that this was the + * user's e-mail address at the time the build was initiated; this address may + * not represent the same end-user for all time. + * + * Generated from protobuf field string creator = 8; + * @return string + */ + public function getCreator() + { + return $this->creator; + } + + /** + * E-mail address of the user who initiated this build. Note that this was the + * user's e-mail address at the time the build was initiated; this address may + * not represent the same end-user for all time. + * + * Generated from protobuf field string creator = 8; + * @param string $var + * @return $this + */ + public function setCreator($var) + { + GPBUtil::checkString($var, True); + $this->creator = $var; + + return $this; + } + + /** + * URI where any logs for this provenance were written. + * + * Generated from protobuf field string logs_uri = 9; + * @return string + */ + public function getLogsUri() + { + return $this->logs_uri; + } + + /** + * URI where any logs for this provenance were written. + * + * Generated from protobuf field string logs_uri = 9; + * @param string $var + * @return $this + */ + public function setLogsUri($var) + { + GPBUtil::checkString($var, True); + $this->logs_uri = $var; + + return $this; + } + + /** + * Details of the Source input to the build. + * + * Generated from protobuf field .grafeas.v1.Source source_provenance = 10; + * @return \Grafeas\V1\Source|null + */ + public function getSourceProvenance() + { + return $this->source_provenance; + } + + public function hasSourceProvenance() + { + return isset($this->source_provenance); + } + + public function clearSourceProvenance() + { + unset($this->source_provenance); + } + + /** + * Details of the Source input to the build. + * + * Generated from protobuf field .grafeas.v1.Source source_provenance = 10; + * @param \Grafeas\V1\Source $var + * @return $this + */ + public function setSourceProvenance($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\Source::class); + $this->source_provenance = $var; + + return $this; + } + + /** + * Trigger identifier if the build was triggered automatically; empty if not. + * + * Generated from protobuf field string trigger_id = 11; + * @return string + */ + public function getTriggerId() + { + return $this->trigger_id; + } + + /** + * Trigger identifier if the build was triggered automatically; empty if not. + * + * Generated from protobuf field string trigger_id = 11; + * @param string $var + * @return $this + */ + public function setTriggerId($var) + { + GPBUtil::checkString($var, True); + $this->trigger_id = $var; + + return $this; + } + + /** + * Special options applied to this build. This is a catch-all field where + * build providers can enter any desired additional details. + * + * Generated from protobuf field map build_options = 12; + * @return \Google\Protobuf\Internal\MapField + */ + public function getBuildOptions() + { + return $this->build_options; + } + + /** + * Special options applied to this build. This is a catch-all field where + * build providers can enter any desired additional details. + * + * Generated from protobuf field map build_options = 12; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setBuildOptions($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->build_options = $arr; + + return $this; + } + + /** + * Version string of the builder at the time this build was executed. + * + * Generated from protobuf field string builder_version = 13; + * @return string + */ + public function getBuilderVersion() + { + return $this->builder_version; + } + + /** + * Version string of the builder at the time this build was executed. + * + * Generated from protobuf field string builder_version = 13; + * @param string $var + * @return $this + */ + public function setBuilderVersion($var) + { + GPBUtil::checkString($var, True); + $this->builder_version = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/BuilderConfig.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/BuilderConfig.php new file mode 100644 index 000000000000..97732fb870dd --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/BuilderConfig.php @@ -0,0 +1,58 @@ +grafeas.v1.BuilderConfig + */ +class BuilderConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field string id = 1; + */ + protected $id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $id + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\IntotoProvenance::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field string id = 1; + * @return string + */ + public function getId() + { + return $this->id; + } + + /** + * Generated from protobuf field string id = 1; + * @param string $var + * @return $this + */ + public function setId($var) + { + GPBUtil::checkString($var, True); + $this->id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/CVSS.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/CVSS.php new file mode 100644 index 000000000000..eed433379f38 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/CVSS.php @@ -0,0 +1,382 @@ +grafeas.v1.CVSS + */ +class CVSS extends \Google\Protobuf\Internal\Message +{ + /** + * The base score is a function of the base metric scores. + * + * Generated from protobuf field float base_score = 1; + */ + protected $base_score = 0.0; + /** + * Generated from protobuf field float exploitability_score = 2; + */ + protected $exploitability_score = 0.0; + /** + * Generated from protobuf field float impact_score = 3; + */ + protected $impact_score = 0.0; + /** + * Base Metrics + * Represents the intrinsic characteristics of a vulnerability that are + * constant over time and across user environments. + * + * Generated from protobuf field .grafeas.v1.CVSS.AttackVector attack_vector = 4; + */ + protected $attack_vector = 0; + /** + * Generated from protobuf field .grafeas.v1.CVSS.AttackComplexity attack_complexity = 5; + */ + protected $attack_complexity = 0; + /** + * Generated from protobuf field .grafeas.v1.CVSS.Authentication authentication = 6; + */ + protected $authentication = 0; + /** + * Generated from protobuf field .grafeas.v1.CVSS.PrivilegesRequired privileges_required = 7; + */ + protected $privileges_required = 0; + /** + * Generated from protobuf field .grafeas.v1.CVSS.UserInteraction user_interaction = 8; + */ + protected $user_interaction = 0; + /** + * Generated from protobuf field .grafeas.v1.CVSS.Scope scope = 9; + */ + protected $scope = 0; + /** + * Generated from protobuf field .grafeas.v1.CVSS.Impact confidentiality_impact = 10; + */ + protected $confidentiality_impact = 0; + /** + * Generated from protobuf field .grafeas.v1.CVSS.Impact integrity_impact = 11; + */ + protected $integrity_impact = 0; + /** + * Generated from protobuf field .grafeas.v1.CVSS.Impact availability_impact = 12; + */ + protected $availability_impact = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type float $base_score + * The base score is a function of the base metric scores. + * @type float $exploitability_score + * @type float $impact_score + * @type int $attack_vector + * Base Metrics + * Represents the intrinsic characteristics of a vulnerability that are + * constant over time and across user environments. + * @type int $attack_complexity + * @type int $authentication + * @type int $privileges_required + * @type int $user_interaction + * @type int $scope + * @type int $confidentiality_impact + * @type int $integrity_impact + * @type int $availability_impact + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Cvss::initOnce(); + parent::__construct($data); + } + + /** + * The base score is a function of the base metric scores. + * + * Generated from protobuf field float base_score = 1; + * @return float + */ + public function getBaseScore() + { + return $this->base_score; + } + + /** + * The base score is a function of the base metric scores. + * + * Generated from protobuf field float base_score = 1; + * @param float $var + * @return $this + */ + public function setBaseScore($var) + { + GPBUtil::checkFloat($var); + $this->base_score = $var; + + return $this; + } + + /** + * Generated from protobuf field float exploitability_score = 2; + * @return float + */ + public function getExploitabilityScore() + { + return $this->exploitability_score; + } + + /** + * Generated from protobuf field float exploitability_score = 2; + * @param float $var + * @return $this + */ + public function setExploitabilityScore($var) + { + GPBUtil::checkFloat($var); + $this->exploitability_score = $var; + + return $this; + } + + /** + * Generated from protobuf field float impact_score = 3; + * @return float + */ + public function getImpactScore() + { + return $this->impact_score; + } + + /** + * Generated from protobuf field float impact_score = 3; + * @param float $var + * @return $this + */ + public function setImpactScore($var) + { + GPBUtil::checkFloat($var); + $this->impact_score = $var; + + return $this; + } + + /** + * Base Metrics + * Represents the intrinsic characteristics of a vulnerability that are + * constant over time and across user environments. + * + * Generated from protobuf field .grafeas.v1.CVSS.AttackVector attack_vector = 4; + * @return int + */ + public function getAttackVector() + { + return $this->attack_vector; + } + + /** + * Base Metrics + * Represents the intrinsic characteristics of a vulnerability that are + * constant over time and across user environments. + * + * Generated from protobuf field .grafeas.v1.CVSS.AttackVector attack_vector = 4; + * @param int $var + * @return $this + */ + public function setAttackVector($var) + { + GPBUtil::checkEnum($var, \Grafeas\V1\CVSS\AttackVector::class); + $this->attack_vector = $var; + + return $this; + } + + /** + * Generated from protobuf field .grafeas.v1.CVSS.AttackComplexity attack_complexity = 5; + * @return int + */ + public function getAttackComplexity() + { + return $this->attack_complexity; + } + + /** + * Generated from protobuf field .grafeas.v1.CVSS.AttackComplexity attack_complexity = 5; + * @param int $var + * @return $this + */ + public function setAttackComplexity($var) + { + GPBUtil::checkEnum($var, \Grafeas\V1\CVSS\AttackComplexity::class); + $this->attack_complexity = $var; + + return $this; + } + + /** + * Generated from protobuf field .grafeas.v1.CVSS.Authentication authentication = 6; + * @return int + */ + public function getAuthentication() + { + return $this->authentication; + } + + /** + * Generated from protobuf field .grafeas.v1.CVSS.Authentication authentication = 6; + * @param int $var + * @return $this + */ + public function setAuthentication($var) + { + GPBUtil::checkEnum($var, \Grafeas\V1\CVSS\Authentication::class); + $this->authentication = $var; + + return $this; + } + + /** + * Generated from protobuf field .grafeas.v1.CVSS.PrivilegesRequired privileges_required = 7; + * @return int + */ + public function getPrivilegesRequired() + { + return $this->privileges_required; + } + + /** + * Generated from protobuf field .grafeas.v1.CVSS.PrivilegesRequired privileges_required = 7; + * @param int $var + * @return $this + */ + public function setPrivilegesRequired($var) + { + GPBUtil::checkEnum($var, \Grafeas\V1\CVSS\PrivilegesRequired::class); + $this->privileges_required = $var; + + return $this; + } + + /** + * Generated from protobuf field .grafeas.v1.CVSS.UserInteraction user_interaction = 8; + * @return int + */ + public function getUserInteraction() + { + return $this->user_interaction; + } + + /** + * Generated from protobuf field .grafeas.v1.CVSS.UserInteraction user_interaction = 8; + * @param int $var + * @return $this + */ + public function setUserInteraction($var) + { + GPBUtil::checkEnum($var, \Grafeas\V1\CVSS\UserInteraction::class); + $this->user_interaction = $var; + + return $this; + } + + /** + * Generated from protobuf field .grafeas.v1.CVSS.Scope scope = 9; + * @return int + */ + public function getScope() + { + return $this->scope; + } + + /** + * Generated from protobuf field .grafeas.v1.CVSS.Scope scope = 9; + * @param int $var + * @return $this + */ + public function setScope($var) + { + GPBUtil::checkEnum($var, \Grafeas\V1\CVSS\Scope::class); + $this->scope = $var; + + return $this; + } + + /** + * Generated from protobuf field .grafeas.v1.CVSS.Impact confidentiality_impact = 10; + * @return int + */ + public function getConfidentialityImpact() + { + return $this->confidentiality_impact; + } + + /** + * Generated from protobuf field .grafeas.v1.CVSS.Impact confidentiality_impact = 10; + * @param int $var + * @return $this + */ + public function setConfidentialityImpact($var) + { + GPBUtil::checkEnum($var, \Grafeas\V1\CVSS\Impact::class); + $this->confidentiality_impact = $var; + + return $this; + } + + /** + * Generated from protobuf field .grafeas.v1.CVSS.Impact integrity_impact = 11; + * @return int + */ + public function getIntegrityImpact() + { + return $this->integrity_impact; + } + + /** + * Generated from protobuf field .grafeas.v1.CVSS.Impact integrity_impact = 11; + * @param int $var + * @return $this + */ + public function setIntegrityImpact($var) + { + GPBUtil::checkEnum($var, \Grafeas\V1\CVSS\Impact::class); + $this->integrity_impact = $var; + + return $this; + } + + /** + * Generated from protobuf field .grafeas.v1.CVSS.Impact availability_impact = 12; + * @return int + */ + public function getAvailabilityImpact() + { + return $this->availability_impact; + } + + /** + * Generated from protobuf field .grafeas.v1.CVSS.Impact availability_impact = 12; + * @param int $var + * @return $this + */ + public function setAvailabilityImpact($var) + { + GPBUtil::checkEnum($var, \Grafeas\V1\CVSS\Impact::class); + $this->availability_impact = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/CVSS/AttackComplexity.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/CVSS/AttackComplexity.php new file mode 100644 index 000000000000..011e833e68aa --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/CVSS/AttackComplexity.php @@ -0,0 +1,61 @@ +grafeas.v1.CVSS.AttackComplexity + */ +class AttackComplexity +{ + /** + * Generated from protobuf enum ATTACK_COMPLEXITY_UNSPECIFIED = 0; + */ + const ATTACK_COMPLEXITY_UNSPECIFIED = 0; + /** + * Generated from protobuf enum ATTACK_COMPLEXITY_LOW = 1; + */ + const ATTACK_COMPLEXITY_LOW = 1; + /** + * Generated from protobuf enum ATTACK_COMPLEXITY_HIGH = 2; + */ + const ATTACK_COMPLEXITY_HIGH = 2; + /** + * Generated from protobuf enum ATTACK_COMPLEXITY_MEDIUM = 3; + */ + const ATTACK_COMPLEXITY_MEDIUM = 3; + + private static $valueToName = [ + self::ATTACK_COMPLEXITY_UNSPECIFIED => 'ATTACK_COMPLEXITY_UNSPECIFIED', + self::ATTACK_COMPLEXITY_LOW => 'ATTACK_COMPLEXITY_LOW', + self::ATTACK_COMPLEXITY_HIGH => 'ATTACK_COMPLEXITY_HIGH', + self::ATTACK_COMPLEXITY_MEDIUM => 'ATTACK_COMPLEXITY_MEDIUM', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(AttackComplexity::class, \Grafeas\V1\CVSS_AttackComplexity::class); + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/CVSS/AttackVector.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/CVSS/AttackVector.php new file mode 100644 index 000000000000..e012b40cdfd8 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/CVSS/AttackVector.php @@ -0,0 +1,66 @@ +grafeas.v1.CVSS.AttackVector + */ +class AttackVector +{ + /** + * Generated from protobuf enum ATTACK_VECTOR_UNSPECIFIED = 0; + */ + const ATTACK_VECTOR_UNSPECIFIED = 0; + /** + * Generated from protobuf enum ATTACK_VECTOR_NETWORK = 1; + */ + const ATTACK_VECTOR_NETWORK = 1; + /** + * Generated from protobuf enum ATTACK_VECTOR_ADJACENT = 2; + */ + const ATTACK_VECTOR_ADJACENT = 2; + /** + * Generated from protobuf enum ATTACK_VECTOR_LOCAL = 3; + */ + const ATTACK_VECTOR_LOCAL = 3; + /** + * Generated from protobuf enum ATTACK_VECTOR_PHYSICAL = 4; + */ + const ATTACK_VECTOR_PHYSICAL = 4; + + private static $valueToName = [ + self::ATTACK_VECTOR_UNSPECIFIED => 'ATTACK_VECTOR_UNSPECIFIED', + self::ATTACK_VECTOR_NETWORK => 'ATTACK_VECTOR_NETWORK', + self::ATTACK_VECTOR_ADJACENT => 'ATTACK_VECTOR_ADJACENT', + self::ATTACK_VECTOR_LOCAL => 'ATTACK_VECTOR_LOCAL', + self::ATTACK_VECTOR_PHYSICAL => 'ATTACK_VECTOR_PHYSICAL', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(AttackVector::class, \Grafeas\V1\CVSS_AttackVector::class); + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/CVSS/Authentication.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/CVSS/Authentication.php new file mode 100644 index 000000000000..3e49c8c45e11 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/CVSS/Authentication.php @@ -0,0 +1,61 @@ +grafeas.v1.CVSS.Authentication + */ +class Authentication +{ + /** + * Generated from protobuf enum AUTHENTICATION_UNSPECIFIED = 0; + */ + const AUTHENTICATION_UNSPECIFIED = 0; + /** + * Generated from protobuf enum AUTHENTICATION_MULTIPLE = 1; + */ + const AUTHENTICATION_MULTIPLE = 1; + /** + * Generated from protobuf enum AUTHENTICATION_SINGLE = 2; + */ + const AUTHENTICATION_SINGLE = 2; + /** + * Generated from protobuf enum AUTHENTICATION_NONE = 3; + */ + const AUTHENTICATION_NONE = 3; + + private static $valueToName = [ + self::AUTHENTICATION_UNSPECIFIED => 'AUTHENTICATION_UNSPECIFIED', + self::AUTHENTICATION_MULTIPLE => 'AUTHENTICATION_MULTIPLE', + self::AUTHENTICATION_SINGLE => 'AUTHENTICATION_SINGLE', + self::AUTHENTICATION_NONE => 'AUTHENTICATION_NONE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Authentication::class, \Grafeas\V1\CVSS_Authentication::class); + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/CVSS/Impact.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/CVSS/Impact.php new file mode 100644 index 000000000000..a7c402857bfd --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/CVSS/Impact.php @@ -0,0 +1,71 @@ +grafeas.v1.CVSS.Impact + */ +class Impact +{ + /** + * Generated from protobuf enum IMPACT_UNSPECIFIED = 0; + */ + const IMPACT_UNSPECIFIED = 0; + /** + * Generated from protobuf enum IMPACT_HIGH = 1; + */ + const IMPACT_HIGH = 1; + /** + * Generated from protobuf enum IMPACT_LOW = 2; + */ + const IMPACT_LOW = 2; + /** + * Generated from protobuf enum IMPACT_NONE = 3; + */ + const IMPACT_NONE = 3; + /** + * Generated from protobuf enum IMPACT_PARTIAL = 4; + */ + const IMPACT_PARTIAL = 4; + /** + * Generated from protobuf enum IMPACT_COMPLETE = 5; + */ + const IMPACT_COMPLETE = 5; + + private static $valueToName = [ + self::IMPACT_UNSPECIFIED => 'IMPACT_UNSPECIFIED', + self::IMPACT_HIGH => 'IMPACT_HIGH', + self::IMPACT_LOW => 'IMPACT_LOW', + self::IMPACT_NONE => 'IMPACT_NONE', + self::IMPACT_PARTIAL => 'IMPACT_PARTIAL', + self::IMPACT_COMPLETE => 'IMPACT_COMPLETE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Impact::class, \Grafeas\V1\CVSS_Impact::class); + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/CVSS/PrivilegesRequired.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/CVSS/PrivilegesRequired.php new file mode 100644 index 000000000000..b3f593d06893 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/CVSS/PrivilegesRequired.php @@ -0,0 +1,61 @@ +grafeas.v1.CVSS.PrivilegesRequired + */ +class PrivilegesRequired +{ + /** + * Generated from protobuf enum PRIVILEGES_REQUIRED_UNSPECIFIED = 0; + */ + const PRIVILEGES_REQUIRED_UNSPECIFIED = 0; + /** + * Generated from protobuf enum PRIVILEGES_REQUIRED_NONE = 1; + */ + const PRIVILEGES_REQUIRED_NONE = 1; + /** + * Generated from protobuf enum PRIVILEGES_REQUIRED_LOW = 2; + */ + const PRIVILEGES_REQUIRED_LOW = 2; + /** + * Generated from protobuf enum PRIVILEGES_REQUIRED_HIGH = 3; + */ + const PRIVILEGES_REQUIRED_HIGH = 3; + + private static $valueToName = [ + self::PRIVILEGES_REQUIRED_UNSPECIFIED => 'PRIVILEGES_REQUIRED_UNSPECIFIED', + self::PRIVILEGES_REQUIRED_NONE => 'PRIVILEGES_REQUIRED_NONE', + self::PRIVILEGES_REQUIRED_LOW => 'PRIVILEGES_REQUIRED_LOW', + self::PRIVILEGES_REQUIRED_HIGH => 'PRIVILEGES_REQUIRED_HIGH', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(PrivilegesRequired::class, \Grafeas\V1\CVSS_PrivilegesRequired::class); + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/CVSS/Scope.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/CVSS/Scope.php new file mode 100644 index 000000000000..44ac100792e8 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/CVSS/Scope.php @@ -0,0 +1,56 @@ +grafeas.v1.CVSS.Scope + */ +class Scope +{ + /** + * Generated from protobuf enum SCOPE_UNSPECIFIED = 0; + */ + const SCOPE_UNSPECIFIED = 0; + /** + * Generated from protobuf enum SCOPE_UNCHANGED = 1; + */ + const SCOPE_UNCHANGED = 1; + /** + * Generated from protobuf enum SCOPE_CHANGED = 2; + */ + const SCOPE_CHANGED = 2; + + private static $valueToName = [ + self::SCOPE_UNSPECIFIED => 'SCOPE_UNSPECIFIED', + self::SCOPE_UNCHANGED => 'SCOPE_UNCHANGED', + self::SCOPE_CHANGED => 'SCOPE_CHANGED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Scope::class, \Grafeas\V1\CVSS_Scope::class); + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/CVSS/UserInteraction.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/CVSS/UserInteraction.php new file mode 100644 index 000000000000..2e0e911d1c88 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/CVSS/UserInteraction.php @@ -0,0 +1,56 @@ +grafeas.v1.CVSS.UserInteraction + */ +class UserInteraction +{ + /** + * Generated from protobuf enum USER_INTERACTION_UNSPECIFIED = 0; + */ + const USER_INTERACTION_UNSPECIFIED = 0; + /** + * Generated from protobuf enum USER_INTERACTION_NONE = 1; + */ + const USER_INTERACTION_NONE = 1; + /** + * Generated from protobuf enum USER_INTERACTION_REQUIRED = 2; + */ + const USER_INTERACTION_REQUIRED = 2; + + private static $valueToName = [ + self::USER_INTERACTION_UNSPECIFIED => 'USER_INTERACTION_UNSPECIFIED', + self::USER_INTERACTION_NONE => 'USER_INTERACTION_NONE', + self::USER_INTERACTION_REQUIRED => 'USER_INTERACTION_REQUIRED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(UserInteraction::class, \Grafeas\V1\CVSS_UserInteraction::class); + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/CVSSVersion.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/CVSSVersion.php new file mode 100644 index 000000000000..8c25036f4fff --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/CVSSVersion.php @@ -0,0 +1,55 @@ +grafeas.v1.CVSSVersion + */ +class CVSSVersion +{ + /** + * Generated from protobuf enum CVSS_VERSION_UNSPECIFIED = 0; + */ + const CVSS_VERSION_UNSPECIFIED = 0; + /** + * Generated from protobuf enum CVSS_VERSION_2 = 1; + */ + const CVSS_VERSION_2 = 1; + /** + * Generated from protobuf enum CVSS_VERSION_3 = 2; + */ + const CVSS_VERSION_3 = 2; + + private static $valueToName = [ + self::CVSS_VERSION_UNSPECIFIED => 'CVSS_VERSION_UNSPECIFIED', + self::CVSS_VERSION_2 => 'CVSS_VERSION_2', + self::CVSS_VERSION_3 => 'CVSS_VERSION_3', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/CVSS_AttackComplexity.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/CVSS_AttackComplexity.php new file mode 100644 index 000000000000..f53fa0e2874d --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/CVSS_AttackComplexity.php @@ -0,0 +1,16 @@ +grafeas.v1.CVSSv3 + */ +class CVSSv3 extends \Google\Protobuf\Internal\Message +{ + /** + * The base score is a function of the base metric scores. + * + * Generated from protobuf field float base_score = 1; + */ + protected $base_score = 0.0; + /** + * Generated from protobuf field float exploitability_score = 2; + */ + protected $exploitability_score = 0.0; + /** + * Generated from protobuf field float impact_score = 3; + */ + protected $impact_score = 0.0; + /** + * Base Metrics + * Represents the intrinsic characteristics of a vulnerability that are + * constant over time and across user environments. + * + * Generated from protobuf field .grafeas.v1.CVSSv3.AttackVector attack_vector = 5; + */ + protected $attack_vector = 0; + /** + * Generated from protobuf field .grafeas.v1.CVSSv3.AttackComplexity attack_complexity = 6; + */ + protected $attack_complexity = 0; + /** + * Generated from protobuf field .grafeas.v1.CVSSv3.PrivilegesRequired privileges_required = 7; + */ + protected $privileges_required = 0; + /** + * Generated from protobuf field .grafeas.v1.CVSSv3.UserInteraction user_interaction = 8; + */ + protected $user_interaction = 0; + /** + * Generated from protobuf field .grafeas.v1.CVSSv3.Scope scope = 9; + */ + protected $scope = 0; + /** + * Generated from protobuf field .grafeas.v1.CVSSv3.Impact confidentiality_impact = 10; + */ + protected $confidentiality_impact = 0; + /** + * Generated from protobuf field .grafeas.v1.CVSSv3.Impact integrity_impact = 11; + */ + protected $integrity_impact = 0; + /** + * Generated from protobuf field .grafeas.v1.CVSSv3.Impact availability_impact = 12; + */ + protected $availability_impact = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type float $base_score + * The base score is a function of the base metric scores. + * @type float $exploitability_score + * @type float $impact_score + * @type int $attack_vector + * Base Metrics + * Represents the intrinsic characteristics of a vulnerability that are + * constant over time and across user environments. + * @type int $attack_complexity + * @type int $privileges_required + * @type int $user_interaction + * @type int $scope + * @type int $confidentiality_impact + * @type int $integrity_impact + * @type int $availability_impact + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Cvss::initOnce(); + parent::__construct($data); + } + + /** + * The base score is a function of the base metric scores. + * + * Generated from protobuf field float base_score = 1; + * @return float + */ + public function getBaseScore() + { + return $this->base_score; + } + + /** + * The base score is a function of the base metric scores. + * + * Generated from protobuf field float base_score = 1; + * @param float $var + * @return $this + */ + public function setBaseScore($var) + { + GPBUtil::checkFloat($var); + $this->base_score = $var; + + return $this; + } + + /** + * Generated from protobuf field float exploitability_score = 2; + * @return float + */ + public function getExploitabilityScore() + { + return $this->exploitability_score; + } + + /** + * Generated from protobuf field float exploitability_score = 2; + * @param float $var + * @return $this + */ + public function setExploitabilityScore($var) + { + GPBUtil::checkFloat($var); + $this->exploitability_score = $var; + + return $this; + } + + /** + * Generated from protobuf field float impact_score = 3; + * @return float + */ + public function getImpactScore() + { + return $this->impact_score; + } + + /** + * Generated from protobuf field float impact_score = 3; + * @param float $var + * @return $this + */ + public function setImpactScore($var) + { + GPBUtil::checkFloat($var); + $this->impact_score = $var; + + return $this; + } + + /** + * Base Metrics + * Represents the intrinsic characteristics of a vulnerability that are + * constant over time and across user environments. + * + * Generated from protobuf field .grafeas.v1.CVSSv3.AttackVector attack_vector = 5; + * @return int + */ + public function getAttackVector() + { + return $this->attack_vector; + } + + /** + * Base Metrics + * Represents the intrinsic characteristics of a vulnerability that are + * constant over time and across user environments. + * + * Generated from protobuf field .grafeas.v1.CVSSv3.AttackVector attack_vector = 5; + * @param int $var + * @return $this + */ + public function setAttackVector($var) + { + GPBUtil::checkEnum($var, \Grafeas\V1\CVSSv3\AttackVector::class); + $this->attack_vector = $var; + + return $this; + } + + /** + * Generated from protobuf field .grafeas.v1.CVSSv3.AttackComplexity attack_complexity = 6; + * @return int + */ + public function getAttackComplexity() + { + return $this->attack_complexity; + } + + /** + * Generated from protobuf field .grafeas.v1.CVSSv3.AttackComplexity attack_complexity = 6; + * @param int $var + * @return $this + */ + public function setAttackComplexity($var) + { + GPBUtil::checkEnum($var, \Grafeas\V1\CVSSv3\AttackComplexity::class); + $this->attack_complexity = $var; + + return $this; + } + + /** + * Generated from protobuf field .grafeas.v1.CVSSv3.PrivilegesRequired privileges_required = 7; + * @return int + */ + public function getPrivilegesRequired() + { + return $this->privileges_required; + } + + /** + * Generated from protobuf field .grafeas.v1.CVSSv3.PrivilegesRequired privileges_required = 7; + * @param int $var + * @return $this + */ + public function setPrivilegesRequired($var) + { + GPBUtil::checkEnum($var, \Grafeas\V1\CVSSv3\PrivilegesRequired::class); + $this->privileges_required = $var; + + return $this; + } + + /** + * Generated from protobuf field .grafeas.v1.CVSSv3.UserInteraction user_interaction = 8; + * @return int + */ + public function getUserInteraction() + { + return $this->user_interaction; + } + + /** + * Generated from protobuf field .grafeas.v1.CVSSv3.UserInteraction user_interaction = 8; + * @param int $var + * @return $this + */ + public function setUserInteraction($var) + { + GPBUtil::checkEnum($var, \Grafeas\V1\CVSSv3\UserInteraction::class); + $this->user_interaction = $var; + + return $this; + } + + /** + * Generated from protobuf field .grafeas.v1.CVSSv3.Scope scope = 9; + * @return int + */ + public function getScope() + { + return $this->scope; + } + + /** + * Generated from protobuf field .grafeas.v1.CVSSv3.Scope scope = 9; + * @param int $var + * @return $this + */ + public function setScope($var) + { + GPBUtil::checkEnum($var, \Grafeas\V1\CVSSv3\Scope::class); + $this->scope = $var; + + return $this; + } + + /** + * Generated from protobuf field .grafeas.v1.CVSSv3.Impact confidentiality_impact = 10; + * @return int + */ + public function getConfidentialityImpact() + { + return $this->confidentiality_impact; + } + + /** + * Generated from protobuf field .grafeas.v1.CVSSv3.Impact confidentiality_impact = 10; + * @param int $var + * @return $this + */ + public function setConfidentialityImpact($var) + { + GPBUtil::checkEnum($var, \Grafeas\V1\CVSSv3\Impact::class); + $this->confidentiality_impact = $var; + + return $this; + } + + /** + * Generated from protobuf field .grafeas.v1.CVSSv3.Impact integrity_impact = 11; + * @return int + */ + public function getIntegrityImpact() + { + return $this->integrity_impact; + } + + /** + * Generated from protobuf field .grafeas.v1.CVSSv3.Impact integrity_impact = 11; + * @param int $var + * @return $this + */ + public function setIntegrityImpact($var) + { + GPBUtil::checkEnum($var, \Grafeas\V1\CVSSv3\Impact::class); + $this->integrity_impact = $var; + + return $this; + } + + /** + * Generated from protobuf field .grafeas.v1.CVSSv3.Impact availability_impact = 12; + * @return int + */ + public function getAvailabilityImpact() + { + return $this->availability_impact; + } + + /** + * Generated from protobuf field .grafeas.v1.CVSSv3.Impact availability_impact = 12; + * @param int $var + * @return $this + */ + public function setAvailabilityImpact($var) + { + GPBUtil::checkEnum($var, \Grafeas\V1\CVSSv3\Impact::class); + $this->availability_impact = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/CVSSv3/AttackComplexity.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/CVSSv3/AttackComplexity.php new file mode 100644 index 000000000000..6086d84dc982 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/CVSSv3/AttackComplexity.php @@ -0,0 +1,56 @@ +grafeas.v1.CVSSv3.AttackComplexity + */ +class AttackComplexity +{ + /** + * Generated from protobuf enum ATTACK_COMPLEXITY_UNSPECIFIED = 0; + */ + const ATTACK_COMPLEXITY_UNSPECIFIED = 0; + /** + * Generated from protobuf enum ATTACK_COMPLEXITY_LOW = 1; + */ + const ATTACK_COMPLEXITY_LOW = 1; + /** + * Generated from protobuf enum ATTACK_COMPLEXITY_HIGH = 2; + */ + const ATTACK_COMPLEXITY_HIGH = 2; + + private static $valueToName = [ + self::ATTACK_COMPLEXITY_UNSPECIFIED => 'ATTACK_COMPLEXITY_UNSPECIFIED', + self::ATTACK_COMPLEXITY_LOW => 'ATTACK_COMPLEXITY_LOW', + self::ATTACK_COMPLEXITY_HIGH => 'ATTACK_COMPLEXITY_HIGH', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(AttackComplexity::class, \Grafeas\V1\CVSSv3_AttackComplexity::class); + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/CVSSv3/AttackVector.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/CVSSv3/AttackVector.php new file mode 100644 index 000000000000..9f0892749620 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/CVSSv3/AttackVector.php @@ -0,0 +1,66 @@ +grafeas.v1.CVSSv3.AttackVector + */ +class AttackVector +{ + /** + * Generated from protobuf enum ATTACK_VECTOR_UNSPECIFIED = 0; + */ + const ATTACK_VECTOR_UNSPECIFIED = 0; + /** + * Generated from protobuf enum ATTACK_VECTOR_NETWORK = 1; + */ + const ATTACK_VECTOR_NETWORK = 1; + /** + * Generated from protobuf enum ATTACK_VECTOR_ADJACENT = 2; + */ + const ATTACK_VECTOR_ADJACENT = 2; + /** + * Generated from protobuf enum ATTACK_VECTOR_LOCAL = 3; + */ + const ATTACK_VECTOR_LOCAL = 3; + /** + * Generated from protobuf enum ATTACK_VECTOR_PHYSICAL = 4; + */ + const ATTACK_VECTOR_PHYSICAL = 4; + + private static $valueToName = [ + self::ATTACK_VECTOR_UNSPECIFIED => 'ATTACK_VECTOR_UNSPECIFIED', + self::ATTACK_VECTOR_NETWORK => 'ATTACK_VECTOR_NETWORK', + self::ATTACK_VECTOR_ADJACENT => 'ATTACK_VECTOR_ADJACENT', + self::ATTACK_VECTOR_LOCAL => 'ATTACK_VECTOR_LOCAL', + self::ATTACK_VECTOR_PHYSICAL => 'ATTACK_VECTOR_PHYSICAL', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(AttackVector::class, \Grafeas\V1\CVSSv3_AttackVector::class); + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/CVSSv3/Impact.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/CVSSv3/Impact.php new file mode 100644 index 000000000000..d933d36fe7fb --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/CVSSv3/Impact.php @@ -0,0 +1,61 @@ +grafeas.v1.CVSSv3.Impact + */ +class Impact +{ + /** + * Generated from protobuf enum IMPACT_UNSPECIFIED = 0; + */ + const IMPACT_UNSPECIFIED = 0; + /** + * Generated from protobuf enum IMPACT_HIGH = 1; + */ + const IMPACT_HIGH = 1; + /** + * Generated from protobuf enum IMPACT_LOW = 2; + */ + const IMPACT_LOW = 2; + /** + * Generated from protobuf enum IMPACT_NONE = 3; + */ + const IMPACT_NONE = 3; + + private static $valueToName = [ + self::IMPACT_UNSPECIFIED => 'IMPACT_UNSPECIFIED', + self::IMPACT_HIGH => 'IMPACT_HIGH', + self::IMPACT_LOW => 'IMPACT_LOW', + self::IMPACT_NONE => 'IMPACT_NONE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Impact::class, \Grafeas\V1\CVSSv3_Impact::class); + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/CVSSv3/PrivilegesRequired.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/CVSSv3/PrivilegesRequired.php new file mode 100644 index 000000000000..dff9206db9b8 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/CVSSv3/PrivilegesRequired.php @@ -0,0 +1,61 @@ +grafeas.v1.CVSSv3.PrivilegesRequired + */ +class PrivilegesRequired +{ + /** + * Generated from protobuf enum PRIVILEGES_REQUIRED_UNSPECIFIED = 0; + */ + const PRIVILEGES_REQUIRED_UNSPECIFIED = 0; + /** + * Generated from protobuf enum PRIVILEGES_REQUIRED_NONE = 1; + */ + const PRIVILEGES_REQUIRED_NONE = 1; + /** + * Generated from protobuf enum PRIVILEGES_REQUIRED_LOW = 2; + */ + const PRIVILEGES_REQUIRED_LOW = 2; + /** + * Generated from protobuf enum PRIVILEGES_REQUIRED_HIGH = 3; + */ + const PRIVILEGES_REQUIRED_HIGH = 3; + + private static $valueToName = [ + self::PRIVILEGES_REQUIRED_UNSPECIFIED => 'PRIVILEGES_REQUIRED_UNSPECIFIED', + self::PRIVILEGES_REQUIRED_NONE => 'PRIVILEGES_REQUIRED_NONE', + self::PRIVILEGES_REQUIRED_LOW => 'PRIVILEGES_REQUIRED_LOW', + self::PRIVILEGES_REQUIRED_HIGH => 'PRIVILEGES_REQUIRED_HIGH', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(PrivilegesRequired::class, \Grafeas\V1\CVSSv3_PrivilegesRequired::class); + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/CVSSv3/Scope.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/CVSSv3/Scope.php new file mode 100644 index 000000000000..fc48b6eed3d7 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/CVSSv3/Scope.php @@ -0,0 +1,56 @@ +grafeas.v1.CVSSv3.Scope + */ +class Scope +{ + /** + * Generated from protobuf enum SCOPE_UNSPECIFIED = 0; + */ + const SCOPE_UNSPECIFIED = 0; + /** + * Generated from protobuf enum SCOPE_UNCHANGED = 1; + */ + const SCOPE_UNCHANGED = 1; + /** + * Generated from protobuf enum SCOPE_CHANGED = 2; + */ + const SCOPE_CHANGED = 2; + + private static $valueToName = [ + self::SCOPE_UNSPECIFIED => 'SCOPE_UNSPECIFIED', + self::SCOPE_UNCHANGED => 'SCOPE_UNCHANGED', + self::SCOPE_CHANGED => 'SCOPE_CHANGED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Scope::class, \Grafeas\V1\CVSSv3_Scope::class); + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/CVSSv3/UserInteraction.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/CVSSv3/UserInteraction.php new file mode 100644 index 000000000000..2348d20766da --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/CVSSv3/UserInteraction.php @@ -0,0 +1,56 @@ +grafeas.v1.CVSSv3.UserInteraction + */ +class UserInteraction +{ + /** + * Generated from protobuf enum USER_INTERACTION_UNSPECIFIED = 0; + */ + const USER_INTERACTION_UNSPECIFIED = 0; + /** + * Generated from protobuf enum USER_INTERACTION_NONE = 1; + */ + const USER_INTERACTION_NONE = 1; + /** + * Generated from protobuf enum USER_INTERACTION_REQUIRED = 2; + */ + const USER_INTERACTION_REQUIRED = 2; + + private static $valueToName = [ + self::USER_INTERACTION_UNSPECIFIED => 'USER_INTERACTION_UNSPECIFIED', + self::USER_INTERACTION_NONE => 'USER_INTERACTION_NONE', + self::USER_INTERACTION_REQUIRED => 'USER_INTERACTION_REQUIRED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(UserInteraction::class, \Grafeas\V1\CVSSv3_UserInteraction::class); + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/CVSSv3_AttackComplexity.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/CVSSv3_AttackComplexity.php new file mode 100644 index 000000000000..5194d471da3e --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/CVSSv3_AttackComplexity.php @@ -0,0 +1,16 @@ +grafeas.v1.CloudRepoSourceContext + */ +class CloudRepoSourceContext extends \Google\Protobuf\Internal\Message +{ + /** + * The ID of the repo. + * + * Generated from protobuf field .grafeas.v1.RepoId repo_id = 1; + */ + protected $repo_id = null; + protected $revision; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Grafeas\V1\RepoId $repo_id + * The ID of the repo. + * @type string $revision_id + * A revision ID. + * @type \Grafeas\V1\AliasContext $alias_context + * An alias, which may be a branch or tag. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Provenance::initOnce(); + parent::__construct($data); + } + + /** + * The ID of the repo. + * + * Generated from protobuf field .grafeas.v1.RepoId repo_id = 1; + * @return \Grafeas\V1\RepoId|null + */ + public function getRepoId() + { + return $this->repo_id; + } + + public function hasRepoId() + { + return isset($this->repo_id); + } + + public function clearRepoId() + { + unset($this->repo_id); + } + + /** + * The ID of the repo. + * + * Generated from protobuf field .grafeas.v1.RepoId repo_id = 1; + * @param \Grafeas\V1\RepoId $var + * @return $this + */ + public function setRepoId($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\RepoId::class); + $this->repo_id = $var; + + return $this; + } + + /** + * A revision ID. + * + * Generated from protobuf field string revision_id = 2; + * @return string + */ + public function getRevisionId() + { + return $this->readOneof(2); + } + + public function hasRevisionId() + { + return $this->hasOneof(2); + } + + /** + * A revision ID. + * + * Generated from protobuf field string revision_id = 2; + * @param string $var + * @return $this + */ + public function setRevisionId($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * An alias, which may be a branch or tag. + * + * Generated from protobuf field .grafeas.v1.AliasContext alias_context = 3; + * @return \Grafeas\V1\AliasContext|null + */ + public function getAliasContext() + { + return $this->readOneof(3); + } + + public function hasAliasContext() + { + return $this->hasOneof(3); + } + + /** + * An alias, which may be a branch or tag. + * + * Generated from protobuf field .grafeas.v1.AliasContext alias_context = 3; + * @param \Grafeas\V1\AliasContext $var + * @return $this + */ + public function setAliasContext($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\AliasContext::class); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * @return string + */ + public function getRevision() + { + return $this->whichOneof("revision"); + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/Command.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/Command.php new file mode 100644 index 000000000000..40d507cfd67f --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/Command.php @@ -0,0 +1,249 @@ +grafeas.v1.Command + */ +class Command extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the command, as presented on the command line, or if the + * command is packaged as a Docker container, as presented to `docker pull`. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * Environment variables set before running this command. + * + * Generated from protobuf field repeated string env = 2; + */ + private $env; + /** + * Command-line arguments used when executing this command. + * + * Generated from protobuf field repeated string args = 3; + */ + private $args; + /** + * Working directory (relative to project source root) used when running this + * command. + * + * Generated from protobuf field string dir = 4; + */ + protected $dir = ''; + /** + * Optional unique identifier for this command, used in wait_for to reference + * this command as a dependency. + * + * Generated from protobuf field string id = 5; + */ + protected $id = ''; + /** + * The ID(s) of the command(s) that this command depends on. + * + * Generated from protobuf field repeated string wait_for = 6; + */ + private $wait_for; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Name of the command, as presented on the command line, or if the + * command is packaged as a Docker container, as presented to `docker pull`. + * @type array|\Google\Protobuf\Internal\RepeatedField $env + * Environment variables set before running this command. + * @type array|\Google\Protobuf\Internal\RepeatedField $args + * Command-line arguments used when executing this command. + * @type string $dir + * Working directory (relative to project source root) used when running this + * command. + * @type string $id + * Optional unique identifier for this command, used in wait_for to reference + * this command as a dependency. + * @type array|\Google\Protobuf\Internal\RepeatedField $wait_for + * The ID(s) of the command(s) that this command depends on. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Provenance::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the command, as presented on the command line, or if the + * command is packaged as a Docker container, as presented to `docker pull`. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Name of the command, as presented on the command line, or if the + * command is packaged as a Docker container, as presented to `docker pull`. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Environment variables set before running this command. + * + * Generated from protobuf field repeated string env = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getEnv() + { + return $this->env; + } + + /** + * Environment variables set before running this command. + * + * Generated from protobuf field repeated string env = 2; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setEnv($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->env = $arr; + + return $this; + } + + /** + * Command-line arguments used when executing this command. + * + * Generated from protobuf field repeated string args = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getArgs() + { + return $this->args; + } + + /** + * Command-line arguments used when executing this command. + * + * Generated from protobuf field repeated string args = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setArgs($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->args = $arr; + + return $this; + } + + /** + * Working directory (relative to project source root) used when running this + * command. + * + * Generated from protobuf field string dir = 4; + * @return string + */ + public function getDir() + { + return $this->dir; + } + + /** + * Working directory (relative to project source root) used when running this + * command. + * + * Generated from protobuf field string dir = 4; + * @param string $var + * @return $this + */ + public function setDir($var) + { + GPBUtil::checkString($var, True); + $this->dir = $var; + + return $this; + } + + /** + * Optional unique identifier for this command, used in wait_for to reference + * this command as a dependency. + * + * Generated from protobuf field string id = 5; + * @return string + */ + public function getId() + { + return $this->id; + } + + /** + * Optional unique identifier for this command, used in wait_for to reference + * this command as a dependency. + * + * Generated from protobuf field string id = 5; + * @param string $var + * @return $this + */ + public function setId($var) + { + GPBUtil::checkString($var, True); + $this->id = $var; + + return $this; + } + + /** + * The ID(s) of the command(s) that this command depends on. + * + * Generated from protobuf field repeated string wait_for = 6; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getWaitFor() + { + return $this->wait_for; + } + + /** + * The ID(s) of the command(s) that this command depends on. + * + * Generated from protobuf field repeated string wait_for = 6; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setWaitFor($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->wait_for = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/Completeness.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/Completeness.php new file mode 100644 index 000000000000..d5cd151e9b5d --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/Completeness.php @@ -0,0 +1,148 @@ +grafeas.v1.Completeness + */ +class Completeness extends \Google\Protobuf\Internal\Message +{ + /** + * If true, the builder claims that recipe.arguments is complete, meaning that + * all external inputs are properly captured in the recipe. + * + * Generated from protobuf field bool arguments = 1; + */ + protected $arguments = false; + /** + * If true, the builder claims that recipe.environment is claimed to be + * complete. + * + * Generated from protobuf field bool environment = 2; + */ + protected $environment = false; + /** + * If true, the builder claims that materials are complete, usually through + * some controls to prevent network access. Sometimes called "hermetic". + * + * Generated from protobuf field bool materials = 3; + */ + protected $materials = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $arguments + * If true, the builder claims that recipe.arguments is complete, meaning that + * all external inputs are properly captured in the recipe. + * @type bool $environment + * If true, the builder claims that recipe.environment is claimed to be + * complete. + * @type bool $materials + * If true, the builder claims that materials are complete, usually through + * some controls to prevent network access. Sometimes called "hermetic". + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\IntotoProvenance::initOnce(); + parent::__construct($data); + } + + /** + * If true, the builder claims that recipe.arguments is complete, meaning that + * all external inputs are properly captured in the recipe. + * + * Generated from protobuf field bool arguments = 1; + * @return bool + */ + public function getArguments() + { + return $this->arguments; + } + + /** + * If true, the builder claims that recipe.arguments is complete, meaning that + * all external inputs are properly captured in the recipe. + * + * Generated from protobuf field bool arguments = 1; + * @param bool $var + * @return $this + */ + public function setArguments($var) + { + GPBUtil::checkBool($var); + $this->arguments = $var; + + return $this; + } + + /** + * If true, the builder claims that recipe.environment is claimed to be + * complete. + * + * Generated from protobuf field bool environment = 2; + * @return bool + */ + public function getEnvironment() + { + return $this->environment; + } + + /** + * If true, the builder claims that recipe.environment is claimed to be + * complete. + * + * Generated from protobuf field bool environment = 2; + * @param bool $var + * @return $this + */ + public function setEnvironment($var) + { + GPBUtil::checkBool($var); + $this->environment = $var; + + return $this; + } + + /** + * If true, the builder claims that materials are complete, usually through + * some controls to prevent network access. Sometimes called "hermetic". + * + * Generated from protobuf field bool materials = 3; + * @return bool + */ + public function getMaterials() + { + return $this->materials; + } + + /** + * If true, the builder claims that materials are complete, usually through + * some controls to prevent network access. Sometimes called "hermetic". + * + * Generated from protobuf field bool materials = 3; + * @param bool $var + * @return $this + */ + public function setMaterials($var) + { + GPBUtil::checkBool($var); + $this->materials = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/ComplianceNote.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/ComplianceNote.php new file mode 100644 index 000000000000..651c3573ec47 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/ComplianceNote.php @@ -0,0 +1,272 @@ +grafeas.v1.ComplianceNote + */ +class ComplianceNote extends \Google\Protobuf\Internal\Message +{ + /** + * The title that identifies this compliance check. + * + * Generated from protobuf field string title = 1; + */ + protected $title = ''; + /** + * A description about this compliance check. + * + * Generated from protobuf field string description = 2; + */ + protected $description = ''; + /** + * The OS and config versions the benchmark applies to. + * + * Generated from protobuf field repeated .grafeas.v1.ComplianceVersion version = 3; + */ + private $version; + /** + * A rationale for the existence of this compliance check. + * + * Generated from protobuf field string rationale = 4; + */ + protected $rationale = ''; + /** + * A description of remediation steps if the compliance check fails. + * + * Generated from protobuf field string remediation = 5; + */ + protected $remediation = ''; + /** + * Serialized scan instructions with a predefined format. + * + * Generated from protobuf field bytes scan_instructions = 7; + */ + protected $scan_instructions = ''; + protected $compliance_type; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $title + * The title that identifies this compliance check. + * @type string $description + * A description about this compliance check. + * @type array<\Grafeas\V1\ComplianceVersion>|\Google\Protobuf\Internal\RepeatedField $version + * The OS and config versions the benchmark applies to. + * @type string $rationale + * A rationale for the existence of this compliance check. + * @type string $remediation + * A description of remediation steps if the compliance check fails. + * @type \Grafeas\V1\ComplianceNote\CisBenchmark $cis_benchmark + * @type string $scan_instructions + * Serialized scan instructions with a predefined format. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Compliance::initOnce(); + parent::__construct($data); + } + + /** + * The title that identifies this compliance check. + * + * Generated from protobuf field string title = 1; + * @return string + */ + public function getTitle() + { + return $this->title; + } + + /** + * The title that identifies this compliance check. + * + * Generated from protobuf field string title = 1; + * @param string $var + * @return $this + */ + public function setTitle($var) + { + GPBUtil::checkString($var, True); + $this->title = $var; + + return $this; + } + + /** + * A description about this compliance check. + * + * Generated from protobuf field string description = 2; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * A description about this compliance check. + * + * Generated from protobuf field string description = 2; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * The OS and config versions the benchmark applies to. + * + * Generated from protobuf field repeated .grafeas.v1.ComplianceVersion version = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getVersion() + { + return $this->version; + } + + /** + * The OS and config versions the benchmark applies to. + * + * Generated from protobuf field repeated .grafeas.v1.ComplianceVersion version = 3; + * @param array<\Grafeas\V1\ComplianceVersion>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setVersion($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Grafeas\V1\ComplianceVersion::class); + $this->version = $arr; + + return $this; + } + + /** + * A rationale for the existence of this compliance check. + * + * Generated from protobuf field string rationale = 4; + * @return string + */ + public function getRationale() + { + return $this->rationale; + } + + /** + * A rationale for the existence of this compliance check. + * + * Generated from protobuf field string rationale = 4; + * @param string $var + * @return $this + */ + public function setRationale($var) + { + GPBUtil::checkString($var, True); + $this->rationale = $var; + + return $this; + } + + /** + * A description of remediation steps if the compliance check fails. + * + * Generated from protobuf field string remediation = 5; + * @return string + */ + public function getRemediation() + { + return $this->remediation; + } + + /** + * A description of remediation steps if the compliance check fails. + * + * Generated from protobuf field string remediation = 5; + * @param string $var + * @return $this + */ + public function setRemediation($var) + { + GPBUtil::checkString($var, True); + $this->remediation = $var; + + return $this; + } + + /** + * Generated from protobuf field .grafeas.v1.ComplianceNote.CisBenchmark cis_benchmark = 6; + * @return \Grafeas\V1\ComplianceNote\CisBenchmark|null + */ + public function getCisBenchmark() + { + return $this->readOneof(6); + } + + public function hasCisBenchmark() + { + return $this->hasOneof(6); + } + + /** + * Generated from protobuf field .grafeas.v1.ComplianceNote.CisBenchmark cis_benchmark = 6; + * @param \Grafeas\V1\ComplianceNote\CisBenchmark $var + * @return $this + */ + public function setCisBenchmark($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\ComplianceNote\CisBenchmark::class); + $this->writeOneof(6, $var); + + return $this; + } + + /** + * Serialized scan instructions with a predefined format. + * + * Generated from protobuf field bytes scan_instructions = 7; + * @return string + */ + public function getScanInstructions() + { + return $this->scan_instructions; + } + + /** + * Serialized scan instructions with a predefined format. + * + * Generated from protobuf field bytes scan_instructions = 7; + * @param string $var + * @return $this + */ + public function setScanInstructions($var) + { + GPBUtil::checkString($var, False); + $this->scan_instructions = $var; + + return $this; + } + + /** + * @return string + */ + public function getComplianceType() + { + return $this->whichOneof("compliance_type"); + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/ComplianceNote/CisBenchmark.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/ComplianceNote/CisBenchmark.php new file mode 100644 index 000000000000..be70e77b1666 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/ComplianceNote/CisBenchmark.php @@ -0,0 +1,90 @@ +grafeas.v1.ComplianceNote.CisBenchmark + */ +class CisBenchmark extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field int32 profile_level = 1; + */ + protected $profile_level = 0; + /** + * Generated from protobuf field .grafeas.v1.Severity severity = 2; + */ + protected $severity = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $profile_level + * @type int $severity + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Compliance::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field int32 profile_level = 1; + * @return int + */ + public function getProfileLevel() + { + return $this->profile_level; + } + + /** + * Generated from protobuf field int32 profile_level = 1; + * @param int $var + * @return $this + */ + public function setProfileLevel($var) + { + GPBUtil::checkInt32($var); + $this->profile_level = $var; + + return $this; + } + + /** + * Generated from protobuf field .grafeas.v1.Severity severity = 2; + * @return int + */ + public function getSeverity() + { + return $this->severity; + } + + /** + * Generated from protobuf field .grafeas.v1.Severity severity = 2; + * @param int $var + * @return $this + */ + public function setSeverity($var) + { + GPBUtil::checkEnum($var, \Grafeas\V1\Severity::class); + $this->severity = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(CisBenchmark::class, \Grafeas\V1\ComplianceNote_CisBenchmark::class); + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/ComplianceNote_CisBenchmark.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/ComplianceNote_CisBenchmark.php new file mode 100644 index 000000000000..05b17cf4e1c0 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/ComplianceNote_CisBenchmark.php @@ -0,0 +1,16 @@ +grafeas.v1.ComplianceOccurrence + */ +class ComplianceOccurrence extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field repeated .grafeas.v1.NonCompliantFile non_compliant_files = 2; + */ + private $non_compliant_files; + /** + * Generated from protobuf field string non_compliance_reason = 3; + */ + protected $non_compliance_reason = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Grafeas\V1\NonCompliantFile>|\Google\Protobuf\Internal\RepeatedField $non_compliant_files + * @type string $non_compliance_reason + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Compliance::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field repeated .grafeas.v1.NonCompliantFile non_compliant_files = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getNonCompliantFiles() + { + return $this->non_compliant_files; + } + + /** + * Generated from protobuf field repeated .grafeas.v1.NonCompliantFile non_compliant_files = 2; + * @param array<\Grafeas\V1\NonCompliantFile>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setNonCompliantFiles($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Grafeas\V1\NonCompliantFile::class); + $this->non_compliant_files = $arr; + + return $this; + } + + /** + * Generated from protobuf field string non_compliance_reason = 3; + * @return string + */ + public function getNonComplianceReason() + { + return $this->non_compliance_reason; + } + + /** + * Generated from protobuf field string non_compliance_reason = 3; + * @param string $var + * @return $this + */ + public function setNonComplianceReason($var) + { + GPBUtil::checkString($var, True); + $this->non_compliance_reason = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/ComplianceVersion.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/ComplianceVersion.php new file mode 100644 index 000000000000..19d19abd80bd --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/ComplianceVersion.php @@ -0,0 +1,148 @@ +grafeas.v1.ComplianceVersion + */ +class ComplianceVersion extends \Google\Protobuf\Internal\Message +{ + /** + * The CPE URI (https://cpe.mitre.org/specification/) this benchmark is + * applicable to. + * + * Generated from protobuf field string cpe_uri = 1; + */ + protected $cpe_uri = ''; + /** + * The name of the document that defines this benchmark, e.g. "CIS + * Container-Optimized OS". + * + * Generated from protobuf field string benchmark_document = 3; + */ + protected $benchmark_document = ''; + /** + * The version of the benchmark. This is set to the version of the OS-specific + * CIS document the benchmark is defined in. + * + * Generated from protobuf field string version = 2; + */ + protected $version = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $cpe_uri + * The CPE URI (https://cpe.mitre.org/specification/) this benchmark is + * applicable to. + * @type string $benchmark_document + * The name of the document that defines this benchmark, e.g. "CIS + * Container-Optimized OS". + * @type string $version + * The version of the benchmark. This is set to the version of the OS-specific + * CIS document the benchmark is defined in. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Compliance::initOnce(); + parent::__construct($data); + } + + /** + * The CPE URI (https://cpe.mitre.org/specification/) this benchmark is + * applicable to. + * + * Generated from protobuf field string cpe_uri = 1; + * @return string + */ + public function getCpeUri() + { + return $this->cpe_uri; + } + + /** + * The CPE URI (https://cpe.mitre.org/specification/) this benchmark is + * applicable to. + * + * Generated from protobuf field string cpe_uri = 1; + * @param string $var + * @return $this + */ + public function setCpeUri($var) + { + GPBUtil::checkString($var, True); + $this->cpe_uri = $var; + + return $this; + } + + /** + * The name of the document that defines this benchmark, e.g. "CIS + * Container-Optimized OS". + * + * Generated from protobuf field string benchmark_document = 3; + * @return string + */ + public function getBenchmarkDocument() + { + return $this->benchmark_document; + } + + /** + * The name of the document that defines this benchmark, e.g. "CIS + * Container-Optimized OS". + * + * Generated from protobuf field string benchmark_document = 3; + * @param string $var + * @return $this + */ + public function setBenchmarkDocument($var) + { + GPBUtil::checkString($var, True); + $this->benchmark_document = $var; + + return $this; + } + + /** + * The version of the benchmark. This is set to the version of the OS-specific + * CIS document the benchmark is defined in. + * + * Generated from protobuf field string version = 2; + * @return string + */ + public function getVersion() + { + return $this->version; + } + + /** + * The version of the benchmark. This is set to the version of the OS-specific + * CIS document the benchmark is defined in. + * + * Generated from protobuf field string version = 2; + * @param string $var + * @return $this + */ + public function setVersion($var) + { + GPBUtil::checkString($var, True); + $this->version = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/CreateNoteRequest.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/CreateNoteRequest.php new file mode 100644 index 000000000000..b03b9181f323 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/CreateNoteRequest.php @@ -0,0 +1,168 @@ +grafeas.v1.CreateNoteRequest + */ +class CreateNoteRequest extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the project in the form of `projects/[PROJECT_ID]`, under which + * the note is to be created. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The ID to use for this note. + * + * Generated from protobuf field string note_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $note_id = ''; + /** + * The note to create. + * + * Generated from protobuf field .grafeas.v1.Note note = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $note = null; + + /** + * @param string $parent The name of the project in the form of `projects/[PROJECT_ID]`, under which + * the note is to be created. Please see + * {@see GrafeasClient::projectName()} for help formatting this field. + * @param string $noteId The ID to use for this note. + * @param \Grafeas\V1\Note $note The note to create. + * + * @return \Grafeas\V1\CreateNoteRequest + * + * @experimental + */ + public static function build(string $parent, string $noteId, \Grafeas\V1\Note $note): self + { + return (new self()) + ->setParent($parent) + ->setNoteId($noteId) + ->setNote($note); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * The name of the project in the form of `projects/[PROJECT_ID]`, under which + * the note is to be created. + * @type string $note_id + * The ID to use for this note. + * @type \Grafeas\V1\Note $note + * The note to create. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Grafeas::initOnce(); + parent::__construct($data); + } + + /** + * The name of the project in the form of `projects/[PROJECT_ID]`, under which + * the note is to be created. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * The name of the project in the form of `projects/[PROJECT_ID]`, under which + * the note is to be created. + * + * 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; + } + + /** + * The ID to use for this note. + * + * Generated from protobuf field string note_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getNoteId() + { + return $this->note_id; + } + + /** + * The ID to use for this note. + * + * Generated from protobuf field string note_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setNoteId($var) + { + GPBUtil::checkString($var, True); + $this->note_id = $var; + + return $this; + } + + /** + * The note to create. + * + * Generated from protobuf field .grafeas.v1.Note note = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Grafeas\V1\Note|null + */ + public function getNote() + { + return $this->note; + } + + public function hasNote() + { + return isset($this->note); + } + + public function clearNote() + { + unset($this->note); + } + + /** + * The note to create. + * + * Generated from protobuf field .grafeas.v1.Note note = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Grafeas\V1\Note $var + * @return $this + */ + public function setNote($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\Note::class); + $this->note = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/CreateOccurrenceRequest.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/CreateOccurrenceRequest.php new file mode 100644 index 000000000000..ac9031ca5a6f --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/CreateOccurrenceRequest.php @@ -0,0 +1,132 @@ +grafeas.v1.CreateOccurrenceRequest + */ +class CreateOccurrenceRequest extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the project in the form of `projects/[PROJECT_ID]`, under which + * the occurrence is to be created. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The occurrence to create. + * + * Generated from protobuf field .grafeas.v1.Occurrence occurrence = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $occurrence = null; + + /** + * @param string $parent The name of the project in the form of `projects/[PROJECT_ID]`, under which + * the occurrence is to be created. Please see + * {@see GrafeasClient::projectName()} for help formatting this field. + * @param \Grafeas\V1\Occurrence $occurrence The occurrence to create. + * + * @return \Grafeas\V1\CreateOccurrenceRequest + * + * @experimental + */ + public static function build(string $parent, \Grafeas\V1\Occurrence $occurrence): self + { + return (new self()) + ->setParent($parent) + ->setOccurrence($occurrence); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * The name of the project in the form of `projects/[PROJECT_ID]`, under which + * the occurrence is to be created. + * @type \Grafeas\V1\Occurrence $occurrence + * The occurrence to create. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Grafeas::initOnce(); + parent::__construct($data); + } + + /** + * The name of the project in the form of `projects/[PROJECT_ID]`, under which + * the occurrence is to be created. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * The name of the project in the form of `projects/[PROJECT_ID]`, under which + * the occurrence is to be created. + * + * 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; + } + + /** + * The occurrence to create. + * + * Generated from protobuf field .grafeas.v1.Occurrence occurrence = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Grafeas\V1\Occurrence|null + */ + public function getOccurrence() + { + return $this->occurrence; + } + + public function hasOccurrence() + { + return isset($this->occurrence); + } + + public function clearOccurrence() + { + unset($this->occurrence); + } + + /** + * The occurrence to create. + * + * Generated from protobuf field .grafeas.v1.Occurrence occurrence = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Grafeas\V1\Occurrence $var + * @return $this + */ + public function setOccurrence($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\Occurrence::class); + $this->occurrence = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/DSSEAttestationNote.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/DSSEAttestationNote.php new file mode 100644 index 000000000000..b40b73c92c36 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/DSSEAttestationNote.php @@ -0,0 +1,75 @@ +grafeas.v1.DSSEAttestationNote + */ +class DSSEAttestationNote extends \Google\Protobuf\Internal\Message +{ + /** + * DSSEHint hints at the purpose of the attestation authority. + * + * Generated from protobuf field .grafeas.v1.DSSEAttestationNote.DSSEHint hint = 1; + */ + protected $hint = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Grafeas\V1\DSSEAttestationNote\DSSEHint $hint + * DSSEHint hints at the purpose of the attestation authority. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\DsseAttestation::initOnce(); + parent::__construct($data); + } + + /** + * DSSEHint hints at the purpose of the attestation authority. + * + * Generated from protobuf field .grafeas.v1.DSSEAttestationNote.DSSEHint hint = 1; + * @return \Grafeas\V1\DSSEAttestationNote\DSSEHint|null + */ + public function getHint() + { + return $this->hint; + } + + public function hasHint() + { + return isset($this->hint); + } + + public function clearHint() + { + unset($this->hint); + } + + /** + * DSSEHint hints at the purpose of the attestation authority. + * + * Generated from protobuf field .grafeas.v1.DSSEAttestationNote.DSSEHint hint = 1; + * @param \Grafeas\V1\DSSEAttestationNote\DSSEHint $var + * @return $this + */ + public function setHint($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\DSSEAttestationNote\DSSEHint::class); + $this->hint = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/DSSEAttestationNote/DSSEHint.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/DSSEAttestationNote/DSSEHint.php new file mode 100644 index 000000000000..972f84285167 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/DSSEAttestationNote/DSSEHint.php @@ -0,0 +1,80 @@ +grafeas.v1.DSSEAttestationNote.DSSEHint + */ +class DSSEHint extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The human readable name of this attestation authority, for + * example "cloudbuild-prod". + * + * Generated from protobuf field string human_readable_name = 1; + */ + protected $human_readable_name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $human_readable_name + * Required. The human readable name of this attestation authority, for + * example "cloudbuild-prod". + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\DsseAttestation::initOnce(); + parent::__construct($data); + } + + /** + * Required. The human readable name of this attestation authority, for + * example "cloudbuild-prod". + * + * Generated from protobuf field string human_readable_name = 1; + * @return string + */ + public function getHumanReadableName() + { + return $this->human_readable_name; + } + + /** + * Required. The human readable name of this attestation authority, for + * example "cloudbuild-prod". + * + * Generated from protobuf field string human_readable_name = 1; + * @param string $var + * @return $this + */ + public function setHumanReadableName($var) + { + GPBUtil::checkString($var, True); + $this->human_readable_name = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(DSSEHint::class, \Grafeas\V1\DSSEAttestationNote_DSSEHint::class); + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/DSSEAttestationNote_DSSEHint.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/DSSEAttestationNote_DSSEHint.php new file mode 100644 index 000000000000..59c6d41f9483 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/DSSEAttestationNote_DSSEHint.php @@ -0,0 +1,16 @@ +grafeas.v1.DSSEAttestationOccurrence + */ +class DSSEAttestationOccurrence extends \Google\Protobuf\Internal\Message +{ + /** + * If doing something security critical, make sure to verify the signatures in + * this metadata. + * + * Generated from protobuf field .grafeas.v1.Envelope envelope = 1; + */ + protected $envelope = null; + protected $decoded_payload; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Grafeas\V1\Envelope $envelope + * If doing something security critical, make sure to verify the signatures in + * this metadata. + * @type \Grafeas\V1\InTotoStatement $statement + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\DsseAttestation::initOnce(); + parent::__construct($data); + } + + /** + * If doing something security critical, make sure to verify the signatures in + * this metadata. + * + * Generated from protobuf field .grafeas.v1.Envelope envelope = 1; + * @return \Grafeas\V1\Envelope|null + */ + public function getEnvelope() + { + return $this->envelope; + } + + public function hasEnvelope() + { + return isset($this->envelope); + } + + public function clearEnvelope() + { + unset($this->envelope); + } + + /** + * If doing something security critical, make sure to verify the signatures in + * this metadata. + * + * Generated from protobuf field .grafeas.v1.Envelope envelope = 1; + * @param \Grafeas\V1\Envelope $var + * @return $this + */ + public function setEnvelope($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\Envelope::class); + $this->envelope = $var; + + return $this; + } + + /** + * Generated from protobuf field .grafeas.v1.InTotoStatement statement = 2; + * @return \Grafeas\V1\InTotoStatement|null + */ + public function getStatement() + { + return $this->readOneof(2); + } + + public function hasStatement() + { + return $this->hasOneof(2); + } + + /** + * Generated from protobuf field .grafeas.v1.InTotoStatement statement = 2; + * @param \Grafeas\V1\InTotoStatement $var + * @return $this + */ + public function setStatement($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\InTotoStatement::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * @return string + */ + public function getDecodedPayload() + { + return $this->whichOneof("decoded_payload"); + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/DeleteNoteRequest.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/DeleteNoteRequest.php new file mode 100644 index 000000000000..14fcef007666 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/DeleteNoteRequest.php @@ -0,0 +1,86 @@ +grafeas.v1.DeleteNoteRequest + */ +class DeleteNoteRequest extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the note in the form of + * `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name The name of the note in the form of + * `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. Please see + * {@see GrafeasClient::noteName()} for help formatting this field. + * + * @return \Grafeas\V1\DeleteNoteRequest + * + * @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 + * The name of the note in the form of + * `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Grafeas::initOnce(); + parent::__construct($data); + } + + /** + * The name of the note in the form of + * `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The name of the note in the form of + * `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. + * + * 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; + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/DeleteOccurrenceRequest.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/DeleteOccurrenceRequest.php new file mode 100644 index 000000000000..4318a5540847 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/DeleteOccurrenceRequest.php @@ -0,0 +1,86 @@ +grafeas.v1.DeleteOccurrenceRequest + */ +class DeleteOccurrenceRequest extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the occurrence in the form of + * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name The name of the occurrence in the form of + * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. Please see + * {@see GrafeasClient::occurrenceName()} for help formatting this field. + * + * @return \Grafeas\V1\DeleteOccurrenceRequest + * + * @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 + * The name of the occurrence in the form of + * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Grafeas::initOnce(); + parent::__construct($data); + } + + /** + * The name of the occurrence in the form of + * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The name of the occurrence in the form of + * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. + * + * 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; + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/DeploymentNote.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/DeploymentNote.php new file mode 100644 index 000000000000..d934670e3bb8 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/DeploymentNote.php @@ -0,0 +1,67 @@ +grafeas.v1.DeploymentNote + */ +class DeploymentNote extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Resource URI for the artifact being deployed. + * + * Generated from protobuf field repeated string resource_uri = 1; + */ + private $resource_uri; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $resource_uri + * Required. Resource URI for the artifact being deployed. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Deployment::initOnce(); + parent::__construct($data); + } + + /** + * Required. Resource URI for the artifact being deployed. + * + * Generated from protobuf field repeated string resource_uri = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getResourceUri() + { + return $this->resource_uri; + } + + /** + * Required. Resource URI for the artifact being deployed. + * + * Generated from protobuf field repeated string resource_uri = 1; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setResourceUri($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->resource_uri = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/DeploymentOccurrence.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/DeploymentOccurrence.php new file mode 100644 index 000000000000..9971d3eb3d44 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/DeploymentOccurrence.php @@ -0,0 +1,295 @@ +grafeas.v1.DeploymentOccurrence + */ +class DeploymentOccurrence extends \Google\Protobuf\Internal\Message +{ + /** + * Identity of the user that triggered this deployment. + * + * Generated from protobuf field string user_email = 1; + */ + protected $user_email = ''; + /** + * Required. Beginning of the lifetime of this deployment. + * + * Generated from protobuf field .google.protobuf.Timestamp deploy_time = 2; + */ + protected $deploy_time = null; + /** + * End of the lifetime of this deployment. + * + * Generated from protobuf field .google.protobuf.Timestamp undeploy_time = 3; + */ + protected $undeploy_time = null; + /** + * Configuration used to create this deployment. + * + * Generated from protobuf field string config = 4; + */ + protected $config = ''; + /** + * Address of the runtime element hosting this deployment. + * + * Generated from protobuf field string address = 5; + */ + protected $address = ''; + /** + * Output only. Resource URI for the artifact being deployed taken from + * the deployable field with the same name. + * + * Generated from protobuf field repeated string resource_uri = 6; + */ + private $resource_uri; + /** + * Platform hosting this deployment. + * + * Generated from protobuf field .grafeas.v1.DeploymentOccurrence.Platform platform = 7; + */ + protected $platform = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $user_email + * Identity of the user that triggered this deployment. + * @type \Google\Protobuf\Timestamp $deploy_time + * Required. Beginning of the lifetime of this deployment. + * @type \Google\Protobuf\Timestamp $undeploy_time + * End of the lifetime of this deployment. + * @type string $config + * Configuration used to create this deployment. + * @type string $address + * Address of the runtime element hosting this deployment. + * @type array|\Google\Protobuf\Internal\RepeatedField $resource_uri + * Output only. Resource URI for the artifact being deployed taken from + * the deployable field with the same name. + * @type int $platform + * Platform hosting this deployment. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Deployment::initOnce(); + parent::__construct($data); + } + + /** + * Identity of the user that triggered this deployment. + * + * Generated from protobuf field string user_email = 1; + * @return string + */ + public function getUserEmail() + { + return $this->user_email; + } + + /** + * Identity of the user that triggered this deployment. + * + * Generated from protobuf field string user_email = 1; + * @param string $var + * @return $this + */ + public function setUserEmail($var) + { + GPBUtil::checkString($var, True); + $this->user_email = $var; + + return $this; + } + + /** + * Required. Beginning of the lifetime of this deployment. + * + * Generated from protobuf field .google.protobuf.Timestamp deploy_time = 2; + * @return \Google\Protobuf\Timestamp|null + */ + public function getDeployTime() + { + return $this->deploy_time; + } + + public function hasDeployTime() + { + return isset($this->deploy_time); + } + + public function clearDeployTime() + { + unset($this->deploy_time); + } + + /** + * Required. Beginning of the lifetime of this deployment. + * + * Generated from protobuf field .google.protobuf.Timestamp deploy_time = 2; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setDeployTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->deploy_time = $var; + + return $this; + } + + /** + * End of the lifetime of this deployment. + * + * Generated from protobuf field .google.protobuf.Timestamp undeploy_time = 3; + * @return \Google\Protobuf\Timestamp|null + */ + public function getUndeployTime() + { + return $this->undeploy_time; + } + + public function hasUndeployTime() + { + return isset($this->undeploy_time); + } + + public function clearUndeployTime() + { + unset($this->undeploy_time); + } + + /** + * End of the lifetime of this deployment. + * + * Generated from protobuf field .google.protobuf.Timestamp undeploy_time = 3; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setUndeployTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->undeploy_time = $var; + + return $this; + } + + /** + * Configuration used to create this deployment. + * + * Generated from protobuf field string config = 4; + * @return string + */ + public function getConfig() + { + return $this->config; + } + + /** + * Configuration used to create this deployment. + * + * Generated from protobuf field string config = 4; + * @param string $var + * @return $this + */ + public function setConfig($var) + { + GPBUtil::checkString($var, True); + $this->config = $var; + + return $this; + } + + /** + * Address of the runtime element hosting this deployment. + * + * Generated from protobuf field string address = 5; + * @return string + */ + public function getAddress() + { + return $this->address; + } + + /** + * Address of the runtime element hosting this deployment. + * + * Generated from protobuf field string address = 5; + * @param string $var + * @return $this + */ + public function setAddress($var) + { + GPBUtil::checkString($var, True); + $this->address = $var; + + return $this; + } + + /** + * Output only. Resource URI for the artifact being deployed taken from + * the deployable field with the same name. + * + * Generated from protobuf field repeated string resource_uri = 6; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getResourceUri() + { + return $this->resource_uri; + } + + /** + * Output only. Resource URI for the artifact being deployed taken from + * the deployable field with the same name. + * + * Generated from protobuf field repeated string resource_uri = 6; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setResourceUri($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->resource_uri = $arr; + + return $this; + } + + /** + * Platform hosting this deployment. + * + * Generated from protobuf field .grafeas.v1.DeploymentOccurrence.Platform platform = 7; + * @return int + */ + public function getPlatform() + { + return $this->platform; + } + + /** + * Platform hosting this deployment. + * + * Generated from protobuf field .grafeas.v1.DeploymentOccurrence.Platform platform = 7; + * @param int $var + * @return $this + */ + public function setPlatform($var) + { + GPBUtil::checkEnum($var, \Grafeas\V1\DeploymentOccurrence\Platform::class); + $this->platform = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/DeploymentOccurrence/Platform.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/DeploymentOccurrence/Platform.php new file mode 100644 index 000000000000..35b13b4c7858 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/DeploymentOccurrence/Platform.php @@ -0,0 +1,71 @@ +grafeas.v1.DeploymentOccurrence.Platform + */ +class Platform +{ + /** + * Unknown. + * + * Generated from protobuf enum PLATFORM_UNSPECIFIED = 0; + */ + const PLATFORM_UNSPECIFIED = 0; + /** + * Google Container Engine. + * + * Generated from protobuf enum GKE = 1; + */ + const GKE = 1; + /** + * Google App Engine: Flexible Environment. + * + * Generated from protobuf enum FLEX = 2; + */ + const FLEX = 2; + /** + * Custom user-defined platform. + * + * Generated from protobuf enum CUSTOM = 3; + */ + const CUSTOM = 3; + + private static $valueToName = [ + self::PLATFORM_UNSPECIFIED => 'PLATFORM_UNSPECIFIED', + self::GKE => 'GKE', + self::FLEX => 'FLEX', + self::CUSTOM => 'CUSTOM', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Platform::class, \Grafeas\V1\DeploymentOccurrence_Platform::class); + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/DeploymentOccurrence_Platform.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/DeploymentOccurrence_Platform.php new file mode 100644 index 000000000000..411764953ea1 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/DeploymentOccurrence_Platform.php @@ -0,0 +1,16 @@ +grafeas.v1.Digest + */ +class Digest extends \Google\Protobuf\Internal\Message +{ + /** + * `SHA1`, `SHA512` etc. + * + * Generated from protobuf field string algo = 1; + */ + protected $algo = ''; + /** + * Value of the digest. + * + * Generated from protobuf field bytes digest_bytes = 2; + */ + protected $digest_bytes = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $algo + * `SHA1`, `SHA512` etc. + * @type string $digest_bytes + * Value of the digest. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Common::initOnce(); + parent::__construct($data); + } + + /** + * `SHA1`, `SHA512` etc. + * + * Generated from protobuf field string algo = 1; + * @return string + */ + public function getAlgo() + { + return $this->algo; + } + + /** + * `SHA1`, `SHA512` etc. + * + * Generated from protobuf field string algo = 1; + * @param string $var + * @return $this + */ + public function setAlgo($var) + { + GPBUtil::checkString($var, True); + $this->algo = $var; + + return $this; + } + + /** + * Value of the digest. + * + * Generated from protobuf field bytes digest_bytes = 2; + * @return string + */ + public function getDigestBytes() + { + return $this->digest_bytes; + } + + /** + * Value of the digest. + * + * Generated from protobuf field bytes digest_bytes = 2; + * @param string $var + * @return $this + */ + public function setDigestBytes($var) + { + GPBUtil::checkString($var, False); + $this->digest_bytes = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/DiscoveryNote.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/DiscoveryNote.php new file mode 100644 index 000000000000..d1fa446c046d --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/DiscoveryNote.php @@ -0,0 +1,73 @@ +grafeas.v1.DiscoveryNote + */ +class DiscoveryNote extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Immutable. The kind of analysis that is handled by this + * discovery. + * + * Generated from protobuf field .grafeas.v1.NoteKind analysis_kind = 1; + */ + protected $analysis_kind = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $analysis_kind + * Required. Immutable. The kind of analysis that is handled by this + * discovery. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Discovery::initOnce(); + parent::__construct($data); + } + + /** + * Required. Immutable. The kind of analysis that is handled by this + * discovery. + * + * Generated from protobuf field .grafeas.v1.NoteKind analysis_kind = 1; + * @return int + */ + public function getAnalysisKind() + { + return $this->analysis_kind; + } + + /** + * Required. Immutable. The kind of analysis that is handled by this + * discovery. + * + * Generated from protobuf field .grafeas.v1.NoteKind analysis_kind = 1; + * @param int $var + * @return $this + */ + public function setAnalysisKind($var) + { + GPBUtil::checkEnum($var, \Grafeas\V1\NoteKind::class); + $this->analysis_kind = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/DiscoveryOccurrence.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/DiscoveryOccurrence.php new file mode 100644 index 000000000000..e1710bb863ec --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/DiscoveryOccurrence.php @@ -0,0 +1,350 @@ +grafeas.v1.DiscoveryOccurrence + */ +class DiscoveryOccurrence extends \Google\Protobuf\Internal\Message +{ + /** + * Whether the resource is continuously analyzed. + * + * Generated from protobuf field .grafeas.v1.DiscoveryOccurrence.ContinuousAnalysis continuous_analysis = 1; + */ + protected $continuous_analysis = 0; + /** + * The status of discovery for the resource. + * + * Generated from protobuf field .grafeas.v1.DiscoveryOccurrence.AnalysisStatus analysis_status = 2; + */ + protected $analysis_status = 0; + /** + * Generated from protobuf field .grafeas.v1.DiscoveryOccurrence.AnalysisCompleted analysis_completed = 7; + */ + protected $analysis_completed = null; + /** + * Indicates any errors encountered during analysis of a resource. There + * could be 0 or more of these errors. + * + * Generated from protobuf field repeated .google.rpc.Status analysis_error = 8; + */ + private $analysis_error; + /** + * When an error is encountered this will contain a LocalizedMessage under + * details to show to the user. The LocalizedMessage is output only and + * populated by the API. + * + * Generated from protobuf field .google.rpc.Status analysis_status_error = 3; + */ + protected $analysis_status_error = null; + /** + * The CPE of the resource being scanned. + * + * Generated from protobuf field string cpe = 4; + */ + protected $cpe = ''; + /** + * The last time this resource was scanned. + * + * Generated from protobuf field .google.protobuf.Timestamp last_scan_time = 5; + */ + protected $last_scan_time = null; + /** + * The time occurrences related to this discovery occurrence were archived. + * + * Generated from protobuf field .google.protobuf.Timestamp archive_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $archive_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $continuous_analysis + * Whether the resource is continuously analyzed. + * @type int $analysis_status + * The status of discovery for the resource. + * @type \Grafeas\V1\DiscoveryOccurrence\AnalysisCompleted $analysis_completed + * @type array<\Google\Rpc\Status>|\Google\Protobuf\Internal\RepeatedField $analysis_error + * Indicates any errors encountered during analysis of a resource. There + * could be 0 or more of these errors. + * @type \Google\Rpc\Status $analysis_status_error + * When an error is encountered this will contain a LocalizedMessage under + * details to show to the user. The LocalizedMessage is output only and + * populated by the API. + * @type string $cpe + * The CPE of the resource being scanned. + * @type \Google\Protobuf\Timestamp $last_scan_time + * The last time this resource was scanned. + * @type \Google\Protobuf\Timestamp $archive_time + * The time occurrences related to this discovery occurrence were archived. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Discovery::initOnce(); + parent::__construct($data); + } + + /** + * Whether the resource is continuously analyzed. + * + * Generated from protobuf field .grafeas.v1.DiscoveryOccurrence.ContinuousAnalysis continuous_analysis = 1; + * @return int + */ + public function getContinuousAnalysis() + { + return $this->continuous_analysis; + } + + /** + * Whether the resource is continuously analyzed. + * + * Generated from protobuf field .grafeas.v1.DiscoveryOccurrence.ContinuousAnalysis continuous_analysis = 1; + * @param int $var + * @return $this + */ + public function setContinuousAnalysis($var) + { + GPBUtil::checkEnum($var, \Grafeas\V1\DiscoveryOccurrence\ContinuousAnalysis::class); + $this->continuous_analysis = $var; + + return $this; + } + + /** + * The status of discovery for the resource. + * + * Generated from protobuf field .grafeas.v1.DiscoveryOccurrence.AnalysisStatus analysis_status = 2; + * @return int + */ + public function getAnalysisStatus() + { + return $this->analysis_status; + } + + /** + * The status of discovery for the resource. + * + * Generated from protobuf field .grafeas.v1.DiscoveryOccurrence.AnalysisStatus analysis_status = 2; + * @param int $var + * @return $this + */ + public function setAnalysisStatus($var) + { + GPBUtil::checkEnum($var, \Grafeas\V1\DiscoveryOccurrence\AnalysisStatus::class); + $this->analysis_status = $var; + + return $this; + } + + /** + * Generated from protobuf field .grafeas.v1.DiscoveryOccurrence.AnalysisCompleted analysis_completed = 7; + * @return \Grafeas\V1\DiscoveryOccurrence\AnalysisCompleted|null + */ + public function getAnalysisCompleted() + { + return $this->analysis_completed; + } + + public function hasAnalysisCompleted() + { + return isset($this->analysis_completed); + } + + public function clearAnalysisCompleted() + { + unset($this->analysis_completed); + } + + /** + * Generated from protobuf field .grafeas.v1.DiscoveryOccurrence.AnalysisCompleted analysis_completed = 7; + * @param \Grafeas\V1\DiscoveryOccurrence\AnalysisCompleted $var + * @return $this + */ + public function setAnalysisCompleted($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\DiscoveryOccurrence\AnalysisCompleted::class); + $this->analysis_completed = $var; + + return $this; + } + + /** + * Indicates any errors encountered during analysis of a resource. There + * could be 0 or more of these errors. + * + * Generated from protobuf field repeated .google.rpc.Status analysis_error = 8; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAnalysisError() + { + return $this->analysis_error; + } + + /** + * Indicates any errors encountered during analysis of a resource. There + * could be 0 or more of these errors. + * + * Generated from protobuf field repeated .google.rpc.Status analysis_error = 8; + * @param array<\Google\Rpc\Status>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAnalysisError($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Rpc\Status::class); + $this->analysis_error = $arr; + + return $this; + } + + /** + * When an error is encountered this will contain a LocalizedMessage under + * details to show to the user. The LocalizedMessage is output only and + * populated by the API. + * + * Generated from protobuf field .google.rpc.Status analysis_status_error = 3; + * @return \Google\Rpc\Status|null + */ + public function getAnalysisStatusError() + { + return $this->analysis_status_error; + } + + public function hasAnalysisStatusError() + { + return isset($this->analysis_status_error); + } + + public function clearAnalysisStatusError() + { + unset($this->analysis_status_error); + } + + /** + * When an error is encountered this will contain a LocalizedMessage under + * details to show to the user. The LocalizedMessage is output only and + * populated by the API. + * + * Generated from protobuf field .google.rpc.Status analysis_status_error = 3; + * @param \Google\Rpc\Status $var + * @return $this + */ + public function setAnalysisStatusError($var) + { + GPBUtil::checkMessage($var, \Google\Rpc\Status::class); + $this->analysis_status_error = $var; + + return $this; + } + + /** + * The CPE of the resource being scanned. + * + * Generated from protobuf field string cpe = 4; + * @return string + */ + public function getCpe() + { + return $this->cpe; + } + + /** + * The CPE of the resource being scanned. + * + * Generated from protobuf field string cpe = 4; + * @param string $var + * @return $this + */ + public function setCpe($var) + { + GPBUtil::checkString($var, True); + $this->cpe = $var; + + return $this; + } + + /** + * The last time this resource was scanned. + * + * Generated from protobuf field .google.protobuf.Timestamp last_scan_time = 5; + * @return \Google\Protobuf\Timestamp|null + */ + public function getLastScanTime() + { + return $this->last_scan_time; + } + + public function hasLastScanTime() + { + return isset($this->last_scan_time); + } + + public function clearLastScanTime() + { + unset($this->last_scan_time); + } + + /** + * The last time this resource was scanned. + * + * Generated from protobuf field .google.protobuf.Timestamp last_scan_time = 5; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setLastScanTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->last_scan_time = $var; + + return $this; + } + + /** + * The time occurrences related to this discovery occurrence were archived. + * + * Generated from protobuf field .google.protobuf.Timestamp archive_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getArchiveTime() + { + return $this->archive_time; + } + + public function hasArchiveTime() + { + return isset($this->archive_time); + } + + public function clearArchiveTime() + { + unset($this->archive_time); + } + + /** + * The time occurrences related to this discovery occurrence were archived. + * + * Generated from protobuf field .google.protobuf.Timestamp archive_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setArchiveTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->archive_time = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/DiscoveryOccurrence/AnalysisCompleted.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/DiscoveryOccurrence/AnalysisCompleted.php new file mode 100644 index 000000000000..5d1e7201fb22 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/DiscoveryOccurrence/AnalysisCompleted.php @@ -0,0 +1,64 @@ +grafeas.v1.DiscoveryOccurrence.AnalysisCompleted + */ +class AnalysisCompleted extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field repeated string analysis_type = 1; + */ + private $analysis_type; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $analysis_type + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Discovery::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field repeated string analysis_type = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAnalysisType() + { + return $this->analysis_type; + } + + /** + * Generated from protobuf field repeated string analysis_type = 1; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAnalysisType($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->analysis_type = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(AnalysisCompleted::class, \Grafeas\V1\DiscoveryOccurrence_AnalysisCompleted::class); + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/DiscoveryOccurrence/AnalysisStatus.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/DiscoveryOccurrence/AnalysisStatus.php new file mode 100644 index 000000000000..fcef24fb33a3 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/DiscoveryOccurrence/AnalysisStatus.php @@ -0,0 +1,94 @@ +grafeas.v1.DiscoveryOccurrence.AnalysisStatus + */ +class AnalysisStatus +{ + /** + * Unknown. + * + * Generated from protobuf enum ANALYSIS_STATUS_UNSPECIFIED = 0; + */ + const ANALYSIS_STATUS_UNSPECIFIED = 0; + /** + * Resource is known but no action has been taken yet. + * + * Generated from protobuf enum PENDING = 1; + */ + const PENDING = 1; + /** + * Resource is being analyzed. + * + * Generated from protobuf enum SCANNING = 2; + */ + const SCANNING = 2; + /** + * Analysis has finished successfully. + * + * Generated from protobuf enum FINISHED_SUCCESS = 3; + */ + const FINISHED_SUCCESS = 3; + /** + * Analysis has completed. + * + * Generated from protobuf enum COMPLETE = 3; + */ + const COMPLETE = 3; + /** + * Analysis has finished unsuccessfully, the analysis itself is in a bad + * state. + * + * Generated from protobuf enum FINISHED_FAILED = 4; + */ + const FINISHED_FAILED = 4; + /** + * The resource is known not to be supported. + * + * Generated from protobuf enum FINISHED_UNSUPPORTED = 5; + */ + const FINISHED_UNSUPPORTED = 5; + + private static $valueToName = [ + self::ANALYSIS_STATUS_UNSPECIFIED => 'ANALYSIS_STATUS_UNSPECIFIED', + self::PENDING => 'PENDING', + self::SCANNING => 'SCANNING', + self::FINISHED_SUCCESS => 'FINISHED_SUCCESS', + self::COMPLETE => 'COMPLETE', + self::FINISHED_FAILED => 'FINISHED_FAILED', + self::FINISHED_UNSUPPORTED => 'FINISHED_UNSUPPORTED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(AnalysisStatus::class, \Grafeas\V1\DiscoveryOccurrence_AnalysisStatus::class); + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/DiscoveryOccurrence/ContinuousAnalysis.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/DiscoveryOccurrence/ContinuousAnalysis.php new file mode 100644 index 000000000000..350c2fb7590b --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/DiscoveryOccurrence/ContinuousAnalysis.php @@ -0,0 +1,64 @@ +grafeas.v1.DiscoveryOccurrence.ContinuousAnalysis + */ +class ContinuousAnalysis +{ + /** + * Unknown. + * + * Generated from protobuf enum CONTINUOUS_ANALYSIS_UNSPECIFIED = 0; + */ + const CONTINUOUS_ANALYSIS_UNSPECIFIED = 0; + /** + * The resource is continuously analyzed. + * + * Generated from protobuf enum ACTIVE = 1; + */ + const ACTIVE = 1; + /** + * The resource is ignored for continuous analysis. + * + * Generated from protobuf enum INACTIVE = 2; + */ + const INACTIVE = 2; + + private static $valueToName = [ + self::CONTINUOUS_ANALYSIS_UNSPECIFIED => 'CONTINUOUS_ANALYSIS_UNSPECIFIED', + self::ACTIVE => 'ACTIVE', + self::INACTIVE => 'INACTIVE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ContinuousAnalysis::class, \Grafeas\V1\DiscoveryOccurrence_ContinuousAnalysis::class); + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/DiscoveryOccurrence_AnalysisCompleted.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/DiscoveryOccurrence_AnalysisCompleted.php new file mode 100644 index 000000000000..8fb46b02d277 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/DiscoveryOccurrence_AnalysisCompleted.php @@ -0,0 +1,16 @@ +grafeas.v1.Distribution + */ +class Distribution extends \Google\Protobuf\Internal\Message +{ + /** + * The cpe_uri in [CPE format](https://cpe.mitre.org/specification/) + * denoting the package manager version distributing a package. + * + * Generated from protobuf field string cpe_uri = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $cpe_uri = ''; + /** + * The CPU architecture for which packages in this distribution channel were + * built. + * + * Generated from protobuf field .grafeas.v1.Architecture architecture = 2; + */ + protected $architecture = 0; + /** + * The latest available version of this package in this distribution channel. + * + * Generated from protobuf field .grafeas.v1.Version latest_version = 3; + */ + protected $latest_version = null; + /** + * A freeform string denoting the maintainer of this package. + * + * Generated from protobuf field string maintainer = 4; + */ + protected $maintainer = ''; + /** + * The distribution channel-specific homepage for this package. + * + * Generated from protobuf field string url = 5; + */ + protected $url = ''; + /** + * The distribution channel-specific description of this package. + * + * Generated from protobuf field string description = 6; + */ + protected $description = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $cpe_uri + * The cpe_uri in [CPE format](https://cpe.mitre.org/specification/) + * denoting the package manager version distributing a package. + * @type int $architecture + * The CPU architecture for which packages in this distribution channel were + * built. + * @type \Grafeas\V1\Version $latest_version + * The latest available version of this package in this distribution channel. + * @type string $maintainer + * A freeform string denoting the maintainer of this package. + * @type string $url + * The distribution channel-specific homepage for this package. + * @type string $description + * The distribution channel-specific description of this package. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Package::initOnce(); + parent::__construct($data); + } + + /** + * The cpe_uri in [CPE format](https://cpe.mitre.org/specification/) + * denoting the package manager version distributing a package. + * + * Generated from protobuf field string cpe_uri = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getCpeUri() + { + return $this->cpe_uri; + } + + /** + * The cpe_uri in [CPE format](https://cpe.mitre.org/specification/) + * denoting the package manager version distributing a package. + * + * Generated from protobuf field string cpe_uri = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setCpeUri($var) + { + GPBUtil::checkString($var, True); + $this->cpe_uri = $var; + + return $this; + } + + /** + * The CPU architecture for which packages in this distribution channel were + * built. + * + * Generated from protobuf field .grafeas.v1.Architecture architecture = 2; + * @return int + */ + public function getArchitecture() + { + return $this->architecture; + } + + /** + * The CPU architecture for which packages in this distribution channel were + * built. + * + * Generated from protobuf field .grafeas.v1.Architecture architecture = 2; + * @param int $var + * @return $this + */ + public function setArchitecture($var) + { + GPBUtil::checkEnum($var, \Grafeas\V1\Architecture::class); + $this->architecture = $var; + + return $this; + } + + /** + * The latest available version of this package in this distribution channel. + * + * Generated from protobuf field .grafeas.v1.Version latest_version = 3; + * @return \Grafeas\V1\Version|null + */ + public function getLatestVersion() + { + return $this->latest_version; + } + + public function hasLatestVersion() + { + return isset($this->latest_version); + } + + public function clearLatestVersion() + { + unset($this->latest_version); + } + + /** + * The latest available version of this package in this distribution channel. + * + * Generated from protobuf field .grafeas.v1.Version latest_version = 3; + * @param \Grafeas\V1\Version $var + * @return $this + */ + public function setLatestVersion($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\Version::class); + $this->latest_version = $var; + + return $this; + } + + /** + * A freeform string denoting the maintainer of this package. + * + * Generated from protobuf field string maintainer = 4; + * @return string + */ + public function getMaintainer() + { + return $this->maintainer; + } + + /** + * A freeform string denoting the maintainer of this package. + * + * Generated from protobuf field string maintainer = 4; + * @param string $var + * @return $this + */ + public function setMaintainer($var) + { + GPBUtil::checkString($var, True); + $this->maintainer = $var; + + return $this; + } + + /** + * The distribution channel-specific homepage for this package. + * + * Generated from protobuf field string url = 5; + * @return string + */ + public function getUrl() + { + return $this->url; + } + + /** + * The distribution channel-specific homepage for this package. + * + * Generated from protobuf field string url = 5; + * @param string $var + * @return $this + */ + public function setUrl($var) + { + GPBUtil::checkString($var, True); + $this->url = $var; + + return $this; + } + + /** + * The distribution channel-specific description of this package. + * + * Generated from protobuf field string description = 6; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * The distribution channel-specific description of this package. + * + * Generated from protobuf field string description = 6; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/Envelope.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/Envelope.php new file mode 100644 index 000000000000..17bcc1346ae5 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/Envelope.php @@ -0,0 +1,116 @@ +grafeas.v1.Envelope + */ +class Envelope extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field bytes payload = 1; + */ + protected $payload = ''; + /** + * Generated from protobuf field string payload_type = 2; + */ + protected $payload_type = ''; + /** + * Generated from protobuf field repeated .grafeas.v1.EnvelopeSignature signatures = 3; + */ + private $signatures; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $payload + * @type string $payload_type + * @type array<\Grafeas\V1\EnvelopeSignature>|\Google\Protobuf\Internal\RepeatedField $signatures + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Common::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field bytes payload = 1; + * @return string + */ + public function getPayload() + { + return $this->payload; + } + + /** + * Generated from protobuf field bytes payload = 1; + * @param string $var + * @return $this + */ + public function setPayload($var) + { + GPBUtil::checkString($var, False); + $this->payload = $var; + + return $this; + } + + /** + * Generated from protobuf field string payload_type = 2; + * @return string + */ + public function getPayloadType() + { + return $this->payload_type; + } + + /** + * Generated from protobuf field string payload_type = 2; + * @param string $var + * @return $this + */ + public function setPayloadType($var) + { + GPBUtil::checkString($var, True); + $this->payload_type = $var; + + return $this; + } + + /** + * Generated from protobuf field repeated .grafeas.v1.EnvelopeSignature signatures = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSignatures() + { + return $this->signatures; + } + + /** + * Generated from protobuf field repeated .grafeas.v1.EnvelopeSignature signatures = 3; + * @param array<\Grafeas\V1\EnvelopeSignature>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSignatures($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Grafeas\V1\EnvelopeSignature::class); + $this->signatures = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/EnvelopeSignature.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/EnvelopeSignature.php new file mode 100644 index 000000000000..61ebdc60fbcf --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/EnvelopeSignature.php @@ -0,0 +1,85 @@ +grafeas.v1.EnvelopeSignature + */ +class EnvelopeSignature extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field bytes sig = 1; + */ + protected $sig = ''; + /** + * Generated from protobuf field string keyid = 2; + */ + protected $keyid = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $sig + * @type string $keyid + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Common::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field bytes sig = 1; + * @return string + */ + public function getSig() + { + return $this->sig; + } + + /** + * Generated from protobuf field bytes sig = 1; + * @param string $var + * @return $this + */ + public function setSig($var) + { + GPBUtil::checkString($var, False); + $this->sig = $var; + + return $this; + } + + /** + * Generated from protobuf field string keyid = 2; + * @return string + */ + public function getKeyid() + { + return $this->keyid; + } + + /** + * Generated from protobuf field string keyid = 2; + * @param string $var + * @return $this + */ + public function setKeyid($var) + { + GPBUtil::checkString($var, True); + $this->keyid = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/FileHashes.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/FileHashes.php new file mode 100644 index 000000000000..a24ab1da8401 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/FileHashes.php @@ -0,0 +1,68 @@ +grafeas.v1.FileHashes + */ +class FileHashes extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Collection of file hashes. + * + * Generated from protobuf field repeated .grafeas.v1.Hash file_hash = 1; + */ + private $file_hash; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Grafeas\V1\Hash>|\Google\Protobuf\Internal\RepeatedField $file_hash + * Required. Collection of file hashes. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Provenance::initOnce(); + parent::__construct($data); + } + + /** + * Required. Collection of file hashes. + * + * Generated from protobuf field repeated .grafeas.v1.Hash file_hash = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getFileHash() + { + return $this->file_hash; + } + + /** + * Required. Collection of file hashes. + * + * Generated from protobuf field repeated .grafeas.v1.Hash file_hash = 1; + * @param array<\Grafeas\V1\Hash>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setFileHash($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Grafeas\V1\Hash::class); + $this->file_hash = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/FileLocation.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/FileLocation.php new file mode 100644 index 000000000000..c7f6d9e7cccc --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/FileLocation.php @@ -0,0 +1,71 @@ +grafeas.v1.FileLocation + */ +class FileLocation extends \Google\Protobuf\Internal\Message +{ + /** + * For jars that are contained inside .war files, this filepath + * can indicate the path to war file combined with the path to jar file. + * + * Generated from protobuf field string file_path = 1; + */ + protected $file_path = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $file_path + * For jars that are contained inside .war files, this filepath + * can indicate the path to war file combined with the path to jar file. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Common::initOnce(); + parent::__construct($data); + } + + /** + * For jars that are contained inside .war files, this filepath + * can indicate the path to war file combined with the path to jar file. + * + * Generated from protobuf field string file_path = 1; + * @return string + */ + public function getFilePath() + { + return $this->file_path; + } + + /** + * For jars that are contained inside .war files, this filepath + * can indicate the path to war file combined with the path to jar file. + * + * Generated from protobuf field string file_path = 1; + * @param string $var + * @return $this + */ + public function setFilePath($var) + { + GPBUtil::checkString($var, True); + $this->file_path = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/Fingerprint.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/Fingerprint.php new file mode 100644 index 000000000000..7191d7383ef5 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/Fingerprint.php @@ -0,0 +1,151 @@ +grafeas.v1.Fingerprint + */ +class Fingerprint extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The layer ID of the final layer in the Docker image's v1 + * representation. + * + * Generated from protobuf field string v1_name = 1; + */ + protected $v1_name = ''; + /** + * Required. The ordered list of v2 blobs that represent a given image. + * + * Generated from protobuf field repeated string v2_blob = 2; + */ + private $v2_blob; + /** + * Output only. The name of the image's v2 blobs computed via: + * [bottom] := v2_blob[bottom] + * [N] := sha256(v2_blob[N] + " " + v2_name[N+1]) + * Only the name of the final blob is kept. + * + * Generated from protobuf field string v2_name = 3; + */ + protected $v2_name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $v1_name + * Required. The layer ID of the final layer in the Docker image's v1 + * representation. + * @type array|\Google\Protobuf\Internal\RepeatedField $v2_blob + * Required. The ordered list of v2 blobs that represent a given image. + * @type string $v2_name + * Output only. The name of the image's v2 blobs computed via: + * [bottom] := v2_blob[bottom] + * [N] := sha256(v2_blob[N] + " " + v2_name[N+1]) + * Only the name of the final blob is kept. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Image::initOnce(); + parent::__construct($data); + } + + /** + * Required. The layer ID of the final layer in the Docker image's v1 + * representation. + * + * Generated from protobuf field string v1_name = 1; + * @return string + */ + public function getV1Name() + { + return $this->v1_name; + } + + /** + * Required. The layer ID of the final layer in the Docker image's v1 + * representation. + * + * Generated from protobuf field string v1_name = 1; + * @param string $var + * @return $this + */ + public function setV1Name($var) + { + GPBUtil::checkString($var, True); + $this->v1_name = $var; + + return $this; + } + + /** + * Required. The ordered list of v2 blobs that represent a given image. + * + * Generated from protobuf field repeated string v2_blob = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getV2Blob() + { + return $this->v2_blob; + } + + /** + * Required. The ordered list of v2 blobs that represent a given image. + * + * Generated from protobuf field repeated string v2_blob = 2; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setV2Blob($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->v2_blob = $arr; + + return $this; + } + + /** + * Output only. The name of the image's v2 blobs computed via: + * [bottom] := v2_blob[bottom] + * [N] := sha256(v2_blob[N] + " " + v2_name[N+1]) + * Only the name of the final blob is kept. + * + * Generated from protobuf field string v2_name = 3; + * @return string + */ + public function getV2Name() + { + return $this->v2_name; + } + + /** + * Output only. The name of the image's v2 blobs computed via: + * [bottom] := v2_blob[bottom] + * [N] := sha256(v2_blob[N] + " " + v2_name[N+1]) + * Only the name of the final blob is kept. + * + * Generated from protobuf field string v2_name = 3; + * @param string $var + * @return $this + */ + public function setV2Name($var) + { + GPBUtil::checkString($var, True); + $this->v2_name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/GerritSourceContext.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/GerritSourceContext.php new file mode 100644 index 000000000000..616fb62984ad --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/GerritSourceContext.php @@ -0,0 +1,184 @@ +grafeas.v1.GerritSourceContext + */ +class GerritSourceContext extends \Google\Protobuf\Internal\Message +{ + /** + * The URI of a running Gerrit instance. + * + * Generated from protobuf field string host_uri = 1; + */ + protected $host_uri = ''; + /** + * The full project name within the host. Projects may be nested, so + * "project/subproject" is a valid project name. The "repo name" is the + * hostURI/project. + * + * Generated from protobuf field string gerrit_project = 2; + */ + protected $gerrit_project = ''; + protected $revision; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $host_uri + * The URI of a running Gerrit instance. + * @type string $gerrit_project + * The full project name within the host. Projects may be nested, so + * "project/subproject" is a valid project name. The "repo name" is the + * hostURI/project. + * @type string $revision_id + * A revision (commit) ID. + * @type \Grafeas\V1\AliasContext $alias_context + * An alias, which may be a branch or tag. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Provenance::initOnce(); + parent::__construct($data); + } + + /** + * The URI of a running Gerrit instance. + * + * Generated from protobuf field string host_uri = 1; + * @return string + */ + public function getHostUri() + { + return $this->host_uri; + } + + /** + * The URI of a running Gerrit instance. + * + * Generated from protobuf field string host_uri = 1; + * @param string $var + * @return $this + */ + public function setHostUri($var) + { + GPBUtil::checkString($var, True); + $this->host_uri = $var; + + return $this; + } + + /** + * The full project name within the host. Projects may be nested, so + * "project/subproject" is a valid project name. The "repo name" is the + * hostURI/project. + * + * Generated from protobuf field string gerrit_project = 2; + * @return string + */ + public function getGerritProject() + { + return $this->gerrit_project; + } + + /** + * The full project name within the host. Projects may be nested, so + * "project/subproject" is a valid project name. The "repo name" is the + * hostURI/project. + * + * Generated from protobuf field string gerrit_project = 2; + * @param string $var + * @return $this + */ + public function setGerritProject($var) + { + GPBUtil::checkString($var, True); + $this->gerrit_project = $var; + + return $this; + } + + /** + * A revision (commit) ID. + * + * Generated from protobuf field string revision_id = 3; + * @return string + */ + public function getRevisionId() + { + return $this->readOneof(3); + } + + public function hasRevisionId() + { + return $this->hasOneof(3); + } + + /** + * A revision (commit) ID. + * + * Generated from protobuf field string revision_id = 3; + * @param string $var + * @return $this + */ + public function setRevisionId($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * An alias, which may be a branch or tag. + * + * Generated from protobuf field .grafeas.v1.AliasContext alias_context = 4; + * @return \Grafeas\V1\AliasContext|null + */ + public function getAliasContext() + { + return $this->readOneof(4); + } + + public function hasAliasContext() + { + return $this->hasOneof(4); + } + + /** + * An alias, which may be a branch or tag. + * + * Generated from protobuf field .grafeas.v1.AliasContext alias_context = 4; + * @param \Grafeas\V1\AliasContext $var + * @return $this + */ + public function setAliasContext($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\AliasContext::class); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * @return string + */ + public function getRevision() + { + return $this->whichOneof("revision"); + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/GetNoteRequest.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/GetNoteRequest.php new file mode 100644 index 000000000000..8f653431ea0e --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/GetNoteRequest.php @@ -0,0 +1,86 @@ +grafeas.v1.GetNoteRequest + */ +class GetNoteRequest extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the note in the form of + * `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name The name of the note in the form of + * `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. Please see + * {@see GrafeasClient::noteName()} for help formatting this field. + * + * @return \Grafeas\V1\GetNoteRequest + * + * @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 + * The name of the note in the form of + * `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Grafeas::initOnce(); + parent::__construct($data); + } + + /** + * The name of the note in the form of + * `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The name of the note in the form of + * `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. + * + * 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; + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/GetOccurrenceNoteRequest.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/GetOccurrenceNoteRequest.php new file mode 100644 index 000000000000..805395e9fb91 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/GetOccurrenceNoteRequest.php @@ -0,0 +1,86 @@ +grafeas.v1.GetOccurrenceNoteRequest + */ +class GetOccurrenceNoteRequest extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the occurrence in the form of + * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name The name of the occurrence in the form of + * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. Please see + * {@see GrafeasClient::occurrenceName()} for help formatting this field. + * + * @return \Grafeas\V1\GetOccurrenceNoteRequest + * + * @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 + * The name of the occurrence in the form of + * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Grafeas::initOnce(); + parent::__construct($data); + } + + /** + * The name of the occurrence in the form of + * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The name of the occurrence in the form of + * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. + * + * 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; + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/GetOccurrenceRequest.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/GetOccurrenceRequest.php new file mode 100644 index 000000000000..4e2ef6f3fa04 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/GetOccurrenceRequest.php @@ -0,0 +1,86 @@ +grafeas.v1.GetOccurrenceRequest + */ +class GetOccurrenceRequest extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the occurrence in the form of + * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name The name of the occurrence in the form of + * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. Please see + * {@see GrafeasClient::occurrenceName()} for help formatting this field. + * + * @return \Grafeas\V1\GetOccurrenceRequest + * + * @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 + * The name of the occurrence in the form of + * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Grafeas::initOnce(); + parent::__construct($data); + } + + /** + * The name of the occurrence in the form of + * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The name of the occurrence in the form of + * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. + * + * 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; + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/GitSourceContext.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/GitSourceContext.php new file mode 100644 index 000000000000..6eb31ad84fe2 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/GitSourceContext.php @@ -0,0 +1,102 @@ +grafeas.v1.GitSourceContext + */ +class GitSourceContext extends \Google\Protobuf\Internal\Message +{ + /** + * Git repository URL. + * + * Generated from protobuf field string url = 1; + */ + protected $url = ''; + /** + * Git commit hash. + * + * Generated from protobuf field string revision_id = 2; + */ + protected $revision_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $url + * Git repository URL. + * @type string $revision_id + * Git commit hash. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Provenance::initOnce(); + parent::__construct($data); + } + + /** + * Git repository URL. + * + * Generated from protobuf field string url = 1; + * @return string + */ + public function getUrl() + { + return $this->url; + } + + /** + * Git repository URL. + * + * Generated from protobuf field string url = 1; + * @param string $var + * @return $this + */ + public function setUrl($var) + { + GPBUtil::checkString($var, True); + $this->url = $var; + + return $this; + } + + /** + * Git commit hash. + * + * Generated from protobuf field string revision_id = 2; + * @return string + */ + public function getRevisionId() + { + return $this->revision_id; + } + + /** + * Git commit hash. + * + * Generated from protobuf field string revision_id = 2; + * @param string $var + * @return $this + */ + public function setRevisionId($var) + { + GPBUtil::checkString($var, True); + $this->revision_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/GrafeasGrpcClient.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/GrafeasGrpcClient.php new file mode 100644 index 000000000000..5c3784661a8b --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/GrafeasGrpcClient.php @@ -0,0 +1,263 @@ +_simpleRequest('/grafeas.v1.Grafeas/GetOccurrence', + $argument, + ['\Grafeas\V1\Occurrence', 'decode'], + $metadata, $options); + } + + /** + * Lists occurrences for the specified project. + * @param \Grafeas\V1\ListOccurrencesRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function ListOccurrences(\Grafeas\V1\ListOccurrencesRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/grafeas.v1.Grafeas/ListOccurrences', + $argument, + ['\Grafeas\V1\ListOccurrencesResponse', 'decode'], + $metadata, $options); + } + + /** + * Deletes the specified occurrence. For example, use this method to delete an + * occurrence when the occurrence is no longer applicable for the given + * resource. + * @param \Grafeas\V1\DeleteOccurrenceRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function DeleteOccurrence(\Grafeas\V1\DeleteOccurrenceRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/grafeas.v1.Grafeas/DeleteOccurrence', + $argument, + ['\Google\Protobuf\GPBEmpty', 'decode'], + $metadata, $options); + } + + /** + * Creates a new occurrence. + * @param \Grafeas\V1\CreateOccurrenceRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function CreateOccurrence(\Grafeas\V1\CreateOccurrenceRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/grafeas.v1.Grafeas/CreateOccurrence', + $argument, + ['\Grafeas\V1\Occurrence', 'decode'], + $metadata, $options); + } + + /** + * Creates new occurrences in batch. + * @param \Grafeas\V1\BatchCreateOccurrencesRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function BatchCreateOccurrences(\Grafeas\V1\BatchCreateOccurrencesRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/grafeas.v1.Grafeas/BatchCreateOccurrences', + $argument, + ['\Grafeas\V1\BatchCreateOccurrencesResponse', 'decode'], + $metadata, $options); + } + + /** + * Updates the specified occurrence. + * @param \Grafeas\V1\UpdateOccurrenceRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function UpdateOccurrence(\Grafeas\V1\UpdateOccurrenceRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/grafeas.v1.Grafeas/UpdateOccurrence', + $argument, + ['\Grafeas\V1\Occurrence', 'decode'], + $metadata, $options); + } + + /** + * Gets the note attached to the specified occurrence. Consumer projects can + * use this method to get a note that belongs to a provider project. + * @param \Grafeas\V1\GetOccurrenceNoteRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function GetOccurrenceNote(\Grafeas\V1\GetOccurrenceNoteRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/grafeas.v1.Grafeas/GetOccurrenceNote', + $argument, + ['\Grafeas\V1\Note', 'decode'], + $metadata, $options); + } + + /** + * Gets the specified note. + * @param \Grafeas\V1\GetNoteRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function GetNote(\Grafeas\V1\GetNoteRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/grafeas.v1.Grafeas/GetNote', + $argument, + ['\Grafeas\V1\Note', 'decode'], + $metadata, $options); + } + + /** + * Lists notes for the specified project. + * @param \Grafeas\V1\ListNotesRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function ListNotes(\Grafeas\V1\ListNotesRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/grafeas.v1.Grafeas/ListNotes', + $argument, + ['\Grafeas\V1\ListNotesResponse', 'decode'], + $metadata, $options); + } + + /** + * Deletes the specified note. + * @param \Grafeas\V1\DeleteNoteRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function DeleteNote(\Grafeas\V1\DeleteNoteRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/grafeas.v1.Grafeas/DeleteNote', + $argument, + ['\Google\Protobuf\GPBEmpty', 'decode'], + $metadata, $options); + } + + /** + * Creates a new note. + * @param \Grafeas\V1\CreateNoteRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function CreateNote(\Grafeas\V1\CreateNoteRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/grafeas.v1.Grafeas/CreateNote', + $argument, + ['\Grafeas\V1\Note', 'decode'], + $metadata, $options); + } + + /** + * Creates new notes in batch. + * @param \Grafeas\V1\BatchCreateNotesRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function BatchCreateNotes(\Grafeas\V1\BatchCreateNotesRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/grafeas.v1.Grafeas/BatchCreateNotes', + $argument, + ['\Grafeas\V1\BatchCreateNotesResponse', 'decode'], + $metadata, $options); + } + + /** + * Updates the specified note. + * @param \Grafeas\V1\UpdateNoteRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function UpdateNote(\Grafeas\V1\UpdateNoteRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/grafeas.v1.Grafeas/UpdateNote', + $argument, + ['\Grafeas\V1\Note', 'decode'], + $metadata, $options); + } + + /** + * Lists occurrences referencing the specified note. Provider projects can use + * this method to get all occurrences across consumer projects referencing the + * specified note. + * @param \Grafeas\V1\ListNoteOccurrencesRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function ListNoteOccurrences(\Grafeas\V1\ListNoteOccurrencesRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/grafeas.v1.Grafeas/ListNoteOccurrences', + $argument, + ['\Grafeas\V1\ListNoteOccurrencesResponse', 'decode'], + $metadata, $options); + } + +} diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/Hash.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/Hash.php new file mode 100644 index 000000000000..a6f6d1b8ae02 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/Hash.php @@ -0,0 +1,101 @@ +grafeas.v1.Hash + */ +class Hash extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The type of hash that was performed, e.g. "SHA-256". + * + * Generated from protobuf field string type = 1; + */ + protected $type = ''; + /** + * Required. The hash value. + * + * Generated from protobuf field bytes value = 2; + */ + protected $value = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $type + * Required. The type of hash that was performed, e.g. "SHA-256". + * @type string $value + * Required. The hash value. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Provenance::initOnce(); + parent::__construct($data); + } + + /** + * Required. The type of hash that was performed, e.g. "SHA-256". + * + * Generated from protobuf field string type = 1; + * @return string + */ + public function getType() + { + return $this->type; + } + + /** + * Required. The type of hash that was performed, e.g. "SHA-256". + * + * Generated from protobuf field string type = 1; + * @param string $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkString($var, True); + $this->type = $var; + + return $this; + } + + /** + * Required. The hash value. + * + * Generated from protobuf field bytes value = 2; + * @return string + */ + public function getValue() + { + return $this->value; + } + + /** + * Required. The hash value. + * + * Generated from protobuf field bytes value = 2; + * @param string $var + * @return $this + */ + public function setValue($var) + { + GPBUtil::checkString($var, False); + $this->value = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/ImageNote.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/ImageNote.php new file mode 100644 index 000000000000..661c99087167 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/ImageNote.php @@ -0,0 +1,119 @@ + + * Or an equivalent reference, e.g., a tag of the resource_url. + * + * Generated from protobuf message grafeas.v1.ImageNote + */ +class ImageNote extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Immutable. The resource_url for the resource representing the + * basis of associated occurrence images. + * + * Generated from protobuf field string resource_url = 1; + */ + protected $resource_url = ''; + /** + * Required. Immutable. The fingerprint of the base image. + * + * Generated from protobuf field .grafeas.v1.Fingerprint fingerprint = 2; + */ + protected $fingerprint = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $resource_url + * Required. Immutable. The resource_url for the resource representing the + * basis of associated occurrence images. + * @type \Grafeas\V1\Fingerprint $fingerprint + * Required. Immutable. The fingerprint of the base image. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Image::initOnce(); + parent::__construct($data); + } + + /** + * Required. Immutable. The resource_url for the resource representing the + * basis of associated occurrence images. + * + * Generated from protobuf field string resource_url = 1; + * @return string + */ + public function getResourceUrl() + { + return $this->resource_url; + } + + /** + * Required. Immutable. The resource_url for the resource representing the + * basis of associated occurrence images. + * + * Generated from protobuf field string resource_url = 1; + * @param string $var + * @return $this + */ + public function setResourceUrl($var) + { + GPBUtil::checkString($var, True); + $this->resource_url = $var; + + return $this; + } + + /** + * Required. Immutable. The fingerprint of the base image. + * + * Generated from protobuf field .grafeas.v1.Fingerprint fingerprint = 2; + * @return \Grafeas\V1\Fingerprint|null + */ + public function getFingerprint() + { + return $this->fingerprint; + } + + public function hasFingerprint() + { + return isset($this->fingerprint); + } + + public function clearFingerprint() + { + unset($this->fingerprint); + } + + /** + * Required. Immutable. The fingerprint of the base image. + * + * Generated from protobuf field .grafeas.v1.Fingerprint fingerprint = 2; + * @param \Grafeas\V1\Fingerprint $var + * @return $this + */ + public function setFingerprint($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\Fingerprint::class); + $this->fingerprint = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/ImageOccurrence.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/ImageOccurrence.php new file mode 100644 index 000000000000..e6c64fc037e3 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/ImageOccurrence.php @@ -0,0 +1,197 @@ +. + * + * Generated from protobuf message grafeas.v1.ImageOccurrence + */ +class ImageOccurrence extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The fingerprint of the derived image. + * + * Generated from protobuf field .grafeas.v1.Fingerprint fingerprint = 1; + */ + protected $fingerprint = null; + /** + * Output only. The number of layers by which this image differs from the + * associated image basis. + * + * Generated from protobuf field int32 distance = 2; + */ + protected $distance = 0; + /** + * This contains layer-specific metadata, if populated it has length + * "distance" and is ordered with [distance] being the layer immediately + * following the base image and [1] being the final layer. + * + * Generated from protobuf field repeated .grafeas.v1.Layer layer_info = 3; + */ + private $layer_info; + /** + * Output only. This contains the base image URL for the derived image + * occurrence. + * + * Generated from protobuf field string base_resource_url = 4; + */ + protected $base_resource_url = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Grafeas\V1\Fingerprint $fingerprint + * Required. The fingerprint of the derived image. + * @type int $distance + * Output only. The number of layers by which this image differs from the + * associated image basis. + * @type array<\Grafeas\V1\Layer>|\Google\Protobuf\Internal\RepeatedField $layer_info + * This contains layer-specific metadata, if populated it has length + * "distance" and is ordered with [distance] being the layer immediately + * following the base image and [1] being the final layer. + * @type string $base_resource_url + * Output only. This contains the base image URL for the derived image + * occurrence. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Image::initOnce(); + parent::__construct($data); + } + + /** + * Required. The fingerprint of the derived image. + * + * Generated from protobuf field .grafeas.v1.Fingerprint fingerprint = 1; + * @return \Grafeas\V1\Fingerprint|null + */ + public function getFingerprint() + { + return $this->fingerprint; + } + + public function hasFingerprint() + { + return isset($this->fingerprint); + } + + public function clearFingerprint() + { + unset($this->fingerprint); + } + + /** + * Required. The fingerprint of the derived image. + * + * Generated from protobuf field .grafeas.v1.Fingerprint fingerprint = 1; + * @param \Grafeas\V1\Fingerprint $var + * @return $this + */ + public function setFingerprint($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\Fingerprint::class); + $this->fingerprint = $var; + + return $this; + } + + /** + * Output only. The number of layers by which this image differs from the + * associated image basis. + * + * Generated from protobuf field int32 distance = 2; + * @return int + */ + public function getDistance() + { + return $this->distance; + } + + /** + * Output only. The number of layers by which this image differs from the + * associated image basis. + * + * Generated from protobuf field int32 distance = 2; + * @param int $var + * @return $this + */ + public function setDistance($var) + { + GPBUtil::checkInt32($var); + $this->distance = $var; + + return $this; + } + + /** + * This contains layer-specific metadata, if populated it has length + * "distance" and is ordered with [distance] being the layer immediately + * following the base image and [1] being the final layer. + * + * Generated from protobuf field repeated .grafeas.v1.Layer layer_info = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getLayerInfo() + { + return $this->layer_info; + } + + /** + * This contains layer-specific metadata, if populated it has length + * "distance" and is ordered with [distance] being the layer immediately + * following the base image and [1] being the final layer. + * + * Generated from protobuf field repeated .grafeas.v1.Layer layer_info = 3; + * @param array<\Grafeas\V1\Layer>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setLayerInfo($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Grafeas\V1\Layer::class); + $this->layer_info = $arr; + + return $this; + } + + /** + * Output only. This contains the base image URL for the derived image + * occurrence. + * + * Generated from protobuf field string base_resource_url = 4; + * @return string + */ + public function getBaseResourceUrl() + { + return $this->base_resource_url; + } + + /** + * Output only. This contains the base image URL for the derived image + * occurrence. + * + * Generated from protobuf field string base_resource_url = 4; + * @param string $var + * @return $this + */ + public function setBaseResourceUrl($var) + { + GPBUtil::checkString($var, True); + $this->base_resource_url = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/InTotoProvenance.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/InTotoProvenance.php new file mode 100644 index 000000000000..74cc83a629ce --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/InTotoProvenance.php @@ -0,0 +1,214 @@ +grafeas.v1.InTotoProvenance + */ +class InTotoProvenance extends \Google\Protobuf\Internal\Message +{ + /** + * required + * + * Generated from protobuf field .grafeas.v1.BuilderConfig builder_config = 1; + */ + protected $builder_config = null; + /** + * Identifies the configuration used for the build. + * When combined with materials, this SHOULD fully describe the build, + * such that re-running this recipe results in bit-for-bit identical output + * (if the build is reproducible). + * + * Generated from protobuf field .grafeas.v1.Recipe recipe = 2; + */ + protected $recipe = null; + /** + * Generated from protobuf field .grafeas.v1.Metadata metadata = 3; + */ + protected $metadata = null; + /** + * The collection of artifacts that influenced the build including sources, + * dependencies, build tools, base images, and so on. This is considered to be + * incomplete unless metadata.completeness.materials is true. Unset or null is + * equivalent to empty. + * + * Generated from protobuf field repeated string materials = 4; + */ + private $materials; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Grafeas\V1\BuilderConfig $builder_config + * required + * @type \Grafeas\V1\Recipe $recipe + * Identifies the configuration used for the build. + * When combined with materials, this SHOULD fully describe the build, + * such that re-running this recipe results in bit-for-bit identical output + * (if the build is reproducible). + * @type \Grafeas\V1\Metadata $metadata + * @type array|\Google\Protobuf\Internal\RepeatedField $materials + * The collection of artifacts that influenced the build including sources, + * dependencies, build tools, base images, and so on. This is considered to be + * incomplete unless metadata.completeness.materials is true. Unset or null is + * equivalent to empty. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\IntotoProvenance::initOnce(); + parent::__construct($data); + } + + /** + * required + * + * Generated from protobuf field .grafeas.v1.BuilderConfig builder_config = 1; + * @return \Grafeas\V1\BuilderConfig|null + */ + public function getBuilderConfig() + { + return $this->builder_config; + } + + public function hasBuilderConfig() + { + return isset($this->builder_config); + } + + public function clearBuilderConfig() + { + unset($this->builder_config); + } + + /** + * required + * + * Generated from protobuf field .grafeas.v1.BuilderConfig builder_config = 1; + * @param \Grafeas\V1\BuilderConfig $var + * @return $this + */ + public function setBuilderConfig($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\BuilderConfig::class); + $this->builder_config = $var; + + return $this; + } + + /** + * Identifies the configuration used for the build. + * When combined with materials, this SHOULD fully describe the build, + * such that re-running this recipe results in bit-for-bit identical output + * (if the build is reproducible). + * + * Generated from protobuf field .grafeas.v1.Recipe recipe = 2; + * @return \Grafeas\V1\Recipe|null + */ + public function getRecipe() + { + return $this->recipe; + } + + public function hasRecipe() + { + return isset($this->recipe); + } + + public function clearRecipe() + { + unset($this->recipe); + } + + /** + * Identifies the configuration used for the build. + * When combined with materials, this SHOULD fully describe the build, + * such that re-running this recipe results in bit-for-bit identical output + * (if the build is reproducible). + * + * Generated from protobuf field .grafeas.v1.Recipe recipe = 2; + * @param \Grafeas\V1\Recipe $var + * @return $this + */ + public function setRecipe($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\Recipe::class); + $this->recipe = $var; + + return $this; + } + + /** + * Generated from protobuf field .grafeas.v1.Metadata metadata = 3; + * @return \Grafeas\V1\Metadata|null + */ + public function getMetadata() + { + return $this->metadata; + } + + public function hasMetadata() + { + return isset($this->metadata); + } + + public function clearMetadata() + { + unset($this->metadata); + } + + /** + * Generated from protobuf field .grafeas.v1.Metadata metadata = 3; + * @param \Grafeas\V1\Metadata $var + * @return $this + */ + public function setMetadata($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\Metadata::class); + $this->metadata = $var; + + return $this; + } + + /** + * The collection of artifacts that influenced the build including sources, + * dependencies, build tools, base images, and so on. This is considered to be + * incomplete unless metadata.completeness.materials is true. Unset or null is + * equivalent to empty. + * + * Generated from protobuf field repeated string materials = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getMaterials() + { + return $this->materials; + } + + /** + * The collection of artifacts that influenced the build including sources, + * dependencies, build tools, base images, and so on. This is considered to be + * incomplete unless metadata.completeness.materials is true. Unset or null is + * equivalent to empty. + * + * Generated from protobuf field repeated string materials = 4; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setMaterials($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->materials = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/InTotoStatement.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/InTotoStatement.php new file mode 100644 index 000000000000..93a86b0dd503 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/InTotoStatement.php @@ -0,0 +1,224 @@ +grafeas.v1.InTotoStatement + */ +class InTotoStatement extends \Google\Protobuf\Internal\Message +{ + /** + * Always `https://in-toto.io/Statement/v0.1`. + * + * Generated from protobuf field string type = 1 [json_name = "_type"]; + */ + protected $type = ''; + /** + * Generated from protobuf field repeated .grafeas.v1.Subject subject = 2; + */ + private $subject; + /** + * `https://slsa.dev/provenance/v0.1` for SlsaProvenance. + * + * Generated from protobuf field string predicate_type = 3; + */ + protected $predicate_type = ''; + protected $predicate; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $type + * Always `https://in-toto.io/Statement/v0.1`. + * @type array<\Grafeas\V1\Subject>|\Google\Protobuf\Internal\RepeatedField $subject + * @type string $predicate_type + * `https://slsa.dev/provenance/v0.1` for SlsaProvenance. + * @type \Grafeas\V1\InTotoProvenance $provenance + * @type \Grafeas\V1\SlsaProvenance $slsa_provenance + * @type \Grafeas\V1\SlsaProvenanceZeroTwo $slsa_provenance_zero_two + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\IntotoStatement::initOnce(); + parent::__construct($data); + } + + /** + * Always `https://in-toto.io/Statement/v0.1`. + * + * Generated from protobuf field string type = 1 [json_name = "_type"]; + * @return string + */ + public function getType() + { + return $this->type; + } + + /** + * Always `https://in-toto.io/Statement/v0.1`. + * + * Generated from protobuf field string type = 1 [json_name = "_type"]; + * @param string $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkString($var, True); + $this->type = $var; + + return $this; + } + + /** + * Generated from protobuf field repeated .grafeas.v1.Subject subject = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSubject() + { + return $this->subject; + } + + /** + * Generated from protobuf field repeated .grafeas.v1.Subject subject = 2; + * @param array<\Grafeas\V1\Subject>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSubject($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Grafeas\V1\Subject::class); + $this->subject = $arr; + + return $this; + } + + /** + * `https://slsa.dev/provenance/v0.1` for SlsaProvenance. + * + * Generated from protobuf field string predicate_type = 3; + * @return string + */ + public function getPredicateType() + { + return $this->predicate_type; + } + + /** + * `https://slsa.dev/provenance/v0.1` for SlsaProvenance. + * + * Generated from protobuf field string predicate_type = 3; + * @param string $var + * @return $this + */ + public function setPredicateType($var) + { + GPBUtil::checkString($var, True); + $this->predicate_type = $var; + + return $this; + } + + /** + * Generated from protobuf field .grafeas.v1.InTotoProvenance provenance = 4; + * @return \Grafeas\V1\InTotoProvenance|null + */ + public function getProvenance() + { + return $this->readOneof(4); + } + + public function hasProvenance() + { + return $this->hasOneof(4); + } + + /** + * Generated from protobuf field .grafeas.v1.InTotoProvenance provenance = 4; + * @param \Grafeas\V1\InTotoProvenance $var + * @return $this + */ + public function setProvenance($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\InTotoProvenance::class); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * Generated from protobuf field .grafeas.v1.SlsaProvenance slsa_provenance = 5; + * @return \Grafeas\V1\SlsaProvenance|null + */ + public function getSlsaProvenance() + { + return $this->readOneof(5); + } + + public function hasSlsaProvenance() + { + return $this->hasOneof(5); + } + + /** + * Generated from protobuf field .grafeas.v1.SlsaProvenance slsa_provenance = 5; + * @param \Grafeas\V1\SlsaProvenance $var + * @return $this + */ + public function setSlsaProvenance($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\SlsaProvenance::class); + $this->writeOneof(5, $var); + + return $this; + } + + /** + * Generated from protobuf field .grafeas.v1.SlsaProvenanceZeroTwo slsa_provenance_zero_two = 6; + * @return \Grafeas\V1\SlsaProvenanceZeroTwo|null + */ + public function getSlsaProvenanceZeroTwo() + { + return $this->readOneof(6); + } + + public function hasSlsaProvenanceZeroTwo() + { + return $this->hasOneof(6); + } + + /** + * Generated from protobuf field .grafeas.v1.SlsaProvenanceZeroTwo slsa_provenance_zero_two = 6; + * @param \Grafeas\V1\SlsaProvenanceZeroTwo $var + * @return $this + */ + public function setSlsaProvenanceZeroTwo($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\SlsaProvenanceZeroTwo::class); + $this->writeOneof(6, $var); + + return $this; + } + + /** + * @return string + */ + public function getPredicate() + { + return $this->whichOneof("predicate"); + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/Jwt.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/Jwt.php new file mode 100644 index 000000000000..3b9e9a5ece42 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/Jwt.php @@ -0,0 +1,73 @@ +grafeas.v1.Jwt + */ +class Jwt extends \Google\Protobuf\Internal\Message +{ + /** + * The compact encoding of a JWS, which is always three base64 encoded strings + * joined by periods. For details, see: + * https://tools.ietf.org/html/rfc7515.html#section-3.1 + * + * Generated from protobuf field string compact_jwt = 1; + */ + protected $compact_jwt = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $compact_jwt + * The compact encoding of a JWS, which is always three base64 encoded strings + * joined by periods. For details, see: + * https://tools.ietf.org/html/rfc7515.html#section-3.1 + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Attestation::initOnce(); + parent::__construct($data); + } + + /** + * The compact encoding of a JWS, which is always three base64 encoded strings + * joined by periods. For details, see: + * https://tools.ietf.org/html/rfc7515.html#section-3.1 + * + * Generated from protobuf field string compact_jwt = 1; + * @return string + */ + public function getCompactJwt() + { + return $this->compact_jwt; + } + + /** + * The compact encoding of a JWS, which is always three base64 encoded strings + * joined by periods. For details, see: + * https://tools.ietf.org/html/rfc7515.html#section-3.1 + * + * Generated from protobuf field string compact_jwt = 1; + * @param string $var + * @return $this + */ + public function setCompactJwt($var) + { + GPBUtil::checkString($var, True); + $this->compact_jwt = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/Layer.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/Layer.php new file mode 100644 index 000000000000..429ce63f2c3a --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/Layer.php @@ -0,0 +1,105 @@ +grafeas.v1.Layer + */ +class Layer extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The recovered Dockerfile directive used to construct this layer. + * See https://docs.docker.com/engine/reference/builder/ for more information. + * + * Generated from protobuf field string directive = 1; + */ + protected $directive = ''; + /** + * The recovered arguments to the Dockerfile directive. + * + * Generated from protobuf field string arguments = 2; + */ + protected $arguments = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $directive + * Required. The recovered Dockerfile directive used to construct this layer. + * See https://docs.docker.com/engine/reference/builder/ for more information. + * @type string $arguments + * The recovered arguments to the Dockerfile directive. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Image::initOnce(); + parent::__construct($data); + } + + /** + * Required. The recovered Dockerfile directive used to construct this layer. + * See https://docs.docker.com/engine/reference/builder/ for more information. + * + * Generated from protobuf field string directive = 1; + * @return string + */ + public function getDirective() + { + return $this->directive; + } + + /** + * Required. The recovered Dockerfile directive used to construct this layer. + * See https://docs.docker.com/engine/reference/builder/ for more information. + * + * Generated from protobuf field string directive = 1; + * @param string $var + * @return $this + */ + public function setDirective($var) + { + GPBUtil::checkString($var, True); + $this->directive = $var; + + return $this; + } + + /** + * The recovered arguments to the Dockerfile directive. + * + * Generated from protobuf field string arguments = 2; + * @return string + */ + public function getArguments() + { + return $this->arguments; + } + + /** + * The recovered arguments to the Dockerfile directive. + * + * Generated from protobuf field string arguments = 2; + * @param string $var + * @return $this + */ + public function setArguments($var) + { + GPBUtil::checkString($var, True); + $this->arguments = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/License.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/License.php new file mode 100644 index 000000000000..cf2409f0739f --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/License.php @@ -0,0 +1,117 @@ +grafeas.v1.License + */ +class License extends \Google\Protobuf\Internal\Message +{ + /** + * Often a single license can be used to represent the licensing terms. + * Sometimes it is necessary to include a choice of one or more licenses + * or some combination of license identifiers. + * Examples: "LGPL-2.1-only OR MIT", "LGPL-2.1-only AND MIT", + * "GPL-2.0-or-later WITH Bison-exception-2.2". + * + * Generated from protobuf field string expression = 1; + */ + protected $expression = ''; + /** + * Comments + * + * Generated from protobuf field string comments = 2; + */ + protected $comments = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $expression + * Often a single license can be used to represent the licensing terms. + * Sometimes it is necessary to include a choice of one or more licenses + * or some combination of license identifiers. + * Examples: "LGPL-2.1-only OR MIT", "LGPL-2.1-only AND MIT", + * "GPL-2.0-or-later WITH Bison-exception-2.2". + * @type string $comments + * Comments + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Common::initOnce(); + parent::__construct($data); + } + + /** + * Often a single license can be used to represent the licensing terms. + * Sometimes it is necessary to include a choice of one or more licenses + * or some combination of license identifiers. + * Examples: "LGPL-2.1-only OR MIT", "LGPL-2.1-only AND MIT", + * "GPL-2.0-or-later WITH Bison-exception-2.2". + * + * Generated from protobuf field string expression = 1; + * @return string + */ + public function getExpression() + { + return $this->expression; + } + + /** + * Often a single license can be used to represent the licensing terms. + * Sometimes it is necessary to include a choice of one or more licenses + * or some combination of license identifiers. + * Examples: "LGPL-2.1-only OR MIT", "LGPL-2.1-only AND MIT", + * "GPL-2.0-or-later WITH Bison-exception-2.2". + * + * Generated from protobuf field string expression = 1; + * @param string $var + * @return $this + */ + public function setExpression($var) + { + GPBUtil::checkString($var, True); + $this->expression = $var; + + return $this; + } + + /** + * Comments + * + * Generated from protobuf field string comments = 2; + * @return string + */ + public function getComments() + { + return $this->comments; + } + + /** + * Comments + * + * Generated from protobuf field string comments = 2; + * @param string $var + * @return $this + */ + public function setComments($var) + { + GPBUtil::checkString($var, True); + $this->comments = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/ListNoteOccurrencesRequest.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/ListNoteOccurrencesRequest.php new file mode 100644 index 000000000000..2a854147766a --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/ListNoteOccurrencesRequest.php @@ -0,0 +1,190 @@ +grafeas.v1.ListNoteOccurrencesRequest + */ +class ListNoteOccurrencesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the note to list occurrences for in the form of + * `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * The filter expression. + * + * Generated from protobuf field string filter = 2; + */ + protected $filter = ''; + /** + * Number of occurrences to return in the list. + * + * Generated from protobuf field int32 page_size = 3; + */ + protected $page_size = 0; + /** + * Token to provide to skip to a particular spot in the list. + * + * Generated from protobuf field string page_token = 4; + */ + protected $page_token = ''; + + /** + * @param string $name The name of the note to list occurrences for in the form of + * `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. Please see + * {@see GrafeasClient::noteName()} for help formatting this field. + * @param string $filter The filter expression. + * + * @return \Grafeas\V1\ListNoteOccurrencesRequest + * + * @experimental + */ + public static function build(string $name, string $filter): self + { + return (new self()) + ->setName($name) + ->setFilter($filter); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The name of the note to list occurrences for in the form of + * `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. + * @type string $filter + * The filter expression. + * @type int $page_size + * Number of occurrences to return in the list. + * @type string $page_token + * Token to provide to skip to a particular spot in the list. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Grafeas::initOnce(); + parent::__construct($data); + } + + /** + * The name of the note to list occurrences for in the form of + * `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The name of the note to list occurrences for in the form of + * `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. + * + * 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; + } + + /** + * The filter expression. + * + * Generated from protobuf field string filter = 2; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * The filter expression. + * + * Generated from protobuf field string filter = 2; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Number of occurrences to return in the list. + * + * Generated from protobuf field int32 page_size = 3; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Number of occurrences to return in the list. + * + * Generated from protobuf field int32 page_size = 3; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * Token to provide to skip to a particular spot in the list. + * + * Generated from protobuf field string page_token = 4; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Token to provide to skip to a particular spot in the list. + * + * Generated from protobuf field string page_token = 4; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/ListNoteOccurrencesResponse.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/ListNoteOccurrencesResponse.php new file mode 100644 index 000000000000..d76a8a59df99 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/ListNoteOccurrencesResponse.php @@ -0,0 +1,101 @@ +grafeas.v1.ListNoteOccurrencesResponse + */ +class ListNoteOccurrencesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The occurrences attached to the specified note. + * + * Generated from protobuf field repeated .grafeas.v1.Occurrence occurrences = 1; + */ + private $occurrences; + /** + * Token to provide to skip to a particular spot in the list. + * + * 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<\Grafeas\V1\Occurrence>|\Google\Protobuf\Internal\RepeatedField $occurrences + * The occurrences attached to the specified note. + * @type string $next_page_token + * Token to provide to skip to a particular spot in the list. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Grafeas::initOnce(); + parent::__construct($data); + } + + /** + * The occurrences attached to the specified note. + * + * Generated from protobuf field repeated .grafeas.v1.Occurrence occurrences = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getOccurrences() + { + return $this->occurrences; + } + + /** + * The occurrences attached to the specified note. + * + * Generated from protobuf field repeated .grafeas.v1.Occurrence occurrences = 1; + * @param array<\Grafeas\V1\Occurrence>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setOccurrences($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Grafeas\V1\Occurrence::class); + $this->occurrences = $arr; + + return $this; + } + + /** + * Token to provide to skip to a particular spot in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Token to provide to skip to a particular spot in the list. + * + * 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/Grafeas/v1/proto/src/Grafeas/V1/ListNotesRequest.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/ListNotesRequest.php new file mode 100644 index 000000000000..a2a556f02170 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/ListNotesRequest.php @@ -0,0 +1,194 @@ +grafeas.v1.ListNotesRequest + */ +class ListNotesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the project to list notes for in the form of + * `projects/[PROJECT_ID]`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The filter expression. + * + * Generated from protobuf field string filter = 2; + */ + protected $filter = ''; + /** + * Number of notes to return in the list. Must be positive. Max allowed page + * size is 1000. If not specified, page size defaults to 20. + * + * Generated from protobuf field int32 page_size = 3; + */ + protected $page_size = 0; + /** + * Token to provide to skip to a particular spot in the list. + * + * Generated from protobuf field string page_token = 4; + */ + protected $page_token = ''; + + /** + * @param string $parent The name of the project to list notes for in the form of + * `projects/[PROJECT_ID]`. Please see + * {@see GrafeasClient::projectName()} for help formatting this field. + * @param string $filter The filter expression. + * + * @return \Grafeas\V1\ListNotesRequest + * + * @experimental + */ + public static function build(string $parent, string $filter): self + { + return (new self()) + ->setParent($parent) + ->setFilter($filter); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * The name of the project to list notes for in the form of + * `projects/[PROJECT_ID]`. + * @type string $filter + * The filter expression. + * @type int $page_size + * Number of notes to return in the list. Must be positive. Max allowed page + * size is 1000. If not specified, page size defaults to 20. + * @type string $page_token + * Token to provide to skip to a particular spot in the list. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Grafeas::initOnce(); + parent::__construct($data); + } + + /** + * The name of the project to list notes for in the form of + * `projects/[PROJECT_ID]`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * The name of the project to list notes for in the form of + * `projects/[PROJECT_ID]`. + * + * 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; + } + + /** + * The filter expression. + * + * Generated from protobuf field string filter = 2; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * The filter expression. + * + * Generated from protobuf field string filter = 2; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Number of notes to return in the list. Must be positive. Max allowed page + * size is 1000. If not specified, page size defaults to 20. + * + * Generated from protobuf field int32 page_size = 3; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Number of notes to return in the list. Must be positive. Max allowed page + * size is 1000. If not specified, page size defaults to 20. + * + * Generated from protobuf field int32 page_size = 3; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * Token to provide to skip to a particular spot in the list. + * + * Generated from protobuf field string page_token = 4; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Token to provide to skip to a particular spot in the list. + * + * Generated from protobuf field string page_token = 4; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/ListNotesResponse.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/ListNotesResponse.php new file mode 100644 index 000000000000..22c8bc22a257 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/ListNotesResponse.php @@ -0,0 +1,109 @@ +grafeas.v1.ListNotesResponse + */ +class ListNotesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The notes requested. + * + * Generated from protobuf field repeated .grafeas.v1.Note notes = 1; + */ + private $notes; + /** + * The next pagination token in the list response. It should be used as + * `page_token` for the following request. An empty value means no more + * 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<\Grafeas\V1\Note>|\Google\Protobuf\Internal\RepeatedField $notes + * The notes requested. + * @type string $next_page_token + * The next pagination token in the list response. It should be used as + * `page_token` for the following request. An empty value means no more + * results. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Grafeas::initOnce(); + parent::__construct($data); + } + + /** + * The notes requested. + * + * Generated from protobuf field repeated .grafeas.v1.Note notes = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getNotes() + { + return $this->notes; + } + + /** + * The notes requested. + * + * Generated from protobuf field repeated .grafeas.v1.Note notes = 1; + * @param array<\Grafeas\V1\Note>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setNotes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Grafeas\V1\Note::class); + $this->notes = $arr; + + return $this; + } + + /** + * The next pagination token in the list response. It should be used as + * `page_token` for the following request. An empty value means no more + * results. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * The next pagination token in the list response. It should be used as + * `page_token` for the following request. An empty value means no more + * 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/Grafeas/v1/proto/src/Grafeas/V1/ListOccurrencesRequest.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/ListOccurrencesRequest.php new file mode 100644 index 000000000000..d530c4ea371a --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/ListOccurrencesRequest.php @@ -0,0 +1,194 @@ +grafeas.v1.ListOccurrencesRequest + */ +class ListOccurrencesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the project to list occurrences for in the form of + * `projects/[PROJECT_ID]`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The filter expression. + * + * Generated from protobuf field string filter = 2; + */ + protected $filter = ''; + /** + * Number of occurrences to return in the list. Must be positive. Max allowed + * page size is 1000. If not specified, page size defaults to 20. + * + * Generated from protobuf field int32 page_size = 3; + */ + protected $page_size = 0; + /** + * Token to provide to skip to a particular spot in the list. + * + * Generated from protobuf field string page_token = 4; + */ + protected $page_token = ''; + + /** + * @param string $parent The name of the project to list occurrences for in the form of + * `projects/[PROJECT_ID]`. Please see + * {@see GrafeasClient::projectName()} for help formatting this field. + * @param string $filter The filter expression. + * + * @return \Grafeas\V1\ListOccurrencesRequest + * + * @experimental + */ + public static function build(string $parent, string $filter): self + { + return (new self()) + ->setParent($parent) + ->setFilter($filter); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * The name of the project to list occurrences for in the form of + * `projects/[PROJECT_ID]`. + * @type string $filter + * The filter expression. + * @type int $page_size + * Number of occurrences to return in the list. Must be positive. Max allowed + * page size is 1000. If not specified, page size defaults to 20. + * @type string $page_token + * Token to provide to skip to a particular spot in the list. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Grafeas::initOnce(); + parent::__construct($data); + } + + /** + * The name of the project to list occurrences for in the form of + * `projects/[PROJECT_ID]`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * The name of the project to list occurrences for in the form of + * `projects/[PROJECT_ID]`. + * + * 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; + } + + /** + * The filter expression. + * + * Generated from protobuf field string filter = 2; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * The filter expression. + * + * Generated from protobuf field string filter = 2; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Number of occurrences to return in the list. Must be positive. Max allowed + * page size is 1000. If not specified, page size defaults to 20. + * + * Generated from protobuf field int32 page_size = 3; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Number of occurrences to return in the list. Must be positive. Max allowed + * page size is 1000. If not specified, page size defaults to 20. + * + * Generated from protobuf field int32 page_size = 3; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * Token to provide to skip to a particular spot in the list. + * + * Generated from protobuf field string page_token = 4; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Token to provide to skip to a particular spot in the list. + * + * Generated from protobuf field string page_token = 4; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/ListOccurrencesResponse.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/ListOccurrencesResponse.php new file mode 100644 index 000000000000..c698cc7476a2 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/ListOccurrencesResponse.php @@ -0,0 +1,109 @@ +grafeas.v1.ListOccurrencesResponse + */ +class ListOccurrencesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The occurrences requested. + * + * Generated from protobuf field repeated .grafeas.v1.Occurrence occurrences = 1; + */ + private $occurrences; + /** + * The next pagination token in the list response. It should be used as + * `page_token` for the following request. An empty value means no more + * 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<\Grafeas\V1\Occurrence>|\Google\Protobuf\Internal\RepeatedField $occurrences + * The occurrences requested. + * @type string $next_page_token + * The next pagination token in the list response. It should be used as + * `page_token` for the following request. An empty value means no more + * results. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Grafeas::initOnce(); + parent::__construct($data); + } + + /** + * The occurrences requested. + * + * Generated from protobuf field repeated .grafeas.v1.Occurrence occurrences = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getOccurrences() + { + return $this->occurrences; + } + + /** + * The occurrences requested. + * + * Generated from protobuf field repeated .grafeas.v1.Occurrence occurrences = 1; + * @param array<\Grafeas\V1\Occurrence>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setOccurrences($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Grafeas\V1\Occurrence::class); + $this->occurrences = $arr; + + return $this; + } + + /** + * The next pagination token in the list response. It should be used as + * `page_token` for the following request. An empty value means no more + * results. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * The next pagination token in the list response. It should be used as + * `page_token` for the following request. An empty value means no more + * 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/Grafeas/v1/proto/src/Grafeas/V1/Location.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/Location.php new file mode 100644 index 000000000000..b8381eca4d41 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/Location.php @@ -0,0 +1,154 @@ +grafeas.v1.Location + */ +class Location extends \Google\Protobuf\Internal\Message +{ + /** + * Deprecated. + * The CPE URI in [CPE format](https://cpe.mitre.org/specification/) + * + * Generated from protobuf field string cpe_uri = 1; + */ + protected $cpe_uri = ''; + /** + * Deprecated. + * The version installed at this location. + * + * Generated from protobuf field .grafeas.v1.Version version = 2; + */ + protected $version = null; + /** + * The path from which we gathered that this package/version is installed. + * + * Generated from protobuf field string path = 3; + */ + protected $path = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $cpe_uri + * Deprecated. + * The CPE URI in [CPE format](https://cpe.mitre.org/specification/) + * @type \Grafeas\V1\Version $version + * Deprecated. + * The version installed at this location. + * @type string $path + * The path from which we gathered that this package/version is installed. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Package::initOnce(); + parent::__construct($data); + } + + /** + * Deprecated. + * The CPE URI in [CPE format](https://cpe.mitre.org/specification/) + * + * Generated from protobuf field string cpe_uri = 1; + * @return string + */ + public function getCpeUri() + { + return $this->cpe_uri; + } + + /** + * Deprecated. + * The CPE URI in [CPE format](https://cpe.mitre.org/specification/) + * + * Generated from protobuf field string cpe_uri = 1; + * @param string $var + * @return $this + */ + public function setCpeUri($var) + { + GPBUtil::checkString($var, True); + $this->cpe_uri = $var; + + return $this; + } + + /** + * Deprecated. + * The version installed at this location. + * + * Generated from protobuf field .grafeas.v1.Version version = 2; + * @return \Grafeas\V1\Version|null + */ + public function getVersion() + { + return $this->version; + } + + public function hasVersion() + { + return isset($this->version); + } + + public function clearVersion() + { + unset($this->version); + } + + /** + * Deprecated. + * The version installed at this location. + * + * Generated from protobuf field .grafeas.v1.Version version = 2; + * @param \Grafeas\V1\Version $var + * @return $this + */ + public function setVersion($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\Version::class); + $this->version = $var; + + return $this; + } + + /** + * The path from which we gathered that this package/version is installed. + * + * Generated from protobuf field string path = 3; + * @return string + */ + public function getPath() + { + return $this->path; + } + + /** + * The path from which we gathered that this package/version is installed. + * + * Generated from protobuf field string path = 3; + * @param string $var + * @return $this + */ + public function setPath($var) + { + GPBUtil::checkString($var, True); + $this->path = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/Metadata.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/Metadata.php new file mode 100644 index 000000000000..496b347e8c53 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/Metadata.php @@ -0,0 +1,249 @@ +grafeas.v1.Metadata + */ +class Metadata extends \Google\Protobuf\Internal\Message +{ + /** + * Identifies the particular build invocation, which can be useful for finding + * associated logs or other ad-hoc analysis. The value SHOULD be globally + * unique, per in-toto Provenance spec. + * + * Generated from protobuf field string build_invocation_id = 1; + */ + protected $build_invocation_id = ''; + /** + * The timestamp of when the build started. + * + * Generated from protobuf field .google.protobuf.Timestamp build_started_on = 2; + */ + protected $build_started_on = null; + /** + * The timestamp of when the build completed. + * + * Generated from protobuf field .google.protobuf.Timestamp build_finished_on = 3; + */ + protected $build_finished_on = null; + /** + * Indicates that the builder claims certain fields in this message to be + * complete. + * + * Generated from protobuf field .grafeas.v1.Completeness completeness = 4; + */ + protected $completeness = null; + /** + * If true, the builder claims that running the recipe on materials will + * produce bit-for-bit identical output. + * + * Generated from protobuf field bool reproducible = 5; + */ + protected $reproducible = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $build_invocation_id + * Identifies the particular build invocation, which can be useful for finding + * associated logs or other ad-hoc analysis. The value SHOULD be globally + * unique, per in-toto Provenance spec. + * @type \Google\Protobuf\Timestamp $build_started_on + * The timestamp of when the build started. + * @type \Google\Protobuf\Timestamp $build_finished_on + * The timestamp of when the build completed. + * @type \Grafeas\V1\Completeness $completeness + * Indicates that the builder claims certain fields in this message to be + * complete. + * @type bool $reproducible + * If true, the builder claims that running the recipe on materials will + * produce bit-for-bit identical output. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\IntotoProvenance::initOnce(); + parent::__construct($data); + } + + /** + * Identifies the particular build invocation, which can be useful for finding + * associated logs or other ad-hoc analysis. The value SHOULD be globally + * unique, per in-toto Provenance spec. + * + * Generated from protobuf field string build_invocation_id = 1; + * @return string + */ + public function getBuildInvocationId() + { + return $this->build_invocation_id; + } + + /** + * Identifies the particular build invocation, which can be useful for finding + * associated logs or other ad-hoc analysis. The value SHOULD be globally + * unique, per in-toto Provenance spec. + * + * Generated from protobuf field string build_invocation_id = 1; + * @param string $var + * @return $this + */ + public function setBuildInvocationId($var) + { + GPBUtil::checkString($var, True); + $this->build_invocation_id = $var; + + return $this; + } + + /** + * The timestamp of when the build started. + * + * Generated from protobuf field .google.protobuf.Timestamp build_started_on = 2; + * @return \Google\Protobuf\Timestamp|null + */ + public function getBuildStartedOn() + { + return $this->build_started_on; + } + + public function hasBuildStartedOn() + { + return isset($this->build_started_on); + } + + public function clearBuildStartedOn() + { + unset($this->build_started_on); + } + + /** + * The timestamp of when the build started. + * + * Generated from protobuf field .google.protobuf.Timestamp build_started_on = 2; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setBuildStartedOn($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->build_started_on = $var; + + return $this; + } + + /** + * The timestamp of when the build completed. + * + * Generated from protobuf field .google.protobuf.Timestamp build_finished_on = 3; + * @return \Google\Protobuf\Timestamp|null + */ + public function getBuildFinishedOn() + { + return $this->build_finished_on; + } + + public function hasBuildFinishedOn() + { + return isset($this->build_finished_on); + } + + public function clearBuildFinishedOn() + { + unset($this->build_finished_on); + } + + /** + * The timestamp of when the build completed. + * + * Generated from protobuf field .google.protobuf.Timestamp build_finished_on = 3; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setBuildFinishedOn($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->build_finished_on = $var; + + return $this; + } + + /** + * Indicates that the builder claims certain fields in this message to be + * complete. + * + * Generated from protobuf field .grafeas.v1.Completeness completeness = 4; + * @return \Grafeas\V1\Completeness|null + */ + public function getCompleteness() + { + return $this->completeness; + } + + public function hasCompleteness() + { + return isset($this->completeness); + } + + public function clearCompleteness() + { + unset($this->completeness); + } + + /** + * Indicates that the builder claims certain fields in this message to be + * complete. + * + * Generated from protobuf field .grafeas.v1.Completeness completeness = 4; + * @param \Grafeas\V1\Completeness $var + * @return $this + */ + public function setCompleteness($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\Completeness::class); + $this->completeness = $var; + + return $this; + } + + /** + * If true, the builder claims that running the recipe on materials will + * produce bit-for-bit identical output. + * + * Generated from protobuf field bool reproducible = 5; + * @return bool + */ + public function getReproducible() + { + return $this->reproducible; + } + + /** + * If true, the builder claims that running the recipe on materials will + * produce bit-for-bit identical output. + * + * Generated from protobuf field bool reproducible = 5; + * @param bool $var + * @return $this + */ + public function setReproducible($var) + { + GPBUtil::checkBool($var); + $this->reproducible = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/NonCompliantFile.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/NonCompliantFile.php new file mode 100644 index 000000000000..db2f7ae1e2f2 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/NonCompliantFile.php @@ -0,0 +1,135 @@ +grafeas.v1.NonCompliantFile + */ +class NonCompliantFile extends \Google\Protobuf\Internal\Message +{ + /** + * Empty if `display_command` is set. + * + * Generated from protobuf field string path = 1; + */ + protected $path = ''; + /** + * Command to display the non-compliant files. + * + * Generated from protobuf field string display_command = 2; + */ + protected $display_command = ''; + /** + * Explains why a file is non compliant for a CIS check. + * + * Generated from protobuf field string reason = 3; + */ + protected $reason = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $path + * Empty if `display_command` is set. + * @type string $display_command + * Command to display the non-compliant files. + * @type string $reason + * Explains why a file is non compliant for a CIS check. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Compliance::initOnce(); + parent::__construct($data); + } + + /** + * Empty if `display_command` is set. + * + * Generated from protobuf field string path = 1; + * @return string + */ + public function getPath() + { + return $this->path; + } + + /** + * Empty if `display_command` is set. + * + * Generated from protobuf field string path = 1; + * @param string $var + * @return $this + */ + public function setPath($var) + { + GPBUtil::checkString($var, True); + $this->path = $var; + + return $this; + } + + /** + * Command to display the non-compliant files. + * + * Generated from protobuf field string display_command = 2; + * @return string + */ + public function getDisplayCommand() + { + return $this->display_command; + } + + /** + * Command to display the non-compliant files. + * + * Generated from protobuf field string display_command = 2; + * @param string $var + * @return $this + */ + public function setDisplayCommand($var) + { + GPBUtil::checkString($var, True); + $this->display_command = $var; + + return $this; + } + + /** + * Explains why a file is non compliant for a CIS check. + * + * Generated from protobuf field string reason = 3; + * @return string + */ + public function getReason() + { + return $this->reason; + } + + /** + * Explains why a file is non compliant for a CIS check. + * + * Generated from protobuf field string reason = 3; + * @param string $var + * @return $this + */ + public function setReason($var) + { + GPBUtil::checkString($var, True); + $this->reason = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/Note.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/Note.php new file mode 100644 index 000000000000..1ca897a111f7 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/Note.php @@ -0,0 +1,757 @@ +grafeas.v1.Note + */ +class Note extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The name of the note in the form of + * `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * A one sentence description of this note. + * + * Generated from protobuf field string short_description = 2; + */ + protected $short_description = ''; + /** + * A detailed description of this note. + * + * Generated from protobuf field string long_description = 3; + */ + protected $long_description = ''; + /** + * Output only. The type of analysis. This field can be used as a filter in + * list requests. + * + * Generated from protobuf field .grafeas.v1.NoteKind kind = 4; + */ + protected $kind = 0; + /** + * URLs associated with this note. + * + * Generated from protobuf field repeated .grafeas.v1.RelatedUrl related_url = 5; + */ + private $related_url; + /** + * Time of expiration for this note. Empty if note does not expire. + * + * Generated from protobuf field .google.protobuf.Timestamp expiration_time = 6; + */ + protected $expiration_time = null; + /** + * Output only. The time this note was created. This field can be used as a + * filter in list requests. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 7; + */ + protected $create_time = null; + /** + * Output only. The time this note was last updated. This field can be used as + * a filter in list requests. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 8; + */ + protected $update_time = null; + /** + * Other notes related to this note. + * + * Generated from protobuf field repeated string related_note_names = 9; + */ + private $related_note_names; + protected $type; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Output only. The name of the note in the form of + * `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. + * @type string $short_description + * A one sentence description of this note. + * @type string $long_description + * A detailed description of this note. + * @type int $kind + * Output only. The type of analysis. This field can be used as a filter in + * list requests. + * @type array<\Grafeas\V1\RelatedUrl>|\Google\Protobuf\Internal\RepeatedField $related_url + * URLs associated with this note. + * @type \Google\Protobuf\Timestamp $expiration_time + * Time of expiration for this note. Empty if note does not expire. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The time this note was created. This field can be used as a + * filter in list requests. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. The time this note was last updated. This field can be used as + * a filter in list requests. + * @type array|\Google\Protobuf\Internal\RepeatedField $related_note_names + * Other notes related to this note. + * @type \Grafeas\V1\VulnerabilityNote $vulnerability + * A note describing a package vulnerability. + * @type \Grafeas\V1\BuildNote $build + * A note describing build provenance for a verifiable build. + * @type \Grafeas\V1\ImageNote $image + * A note describing a base image. + * @type \Grafeas\V1\PackageNote $package + * A note describing a package hosted by various package managers. + * @type \Grafeas\V1\DeploymentNote $deployment + * A note describing something that can be deployed. + * @type \Grafeas\V1\DiscoveryNote $discovery + * A note describing the initial analysis of a resource. + * @type \Grafeas\V1\AttestationNote $attestation + * A note describing an attestation role. + * @type \Grafeas\V1\UpgradeNote $upgrade + * A note describing available package upgrades. + * @type \Grafeas\V1\ComplianceNote $compliance + * A note describing a compliance check. + * @type \Grafeas\V1\DSSEAttestationNote $dsse_attestation + * A note describing a dsse attestation note. + * @type \Grafeas\V1\VulnerabilityAssessmentNote $vulnerability_assessment + * A note describing a vulnerability assessment. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Grafeas::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The name of the note in the form of + * `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Output only. The name of the note in the form of + * `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * A one sentence description of this note. + * + * Generated from protobuf field string short_description = 2; + * @return string + */ + public function getShortDescription() + { + return $this->short_description; + } + + /** + * A one sentence description of this note. + * + * Generated from protobuf field string short_description = 2; + * @param string $var + * @return $this + */ + public function setShortDescription($var) + { + GPBUtil::checkString($var, True); + $this->short_description = $var; + + return $this; + } + + /** + * A detailed description of this note. + * + * Generated from protobuf field string long_description = 3; + * @return string + */ + public function getLongDescription() + { + return $this->long_description; + } + + /** + * A detailed description of this note. + * + * Generated from protobuf field string long_description = 3; + * @param string $var + * @return $this + */ + public function setLongDescription($var) + { + GPBUtil::checkString($var, True); + $this->long_description = $var; + + return $this; + } + + /** + * Output only. The type of analysis. This field can be used as a filter in + * list requests. + * + * Generated from protobuf field .grafeas.v1.NoteKind kind = 4; + * @return int + */ + public function getKind() + { + return $this->kind; + } + + /** + * Output only. The type of analysis. This field can be used as a filter in + * list requests. + * + * Generated from protobuf field .grafeas.v1.NoteKind kind = 4; + * @param int $var + * @return $this + */ + public function setKind($var) + { + GPBUtil::checkEnum($var, \Grafeas\V1\NoteKind::class); + $this->kind = $var; + + return $this; + } + + /** + * URLs associated with this note. + * + * Generated from protobuf field repeated .grafeas.v1.RelatedUrl related_url = 5; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRelatedUrl() + { + return $this->related_url; + } + + /** + * URLs associated with this note. + * + * Generated from protobuf field repeated .grafeas.v1.RelatedUrl related_url = 5; + * @param array<\Grafeas\V1\RelatedUrl>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRelatedUrl($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Grafeas\V1\RelatedUrl::class); + $this->related_url = $arr; + + return $this; + } + + /** + * Time of expiration for this note. Empty if note does not expire. + * + * Generated from protobuf field .google.protobuf.Timestamp expiration_time = 6; + * @return \Google\Protobuf\Timestamp|null + */ + public function getExpirationTime() + { + return $this->expiration_time; + } + + public function hasExpirationTime() + { + return isset($this->expiration_time); + } + + public function clearExpirationTime() + { + unset($this->expiration_time); + } + + /** + * Time of expiration for this note. Empty if note does not expire. + * + * Generated from protobuf field .google.protobuf.Timestamp expiration_time = 6; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setExpirationTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->expiration_time = $var; + + return $this; + } + + /** + * Output only. The time this note was created. This field can be used as a + * filter in list requests. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 7; + * @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 this note was created. This field can be used as a + * filter in list requests. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 7; + * @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 this note was last updated. This field can be used as + * a filter in list requests. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 8; + * @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 this note was last updated. This field can be used as + * a filter in list requests. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 8; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->update_time = $var; + + return $this; + } + + /** + * Other notes related to this note. + * + * Generated from protobuf field repeated string related_note_names = 9; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRelatedNoteNames() + { + return $this->related_note_names; + } + + /** + * Other notes related to this note. + * + * Generated from protobuf field repeated string related_note_names = 9; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRelatedNoteNames($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->related_note_names = $arr; + + return $this; + } + + /** + * A note describing a package vulnerability. + * + * Generated from protobuf field .grafeas.v1.VulnerabilityNote vulnerability = 10; + * @return \Grafeas\V1\VulnerabilityNote|null + */ + public function getVulnerability() + { + return $this->readOneof(10); + } + + public function hasVulnerability() + { + return $this->hasOneof(10); + } + + /** + * A note describing a package vulnerability. + * + * Generated from protobuf field .grafeas.v1.VulnerabilityNote vulnerability = 10; + * @param \Grafeas\V1\VulnerabilityNote $var + * @return $this + */ + public function setVulnerability($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\VulnerabilityNote::class); + $this->writeOneof(10, $var); + + return $this; + } + + /** + * A note describing build provenance for a verifiable build. + * + * Generated from protobuf field .grafeas.v1.BuildNote build = 11; + * @return \Grafeas\V1\BuildNote|null + */ + public function getBuild() + { + return $this->readOneof(11); + } + + public function hasBuild() + { + return $this->hasOneof(11); + } + + /** + * A note describing build provenance for a verifiable build. + * + * Generated from protobuf field .grafeas.v1.BuildNote build = 11; + * @param \Grafeas\V1\BuildNote $var + * @return $this + */ + public function setBuild($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\BuildNote::class); + $this->writeOneof(11, $var); + + return $this; + } + + /** + * A note describing a base image. + * + * Generated from protobuf field .grafeas.v1.ImageNote image = 12; + * @return \Grafeas\V1\ImageNote|null + */ + public function getImage() + { + return $this->readOneof(12); + } + + public function hasImage() + { + return $this->hasOneof(12); + } + + /** + * A note describing a base image. + * + * Generated from protobuf field .grafeas.v1.ImageNote image = 12; + * @param \Grafeas\V1\ImageNote $var + * @return $this + */ + public function setImage($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\ImageNote::class); + $this->writeOneof(12, $var); + + return $this; + } + + /** + * A note describing a package hosted by various package managers. + * + * Generated from protobuf field .grafeas.v1.PackageNote package = 13; + * @return \Grafeas\V1\PackageNote|null + */ + public function getPackage() + { + return $this->readOneof(13); + } + + public function hasPackage() + { + return $this->hasOneof(13); + } + + /** + * A note describing a package hosted by various package managers. + * + * Generated from protobuf field .grafeas.v1.PackageNote package = 13; + * @param \Grafeas\V1\PackageNote $var + * @return $this + */ + public function setPackage($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\PackageNote::class); + $this->writeOneof(13, $var); + + return $this; + } + + /** + * A note describing something that can be deployed. + * + * Generated from protobuf field .grafeas.v1.DeploymentNote deployment = 14; + * @return \Grafeas\V1\DeploymentNote|null + */ + public function getDeployment() + { + return $this->readOneof(14); + } + + public function hasDeployment() + { + return $this->hasOneof(14); + } + + /** + * A note describing something that can be deployed. + * + * Generated from protobuf field .grafeas.v1.DeploymentNote deployment = 14; + * @param \Grafeas\V1\DeploymentNote $var + * @return $this + */ + public function setDeployment($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\DeploymentNote::class); + $this->writeOneof(14, $var); + + return $this; + } + + /** + * A note describing the initial analysis of a resource. + * + * Generated from protobuf field .grafeas.v1.DiscoveryNote discovery = 15; + * @return \Grafeas\V1\DiscoveryNote|null + */ + public function getDiscovery() + { + return $this->readOneof(15); + } + + public function hasDiscovery() + { + return $this->hasOneof(15); + } + + /** + * A note describing the initial analysis of a resource. + * + * Generated from protobuf field .grafeas.v1.DiscoveryNote discovery = 15; + * @param \Grafeas\V1\DiscoveryNote $var + * @return $this + */ + public function setDiscovery($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\DiscoveryNote::class); + $this->writeOneof(15, $var); + + return $this; + } + + /** + * A note describing an attestation role. + * + * Generated from protobuf field .grafeas.v1.AttestationNote attestation = 16; + * @return \Grafeas\V1\AttestationNote|null + */ + public function getAttestation() + { + return $this->readOneof(16); + } + + public function hasAttestation() + { + return $this->hasOneof(16); + } + + /** + * A note describing an attestation role. + * + * Generated from protobuf field .grafeas.v1.AttestationNote attestation = 16; + * @param \Grafeas\V1\AttestationNote $var + * @return $this + */ + public function setAttestation($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\AttestationNote::class); + $this->writeOneof(16, $var); + + return $this; + } + + /** + * A note describing available package upgrades. + * + * Generated from protobuf field .grafeas.v1.UpgradeNote upgrade = 17; + * @return \Grafeas\V1\UpgradeNote|null + */ + public function getUpgrade() + { + return $this->readOneof(17); + } + + public function hasUpgrade() + { + return $this->hasOneof(17); + } + + /** + * A note describing available package upgrades. + * + * Generated from protobuf field .grafeas.v1.UpgradeNote upgrade = 17; + * @param \Grafeas\V1\UpgradeNote $var + * @return $this + */ + public function setUpgrade($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\UpgradeNote::class); + $this->writeOneof(17, $var); + + return $this; + } + + /** + * A note describing a compliance check. + * + * Generated from protobuf field .grafeas.v1.ComplianceNote compliance = 18; + * @return \Grafeas\V1\ComplianceNote|null + */ + public function getCompliance() + { + return $this->readOneof(18); + } + + public function hasCompliance() + { + return $this->hasOneof(18); + } + + /** + * A note describing a compliance check. + * + * Generated from protobuf field .grafeas.v1.ComplianceNote compliance = 18; + * @param \Grafeas\V1\ComplianceNote $var + * @return $this + */ + public function setCompliance($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\ComplianceNote::class); + $this->writeOneof(18, $var); + + return $this; + } + + /** + * A note describing a dsse attestation note. + * + * Generated from protobuf field .grafeas.v1.DSSEAttestationNote dsse_attestation = 19; + * @return \Grafeas\V1\DSSEAttestationNote|null + */ + public function getDsseAttestation() + { + return $this->readOneof(19); + } + + public function hasDsseAttestation() + { + return $this->hasOneof(19); + } + + /** + * A note describing a dsse attestation note. + * + * Generated from protobuf field .grafeas.v1.DSSEAttestationNote dsse_attestation = 19; + * @param \Grafeas\V1\DSSEAttestationNote $var + * @return $this + */ + public function setDsseAttestation($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\DSSEAttestationNote::class); + $this->writeOneof(19, $var); + + return $this; + } + + /** + * A note describing a vulnerability assessment. + * + * Generated from protobuf field .grafeas.v1.VulnerabilityAssessmentNote vulnerability_assessment = 20; + * @return \Grafeas\V1\VulnerabilityAssessmentNote|null + */ + public function getVulnerabilityAssessment() + { + return $this->readOneof(20); + } + + public function hasVulnerabilityAssessment() + { + return $this->hasOneof(20); + } + + /** + * A note describing a vulnerability assessment. + * + * Generated from protobuf field .grafeas.v1.VulnerabilityAssessmentNote vulnerability_assessment = 20; + * @param \Grafeas\V1\VulnerabilityAssessmentNote $var + * @return $this + */ + public function setVulnerabilityAssessment($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\VulnerabilityAssessmentNote::class); + $this->writeOneof(20, $var); + + return $this; + } + + /** + * @return string + */ + public function getType() + { + return $this->whichOneof("type"); + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/NoteKind.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/NoteKind.php new file mode 100644 index 000000000000..7616d7f290cf --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/NoteKind.php @@ -0,0 +1,124 @@ +grafeas.v1.NoteKind + */ +class NoteKind +{ + /** + * Default value. This value is unused. + * + * Generated from protobuf enum NOTE_KIND_UNSPECIFIED = 0; + */ + const NOTE_KIND_UNSPECIFIED = 0; + /** + * The note and occurrence represent a package vulnerability. + * + * Generated from protobuf enum VULNERABILITY = 1; + */ + const VULNERABILITY = 1; + /** + * The note and occurrence assert build provenance. + * + * Generated from protobuf enum BUILD = 2; + */ + const BUILD = 2; + /** + * This represents an image basis relationship. + * + * Generated from protobuf enum IMAGE = 3; + */ + const IMAGE = 3; + /** + * This represents a package installed via a package manager. + * + * Generated from protobuf enum PACKAGE = 4; + */ + const PACKAGE = 4; + /** + * The note and occurrence track deployment events. + * + * Generated from protobuf enum DEPLOYMENT = 5; + */ + const DEPLOYMENT = 5; + /** + * The note and occurrence track the initial discovery status of a resource. + * + * Generated from protobuf enum DISCOVERY = 6; + */ + const DISCOVERY = 6; + /** + * This represents a logical "role" that can attest to artifacts. + * + * Generated from protobuf enum ATTESTATION = 7; + */ + const ATTESTATION = 7; + /** + * This represents an available package upgrade. + * + * Generated from protobuf enum UPGRADE = 8; + */ + const UPGRADE = 8; + /** + * This represents a Compliance Note + * + * Generated from protobuf enum COMPLIANCE = 9; + */ + const COMPLIANCE = 9; + /** + * This represents a DSSE attestation Note + * + * Generated from protobuf enum DSSE_ATTESTATION = 10; + */ + const DSSE_ATTESTATION = 10; + /** + * This represents a Vulnerability Assessment. + * + * Generated from protobuf enum VULNERABILITY_ASSESSMENT = 11; + */ + const VULNERABILITY_ASSESSMENT = 11; + + private static $valueToName = [ + self::NOTE_KIND_UNSPECIFIED => 'NOTE_KIND_UNSPECIFIED', + self::VULNERABILITY => 'VULNERABILITY', + self::BUILD => 'BUILD', + self::IMAGE => 'IMAGE', + self::PACKAGE => 'PACKAGE', + self::DEPLOYMENT => 'DEPLOYMENT', + self::DISCOVERY => 'DISCOVERY', + self::ATTESTATION => 'ATTESTATION', + self::UPGRADE => 'UPGRADE', + self::COMPLIANCE => 'COMPLIANCE', + self::DSSE_ATTESTATION => 'DSSE_ATTESTATION', + self::VULNERABILITY_ASSESSMENT => 'VULNERABILITY_ASSESSMENT', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/Occurrence.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/Occurrence.php new file mode 100644 index 000000000000..afc520226b1c --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/Occurrence.php @@ -0,0 +1,701 @@ +grafeas.v1.Occurrence + */ +class Occurrence extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The name of the occurrence in the form of + * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * Required. Immutable. A URI that represents the resource for which the + * occurrence applies. For example, + * `https://gcr.io/project/image@sha256:123abc` for a Docker image. + * + * Generated from protobuf field string resource_uri = 2; + */ + protected $resource_uri = ''; + /** + * Required. Immutable. The analysis note associated with this occurrence, in + * the form of `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. This field can be + * used as a filter in list requests. + * + * Generated from protobuf field string note_name = 3; + */ + protected $note_name = ''; + /** + * Output only. This explicitly denotes which of the occurrence details are + * specified. This field can be used as a filter in list requests. + * + * Generated from protobuf field .grafeas.v1.NoteKind kind = 4; + */ + protected $kind = 0; + /** + * A description of actions that can be taken to remedy the note. + * + * Generated from protobuf field string remediation = 5; + */ + protected $remediation = ''; + /** + * Output only. The time this occurrence was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 6; + */ + protected $create_time = null; + /** + * Output only. The time this occurrence was last updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 7; + */ + protected $update_time = null; + /** + * https://github.com/secure-systems-lab/dsse + * + * Generated from protobuf field .grafeas.v1.Envelope envelope = 18; + */ + protected $envelope = null; + protected $details; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Output only. The name of the occurrence in the form of + * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. + * @type string $resource_uri + * Required. Immutable. A URI that represents the resource for which the + * occurrence applies. For example, + * `https://gcr.io/project/image@sha256:123abc` for a Docker image. + * @type string $note_name + * Required. Immutable. The analysis note associated with this occurrence, in + * the form of `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. This field can be + * used as a filter in list requests. + * @type int $kind + * Output only. This explicitly denotes which of the occurrence details are + * specified. This field can be used as a filter in list requests. + * @type string $remediation + * A description of actions that can be taken to remedy the note. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The time this occurrence was created. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. The time this occurrence was last updated. + * @type \Grafeas\V1\VulnerabilityOccurrence $vulnerability + * Describes a security vulnerability. + * @type \Grafeas\V1\BuildOccurrence $build + * Describes a verifiable build. + * @type \Grafeas\V1\ImageOccurrence $image + * Describes how this resource derives from the basis in the associated + * note. + * @type \Grafeas\V1\PackageOccurrence $package + * Describes the installation of a package on the linked resource. + * @type \Grafeas\V1\DeploymentOccurrence $deployment + * Describes the deployment of an artifact on a runtime. + * @type \Grafeas\V1\DiscoveryOccurrence $discovery + * Describes when a resource was discovered. + * @type \Grafeas\V1\AttestationOccurrence $attestation + * Describes an attestation of an artifact. + * @type \Grafeas\V1\UpgradeOccurrence $upgrade + * Describes an available package upgrade on the linked resource. + * @type \Grafeas\V1\ComplianceOccurrence $compliance + * Describes a compliance violation on a linked resource. + * @type \Grafeas\V1\DSSEAttestationOccurrence $dsse_attestation + * Describes an attestation of an artifact using dsse. + * @type \Grafeas\V1\Envelope $envelope + * https://github.com/secure-systems-lab/dsse + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Grafeas::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The name of the occurrence in the form of + * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Output only. The name of the occurrence in the form of + * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Required. Immutable. A URI that represents the resource for which the + * occurrence applies. For example, + * `https://gcr.io/project/image@sha256:123abc` for a Docker image. + * + * Generated from protobuf field string resource_uri = 2; + * @return string + */ + public function getResourceUri() + { + return $this->resource_uri; + } + + /** + * Required. Immutable. A URI that represents the resource for which the + * occurrence applies. For example, + * `https://gcr.io/project/image@sha256:123abc` for a Docker image. + * + * Generated from protobuf field string resource_uri = 2; + * @param string $var + * @return $this + */ + public function setResourceUri($var) + { + GPBUtil::checkString($var, True); + $this->resource_uri = $var; + + return $this; + } + + /** + * Required. Immutable. The analysis note associated with this occurrence, in + * the form of `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. This field can be + * used as a filter in list requests. + * + * Generated from protobuf field string note_name = 3; + * @return string + */ + public function getNoteName() + { + return $this->note_name; + } + + /** + * Required. Immutable. The analysis note associated with this occurrence, in + * the form of `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. This field can be + * used as a filter in list requests. + * + * Generated from protobuf field string note_name = 3; + * @param string $var + * @return $this + */ + public function setNoteName($var) + { + GPBUtil::checkString($var, True); + $this->note_name = $var; + + return $this; + } + + /** + * Output only. This explicitly denotes which of the occurrence details are + * specified. This field can be used as a filter in list requests. + * + * Generated from protobuf field .grafeas.v1.NoteKind kind = 4; + * @return int + */ + public function getKind() + { + return $this->kind; + } + + /** + * Output only. This explicitly denotes which of the occurrence details are + * specified. This field can be used as a filter in list requests. + * + * Generated from protobuf field .grafeas.v1.NoteKind kind = 4; + * @param int $var + * @return $this + */ + public function setKind($var) + { + GPBUtil::checkEnum($var, \Grafeas\V1\NoteKind::class); + $this->kind = $var; + + return $this; + } + + /** + * A description of actions that can be taken to remedy the note. + * + * Generated from protobuf field string remediation = 5; + * @return string + */ + public function getRemediation() + { + return $this->remediation; + } + + /** + * A description of actions that can be taken to remedy the note. + * + * Generated from protobuf field string remediation = 5; + * @param string $var + * @return $this + */ + public function setRemediation($var) + { + GPBUtil::checkString($var, True); + $this->remediation = $var; + + return $this; + } + + /** + * Output only. The time this occurrence was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 6; + * @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 this occurrence was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 6; + * @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 this occurrence was last updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 7; + * @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 this occurrence was last updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 7; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->update_time = $var; + + return $this; + } + + /** + * Describes a security vulnerability. + * + * Generated from protobuf field .grafeas.v1.VulnerabilityOccurrence vulnerability = 8; + * @return \Grafeas\V1\VulnerabilityOccurrence|null + */ + public function getVulnerability() + { + return $this->readOneof(8); + } + + public function hasVulnerability() + { + return $this->hasOneof(8); + } + + /** + * Describes a security vulnerability. + * + * Generated from protobuf field .grafeas.v1.VulnerabilityOccurrence vulnerability = 8; + * @param \Grafeas\V1\VulnerabilityOccurrence $var + * @return $this + */ + public function setVulnerability($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\VulnerabilityOccurrence::class); + $this->writeOneof(8, $var); + + return $this; + } + + /** + * Describes a verifiable build. + * + * Generated from protobuf field .grafeas.v1.BuildOccurrence build = 9; + * @return \Grafeas\V1\BuildOccurrence|null + */ + public function getBuild() + { + return $this->readOneof(9); + } + + public function hasBuild() + { + return $this->hasOneof(9); + } + + /** + * Describes a verifiable build. + * + * Generated from protobuf field .grafeas.v1.BuildOccurrence build = 9; + * @param \Grafeas\V1\BuildOccurrence $var + * @return $this + */ + public function setBuild($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\BuildOccurrence::class); + $this->writeOneof(9, $var); + + return $this; + } + + /** + * Describes how this resource derives from the basis in the associated + * note. + * + * Generated from protobuf field .grafeas.v1.ImageOccurrence image = 10; + * @return \Grafeas\V1\ImageOccurrence|null + */ + public function getImage() + { + return $this->readOneof(10); + } + + public function hasImage() + { + return $this->hasOneof(10); + } + + /** + * Describes how this resource derives from the basis in the associated + * note. + * + * Generated from protobuf field .grafeas.v1.ImageOccurrence image = 10; + * @param \Grafeas\V1\ImageOccurrence $var + * @return $this + */ + public function setImage($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\ImageOccurrence::class); + $this->writeOneof(10, $var); + + return $this; + } + + /** + * Describes the installation of a package on the linked resource. + * + * Generated from protobuf field .grafeas.v1.PackageOccurrence package = 11; + * @return \Grafeas\V1\PackageOccurrence|null + */ + public function getPackage() + { + return $this->readOneof(11); + } + + public function hasPackage() + { + return $this->hasOneof(11); + } + + /** + * Describes the installation of a package on the linked resource. + * + * Generated from protobuf field .grafeas.v1.PackageOccurrence package = 11; + * @param \Grafeas\V1\PackageOccurrence $var + * @return $this + */ + public function setPackage($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\PackageOccurrence::class); + $this->writeOneof(11, $var); + + return $this; + } + + /** + * Describes the deployment of an artifact on a runtime. + * + * Generated from protobuf field .grafeas.v1.DeploymentOccurrence deployment = 12; + * @return \Grafeas\V1\DeploymentOccurrence|null + */ + public function getDeployment() + { + return $this->readOneof(12); + } + + public function hasDeployment() + { + return $this->hasOneof(12); + } + + /** + * Describes the deployment of an artifact on a runtime. + * + * Generated from protobuf field .grafeas.v1.DeploymentOccurrence deployment = 12; + * @param \Grafeas\V1\DeploymentOccurrence $var + * @return $this + */ + public function setDeployment($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\DeploymentOccurrence::class); + $this->writeOneof(12, $var); + + return $this; + } + + /** + * Describes when a resource was discovered. + * + * Generated from protobuf field .grafeas.v1.DiscoveryOccurrence discovery = 13; + * @return \Grafeas\V1\DiscoveryOccurrence|null + */ + public function getDiscovery() + { + return $this->readOneof(13); + } + + public function hasDiscovery() + { + return $this->hasOneof(13); + } + + /** + * Describes when a resource was discovered. + * + * Generated from protobuf field .grafeas.v1.DiscoveryOccurrence discovery = 13; + * @param \Grafeas\V1\DiscoveryOccurrence $var + * @return $this + */ + public function setDiscovery($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\DiscoveryOccurrence::class); + $this->writeOneof(13, $var); + + return $this; + } + + /** + * Describes an attestation of an artifact. + * + * Generated from protobuf field .grafeas.v1.AttestationOccurrence attestation = 14; + * @return \Grafeas\V1\AttestationOccurrence|null + */ + public function getAttestation() + { + return $this->readOneof(14); + } + + public function hasAttestation() + { + return $this->hasOneof(14); + } + + /** + * Describes an attestation of an artifact. + * + * Generated from protobuf field .grafeas.v1.AttestationOccurrence attestation = 14; + * @param \Grafeas\V1\AttestationOccurrence $var + * @return $this + */ + public function setAttestation($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\AttestationOccurrence::class); + $this->writeOneof(14, $var); + + return $this; + } + + /** + * Describes an available package upgrade on the linked resource. + * + * Generated from protobuf field .grafeas.v1.UpgradeOccurrence upgrade = 15; + * @return \Grafeas\V1\UpgradeOccurrence|null + */ + public function getUpgrade() + { + return $this->readOneof(15); + } + + public function hasUpgrade() + { + return $this->hasOneof(15); + } + + /** + * Describes an available package upgrade on the linked resource. + * + * Generated from protobuf field .grafeas.v1.UpgradeOccurrence upgrade = 15; + * @param \Grafeas\V1\UpgradeOccurrence $var + * @return $this + */ + public function setUpgrade($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\UpgradeOccurrence::class); + $this->writeOneof(15, $var); + + return $this; + } + + /** + * Describes a compliance violation on a linked resource. + * + * Generated from protobuf field .grafeas.v1.ComplianceOccurrence compliance = 16; + * @return \Grafeas\V1\ComplianceOccurrence|null + */ + public function getCompliance() + { + return $this->readOneof(16); + } + + public function hasCompliance() + { + return $this->hasOneof(16); + } + + /** + * Describes a compliance violation on a linked resource. + * + * Generated from protobuf field .grafeas.v1.ComplianceOccurrence compliance = 16; + * @param \Grafeas\V1\ComplianceOccurrence $var + * @return $this + */ + public function setCompliance($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\ComplianceOccurrence::class); + $this->writeOneof(16, $var); + + return $this; + } + + /** + * Describes an attestation of an artifact using dsse. + * + * Generated from protobuf field .grafeas.v1.DSSEAttestationOccurrence dsse_attestation = 17; + * @return \Grafeas\V1\DSSEAttestationOccurrence|null + */ + public function getDsseAttestation() + { + return $this->readOneof(17); + } + + public function hasDsseAttestation() + { + return $this->hasOneof(17); + } + + /** + * Describes an attestation of an artifact using dsse. + * + * Generated from protobuf field .grafeas.v1.DSSEAttestationOccurrence dsse_attestation = 17; + * @param \Grafeas\V1\DSSEAttestationOccurrence $var + * @return $this + */ + public function setDsseAttestation($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\DSSEAttestationOccurrence::class); + $this->writeOneof(17, $var); + + return $this; + } + + /** + * https://github.com/secure-systems-lab/dsse + * + * Generated from protobuf field .grafeas.v1.Envelope envelope = 18; + * @return \Grafeas\V1\Envelope|null + */ + public function getEnvelope() + { + return $this->envelope; + } + + public function hasEnvelope() + { + return isset($this->envelope); + } + + public function clearEnvelope() + { + unset($this->envelope); + } + + /** + * https://github.com/secure-systems-lab/dsse + * + * Generated from protobuf field .grafeas.v1.Envelope envelope = 18; + * @param \Grafeas\V1\Envelope $var + * @return $this + */ + public function setEnvelope($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\Envelope::class); + $this->envelope = $var; + + return $this; + } + + /** + * @return string + */ + public function getDetails() + { + return $this->whichOneof("details"); + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/PackageNote.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/PackageNote.php new file mode 100644 index 000000000000..a7295d29168a --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/PackageNote.php @@ -0,0 +1,451 @@ +grafeas.v1.PackageNote + */ +class PackageNote extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the package. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + */ + protected $name = ''; + /** + * Deprecated. + * The various channels by which a package is distributed. + * + * Generated from protobuf field repeated .grafeas.v1.Distribution distribution = 10; + */ + private $distribution; + /** + * The type of package; whether native or non native (e.g., ruby gems, + * node.js packages, etc.). + * + * Generated from protobuf field string package_type = 11; + */ + protected $package_type = ''; + /** + * The cpe_uri in [CPE format](https://cpe.mitre.org/specification/) + * denoting the package manager version distributing a package. + * The cpe_uri will be blank for language packages. + * + * Generated from protobuf field string cpe_uri = 12; + */ + protected $cpe_uri = ''; + /** + * The CPU architecture for which packages in this distribution channel were + * built. Architecture will be blank for language packages. + * + * Generated from protobuf field .grafeas.v1.Architecture architecture = 13; + */ + protected $architecture = 0; + /** + * The version of the package. + * + * Generated from protobuf field .grafeas.v1.Version version = 14; + */ + protected $version = null; + /** + * A freeform text denoting the maintainer of this package. + * + * Generated from protobuf field string maintainer = 15; + */ + protected $maintainer = ''; + /** + * The homepage for this package. + * + * Generated from protobuf field string url = 16; + */ + protected $url = ''; + /** + * The description of this package. + * + * Generated from protobuf field string description = 17; + */ + protected $description = ''; + /** + * Licenses that have been declared by the authors of the package. + * + * Generated from protobuf field .grafeas.v1.License license = 18; + */ + protected $license = null; + /** + * Hash value, typically a file digest, that allows unique + * identification a specific package. + * + * Generated from protobuf field repeated .grafeas.v1.Digest digest = 19; + */ + private $digest; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The name of the package. + * @type array<\Grafeas\V1\Distribution>|\Google\Protobuf\Internal\RepeatedField $distribution + * Deprecated. + * The various channels by which a package is distributed. + * @type string $package_type + * The type of package; whether native or non native (e.g., ruby gems, + * node.js packages, etc.). + * @type string $cpe_uri + * The cpe_uri in [CPE format](https://cpe.mitre.org/specification/) + * denoting the package manager version distributing a package. + * The cpe_uri will be blank for language packages. + * @type int $architecture + * The CPU architecture for which packages in this distribution channel were + * built. Architecture will be blank for language packages. + * @type \Grafeas\V1\Version $version + * The version of the package. + * @type string $maintainer + * A freeform text denoting the maintainer of this package. + * @type string $url + * The homepage for this package. + * @type string $description + * The description of this package. + * @type \Grafeas\V1\License $license + * Licenses that have been declared by the authors of the package. + * @type array<\Grafeas\V1\Digest>|\Google\Protobuf\Internal\RepeatedField $digest + * Hash value, typically a file digest, that allows unique + * identification a specific package. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Package::initOnce(); + parent::__construct($data); + } + + /** + * The name of the package. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The name of the package. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Deprecated. + * The various channels by which a package is distributed. + * + * Generated from protobuf field repeated .grafeas.v1.Distribution distribution = 10; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDistribution() + { + return $this->distribution; + } + + /** + * Deprecated. + * The various channels by which a package is distributed. + * + * Generated from protobuf field repeated .grafeas.v1.Distribution distribution = 10; + * @param array<\Grafeas\V1\Distribution>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDistribution($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Grafeas\V1\Distribution::class); + $this->distribution = $arr; + + return $this; + } + + /** + * The type of package; whether native or non native (e.g., ruby gems, + * node.js packages, etc.). + * + * Generated from protobuf field string package_type = 11; + * @return string + */ + public function getPackageType() + { + return $this->package_type; + } + + /** + * The type of package; whether native or non native (e.g., ruby gems, + * node.js packages, etc.). + * + * Generated from protobuf field string package_type = 11; + * @param string $var + * @return $this + */ + public function setPackageType($var) + { + GPBUtil::checkString($var, True); + $this->package_type = $var; + + return $this; + } + + /** + * The cpe_uri in [CPE format](https://cpe.mitre.org/specification/) + * denoting the package manager version distributing a package. + * The cpe_uri will be blank for language packages. + * + * Generated from protobuf field string cpe_uri = 12; + * @return string + */ + public function getCpeUri() + { + return $this->cpe_uri; + } + + /** + * The cpe_uri in [CPE format](https://cpe.mitre.org/specification/) + * denoting the package manager version distributing a package. + * The cpe_uri will be blank for language packages. + * + * Generated from protobuf field string cpe_uri = 12; + * @param string $var + * @return $this + */ + public function setCpeUri($var) + { + GPBUtil::checkString($var, True); + $this->cpe_uri = $var; + + return $this; + } + + /** + * The CPU architecture for which packages in this distribution channel were + * built. Architecture will be blank for language packages. + * + * Generated from protobuf field .grafeas.v1.Architecture architecture = 13; + * @return int + */ + public function getArchitecture() + { + return $this->architecture; + } + + /** + * The CPU architecture for which packages in this distribution channel were + * built. Architecture will be blank for language packages. + * + * Generated from protobuf field .grafeas.v1.Architecture architecture = 13; + * @param int $var + * @return $this + */ + public function setArchitecture($var) + { + GPBUtil::checkEnum($var, \Grafeas\V1\Architecture::class); + $this->architecture = $var; + + return $this; + } + + /** + * The version of the package. + * + * Generated from protobuf field .grafeas.v1.Version version = 14; + * @return \Grafeas\V1\Version|null + */ + public function getVersion() + { + return $this->version; + } + + public function hasVersion() + { + return isset($this->version); + } + + public function clearVersion() + { + unset($this->version); + } + + /** + * The version of the package. + * + * Generated from protobuf field .grafeas.v1.Version version = 14; + * @param \Grafeas\V1\Version $var + * @return $this + */ + public function setVersion($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\Version::class); + $this->version = $var; + + return $this; + } + + /** + * A freeform text denoting the maintainer of this package. + * + * Generated from protobuf field string maintainer = 15; + * @return string + */ + public function getMaintainer() + { + return $this->maintainer; + } + + /** + * A freeform text denoting the maintainer of this package. + * + * Generated from protobuf field string maintainer = 15; + * @param string $var + * @return $this + */ + public function setMaintainer($var) + { + GPBUtil::checkString($var, True); + $this->maintainer = $var; + + return $this; + } + + /** + * The homepage for this package. + * + * Generated from protobuf field string url = 16; + * @return string + */ + public function getUrl() + { + return $this->url; + } + + /** + * The homepage for this package. + * + * Generated from protobuf field string url = 16; + * @param string $var + * @return $this + */ + public function setUrl($var) + { + GPBUtil::checkString($var, True); + $this->url = $var; + + return $this; + } + + /** + * The description of this package. + * + * Generated from protobuf field string description = 17; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * The description of this package. + * + * Generated from protobuf field string description = 17; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * Licenses that have been declared by the authors of the package. + * + * Generated from protobuf field .grafeas.v1.License license = 18; + * @return \Grafeas\V1\License|null + */ + public function getLicense() + { + return $this->license; + } + + public function hasLicense() + { + return isset($this->license); + } + + public function clearLicense() + { + unset($this->license); + } + + /** + * Licenses that have been declared by the authors of the package. + * + * Generated from protobuf field .grafeas.v1.License license = 18; + * @param \Grafeas\V1\License $var + * @return $this + */ + public function setLicense($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\License::class); + $this->license = $var; + + return $this; + } + + /** + * Hash value, typically a file digest, that allows unique + * identification a specific package. + * + * Generated from protobuf field repeated .grafeas.v1.Digest digest = 19; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDigest() + { + return $this->digest; + } + + /** + * Hash value, typically a file digest, that allows unique + * identification a specific package. + * + * Generated from protobuf field repeated .grafeas.v1.Digest digest = 19; + * @param array<\Grafeas\V1\Digest>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDigest($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Grafeas\V1\Digest::class); + $this->digest = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/PackageOccurrence.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/PackageOccurrence.php new file mode 100644 index 000000000000..dafa0769a930 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/PackageOccurrence.php @@ -0,0 +1,311 @@ +grafeas.v1.PackageOccurrence + */ +class PackageOccurrence extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the installed package. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $name = ''; + /** + * All of the places within the filesystem versions of this package + * have been found. + * + * Generated from protobuf field repeated .grafeas.v1.Location location = 2; + */ + private $location; + /** + * The type of package; whether native or non native (e.g., ruby gems, + * node.js packages, etc.). + * + * Generated from protobuf field string package_type = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $package_type = ''; + /** + * The cpe_uri in [CPE format](https://cpe.mitre.org/specification/) + * denoting the package manager version distributing a package. + * The cpe_uri will be blank for language packages. + * + * Generated from protobuf field string cpe_uri = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $cpe_uri = ''; + /** + * The CPU architecture for which packages in this distribution channel were + * built. Architecture will be blank for language packages. + * + * Generated from protobuf field .grafeas.v1.Architecture architecture = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $architecture = 0; + /** + * Licenses that have been declared by the authors of the package. + * + * Generated from protobuf field .grafeas.v1.License license = 6; + */ + protected $license = null; + /** + * The version of the package. + * + * Generated from protobuf field .grafeas.v1.Version version = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $version = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The name of the installed package. + * @type array<\Grafeas\V1\Location>|\Google\Protobuf\Internal\RepeatedField $location + * All of the places within the filesystem versions of this package + * have been found. + * @type string $package_type + * The type of package; whether native or non native (e.g., ruby gems, + * node.js packages, etc.). + * @type string $cpe_uri + * The cpe_uri in [CPE format](https://cpe.mitre.org/specification/) + * denoting the package manager version distributing a package. + * The cpe_uri will be blank for language packages. + * @type int $architecture + * The CPU architecture for which packages in this distribution channel were + * built. Architecture will be blank for language packages. + * @type \Grafeas\V1\License $license + * Licenses that have been declared by the authors of the package. + * @type \Grafeas\V1\Version $version + * The version of the package. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Package::initOnce(); + parent::__construct($data); + } + + /** + * The name of the installed package. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The name of the installed package. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * All of the places within the filesystem versions of this package + * have been found. + * + * Generated from protobuf field repeated .grafeas.v1.Location location = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getLocation() + { + return $this->location; + } + + /** + * All of the places within the filesystem versions of this package + * have been found. + * + * Generated from protobuf field repeated .grafeas.v1.Location location = 2; + * @param array<\Grafeas\V1\Location>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setLocation($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Grafeas\V1\Location::class); + $this->location = $arr; + + return $this; + } + + /** + * The type of package; whether native or non native (e.g., ruby gems, + * node.js packages, etc.). + * + * Generated from protobuf field string package_type = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getPackageType() + { + return $this->package_type; + } + + /** + * The type of package; whether native or non native (e.g., ruby gems, + * node.js packages, etc.). + * + * Generated from protobuf field string package_type = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setPackageType($var) + { + GPBUtil::checkString($var, True); + $this->package_type = $var; + + return $this; + } + + /** + * The cpe_uri in [CPE format](https://cpe.mitre.org/specification/) + * denoting the package manager version distributing a package. + * The cpe_uri will be blank for language packages. + * + * Generated from protobuf field string cpe_uri = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getCpeUri() + { + return $this->cpe_uri; + } + + /** + * The cpe_uri in [CPE format](https://cpe.mitre.org/specification/) + * denoting the package manager version distributing a package. + * The cpe_uri will be blank for language packages. + * + * Generated from protobuf field string cpe_uri = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setCpeUri($var) + { + GPBUtil::checkString($var, True); + $this->cpe_uri = $var; + + return $this; + } + + /** + * The CPU architecture for which packages in this distribution channel were + * built. Architecture will be blank for language packages. + * + * Generated from protobuf field .grafeas.v1.Architecture architecture = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getArchitecture() + { + return $this->architecture; + } + + /** + * The CPU architecture for which packages in this distribution channel were + * built. Architecture will be blank for language packages. + * + * Generated from protobuf field .grafeas.v1.Architecture architecture = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setArchitecture($var) + { + GPBUtil::checkEnum($var, \Grafeas\V1\Architecture::class); + $this->architecture = $var; + + return $this; + } + + /** + * Licenses that have been declared by the authors of the package. + * + * Generated from protobuf field .grafeas.v1.License license = 6; + * @return \Grafeas\V1\License|null + */ + public function getLicense() + { + return $this->license; + } + + public function hasLicense() + { + return isset($this->license); + } + + public function clearLicense() + { + unset($this->license); + } + + /** + * Licenses that have been declared by the authors of the package. + * + * Generated from protobuf field .grafeas.v1.License license = 6; + * @param \Grafeas\V1\License $var + * @return $this + */ + public function setLicense($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\License::class); + $this->license = $var; + + return $this; + } + + /** + * The version of the package. + * + * Generated from protobuf field .grafeas.v1.Version version = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Grafeas\V1\Version|null + */ + public function getVersion() + { + return $this->version; + } + + public function hasVersion() + { + return isset($this->version); + } + + public function clearVersion() + { + unset($this->version); + } + + /** + * The version of the package. + * + * Generated from protobuf field .grafeas.v1.Version version = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Grafeas\V1\Version $var + * @return $this + */ + public function setVersion($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\Version::class); + $this->version = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/ProjectRepoId.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/ProjectRepoId.php new file mode 100644 index 000000000000..d2c9475a063e --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/ProjectRepoId.php @@ -0,0 +1,102 @@ +grafeas.v1.ProjectRepoId + */ +class ProjectRepoId extends \Google\Protobuf\Internal\Message +{ + /** + * The ID of the project. + * + * Generated from protobuf field string project_id = 1; + */ + protected $project_id = ''; + /** + * The name of the repo. Leave empty for the default repo. + * + * Generated from protobuf field string repo_name = 2; + */ + protected $repo_name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $project_id + * The ID of the project. + * @type string $repo_name + * The name of the repo. Leave empty for the default repo. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Provenance::initOnce(); + parent::__construct($data); + } + + /** + * The ID of the project. + * + * Generated from protobuf field string project_id = 1; + * @return string + */ + public function getProjectId() + { + return $this->project_id; + } + + /** + * The ID of the project. + * + * Generated from protobuf field string project_id = 1; + * @param string $var + * @return $this + */ + public function setProjectId($var) + { + GPBUtil::checkString($var, True); + $this->project_id = $var; + + return $this; + } + + /** + * The name of the repo. Leave empty for the default repo. + * + * Generated from protobuf field string repo_name = 2; + * @return string + */ + public function getRepoName() + { + return $this->repo_name; + } + + /** + * The name of the repo. Leave empty for the default repo. + * + * Generated from protobuf field string repo_name = 2; + * @param string $var + * @return $this + */ + public function setRepoName($var) + { + GPBUtil::checkString($var, True); + $this->repo_name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/Recipe.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/Recipe.php new file mode 100644 index 000000000000..0806a1ed630b --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/Recipe.php @@ -0,0 +1,273 @@ +grafeas.v1.Recipe + */ +class Recipe extends \Google\Protobuf\Internal\Message +{ + /** + * URI indicating what type of recipe was performed. It determines the meaning + * of recipe.entryPoint, recipe.arguments, recipe.environment, and materials. + * + * Generated from protobuf field string type = 1; + */ + protected $type = ''; + /** + * Index in materials containing the recipe steps that are not implied by + * recipe.type. For example, if the recipe type were "make", then this would + * point to the source containing the Makefile, not the make program itself. + * Set to -1 if the recipe doesn't come from a material, as zero is default + * unset value for int64. + * + * Generated from protobuf field int64 defined_in_material = 2; + */ + protected $defined_in_material = 0; + /** + * String identifying the entry point into the build. + * This is often a path to a configuration file and/or a target label within + * that file. The syntax and meaning are defined by recipe.type. For example, + * if the recipe type were "make", then this would reference the directory in + * which to run make as well as which target to use. + * + * Generated from protobuf field string entry_point = 3; + */ + protected $entry_point = ''; + /** + * Collection of all external inputs that influenced the build on top of + * recipe.definedInMaterial and recipe.entryPoint. For example, if the recipe + * type were "make", then this might be the flags passed to make aside from + * the target, which is captured in recipe.entryPoint. Since the arguments + * field can greatly vary in structure, depending on the builder and recipe + * type, this is of form "Any". + * + * Generated from protobuf field repeated .google.protobuf.Any arguments = 4; + */ + private $arguments; + /** + * Any other builder-controlled inputs necessary for correctly evaluating the + * recipe. Usually only needed for reproducing the build but not evaluated as + * part of policy. Since the environment field can greatly vary in structure, + * depending on the builder and recipe type, this is of form "Any". + * + * Generated from protobuf field repeated .google.protobuf.Any environment = 5; + */ + private $environment; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $type + * URI indicating what type of recipe was performed. It determines the meaning + * of recipe.entryPoint, recipe.arguments, recipe.environment, and materials. + * @type int|string $defined_in_material + * Index in materials containing the recipe steps that are not implied by + * recipe.type. For example, if the recipe type were "make", then this would + * point to the source containing the Makefile, not the make program itself. + * Set to -1 if the recipe doesn't come from a material, as zero is default + * unset value for int64. + * @type string $entry_point + * String identifying the entry point into the build. + * This is often a path to a configuration file and/or a target label within + * that file. The syntax and meaning are defined by recipe.type. For example, + * if the recipe type were "make", then this would reference the directory in + * which to run make as well as which target to use. + * @type array<\Google\Protobuf\Any>|\Google\Protobuf\Internal\RepeatedField $arguments + * Collection of all external inputs that influenced the build on top of + * recipe.definedInMaterial and recipe.entryPoint. For example, if the recipe + * type were "make", then this might be the flags passed to make aside from + * the target, which is captured in recipe.entryPoint. Since the arguments + * field can greatly vary in structure, depending on the builder and recipe + * type, this is of form "Any". + * @type array<\Google\Protobuf\Any>|\Google\Protobuf\Internal\RepeatedField $environment + * Any other builder-controlled inputs necessary for correctly evaluating the + * recipe. Usually only needed for reproducing the build but not evaluated as + * part of policy. Since the environment field can greatly vary in structure, + * depending on the builder and recipe type, this is of form "Any". + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\IntotoProvenance::initOnce(); + parent::__construct($data); + } + + /** + * URI indicating what type of recipe was performed. It determines the meaning + * of recipe.entryPoint, recipe.arguments, recipe.environment, and materials. + * + * Generated from protobuf field string type = 1; + * @return string + */ + public function getType() + { + return $this->type; + } + + /** + * URI indicating what type of recipe was performed. It determines the meaning + * of recipe.entryPoint, recipe.arguments, recipe.environment, and materials. + * + * Generated from protobuf field string type = 1; + * @param string $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkString($var, True); + $this->type = $var; + + return $this; + } + + /** + * Index in materials containing the recipe steps that are not implied by + * recipe.type. For example, if the recipe type were "make", then this would + * point to the source containing the Makefile, not the make program itself. + * Set to -1 if the recipe doesn't come from a material, as zero is default + * unset value for int64. + * + * Generated from protobuf field int64 defined_in_material = 2; + * @return int|string + */ + public function getDefinedInMaterial() + { + return $this->defined_in_material; + } + + /** + * Index in materials containing the recipe steps that are not implied by + * recipe.type. For example, if the recipe type were "make", then this would + * point to the source containing the Makefile, not the make program itself. + * Set to -1 if the recipe doesn't come from a material, as zero is default + * unset value for int64. + * + * Generated from protobuf field int64 defined_in_material = 2; + * @param int|string $var + * @return $this + */ + public function setDefinedInMaterial($var) + { + GPBUtil::checkInt64($var); + $this->defined_in_material = $var; + + return $this; + } + + /** + * String identifying the entry point into the build. + * This is often a path to a configuration file and/or a target label within + * that file. The syntax and meaning are defined by recipe.type. For example, + * if the recipe type were "make", then this would reference the directory in + * which to run make as well as which target to use. + * + * Generated from protobuf field string entry_point = 3; + * @return string + */ + public function getEntryPoint() + { + return $this->entry_point; + } + + /** + * String identifying the entry point into the build. + * This is often a path to a configuration file and/or a target label within + * that file. The syntax and meaning are defined by recipe.type. For example, + * if the recipe type were "make", then this would reference the directory in + * which to run make as well as which target to use. + * + * Generated from protobuf field string entry_point = 3; + * @param string $var + * @return $this + */ + public function setEntryPoint($var) + { + GPBUtil::checkString($var, True); + $this->entry_point = $var; + + return $this; + } + + /** + * Collection of all external inputs that influenced the build on top of + * recipe.definedInMaterial and recipe.entryPoint. For example, if the recipe + * type were "make", then this might be the flags passed to make aside from + * the target, which is captured in recipe.entryPoint. Since the arguments + * field can greatly vary in structure, depending on the builder and recipe + * type, this is of form "Any". + * + * Generated from protobuf field repeated .google.protobuf.Any arguments = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getArguments() + { + return $this->arguments; + } + + /** + * Collection of all external inputs that influenced the build on top of + * recipe.definedInMaterial and recipe.entryPoint. For example, if the recipe + * type were "make", then this might be the flags passed to make aside from + * the target, which is captured in recipe.entryPoint. Since the arguments + * field can greatly vary in structure, depending on the builder and recipe + * type, this is of form "Any". + * + * Generated from protobuf field repeated .google.protobuf.Any arguments = 4; + * @param array<\Google\Protobuf\Any>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setArguments($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Any::class); + $this->arguments = $arr; + + return $this; + } + + /** + * Any other builder-controlled inputs necessary for correctly evaluating the + * recipe. Usually only needed for reproducing the build but not evaluated as + * part of policy. Since the environment field can greatly vary in structure, + * depending on the builder and recipe type, this is of form "Any". + * + * Generated from protobuf field repeated .google.protobuf.Any environment = 5; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getEnvironment() + { + return $this->environment; + } + + /** + * Any other builder-controlled inputs necessary for correctly evaluating the + * recipe. Usually only needed for reproducing the build but not evaluated as + * part of policy. Since the environment field can greatly vary in structure, + * depending on the builder and recipe type, this is of form "Any". + * + * Generated from protobuf field repeated .google.protobuf.Any environment = 5; + * @param array<\Google\Protobuf\Any>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setEnvironment($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Any::class); + $this->environment = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/RelatedUrl.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/RelatedUrl.php new file mode 100644 index 000000000000..c407db0064b9 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/RelatedUrl.php @@ -0,0 +1,101 @@ +grafeas.v1.RelatedUrl + */ +class RelatedUrl extends \Google\Protobuf\Internal\Message +{ + /** + * Specific URL associated with the resource. + * + * Generated from protobuf field string url = 1; + */ + protected $url = ''; + /** + * Label to describe usage of the URL. + * + * Generated from protobuf field string label = 2; + */ + protected $label = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $url + * Specific URL associated with the resource. + * @type string $label + * Label to describe usage of the URL. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Common::initOnce(); + parent::__construct($data); + } + + /** + * Specific URL associated with the resource. + * + * Generated from protobuf field string url = 1; + * @return string + */ + public function getUrl() + { + return $this->url; + } + + /** + * Specific URL associated with the resource. + * + * Generated from protobuf field string url = 1; + * @param string $var + * @return $this + */ + public function setUrl($var) + { + GPBUtil::checkString($var, True); + $this->url = $var; + + return $this; + } + + /** + * Label to describe usage of the URL. + * + * Generated from protobuf field string label = 2; + * @return string + */ + public function getLabel() + { + return $this->label; + } + + /** + * Label to describe usage of the URL. + * + * Generated from protobuf field string label = 2; + * @param string $var + * @return $this + */ + public function setLabel($var) + { + GPBUtil::checkString($var, True); + $this->label = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/RepoId.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/RepoId.php new file mode 100644 index 000000000000..5643c66c7c24 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/RepoId.php @@ -0,0 +1,108 @@ +grafeas.v1.RepoId + */ +class RepoId extends \Google\Protobuf\Internal\Message +{ + protected $id; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Grafeas\V1\ProjectRepoId $project_repo_id + * A combination of a project ID and a repo name. + * @type string $uid + * A server-assigned, globally unique identifier. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Provenance::initOnce(); + parent::__construct($data); + } + + /** + * A combination of a project ID and a repo name. + * + * Generated from protobuf field .grafeas.v1.ProjectRepoId project_repo_id = 1; + * @return \Grafeas\V1\ProjectRepoId|null + */ + public function getProjectRepoId() + { + return $this->readOneof(1); + } + + public function hasProjectRepoId() + { + return $this->hasOneof(1); + } + + /** + * A combination of a project ID and a repo name. + * + * Generated from protobuf field .grafeas.v1.ProjectRepoId project_repo_id = 1; + * @param \Grafeas\V1\ProjectRepoId $var + * @return $this + */ + public function setProjectRepoId($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\ProjectRepoId::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * A server-assigned, globally unique identifier. + * + * Generated from protobuf field string uid = 2; + * @return string + */ + public function getUid() + { + return $this->readOneof(2); + } + + public function hasUid() + { + return $this->hasOneof(2); + } + + /** + * A server-assigned, globally unique identifier. + * + * Generated from protobuf field string uid = 2; + * @param string $var + * @return $this + */ + public function setUid($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * @return string + */ + public function getId() + { + return $this->whichOneof("id"); + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/Severity.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/Severity.php new file mode 100644 index 000000000000..698112c5460e --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/Severity.php @@ -0,0 +1,82 @@ +grafeas.v1.Severity + */ +class Severity +{ + /** + * Unknown. + * + * Generated from protobuf enum SEVERITY_UNSPECIFIED = 0; + */ + const SEVERITY_UNSPECIFIED = 0; + /** + * Minimal severity. + * + * Generated from protobuf enum MINIMAL = 1; + */ + const MINIMAL = 1; + /** + * Low severity. + * + * Generated from protobuf enum LOW = 2; + */ + const LOW = 2; + /** + * Medium severity. + * + * Generated from protobuf enum MEDIUM = 3; + */ + const MEDIUM = 3; + /** + * High severity. + * + * Generated from protobuf enum HIGH = 4; + */ + const HIGH = 4; + /** + * Critical severity. + * + * Generated from protobuf enum CRITICAL = 5; + */ + const CRITICAL = 5; + + private static $valueToName = [ + self::SEVERITY_UNSPECIFIED => 'SEVERITY_UNSPECIFIED', + self::MINIMAL => 'MINIMAL', + self::LOW => 'LOW', + self::MEDIUM => 'MEDIUM', + self::HIGH => 'HIGH', + self::CRITICAL => 'CRITICAL', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/Signature.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/Signature.php new file mode 100644 index 000000000000..de57d7bfe087 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/Signature.php @@ -0,0 +1,192 @@ +grafeas.v1.Signature + */ +class Signature extends \Google\Protobuf\Internal\Message +{ + /** + * The content of the signature, an opaque bytestring. + * The payload that this signature verifies MUST be unambiguously provided + * with the Signature during verification. A wrapper message might provide + * the payload explicitly. Alternatively, a message might have a canonical + * serialization that can always be unambiguously computed to derive the + * payload. + * + * Generated from protobuf field bytes signature = 1; + */ + protected $signature = ''; + /** + * The identifier for the public key that verifies this signature. + * * The `public_key_id` is required. + * * The `public_key_id` SHOULD be an RFC3986 conformant URI. + * * When possible, the `public_key_id` SHOULD be an immutable reference, + * such as a cryptographic digest. + * Examples of valid `public_key_id`s: + * OpenPGP V4 public key fingerprint: + * * "openpgp4fpr:74FAF3B861BDA0870C7B6DEF607E48D2A663AEEA" + * See https://www.iana.org/assignments/uri-schemes/prov/openpgp4fpr for more + * details on this scheme. + * RFC6920 digest-named SubjectPublicKeyInfo (digest of the DER + * serialization): + * * "ni:///sha-256;cD9o9Cq6LG3jD0iKXqEi_vdjJGecm_iXkbqVoScViaU" + * * "nih:///sha-256;703f68f42aba2c6de30f488a5ea122fef76324679c9bf89791ba95a1271589a5" + * + * Generated from protobuf field string public_key_id = 2; + */ + protected $public_key_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $signature + * The content of the signature, an opaque bytestring. + * The payload that this signature verifies MUST be unambiguously provided + * with the Signature during verification. A wrapper message might provide + * the payload explicitly. Alternatively, a message might have a canonical + * serialization that can always be unambiguously computed to derive the + * payload. + * @type string $public_key_id + * The identifier for the public key that verifies this signature. + * * The `public_key_id` is required. + * * The `public_key_id` SHOULD be an RFC3986 conformant URI. + * * When possible, the `public_key_id` SHOULD be an immutable reference, + * such as a cryptographic digest. + * Examples of valid `public_key_id`s: + * OpenPGP V4 public key fingerprint: + * * "openpgp4fpr:74FAF3B861BDA0870C7B6DEF607E48D2A663AEEA" + * See https://www.iana.org/assignments/uri-schemes/prov/openpgp4fpr for more + * details on this scheme. + * RFC6920 digest-named SubjectPublicKeyInfo (digest of the DER + * serialization): + * * "ni:///sha-256;cD9o9Cq6LG3jD0iKXqEi_vdjJGecm_iXkbqVoScViaU" + * * "nih:///sha-256;703f68f42aba2c6de30f488a5ea122fef76324679c9bf89791ba95a1271589a5" + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Common::initOnce(); + parent::__construct($data); + } + + /** + * The content of the signature, an opaque bytestring. + * The payload that this signature verifies MUST be unambiguously provided + * with the Signature during verification. A wrapper message might provide + * the payload explicitly. Alternatively, a message might have a canonical + * serialization that can always be unambiguously computed to derive the + * payload. + * + * Generated from protobuf field bytes signature = 1; + * @return string + */ + public function getSignature() + { + return $this->signature; + } + + /** + * The content of the signature, an opaque bytestring. + * The payload that this signature verifies MUST be unambiguously provided + * with the Signature during verification. A wrapper message might provide + * the payload explicitly. Alternatively, a message might have a canonical + * serialization that can always be unambiguously computed to derive the + * payload. + * + * Generated from protobuf field bytes signature = 1; + * @param string $var + * @return $this + */ + public function setSignature($var) + { + GPBUtil::checkString($var, False); + $this->signature = $var; + + return $this; + } + + /** + * The identifier for the public key that verifies this signature. + * * The `public_key_id` is required. + * * The `public_key_id` SHOULD be an RFC3986 conformant URI. + * * When possible, the `public_key_id` SHOULD be an immutable reference, + * such as a cryptographic digest. + * Examples of valid `public_key_id`s: + * OpenPGP V4 public key fingerprint: + * * "openpgp4fpr:74FAF3B861BDA0870C7B6DEF607E48D2A663AEEA" + * See https://www.iana.org/assignments/uri-schemes/prov/openpgp4fpr for more + * details on this scheme. + * RFC6920 digest-named SubjectPublicKeyInfo (digest of the DER + * serialization): + * * "ni:///sha-256;cD9o9Cq6LG3jD0iKXqEi_vdjJGecm_iXkbqVoScViaU" + * * "nih:///sha-256;703f68f42aba2c6de30f488a5ea122fef76324679c9bf89791ba95a1271589a5" + * + * Generated from protobuf field string public_key_id = 2; + * @return string + */ + public function getPublicKeyId() + { + return $this->public_key_id; + } + + /** + * The identifier for the public key that verifies this signature. + * * The `public_key_id` is required. + * * The `public_key_id` SHOULD be an RFC3986 conformant URI. + * * When possible, the `public_key_id` SHOULD be an immutable reference, + * such as a cryptographic digest. + * Examples of valid `public_key_id`s: + * OpenPGP V4 public key fingerprint: + * * "openpgp4fpr:74FAF3B861BDA0870C7B6DEF607E48D2A663AEEA" + * See https://www.iana.org/assignments/uri-schemes/prov/openpgp4fpr for more + * details on this scheme. + * RFC6920 digest-named SubjectPublicKeyInfo (digest of the DER + * serialization): + * * "ni:///sha-256;cD9o9Cq6LG3jD0iKXqEi_vdjJGecm_iXkbqVoScViaU" + * * "nih:///sha-256;703f68f42aba2c6de30f488a5ea122fef76324679c9bf89791ba95a1271589a5" + * + * Generated from protobuf field string public_key_id = 2; + * @param string $var + * @return $this + */ + public function setPublicKeyId($var) + { + GPBUtil::checkString($var, True); + $this->public_key_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/SlsaProvenance.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/SlsaProvenance.php new file mode 100644 index 000000000000..0113d091326d --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/SlsaProvenance.php @@ -0,0 +1,214 @@ +grafeas.v1.SlsaProvenance + */ +class SlsaProvenance extends \Google\Protobuf\Internal\Message +{ + /** + * required + * + * Generated from protobuf field .grafeas.v1.SlsaProvenance.SlsaBuilder builder = 1; + */ + protected $builder = null; + /** + * Identifies the configuration used for the build. + * When combined with materials, this SHOULD fully describe the build, + * such that re-running this recipe results in bit-for-bit identical output + * (if the build is reproducible). + * + * Generated from protobuf field .grafeas.v1.SlsaProvenance.SlsaRecipe recipe = 2; + */ + protected $recipe = null; + /** + * Generated from protobuf field .grafeas.v1.SlsaProvenance.SlsaMetadata metadata = 3; + */ + protected $metadata = null; + /** + * The collection of artifacts that influenced the build including sources, + * dependencies, build tools, base images, and so on. This is considered to be + * incomplete unless metadata.completeness.materials is true. Unset or null is + * equivalent to empty. + * + * Generated from protobuf field repeated .grafeas.v1.SlsaProvenance.Material materials = 4; + */ + private $materials; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Grafeas\V1\SlsaProvenance\SlsaBuilder $builder + * required + * @type \Grafeas\V1\SlsaProvenance\SlsaRecipe $recipe + * Identifies the configuration used for the build. + * When combined with materials, this SHOULD fully describe the build, + * such that re-running this recipe results in bit-for-bit identical output + * (if the build is reproducible). + * @type \Grafeas\V1\SlsaProvenance\SlsaMetadata $metadata + * @type array<\Grafeas\V1\SlsaProvenance\Material>|\Google\Protobuf\Internal\RepeatedField $materials + * The collection of artifacts that influenced the build including sources, + * dependencies, build tools, base images, and so on. This is considered to be + * incomplete unless metadata.completeness.materials is true. Unset or null is + * equivalent to empty. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\SlsaProvenance::initOnce(); + parent::__construct($data); + } + + /** + * required + * + * Generated from protobuf field .grafeas.v1.SlsaProvenance.SlsaBuilder builder = 1; + * @return \Grafeas\V1\SlsaProvenance\SlsaBuilder|null + */ + public function getBuilder() + { + return $this->builder; + } + + public function hasBuilder() + { + return isset($this->builder); + } + + public function clearBuilder() + { + unset($this->builder); + } + + /** + * required + * + * Generated from protobuf field .grafeas.v1.SlsaProvenance.SlsaBuilder builder = 1; + * @param \Grafeas\V1\SlsaProvenance\SlsaBuilder $var + * @return $this + */ + public function setBuilder($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\SlsaProvenance\SlsaBuilder::class); + $this->builder = $var; + + return $this; + } + + /** + * Identifies the configuration used for the build. + * When combined with materials, this SHOULD fully describe the build, + * such that re-running this recipe results in bit-for-bit identical output + * (if the build is reproducible). + * + * Generated from protobuf field .grafeas.v1.SlsaProvenance.SlsaRecipe recipe = 2; + * @return \Grafeas\V1\SlsaProvenance\SlsaRecipe|null + */ + public function getRecipe() + { + return $this->recipe; + } + + public function hasRecipe() + { + return isset($this->recipe); + } + + public function clearRecipe() + { + unset($this->recipe); + } + + /** + * Identifies the configuration used for the build. + * When combined with materials, this SHOULD fully describe the build, + * such that re-running this recipe results in bit-for-bit identical output + * (if the build is reproducible). + * + * Generated from protobuf field .grafeas.v1.SlsaProvenance.SlsaRecipe recipe = 2; + * @param \Grafeas\V1\SlsaProvenance\SlsaRecipe $var + * @return $this + */ + public function setRecipe($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\SlsaProvenance\SlsaRecipe::class); + $this->recipe = $var; + + return $this; + } + + /** + * Generated from protobuf field .grafeas.v1.SlsaProvenance.SlsaMetadata metadata = 3; + * @return \Grafeas\V1\SlsaProvenance\SlsaMetadata|null + */ + public function getMetadata() + { + return $this->metadata; + } + + public function hasMetadata() + { + return isset($this->metadata); + } + + public function clearMetadata() + { + unset($this->metadata); + } + + /** + * Generated from protobuf field .grafeas.v1.SlsaProvenance.SlsaMetadata metadata = 3; + * @param \Grafeas\V1\SlsaProvenance\SlsaMetadata $var + * @return $this + */ + public function setMetadata($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\SlsaProvenance\SlsaMetadata::class); + $this->metadata = $var; + + return $this; + } + + /** + * The collection of artifacts that influenced the build including sources, + * dependencies, build tools, base images, and so on. This is considered to be + * incomplete unless metadata.completeness.materials is true. Unset or null is + * equivalent to empty. + * + * Generated from protobuf field repeated .grafeas.v1.SlsaProvenance.Material materials = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getMaterials() + { + return $this->materials; + } + + /** + * The collection of artifacts that influenced the build including sources, + * dependencies, build tools, base images, and so on. This is considered to be + * incomplete unless metadata.completeness.materials is true. Unset or null is + * equivalent to empty. + * + * Generated from protobuf field repeated .grafeas.v1.SlsaProvenance.Material materials = 4; + * @param array<\Grafeas\V1\SlsaProvenance\Material>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setMaterials($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Grafeas\V1\SlsaProvenance\Material::class); + $this->materials = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/SlsaProvenance/Material.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/SlsaProvenance/Material.php new file mode 100644 index 000000000000..d2165056a94b --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/SlsaProvenance/Material.php @@ -0,0 +1,88 @@ +grafeas.v1.SlsaProvenance.Material + */ +class Material extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field string uri = 1; + */ + protected $uri = ''; + /** + * Generated from protobuf field map digest = 2; + */ + private $digest; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $uri + * @type array|\Google\Protobuf\Internal\MapField $digest + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\SlsaProvenance::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field string uri = 1; + * @return string + */ + public function getUri() + { + return $this->uri; + } + + /** + * Generated from protobuf field string uri = 1; + * @param string $var + * @return $this + */ + public function setUri($var) + { + GPBUtil::checkString($var, True); + $this->uri = $var; + + return $this; + } + + /** + * Generated from protobuf field map digest = 2; + * @return \Google\Protobuf\Internal\MapField + */ + public function getDigest() + { + return $this->digest; + } + + /** + * Generated from protobuf field map digest = 2; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setDigest($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->digest = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Material::class, \Grafeas\V1\SlsaProvenance_Material::class); + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/SlsaProvenance/SlsaBuilder.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/SlsaProvenance/SlsaBuilder.php new file mode 100644 index 000000000000..455fa4993f05 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/SlsaProvenance/SlsaBuilder.php @@ -0,0 +1,61 @@ +grafeas.v1.SlsaProvenance.SlsaBuilder + */ +class SlsaBuilder extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field string id = 1; + */ + protected $id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $id + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\SlsaProvenance::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field string id = 1; + * @return string + */ + public function getId() + { + return $this->id; + } + + /** + * Generated from protobuf field string id = 1; + * @param string $var + * @return $this + */ + public function setId($var) + { + GPBUtil::checkString($var, True); + $this->id = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(SlsaBuilder::class, \Grafeas\V1\SlsaProvenance_SlsaBuilder::class); + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/SlsaProvenance/SlsaCompleteness.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/SlsaProvenance/SlsaCompleteness.php new file mode 100644 index 000000000000..15d1ba478108 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/SlsaProvenance/SlsaCompleteness.php @@ -0,0 +1,151 @@ +grafeas.v1.SlsaProvenance.SlsaCompleteness + */ +class SlsaCompleteness extends \Google\Protobuf\Internal\Message +{ + /** + * If true, the builder claims that recipe.arguments is complete, meaning + * that all external inputs are properly captured in the recipe. + * + * Generated from protobuf field bool arguments = 1; + */ + protected $arguments = false; + /** + * If true, the builder claims that recipe.environment is claimed to be + * complete. + * + * Generated from protobuf field bool environment = 2; + */ + protected $environment = false; + /** + * If true, the builder claims that materials are complete, usually through + * some controls to prevent network access. Sometimes called "hermetic". + * + * Generated from protobuf field bool materials = 3; + */ + protected $materials = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $arguments + * If true, the builder claims that recipe.arguments is complete, meaning + * that all external inputs are properly captured in the recipe. + * @type bool $environment + * If true, the builder claims that recipe.environment is claimed to be + * complete. + * @type bool $materials + * If true, the builder claims that materials are complete, usually through + * some controls to prevent network access. Sometimes called "hermetic". + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\SlsaProvenance::initOnce(); + parent::__construct($data); + } + + /** + * If true, the builder claims that recipe.arguments is complete, meaning + * that all external inputs are properly captured in the recipe. + * + * Generated from protobuf field bool arguments = 1; + * @return bool + */ + public function getArguments() + { + return $this->arguments; + } + + /** + * If true, the builder claims that recipe.arguments is complete, meaning + * that all external inputs are properly captured in the recipe. + * + * Generated from protobuf field bool arguments = 1; + * @param bool $var + * @return $this + */ + public function setArguments($var) + { + GPBUtil::checkBool($var); + $this->arguments = $var; + + return $this; + } + + /** + * If true, the builder claims that recipe.environment is claimed to be + * complete. + * + * Generated from protobuf field bool environment = 2; + * @return bool + */ + public function getEnvironment() + { + return $this->environment; + } + + /** + * If true, the builder claims that recipe.environment is claimed to be + * complete. + * + * Generated from protobuf field bool environment = 2; + * @param bool $var + * @return $this + */ + public function setEnvironment($var) + { + GPBUtil::checkBool($var); + $this->environment = $var; + + return $this; + } + + /** + * If true, the builder claims that materials are complete, usually through + * some controls to prevent network access. Sometimes called "hermetic". + * + * Generated from protobuf field bool materials = 3; + * @return bool + */ + public function getMaterials() + { + return $this->materials; + } + + /** + * If true, the builder claims that materials are complete, usually through + * some controls to prevent network access. Sometimes called "hermetic". + * + * Generated from protobuf field bool materials = 3; + * @param bool $var + * @return $this + */ + public function setMaterials($var) + { + GPBUtil::checkBool($var); + $this->materials = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(SlsaCompleteness::class, \Grafeas\V1\SlsaProvenance_SlsaCompleteness::class); + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/SlsaProvenance/SlsaMetadata.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/SlsaProvenance/SlsaMetadata.php new file mode 100644 index 000000000000..05447be11b5c --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/SlsaProvenance/SlsaMetadata.php @@ -0,0 +1,252 @@ +grafeas.v1.SlsaProvenance.SlsaMetadata + */ +class SlsaMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * Identifies the particular build invocation, which can be useful for + * finding associated logs or other ad-hoc analysis. The value SHOULD be + * globally unique, per in-toto Provenance spec. + * + * Generated from protobuf field string build_invocation_id = 1; + */ + protected $build_invocation_id = ''; + /** + * The timestamp of when the build started. + * + * Generated from protobuf field .google.protobuf.Timestamp build_started_on = 2; + */ + protected $build_started_on = null; + /** + * The timestamp of when the build completed. + * + * Generated from protobuf field .google.protobuf.Timestamp build_finished_on = 3; + */ + protected $build_finished_on = null; + /** + * Indicates that the builder claims certain fields in this message to be + * complete. + * + * Generated from protobuf field .grafeas.v1.SlsaProvenance.SlsaCompleteness completeness = 4; + */ + protected $completeness = null; + /** + * If true, the builder claims that running the recipe on materials will + * produce bit-for-bit identical output. + * + * Generated from protobuf field bool reproducible = 5; + */ + protected $reproducible = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $build_invocation_id + * Identifies the particular build invocation, which can be useful for + * finding associated logs or other ad-hoc analysis. The value SHOULD be + * globally unique, per in-toto Provenance spec. + * @type \Google\Protobuf\Timestamp $build_started_on + * The timestamp of when the build started. + * @type \Google\Protobuf\Timestamp $build_finished_on + * The timestamp of when the build completed. + * @type \Grafeas\V1\SlsaProvenance\SlsaCompleteness $completeness + * Indicates that the builder claims certain fields in this message to be + * complete. + * @type bool $reproducible + * If true, the builder claims that running the recipe on materials will + * produce bit-for-bit identical output. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\SlsaProvenance::initOnce(); + parent::__construct($data); + } + + /** + * Identifies the particular build invocation, which can be useful for + * finding associated logs or other ad-hoc analysis. The value SHOULD be + * globally unique, per in-toto Provenance spec. + * + * Generated from protobuf field string build_invocation_id = 1; + * @return string + */ + public function getBuildInvocationId() + { + return $this->build_invocation_id; + } + + /** + * Identifies the particular build invocation, which can be useful for + * finding associated logs or other ad-hoc analysis. The value SHOULD be + * globally unique, per in-toto Provenance spec. + * + * Generated from protobuf field string build_invocation_id = 1; + * @param string $var + * @return $this + */ + public function setBuildInvocationId($var) + { + GPBUtil::checkString($var, True); + $this->build_invocation_id = $var; + + return $this; + } + + /** + * The timestamp of when the build started. + * + * Generated from protobuf field .google.protobuf.Timestamp build_started_on = 2; + * @return \Google\Protobuf\Timestamp|null + */ + public function getBuildStartedOn() + { + return $this->build_started_on; + } + + public function hasBuildStartedOn() + { + return isset($this->build_started_on); + } + + public function clearBuildStartedOn() + { + unset($this->build_started_on); + } + + /** + * The timestamp of when the build started. + * + * Generated from protobuf field .google.protobuf.Timestamp build_started_on = 2; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setBuildStartedOn($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->build_started_on = $var; + + return $this; + } + + /** + * The timestamp of when the build completed. + * + * Generated from protobuf field .google.protobuf.Timestamp build_finished_on = 3; + * @return \Google\Protobuf\Timestamp|null + */ + public function getBuildFinishedOn() + { + return $this->build_finished_on; + } + + public function hasBuildFinishedOn() + { + return isset($this->build_finished_on); + } + + public function clearBuildFinishedOn() + { + unset($this->build_finished_on); + } + + /** + * The timestamp of when the build completed. + * + * Generated from protobuf field .google.protobuf.Timestamp build_finished_on = 3; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setBuildFinishedOn($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->build_finished_on = $var; + + return $this; + } + + /** + * Indicates that the builder claims certain fields in this message to be + * complete. + * + * Generated from protobuf field .grafeas.v1.SlsaProvenance.SlsaCompleteness completeness = 4; + * @return \Grafeas\V1\SlsaProvenance\SlsaCompleteness|null + */ + public function getCompleteness() + { + return $this->completeness; + } + + public function hasCompleteness() + { + return isset($this->completeness); + } + + public function clearCompleteness() + { + unset($this->completeness); + } + + /** + * Indicates that the builder claims certain fields in this message to be + * complete. + * + * Generated from protobuf field .grafeas.v1.SlsaProvenance.SlsaCompleteness completeness = 4; + * @param \Grafeas\V1\SlsaProvenance\SlsaCompleteness $var + * @return $this + */ + public function setCompleteness($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\SlsaProvenance\SlsaCompleteness::class); + $this->completeness = $var; + + return $this; + } + + /** + * If true, the builder claims that running the recipe on materials will + * produce bit-for-bit identical output. + * + * Generated from protobuf field bool reproducible = 5; + * @return bool + */ + public function getReproducible() + { + return $this->reproducible; + } + + /** + * If true, the builder claims that running the recipe on materials will + * produce bit-for-bit identical output. + * + * Generated from protobuf field bool reproducible = 5; + * @param bool $var + * @return $this + */ + public function setReproducible($var) + { + GPBUtil::checkBool($var); + $this->reproducible = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(SlsaMetadata::class, \Grafeas\V1\SlsaProvenance_SlsaMetadata::class); + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/SlsaProvenance/SlsaRecipe.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/SlsaProvenance/SlsaRecipe.php new file mode 100644 index 000000000000..a448a91e95fb --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/SlsaProvenance/SlsaRecipe.php @@ -0,0 +1,296 @@ +grafeas.v1.SlsaProvenance.SlsaRecipe + */ +class SlsaRecipe extends \Google\Protobuf\Internal\Message +{ + /** + * URI indicating what type of recipe was performed. It determines the + * meaning of recipe.entryPoint, recipe.arguments, recipe.environment, and + * materials. + * + * Generated from protobuf field string type = 1; + */ + protected $type = ''; + /** + * Index in materials containing the recipe steps that are not implied by + * recipe.type. For example, if the recipe type were "make", then this would + * point to the source containing the Makefile, not the make program itself. + * Set to -1 if the recipe doesn't come from a material, as zero is default + * unset value for int64. + * + * Generated from protobuf field int64 defined_in_material = 2; + */ + protected $defined_in_material = 0; + /** + * String identifying the entry point into the build. + * This is often a path to a configuration file and/or a target label within + * that file. The syntax and meaning are defined by recipe.type. For + * example, if the recipe type were "make", then this would reference the + * directory in which to run make as well as which target to use. + * + * Generated from protobuf field string entry_point = 3; + */ + protected $entry_point = ''; + /** + * Collection of all external inputs that influenced the build on top of + * recipe.definedInMaterial and recipe.entryPoint. For example, if the + * recipe type were "make", then this might be the flags passed to make + * aside from the target, which is captured in recipe.entryPoint. Depending + * on the recipe Type, the structure may be different. + * + * Generated from protobuf field .google.protobuf.Any arguments = 4; + */ + protected $arguments = null; + /** + * Any other builder-controlled inputs necessary for correctly evaluating + * the recipe. Usually only needed for reproducing the build but not + * evaluated as part of policy. Depending on the recipe Type, the structure + * may be different. + * + * Generated from protobuf field .google.protobuf.Any environment = 5; + */ + protected $environment = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $type + * URI indicating what type of recipe was performed. It determines the + * meaning of recipe.entryPoint, recipe.arguments, recipe.environment, and + * materials. + * @type int|string $defined_in_material + * Index in materials containing the recipe steps that are not implied by + * recipe.type. For example, if the recipe type were "make", then this would + * point to the source containing the Makefile, not the make program itself. + * Set to -1 if the recipe doesn't come from a material, as zero is default + * unset value for int64. + * @type string $entry_point + * String identifying the entry point into the build. + * This is often a path to a configuration file and/or a target label within + * that file. The syntax and meaning are defined by recipe.type. For + * example, if the recipe type were "make", then this would reference the + * directory in which to run make as well as which target to use. + * @type \Google\Protobuf\Any $arguments + * Collection of all external inputs that influenced the build on top of + * recipe.definedInMaterial and recipe.entryPoint. For example, if the + * recipe type were "make", then this might be the flags passed to make + * aside from the target, which is captured in recipe.entryPoint. Depending + * on the recipe Type, the structure may be different. + * @type \Google\Protobuf\Any $environment + * Any other builder-controlled inputs necessary for correctly evaluating + * the recipe. Usually only needed for reproducing the build but not + * evaluated as part of policy. Depending on the recipe Type, the structure + * may be different. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\SlsaProvenance::initOnce(); + parent::__construct($data); + } + + /** + * URI indicating what type of recipe was performed. It determines the + * meaning of recipe.entryPoint, recipe.arguments, recipe.environment, and + * materials. + * + * Generated from protobuf field string type = 1; + * @return string + */ + public function getType() + { + return $this->type; + } + + /** + * URI indicating what type of recipe was performed. It determines the + * meaning of recipe.entryPoint, recipe.arguments, recipe.environment, and + * materials. + * + * Generated from protobuf field string type = 1; + * @param string $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkString($var, True); + $this->type = $var; + + return $this; + } + + /** + * Index in materials containing the recipe steps that are not implied by + * recipe.type. For example, if the recipe type were "make", then this would + * point to the source containing the Makefile, not the make program itself. + * Set to -1 if the recipe doesn't come from a material, as zero is default + * unset value for int64. + * + * Generated from protobuf field int64 defined_in_material = 2; + * @return int|string + */ + public function getDefinedInMaterial() + { + return $this->defined_in_material; + } + + /** + * Index in materials containing the recipe steps that are not implied by + * recipe.type. For example, if the recipe type were "make", then this would + * point to the source containing the Makefile, not the make program itself. + * Set to -1 if the recipe doesn't come from a material, as zero is default + * unset value for int64. + * + * Generated from protobuf field int64 defined_in_material = 2; + * @param int|string $var + * @return $this + */ + public function setDefinedInMaterial($var) + { + GPBUtil::checkInt64($var); + $this->defined_in_material = $var; + + return $this; + } + + /** + * String identifying the entry point into the build. + * This is often a path to a configuration file and/or a target label within + * that file. The syntax and meaning are defined by recipe.type. For + * example, if the recipe type were "make", then this would reference the + * directory in which to run make as well as which target to use. + * + * Generated from protobuf field string entry_point = 3; + * @return string + */ + public function getEntryPoint() + { + return $this->entry_point; + } + + /** + * String identifying the entry point into the build. + * This is often a path to a configuration file and/or a target label within + * that file. The syntax and meaning are defined by recipe.type. For + * example, if the recipe type were "make", then this would reference the + * directory in which to run make as well as which target to use. + * + * Generated from protobuf field string entry_point = 3; + * @param string $var + * @return $this + */ + public function setEntryPoint($var) + { + GPBUtil::checkString($var, True); + $this->entry_point = $var; + + return $this; + } + + /** + * Collection of all external inputs that influenced the build on top of + * recipe.definedInMaterial and recipe.entryPoint. For example, if the + * recipe type were "make", then this might be the flags passed to make + * aside from the target, which is captured in recipe.entryPoint. Depending + * on the recipe Type, the structure may be different. + * + * Generated from protobuf field .google.protobuf.Any arguments = 4; + * @return \Google\Protobuf\Any|null + */ + public function getArguments() + { + return $this->arguments; + } + + public function hasArguments() + { + return isset($this->arguments); + } + + public function clearArguments() + { + unset($this->arguments); + } + + /** + * Collection of all external inputs that influenced the build on top of + * recipe.definedInMaterial and recipe.entryPoint. For example, if the + * recipe type were "make", then this might be the flags passed to make + * aside from the target, which is captured in recipe.entryPoint. Depending + * on the recipe Type, the structure may be different. + * + * Generated from protobuf field .google.protobuf.Any arguments = 4; + * @param \Google\Protobuf\Any $var + * @return $this + */ + public function setArguments($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Any::class); + $this->arguments = $var; + + return $this; + } + + /** + * Any other builder-controlled inputs necessary for correctly evaluating + * the recipe. Usually only needed for reproducing the build but not + * evaluated as part of policy. Depending on the recipe Type, the structure + * may be different. + * + * Generated from protobuf field .google.protobuf.Any environment = 5; + * @return \Google\Protobuf\Any|null + */ + public function getEnvironment() + { + return $this->environment; + } + + public function hasEnvironment() + { + return isset($this->environment); + } + + public function clearEnvironment() + { + unset($this->environment); + } + + /** + * Any other builder-controlled inputs necessary for correctly evaluating + * the recipe. Usually only needed for reproducing the build but not + * evaluated as part of policy. Depending on the recipe Type, the structure + * may be different. + * + * Generated from protobuf field .google.protobuf.Any environment = 5; + * @param \Google\Protobuf\Any $var + * @return $this + */ + public function setEnvironment($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Any::class); + $this->environment = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(SlsaRecipe::class, \Grafeas\V1\SlsaProvenance_SlsaRecipe::class); + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/SlsaProvenanceZeroTwo.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/SlsaProvenanceZeroTwo.php new file mode 100644 index 000000000000..c066b7a6521b --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/SlsaProvenanceZeroTwo.php @@ -0,0 +1,235 @@ +grafeas.v1.SlsaProvenanceZeroTwo + */ +class SlsaProvenanceZeroTwo extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field .grafeas.v1.SlsaProvenanceZeroTwo.SlsaBuilder builder = 1; + */ + protected $builder = null; + /** + * Generated from protobuf field string build_type = 2; + */ + protected $build_type = ''; + /** + * Generated from protobuf field .grafeas.v1.SlsaProvenanceZeroTwo.SlsaInvocation invocation = 3; + */ + protected $invocation = null; + /** + * Generated from protobuf field .google.protobuf.Struct build_config = 4; + */ + protected $build_config = null; + /** + * Generated from protobuf field .grafeas.v1.SlsaProvenanceZeroTwo.SlsaMetadata metadata = 5; + */ + protected $metadata = null; + /** + * Generated from protobuf field repeated .grafeas.v1.SlsaProvenanceZeroTwo.SlsaMaterial materials = 6; + */ + private $materials; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Grafeas\V1\SlsaProvenanceZeroTwo\SlsaBuilder $builder + * @type string $build_type + * @type \Grafeas\V1\SlsaProvenanceZeroTwo\SlsaInvocation $invocation + * @type \Google\Protobuf\Struct $build_config + * @type \Grafeas\V1\SlsaProvenanceZeroTwo\SlsaMetadata $metadata + * @type array<\Grafeas\V1\SlsaProvenanceZeroTwo\SlsaMaterial>|\Google\Protobuf\Internal\RepeatedField $materials + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\SlsaProvenanceZeroTwo::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field .grafeas.v1.SlsaProvenanceZeroTwo.SlsaBuilder builder = 1; + * @return \Grafeas\V1\SlsaProvenanceZeroTwo\SlsaBuilder|null + */ + public function getBuilder() + { + return $this->builder; + } + + public function hasBuilder() + { + return isset($this->builder); + } + + public function clearBuilder() + { + unset($this->builder); + } + + /** + * Generated from protobuf field .grafeas.v1.SlsaProvenanceZeroTwo.SlsaBuilder builder = 1; + * @param \Grafeas\V1\SlsaProvenanceZeroTwo\SlsaBuilder $var + * @return $this + */ + public function setBuilder($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\SlsaProvenanceZeroTwo\SlsaBuilder::class); + $this->builder = $var; + + return $this; + } + + /** + * Generated from protobuf field string build_type = 2; + * @return string + */ + public function getBuildType() + { + return $this->build_type; + } + + /** + * Generated from protobuf field string build_type = 2; + * @param string $var + * @return $this + */ + public function setBuildType($var) + { + GPBUtil::checkString($var, True); + $this->build_type = $var; + + return $this; + } + + /** + * Generated from protobuf field .grafeas.v1.SlsaProvenanceZeroTwo.SlsaInvocation invocation = 3; + * @return \Grafeas\V1\SlsaProvenanceZeroTwo\SlsaInvocation|null + */ + public function getInvocation() + { + return $this->invocation; + } + + public function hasInvocation() + { + return isset($this->invocation); + } + + public function clearInvocation() + { + unset($this->invocation); + } + + /** + * Generated from protobuf field .grafeas.v1.SlsaProvenanceZeroTwo.SlsaInvocation invocation = 3; + * @param \Grafeas\V1\SlsaProvenanceZeroTwo\SlsaInvocation $var + * @return $this + */ + public function setInvocation($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\SlsaProvenanceZeroTwo\SlsaInvocation::class); + $this->invocation = $var; + + return $this; + } + + /** + * Generated from protobuf field .google.protobuf.Struct build_config = 4; + * @return \Google\Protobuf\Struct|null + */ + public function getBuildConfig() + { + return $this->build_config; + } + + public function hasBuildConfig() + { + return isset($this->build_config); + } + + public function clearBuildConfig() + { + unset($this->build_config); + } + + /** + * Generated from protobuf field .google.protobuf.Struct build_config = 4; + * @param \Google\Protobuf\Struct $var + * @return $this + */ + public function setBuildConfig($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Struct::class); + $this->build_config = $var; + + return $this; + } + + /** + * Generated from protobuf field .grafeas.v1.SlsaProvenanceZeroTwo.SlsaMetadata metadata = 5; + * @return \Grafeas\V1\SlsaProvenanceZeroTwo\SlsaMetadata|null + */ + public function getMetadata() + { + return $this->metadata; + } + + public function hasMetadata() + { + return isset($this->metadata); + } + + public function clearMetadata() + { + unset($this->metadata); + } + + /** + * Generated from protobuf field .grafeas.v1.SlsaProvenanceZeroTwo.SlsaMetadata metadata = 5; + * @param \Grafeas\V1\SlsaProvenanceZeroTwo\SlsaMetadata $var + * @return $this + */ + public function setMetadata($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\SlsaProvenanceZeroTwo\SlsaMetadata::class); + $this->metadata = $var; + + return $this; + } + + /** + * Generated from protobuf field repeated .grafeas.v1.SlsaProvenanceZeroTwo.SlsaMaterial materials = 6; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getMaterials() + { + return $this->materials; + } + + /** + * Generated from protobuf field repeated .grafeas.v1.SlsaProvenanceZeroTwo.SlsaMaterial materials = 6; + * @param array<\Grafeas\V1\SlsaProvenanceZeroTwo\SlsaMaterial>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setMaterials($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Grafeas\V1\SlsaProvenanceZeroTwo\SlsaMaterial::class); + $this->materials = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/SlsaProvenanceZeroTwo/SlsaBuilder.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/SlsaProvenanceZeroTwo/SlsaBuilder.php new file mode 100644 index 000000000000..8029c7d4c110 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/SlsaProvenanceZeroTwo/SlsaBuilder.php @@ -0,0 +1,64 @@ +grafeas.v1.SlsaProvenanceZeroTwo.SlsaBuilder + */ +class SlsaBuilder extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field string id = 1; + */ + protected $id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $id + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\SlsaProvenanceZeroTwo::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field string id = 1; + * @return string + */ + public function getId() + { + return $this->id; + } + + /** + * Generated from protobuf field string id = 1; + * @param string $var + * @return $this + */ + public function setId($var) + { + GPBUtil::checkString($var, True); + $this->id = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(SlsaBuilder::class, \Grafeas\V1\SlsaProvenanceZeroTwo_SlsaBuilder::class); + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/SlsaProvenanceZeroTwo/SlsaCompleteness.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/SlsaProvenanceZeroTwo/SlsaCompleteness.php new file mode 100644 index 000000000000..dcb6e0a819c6 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/SlsaProvenanceZeroTwo/SlsaCompleteness.php @@ -0,0 +1,118 @@ +grafeas.v1.SlsaProvenanceZeroTwo.SlsaCompleteness + */ +class SlsaCompleteness extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field bool parameters = 1; + */ + protected $parameters = false; + /** + * Generated from protobuf field bool environment = 2; + */ + protected $environment = false; + /** + * Generated from protobuf field bool materials = 3; + */ + protected $materials = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $parameters + * @type bool $environment + * @type bool $materials + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\SlsaProvenanceZeroTwo::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field bool parameters = 1; + * @return bool + */ + public function getParameters() + { + return $this->parameters; + } + + /** + * Generated from protobuf field bool parameters = 1; + * @param bool $var + * @return $this + */ + public function setParameters($var) + { + GPBUtil::checkBool($var); + $this->parameters = $var; + + return $this; + } + + /** + * Generated from protobuf field bool environment = 2; + * @return bool + */ + public function getEnvironment() + { + return $this->environment; + } + + /** + * Generated from protobuf field bool environment = 2; + * @param bool $var + * @return $this + */ + public function setEnvironment($var) + { + GPBUtil::checkBool($var); + $this->environment = $var; + + return $this; + } + + /** + * Generated from protobuf field bool materials = 3; + * @return bool + */ + public function getMaterials() + { + return $this->materials; + } + + /** + * Generated from protobuf field bool materials = 3; + * @param bool $var + * @return $this + */ + public function setMaterials($var) + { + GPBUtil::checkBool($var); + $this->materials = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(SlsaCompleteness::class, \Grafeas\V1\SlsaProvenanceZeroTwo_SlsaCompleteness::class); + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/SlsaProvenanceZeroTwo/SlsaConfigSource.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/SlsaProvenanceZeroTwo/SlsaConfigSource.php new file mode 100644 index 000000000000..236b9d685397 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/SlsaProvenanceZeroTwo/SlsaConfigSource.php @@ -0,0 +1,118 @@ +grafeas.v1.SlsaProvenanceZeroTwo.SlsaConfigSource + */ +class SlsaConfigSource extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field string uri = 1; + */ + protected $uri = ''; + /** + * Generated from protobuf field map digest = 2; + */ + private $digest; + /** + * Generated from protobuf field string entry_point = 3; + */ + protected $entry_point = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $uri + * @type array|\Google\Protobuf\Internal\MapField $digest + * @type string $entry_point + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\SlsaProvenanceZeroTwo::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field string uri = 1; + * @return string + */ + public function getUri() + { + return $this->uri; + } + + /** + * Generated from protobuf field string uri = 1; + * @param string $var + * @return $this + */ + public function setUri($var) + { + GPBUtil::checkString($var, True); + $this->uri = $var; + + return $this; + } + + /** + * Generated from protobuf field map digest = 2; + * @return \Google\Protobuf\Internal\MapField + */ + public function getDigest() + { + return $this->digest; + } + + /** + * Generated from protobuf field map digest = 2; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setDigest($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->digest = $arr; + + return $this; + } + + /** + * Generated from protobuf field string entry_point = 3; + * @return string + */ + public function getEntryPoint() + { + return $this->entry_point; + } + + /** + * Generated from protobuf field string entry_point = 3; + * @param string $var + * @return $this + */ + public function setEntryPoint($var) + { + GPBUtil::checkString($var, True); + $this->entry_point = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(SlsaConfigSource::class, \Grafeas\V1\SlsaProvenanceZeroTwo_SlsaConfigSource::class); + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/SlsaProvenanceZeroTwo/SlsaInvocation.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/SlsaProvenanceZeroTwo/SlsaInvocation.php new file mode 100644 index 000000000000..14076ccc4655 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/SlsaProvenanceZeroTwo/SlsaInvocation.php @@ -0,0 +1,147 @@ +grafeas.v1.SlsaProvenanceZeroTwo.SlsaInvocation + */ +class SlsaInvocation extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field .grafeas.v1.SlsaProvenanceZeroTwo.SlsaConfigSource config_source = 1; + */ + protected $config_source = null; + /** + * Generated from protobuf field .google.protobuf.Struct parameters = 2; + */ + protected $parameters = null; + /** + * Generated from protobuf field .google.protobuf.Struct environment = 3; + */ + protected $environment = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Grafeas\V1\SlsaProvenanceZeroTwo\SlsaConfigSource $config_source + * @type \Google\Protobuf\Struct $parameters + * @type \Google\Protobuf\Struct $environment + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\SlsaProvenanceZeroTwo::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field .grafeas.v1.SlsaProvenanceZeroTwo.SlsaConfigSource config_source = 1; + * @return \Grafeas\V1\SlsaProvenanceZeroTwo\SlsaConfigSource|null + */ + public function getConfigSource() + { + return $this->config_source; + } + + public function hasConfigSource() + { + return isset($this->config_source); + } + + public function clearConfigSource() + { + unset($this->config_source); + } + + /** + * Generated from protobuf field .grafeas.v1.SlsaProvenanceZeroTwo.SlsaConfigSource config_source = 1; + * @param \Grafeas\V1\SlsaProvenanceZeroTwo\SlsaConfigSource $var + * @return $this + */ + public function setConfigSource($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\SlsaProvenanceZeroTwo\SlsaConfigSource::class); + $this->config_source = $var; + + return $this; + } + + /** + * Generated from protobuf field .google.protobuf.Struct parameters = 2; + * @return \Google\Protobuf\Struct|null + */ + public function getParameters() + { + return $this->parameters; + } + + public function hasParameters() + { + return isset($this->parameters); + } + + public function clearParameters() + { + unset($this->parameters); + } + + /** + * Generated from protobuf field .google.protobuf.Struct parameters = 2; + * @param \Google\Protobuf\Struct $var + * @return $this + */ + public function setParameters($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Struct::class); + $this->parameters = $var; + + return $this; + } + + /** + * Generated from protobuf field .google.protobuf.Struct environment = 3; + * @return \Google\Protobuf\Struct|null + */ + public function getEnvironment() + { + return $this->environment; + } + + public function hasEnvironment() + { + return isset($this->environment); + } + + public function clearEnvironment() + { + unset($this->environment); + } + + /** + * Generated from protobuf field .google.protobuf.Struct environment = 3; + * @param \Google\Protobuf\Struct $var + * @return $this + */ + public function setEnvironment($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Struct::class); + $this->environment = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(SlsaInvocation::class, \Grafeas\V1\SlsaProvenanceZeroTwo_SlsaInvocation::class); + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/SlsaProvenanceZeroTwo/SlsaMaterial.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/SlsaProvenanceZeroTwo/SlsaMaterial.php new file mode 100644 index 000000000000..e25c459a24c4 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/SlsaProvenanceZeroTwo/SlsaMaterial.php @@ -0,0 +1,91 @@ +grafeas.v1.SlsaProvenanceZeroTwo.SlsaMaterial + */ +class SlsaMaterial extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field string uri = 1; + */ + protected $uri = ''; + /** + * Generated from protobuf field map digest = 2; + */ + private $digest; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $uri + * @type array|\Google\Protobuf\Internal\MapField $digest + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\SlsaProvenanceZeroTwo::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field string uri = 1; + * @return string + */ + public function getUri() + { + return $this->uri; + } + + /** + * Generated from protobuf field string uri = 1; + * @param string $var + * @return $this + */ + public function setUri($var) + { + GPBUtil::checkString($var, True); + $this->uri = $var; + + return $this; + } + + /** + * Generated from protobuf field map digest = 2; + * @return \Google\Protobuf\Internal\MapField + */ + public function getDigest() + { + return $this->digest; + } + + /** + * Generated from protobuf field map digest = 2; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setDigest($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->digest = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(SlsaMaterial::class, \Grafeas\V1\SlsaProvenanceZeroTwo_SlsaMaterial::class); + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/SlsaProvenanceZeroTwo/SlsaMetadata.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/SlsaProvenanceZeroTwo/SlsaMetadata.php new file mode 100644 index 000000000000..611a1e272054 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/SlsaProvenanceZeroTwo/SlsaMetadata.php @@ -0,0 +1,201 @@ +grafeas.v1.SlsaProvenanceZeroTwo.SlsaMetadata + */ +class SlsaMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field string build_invocation_id = 1; + */ + protected $build_invocation_id = ''; + /** + * Generated from protobuf field .google.protobuf.Timestamp build_started_on = 2; + */ + protected $build_started_on = null; + /** + * Generated from protobuf field .google.protobuf.Timestamp build_finished_on = 3; + */ + protected $build_finished_on = null; + /** + * Generated from protobuf field .grafeas.v1.SlsaProvenanceZeroTwo.SlsaCompleteness completeness = 4; + */ + protected $completeness = null; + /** + * Generated from protobuf field bool reproducible = 5; + */ + protected $reproducible = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $build_invocation_id + * @type \Google\Protobuf\Timestamp $build_started_on + * @type \Google\Protobuf\Timestamp $build_finished_on + * @type \Grafeas\V1\SlsaProvenanceZeroTwo\SlsaCompleteness $completeness + * @type bool $reproducible + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\SlsaProvenanceZeroTwo::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field string build_invocation_id = 1; + * @return string + */ + public function getBuildInvocationId() + { + return $this->build_invocation_id; + } + + /** + * Generated from protobuf field string build_invocation_id = 1; + * @param string $var + * @return $this + */ + public function setBuildInvocationId($var) + { + GPBUtil::checkString($var, True); + $this->build_invocation_id = $var; + + return $this; + } + + /** + * Generated from protobuf field .google.protobuf.Timestamp build_started_on = 2; + * @return \Google\Protobuf\Timestamp|null + */ + public function getBuildStartedOn() + { + return $this->build_started_on; + } + + public function hasBuildStartedOn() + { + return isset($this->build_started_on); + } + + public function clearBuildStartedOn() + { + unset($this->build_started_on); + } + + /** + * Generated from protobuf field .google.protobuf.Timestamp build_started_on = 2; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setBuildStartedOn($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->build_started_on = $var; + + return $this; + } + + /** + * Generated from protobuf field .google.protobuf.Timestamp build_finished_on = 3; + * @return \Google\Protobuf\Timestamp|null + */ + public function getBuildFinishedOn() + { + return $this->build_finished_on; + } + + public function hasBuildFinishedOn() + { + return isset($this->build_finished_on); + } + + public function clearBuildFinishedOn() + { + unset($this->build_finished_on); + } + + /** + * Generated from protobuf field .google.protobuf.Timestamp build_finished_on = 3; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setBuildFinishedOn($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->build_finished_on = $var; + + return $this; + } + + /** + * Generated from protobuf field .grafeas.v1.SlsaProvenanceZeroTwo.SlsaCompleteness completeness = 4; + * @return \Grafeas\V1\SlsaProvenanceZeroTwo\SlsaCompleteness|null + */ + public function getCompleteness() + { + return $this->completeness; + } + + public function hasCompleteness() + { + return isset($this->completeness); + } + + public function clearCompleteness() + { + unset($this->completeness); + } + + /** + * Generated from protobuf field .grafeas.v1.SlsaProvenanceZeroTwo.SlsaCompleteness completeness = 4; + * @param \Grafeas\V1\SlsaProvenanceZeroTwo\SlsaCompleteness $var + * @return $this + */ + public function setCompleteness($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\SlsaProvenanceZeroTwo\SlsaCompleteness::class); + $this->completeness = $var; + + return $this; + } + + /** + * Generated from protobuf field bool reproducible = 5; + * @return bool + */ + public function getReproducible() + { + return $this->reproducible; + } + + /** + * Generated from protobuf field bool reproducible = 5; + * @param bool $var + * @return $this + */ + public function setReproducible($var) + { + GPBUtil::checkBool($var); + $this->reproducible = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(SlsaMetadata::class, \Grafeas\V1\SlsaProvenanceZeroTwo_SlsaMetadata::class); + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/SlsaProvenanceZeroTwo_SlsaBuilder.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/SlsaProvenanceZeroTwo_SlsaBuilder.php new file mode 100644 index 000000000000..47d4e33cdfd2 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/SlsaProvenanceZeroTwo_SlsaBuilder.php @@ -0,0 +1,16 @@ +grafeas.v1.Source + */ +class Source extends \Google\Protobuf\Internal\Message +{ + /** + * If provided, the input binary artifacts for the build came from this + * location. + * + * Generated from protobuf field string artifact_storage_source_uri = 1; + */ + protected $artifact_storage_source_uri = ''; + /** + * Hash(es) of the build source, which can be used to verify that the original + * source integrity was maintained in the build. + * The keys to this map are file paths used as build source and the values + * contain the hash values for those files. + * If the build source came in a single package such as a gzipped tarfile + * (.tar.gz), the FileHash will be for the single path to that file. + * + * Generated from protobuf field map file_hashes = 2; + */ + private $file_hashes; + /** + * If provided, the source code used for the build came from this location. + * + * Generated from protobuf field .grafeas.v1.SourceContext context = 3; + */ + protected $context = null; + /** + * If provided, some of the source code used for the build may be found in + * these locations, in the case where the source repository had multiple + * remotes or submodules. This list will not include the context specified in + * the context field. + * + * Generated from protobuf field repeated .grafeas.v1.SourceContext additional_contexts = 4; + */ + private $additional_contexts; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $artifact_storage_source_uri + * If provided, the input binary artifacts for the build came from this + * location. + * @type array|\Google\Protobuf\Internal\MapField $file_hashes + * Hash(es) of the build source, which can be used to verify that the original + * source integrity was maintained in the build. + * The keys to this map are file paths used as build source and the values + * contain the hash values for those files. + * If the build source came in a single package such as a gzipped tarfile + * (.tar.gz), the FileHash will be for the single path to that file. + * @type \Grafeas\V1\SourceContext $context + * If provided, the source code used for the build came from this location. + * @type array<\Grafeas\V1\SourceContext>|\Google\Protobuf\Internal\RepeatedField $additional_contexts + * If provided, some of the source code used for the build may be found in + * these locations, in the case where the source repository had multiple + * remotes or submodules. This list will not include the context specified in + * the context field. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Provenance::initOnce(); + parent::__construct($data); + } + + /** + * If provided, the input binary artifacts for the build came from this + * location. + * + * Generated from protobuf field string artifact_storage_source_uri = 1; + * @return string + */ + public function getArtifactStorageSourceUri() + { + return $this->artifact_storage_source_uri; + } + + /** + * If provided, the input binary artifacts for the build came from this + * location. + * + * Generated from protobuf field string artifact_storage_source_uri = 1; + * @param string $var + * @return $this + */ + public function setArtifactStorageSourceUri($var) + { + GPBUtil::checkString($var, True); + $this->artifact_storage_source_uri = $var; + + return $this; + } + + /** + * Hash(es) of the build source, which can be used to verify that the original + * source integrity was maintained in the build. + * The keys to this map are file paths used as build source and the values + * contain the hash values for those files. + * If the build source came in a single package such as a gzipped tarfile + * (.tar.gz), the FileHash will be for the single path to that file. + * + * Generated from protobuf field map file_hashes = 2; + * @return \Google\Protobuf\Internal\MapField + */ + public function getFileHashes() + { + return $this->file_hashes; + } + + /** + * Hash(es) of the build source, which can be used to verify that the original + * source integrity was maintained in the build. + * The keys to this map are file paths used as build source and the values + * contain the hash values for those files. + * If the build source came in a single package such as a gzipped tarfile + * (.tar.gz), the FileHash will be for the single path to that file. + * + * Generated from protobuf field map file_hashes = 2; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setFileHashes($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Grafeas\V1\FileHashes::class); + $this->file_hashes = $arr; + + return $this; + } + + /** + * If provided, the source code used for the build came from this location. + * + * Generated from protobuf field .grafeas.v1.SourceContext context = 3; + * @return \Grafeas\V1\SourceContext|null + */ + public function getContext() + { + return $this->context; + } + + public function hasContext() + { + return isset($this->context); + } + + public function clearContext() + { + unset($this->context); + } + + /** + * If provided, the source code used for the build came from this location. + * + * Generated from protobuf field .grafeas.v1.SourceContext context = 3; + * @param \Grafeas\V1\SourceContext $var + * @return $this + */ + public function setContext($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\SourceContext::class); + $this->context = $var; + + return $this; + } + + /** + * If provided, some of the source code used for the build may be found in + * these locations, in the case where the source repository had multiple + * remotes or submodules. This list will not include the context specified in + * the context field. + * + * Generated from protobuf field repeated .grafeas.v1.SourceContext additional_contexts = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAdditionalContexts() + { + return $this->additional_contexts; + } + + /** + * If provided, some of the source code used for the build may be found in + * these locations, in the case where the source repository had multiple + * remotes or submodules. This list will not include the context specified in + * the context field. + * + * Generated from protobuf field repeated .grafeas.v1.SourceContext additional_contexts = 4; + * @param array<\Grafeas\V1\SourceContext>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAdditionalContexts($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Grafeas\V1\SourceContext::class); + $this->additional_contexts = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/SourceContext.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/SourceContext.php new file mode 100644 index 000000000000..fced17b0d002 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/SourceContext.php @@ -0,0 +1,176 @@ +grafeas.v1.SourceContext + */ +class SourceContext extends \Google\Protobuf\Internal\Message +{ + /** + * Labels with user defined metadata. + * + * Generated from protobuf field map labels = 4; + */ + private $labels; + protected $context; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Grafeas\V1\CloudRepoSourceContext $cloud_repo + * A SourceContext referring to a revision in a Google Cloud Source Repo. + * @type \Grafeas\V1\GerritSourceContext $gerrit + * A SourceContext referring to a Gerrit project. + * @type \Grafeas\V1\GitSourceContext $git + * A SourceContext referring to any third party Git repo (e.g., GitHub). + * @type array|\Google\Protobuf\Internal\MapField $labels + * Labels with user defined metadata. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Provenance::initOnce(); + parent::__construct($data); + } + + /** + * A SourceContext referring to a revision in a Google Cloud Source Repo. + * + * Generated from protobuf field .grafeas.v1.CloudRepoSourceContext cloud_repo = 1; + * @return \Grafeas\V1\CloudRepoSourceContext|null + */ + public function getCloudRepo() + { + return $this->readOneof(1); + } + + public function hasCloudRepo() + { + return $this->hasOneof(1); + } + + /** + * A SourceContext referring to a revision in a Google Cloud Source Repo. + * + * Generated from protobuf field .grafeas.v1.CloudRepoSourceContext cloud_repo = 1; + * @param \Grafeas\V1\CloudRepoSourceContext $var + * @return $this + */ + public function setCloudRepo($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\CloudRepoSourceContext::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * A SourceContext referring to a Gerrit project. + * + * Generated from protobuf field .grafeas.v1.GerritSourceContext gerrit = 2; + * @return \Grafeas\V1\GerritSourceContext|null + */ + public function getGerrit() + { + return $this->readOneof(2); + } + + public function hasGerrit() + { + return $this->hasOneof(2); + } + + /** + * A SourceContext referring to a Gerrit project. + * + * Generated from protobuf field .grafeas.v1.GerritSourceContext gerrit = 2; + * @param \Grafeas\V1\GerritSourceContext $var + * @return $this + */ + public function setGerrit($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\GerritSourceContext::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * A SourceContext referring to any third party Git repo (e.g., GitHub). + * + * Generated from protobuf field .grafeas.v1.GitSourceContext git = 3; + * @return \Grafeas\V1\GitSourceContext|null + */ + public function getGit() + { + return $this->readOneof(3); + } + + public function hasGit() + { + return $this->hasOneof(3); + } + + /** + * A SourceContext referring to any third party Git repo (e.g., GitHub). + * + * Generated from protobuf field .grafeas.v1.GitSourceContext git = 3; + * @param \Grafeas\V1\GitSourceContext $var + * @return $this + */ + public function setGit($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\GitSourceContext::class); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * Labels with user defined metadata. + * + * Generated from protobuf field map labels = 4; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * Labels with user defined metadata. + * + * Generated from protobuf field map labels = 4; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + + /** + * @return string + */ + public function getContext() + { + return $this->whichOneof("context"); + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/Subject.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/Subject.php new file mode 100644 index 000000000000..14d4fa6fe2e7 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/Subject.php @@ -0,0 +1,104 @@ +grafeas.v1.Subject + */ +class Subject extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * `"": ""` + * Algorithms can be e.g. sha256, sha512 + * See + * https://github.com/in-toto/attestation/blob/main/spec/field_types.md#DigestSet + * + * Generated from protobuf field map digest = 2; + */ + private $digest; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * @type array|\Google\Protobuf\Internal\MapField $digest + * `"": ""` + * Algorithms can be e.g. sha256, sha512 + * See + * https://github.com/in-toto/attestation/blob/main/spec/field_types.md#DigestSet + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\IntotoStatement::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * `"": ""` + * Algorithms can be e.g. sha256, sha512 + * See + * https://github.com/in-toto/attestation/blob/main/spec/field_types.md#DigestSet + * + * Generated from protobuf field map digest = 2; + * @return \Google\Protobuf\Internal\MapField + */ + public function getDigest() + { + return $this->digest; + } + + /** + * `"": ""` + * Algorithms can be e.g. sha256, sha512 + * See + * https://github.com/in-toto/attestation/blob/main/spec/field_types.md#DigestSet + * + * Generated from protobuf field map digest = 2; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setDigest($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->digest = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/UpdateNoteRequest.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/UpdateNoteRequest.php new file mode 100644 index 000000000000..e12623cfcdf4 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/UpdateNoteRequest.php @@ -0,0 +1,178 @@ +grafeas.v1.UpdateNoteRequest + */ +class UpdateNoteRequest extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the note in the form of + * `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * The updated note. + * + * Generated from protobuf field .grafeas.v1.Note note = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $note = null; + /** + * The fields to update. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 3; + */ + protected $update_mask = null; + + /** + * @param string $name The name of the note in the form of + * `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. Please see + * {@see GrafeasClient::noteName()} for help formatting this field. + * @param \Grafeas\V1\Note $note The updated note. + * @param \Google\Protobuf\FieldMask $updateMask The fields to update. + * + * @return \Grafeas\V1\UpdateNoteRequest + * + * @experimental + */ + public static function build(string $name, \Grafeas\V1\Note $note, \Google\Protobuf\FieldMask $updateMask): self + { + return (new self()) + ->setName($name) + ->setNote($note) + ->setUpdateMask($updateMask); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The name of the note in the form of + * `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. + * @type \Grafeas\V1\Note $note + * The updated note. + * @type \Google\Protobuf\FieldMask $update_mask + * The fields to update. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Grafeas::initOnce(); + parent::__construct($data); + } + + /** + * The name of the note in the form of + * `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The name of the note in the form of + * `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. + * + * 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; + } + + /** + * The updated note. + * + * Generated from protobuf field .grafeas.v1.Note note = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Grafeas\V1\Note|null + */ + public function getNote() + { + return $this->note; + } + + public function hasNote() + { + return isset($this->note); + } + + public function clearNote() + { + unset($this->note); + } + + /** + * The updated note. + * + * Generated from protobuf field .grafeas.v1.Note note = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Grafeas\V1\Note $var + * @return $this + */ + public function setNote($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\Note::class); + $this->note = $var; + + return $this; + } + + /** + * The fields to update. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 3; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * The fields to update. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 3; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/UpdateOccurrenceRequest.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/UpdateOccurrenceRequest.php new file mode 100644 index 000000000000..0d87112304a1 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/UpdateOccurrenceRequest.php @@ -0,0 +1,178 @@ +grafeas.v1.UpdateOccurrenceRequest + */ +class UpdateOccurrenceRequest extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the occurrence in the form of + * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * The updated occurrence. + * + * Generated from protobuf field .grafeas.v1.Occurrence occurrence = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $occurrence = null; + /** + * The fields to update. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 3; + */ + protected $update_mask = null; + + /** + * @param string $name The name of the occurrence in the form of + * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. Please see + * {@see GrafeasClient::occurrenceName()} for help formatting this field. + * @param \Grafeas\V1\Occurrence $occurrence The updated occurrence. + * @param \Google\Protobuf\FieldMask $updateMask The fields to update. + * + * @return \Grafeas\V1\UpdateOccurrenceRequest + * + * @experimental + */ + public static function build(string $name, \Grafeas\V1\Occurrence $occurrence, \Google\Protobuf\FieldMask $updateMask): self + { + return (new self()) + ->setName($name) + ->setOccurrence($occurrence) + ->setUpdateMask($updateMask); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The name of the occurrence in the form of + * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. + * @type \Grafeas\V1\Occurrence $occurrence + * The updated occurrence. + * @type \Google\Protobuf\FieldMask $update_mask + * The fields to update. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Grafeas::initOnce(); + parent::__construct($data); + } + + /** + * The name of the occurrence in the form of + * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The name of the occurrence in the form of + * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. + * + * 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; + } + + /** + * The updated occurrence. + * + * Generated from protobuf field .grafeas.v1.Occurrence occurrence = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Grafeas\V1\Occurrence|null + */ + public function getOccurrence() + { + return $this->occurrence; + } + + public function hasOccurrence() + { + return isset($this->occurrence); + } + + public function clearOccurrence() + { + unset($this->occurrence); + } + + /** + * The updated occurrence. + * + * Generated from protobuf field .grafeas.v1.Occurrence occurrence = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Grafeas\V1\Occurrence $var + * @return $this + */ + public function setOccurrence($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\Occurrence::class); + $this->occurrence = $var; + + return $this; + } + + /** + * The fields to update. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 3; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * The fields to update. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 3; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/UpgradeDistribution.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/UpgradeDistribution.php new file mode 100644 index 000000000000..b5b16a112b02 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/UpgradeDistribution.php @@ -0,0 +1,187 @@ +grafeas.v1.UpgradeDistribution + */ +class UpgradeDistribution extends \Google\Protobuf\Internal\Message +{ + /** + * Required - The specific operating system this metadata applies to. See + * https://cpe.mitre.org/specification/. + * + * Generated from protobuf field string cpe_uri = 1; + */ + protected $cpe_uri = ''; + /** + * The operating system classification of this Upgrade, as specified by the + * upstream operating system upgrade feed. For Windows the classification is + * one of the category_ids listed at + * https://docs.microsoft.com/en-us/previous-versions/windows/desktop/ff357803(v=vs.85) + * + * Generated from protobuf field string classification = 2; + */ + protected $classification = ''; + /** + * The severity as specified by the upstream operating system. + * + * Generated from protobuf field string severity = 3; + */ + protected $severity = ''; + /** + * The cve tied to this Upgrade. + * + * Generated from protobuf field repeated string cve = 4; + */ + private $cve; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $cpe_uri + * Required - The specific operating system this metadata applies to. See + * https://cpe.mitre.org/specification/. + * @type string $classification + * The operating system classification of this Upgrade, as specified by the + * upstream operating system upgrade feed. For Windows the classification is + * one of the category_ids listed at + * https://docs.microsoft.com/en-us/previous-versions/windows/desktop/ff357803(v=vs.85) + * @type string $severity + * The severity as specified by the upstream operating system. + * @type array|\Google\Protobuf\Internal\RepeatedField $cve + * The cve tied to this Upgrade. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Upgrade::initOnce(); + parent::__construct($data); + } + + /** + * Required - The specific operating system this metadata applies to. See + * https://cpe.mitre.org/specification/. + * + * Generated from protobuf field string cpe_uri = 1; + * @return string + */ + public function getCpeUri() + { + return $this->cpe_uri; + } + + /** + * Required - The specific operating system this metadata applies to. See + * https://cpe.mitre.org/specification/. + * + * Generated from protobuf field string cpe_uri = 1; + * @param string $var + * @return $this + */ + public function setCpeUri($var) + { + GPBUtil::checkString($var, True); + $this->cpe_uri = $var; + + return $this; + } + + /** + * The operating system classification of this Upgrade, as specified by the + * upstream operating system upgrade feed. For Windows the classification is + * one of the category_ids listed at + * https://docs.microsoft.com/en-us/previous-versions/windows/desktop/ff357803(v=vs.85) + * + * Generated from protobuf field string classification = 2; + * @return string + */ + public function getClassification() + { + return $this->classification; + } + + /** + * The operating system classification of this Upgrade, as specified by the + * upstream operating system upgrade feed. For Windows the classification is + * one of the category_ids listed at + * https://docs.microsoft.com/en-us/previous-versions/windows/desktop/ff357803(v=vs.85) + * + * Generated from protobuf field string classification = 2; + * @param string $var + * @return $this + */ + public function setClassification($var) + { + GPBUtil::checkString($var, True); + $this->classification = $var; + + return $this; + } + + /** + * The severity as specified by the upstream operating system. + * + * Generated from protobuf field string severity = 3; + * @return string + */ + public function getSeverity() + { + return $this->severity; + } + + /** + * The severity as specified by the upstream operating system. + * + * Generated from protobuf field string severity = 3; + * @param string $var + * @return $this + */ + public function setSeverity($var) + { + GPBUtil::checkString($var, True); + $this->severity = $var; + + return $this; + } + + /** + * The cve tied to this Upgrade. + * + * Generated from protobuf field repeated string cve = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getCve() + { + return $this->cve; + } + + /** + * The cve tied to this Upgrade. + * + * Generated from protobuf field repeated string cve = 4; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setCve($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->cve = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/UpgradeNote.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/UpgradeNote.php new file mode 100644 index 000000000000..b91b637b0c3b --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/UpgradeNote.php @@ -0,0 +1,196 @@ +grafeas.v1.UpgradeNote + */ +class UpgradeNote extends \Google\Protobuf\Internal\Message +{ + /** + * Required for non-Windows OS. The package this Upgrade is for. + * + * Generated from protobuf field string package = 1; + */ + protected $package = ''; + /** + * Required for non-Windows OS. The version of the package in machine + human + * readable form. + * + * Generated from protobuf field .grafeas.v1.Version version = 2; + */ + protected $version = null; + /** + * Metadata about the upgrade for each specific operating system. + * + * Generated from protobuf field repeated .grafeas.v1.UpgradeDistribution distributions = 3; + */ + private $distributions; + /** + * Required for Windows OS. Represents the metadata about the Windows update. + * + * Generated from protobuf field .grafeas.v1.WindowsUpdate windows_update = 4; + */ + protected $windows_update = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $package + * Required for non-Windows OS. The package this Upgrade is for. + * @type \Grafeas\V1\Version $version + * Required for non-Windows OS. The version of the package in machine + human + * readable form. + * @type array<\Grafeas\V1\UpgradeDistribution>|\Google\Protobuf\Internal\RepeatedField $distributions + * Metadata about the upgrade for each specific operating system. + * @type \Grafeas\V1\WindowsUpdate $windows_update + * Required for Windows OS. Represents the metadata about the Windows update. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Upgrade::initOnce(); + parent::__construct($data); + } + + /** + * Required for non-Windows OS. The package this Upgrade is for. + * + * Generated from protobuf field string package = 1; + * @return string + */ + public function getPackage() + { + return $this->package; + } + + /** + * Required for non-Windows OS. The package this Upgrade is for. + * + * Generated from protobuf field string package = 1; + * @param string $var + * @return $this + */ + public function setPackage($var) + { + GPBUtil::checkString($var, True); + $this->package = $var; + + return $this; + } + + /** + * Required for non-Windows OS. The version of the package in machine + human + * readable form. + * + * Generated from protobuf field .grafeas.v1.Version version = 2; + * @return \Grafeas\V1\Version|null + */ + public function getVersion() + { + return $this->version; + } + + public function hasVersion() + { + return isset($this->version); + } + + public function clearVersion() + { + unset($this->version); + } + + /** + * Required for non-Windows OS. The version of the package in machine + human + * readable form. + * + * Generated from protobuf field .grafeas.v1.Version version = 2; + * @param \Grafeas\V1\Version $var + * @return $this + */ + public function setVersion($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\Version::class); + $this->version = $var; + + return $this; + } + + /** + * Metadata about the upgrade for each specific operating system. + * + * Generated from protobuf field repeated .grafeas.v1.UpgradeDistribution distributions = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDistributions() + { + return $this->distributions; + } + + /** + * Metadata about the upgrade for each specific operating system. + * + * Generated from protobuf field repeated .grafeas.v1.UpgradeDistribution distributions = 3; + * @param array<\Grafeas\V1\UpgradeDistribution>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDistributions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Grafeas\V1\UpgradeDistribution::class); + $this->distributions = $arr; + + return $this; + } + + /** + * Required for Windows OS. Represents the metadata about the Windows update. + * + * Generated from protobuf field .grafeas.v1.WindowsUpdate windows_update = 4; + * @return \Grafeas\V1\WindowsUpdate|null + */ + public function getWindowsUpdate() + { + return $this->windows_update; + } + + public function hasWindowsUpdate() + { + return isset($this->windows_update); + } + + public function clearWindowsUpdate() + { + unset($this->windows_update); + } + + /** + * Required for Windows OS. Represents the metadata about the Windows update. + * + * Generated from protobuf field .grafeas.v1.WindowsUpdate windows_update = 4; + * @param \Grafeas\V1\WindowsUpdate $var + * @return $this + */ + public function setWindowsUpdate($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\WindowsUpdate::class); + $this->windows_update = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/UpgradeOccurrence.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/UpgradeOccurrence.php new file mode 100644 index 000000000000..15c700918d0f --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/UpgradeOccurrence.php @@ -0,0 +1,215 @@ +grafeas.v1.UpgradeOccurrence + */ +class UpgradeOccurrence extends \Google\Protobuf\Internal\Message +{ + /** + * Required for non-Windows OS. The package this Upgrade is for. + * + * Generated from protobuf field string package = 1; + */ + protected $package = ''; + /** + * Required for non-Windows OS. The version of the package in a machine + + * human readable form. + * + * Generated from protobuf field .grafeas.v1.Version parsed_version = 3; + */ + protected $parsed_version = null; + /** + * Metadata about the upgrade for available for the specific operating system + * for the resource_url. This allows efficient filtering, as well as + * making it easier to use the occurrence. + * + * Generated from protobuf field .grafeas.v1.UpgradeDistribution distribution = 4; + */ + protected $distribution = null; + /** + * Required for Windows OS. Represents the metadata about the Windows update. + * + * Generated from protobuf field .grafeas.v1.WindowsUpdate windows_update = 5; + */ + protected $windows_update = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $package + * Required for non-Windows OS. The package this Upgrade is for. + * @type \Grafeas\V1\Version $parsed_version + * Required for non-Windows OS. The version of the package in a machine + + * human readable form. + * @type \Grafeas\V1\UpgradeDistribution $distribution + * Metadata about the upgrade for available for the specific operating system + * for the resource_url. This allows efficient filtering, as well as + * making it easier to use the occurrence. + * @type \Grafeas\V1\WindowsUpdate $windows_update + * Required for Windows OS. Represents the metadata about the Windows update. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Upgrade::initOnce(); + parent::__construct($data); + } + + /** + * Required for non-Windows OS. The package this Upgrade is for. + * + * Generated from protobuf field string package = 1; + * @return string + */ + public function getPackage() + { + return $this->package; + } + + /** + * Required for non-Windows OS. The package this Upgrade is for. + * + * Generated from protobuf field string package = 1; + * @param string $var + * @return $this + */ + public function setPackage($var) + { + GPBUtil::checkString($var, True); + $this->package = $var; + + return $this; + } + + /** + * Required for non-Windows OS. The version of the package in a machine + + * human readable form. + * + * Generated from protobuf field .grafeas.v1.Version parsed_version = 3; + * @return \Grafeas\V1\Version|null + */ + public function getParsedVersion() + { + return $this->parsed_version; + } + + public function hasParsedVersion() + { + return isset($this->parsed_version); + } + + public function clearParsedVersion() + { + unset($this->parsed_version); + } + + /** + * Required for non-Windows OS. The version of the package in a machine + + * human readable form. + * + * Generated from protobuf field .grafeas.v1.Version parsed_version = 3; + * @param \Grafeas\V1\Version $var + * @return $this + */ + public function setParsedVersion($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\Version::class); + $this->parsed_version = $var; + + return $this; + } + + /** + * Metadata about the upgrade for available for the specific operating system + * for the resource_url. This allows efficient filtering, as well as + * making it easier to use the occurrence. + * + * Generated from protobuf field .grafeas.v1.UpgradeDistribution distribution = 4; + * @return \Grafeas\V1\UpgradeDistribution|null + */ + public function getDistribution() + { + return $this->distribution; + } + + public function hasDistribution() + { + return isset($this->distribution); + } + + public function clearDistribution() + { + unset($this->distribution); + } + + /** + * Metadata about the upgrade for available for the specific operating system + * for the resource_url. This allows efficient filtering, as well as + * making it easier to use the occurrence. + * + * Generated from protobuf field .grafeas.v1.UpgradeDistribution distribution = 4; + * @param \Grafeas\V1\UpgradeDistribution $var + * @return $this + */ + public function setDistribution($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\UpgradeDistribution::class); + $this->distribution = $var; + + return $this; + } + + /** + * Required for Windows OS. Represents the metadata about the Windows update. + * + * Generated from protobuf field .grafeas.v1.WindowsUpdate windows_update = 5; + * @return \Grafeas\V1\WindowsUpdate|null + */ + public function getWindowsUpdate() + { + return $this->windows_update; + } + + public function hasWindowsUpdate() + { + return isset($this->windows_update); + } + + public function clearWindowsUpdate() + { + unset($this->windows_update); + } + + /** + * Required for Windows OS. Represents the metadata about the Windows update. + * + * Generated from protobuf field .grafeas.v1.WindowsUpdate windows_update = 5; + * @param \Grafeas\V1\WindowsUpdate $var + * @return $this + */ + public function setWindowsUpdate($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\WindowsUpdate::class); + $this->windows_update = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/Version.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/Version.php new file mode 100644 index 000000000000..ed635362b2f0 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/Version.php @@ -0,0 +1,269 @@ +grafeas.v1.Version + */ +class Version extends \Google\Protobuf\Internal\Message +{ + /** + * Used to correct mistakes in the version numbering scheme. + * + * Generated from protobuf field int32 epoch = 1; + */ + protected $epoch = 0; + /** + * Required only when version kind is NORMAL. The main part of the version + * name. + * + * Generated from protobuf field string name = 2; + */ + protected $name = ''; + /** + * The iteration of the package build from the above version. + * + * Generated from protobuf field string revision = 3; + */ + protected $revision = ''; + /** + * Whether this version is specifying part of an inclusive range. Grafeas + * does not have the capability to specify version ranges; instead we have + * fields that specify start version and end versions. At times this is + * insufficient - we also need to specify whether the version is included in + * the range or is excluded from the range. This boolean is expected to be set + * to true when the version is included in a range. + * + * Generated from protobuf field bool inclusive = 6; + */ + protected $inclusive = false; + /** + * Required. Distinguishes between sentinel MIN/MAX versions and normal + * versions. + * + * Generated from protobuf field .grafeas.v1.Version.VersionKind kind = 4; + */ + protected $kind = 0; + /** + * Human readable version string. This string is of the form + * :- and is only set when kind is NORMAL. + * + * Generated from protobuf field string full_name = 5; + */ + protected $full_name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $epoch + * Used to correct mistakes in the version numbering scheme. + * @type string $name + * Required only when version kind is NORMAL. The main part of the version + * name. + * @type string $revision + * The iteration of the package build from the above version. + * @type bool $inclusive + * Whether this version is specifying part of an inclusive range. Grafeas + * does not have the capability to specify version ranges; instead we have + * fields that specify start version and end versions. At times this is + * insufficient - we also need to specify whether the version is included in + * the range or is excluded from the range. This boolean is expected to be set + * to true when the version is included in a range. + * @type int $kind + * Required. Distinguishes between sentinel MIN/MAX versions and normal + * versions. + * @type string $full_name + * Human readable version string. This string is of the form + * :- and is only set when kind is NORMAL. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Package::initOnce(); + parent::__construct($data); + } + + /** + * Used to correct mistakes in the version numbering scheme. + * + * Generated from protobuf field int32 epoch = 1; + * @return int + */ + public function getEpoch() + { + return $this->epoch; + } + + /** + * Used to correct mistakes in the version numbering scheme. + * + * Generated from protobuf field int32 epoch = 1; + * @param int $var + * @return $this + */ + public function setEpoch($var) + { + GPBUtil::checkInt32($var); + $this->epoch = $var; + + return $this; + } + + /** + * Required only when version kind is NORMAL. The main part of the version + * name. + * + * Generated from protobuf field string name = 2; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required only when version kind is NORMAL. The main part of the version + * name. + * + * Generated from protobuf field string name = 2; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The iteration of the package build from the above version. + * + * Generated from protobuf field string revision = 3; + * @return string + */ + public function getRevision() + { + return $this->revision; + } + + /** + * The iteration of the package build from the above version. + * + * Generated from protobuf field string revision = 3; + * @param string $var + * @return $this + */ + public function setRevision($var) + { + GPBUtil::checkString($var, True); + $this->revision = $var; + + return $this; + } + + /** + * Whether this version is specifying part of an inclusive range. Grafeas + * does not have the capability to specify version ranges; instead we have + * fields that specify start version and end versions. At times this is + * insufficient - we also need to specify whether the version is included in + * the range or is excluded from the range. This boolean is expected to be set + * to true when the version is included in a range. + * + * Generated from protobuf field bool inclusive = 6; + * @return bool + */ + public function getInclusive() + { + return $this->inclusive; + } + + /** + * Whether this version is specifying part of an inclusive range. Grafeas + * does not have the capability to specify version ranges; instead we have + * fields that specify start version and end versions. At times this is + * insufficient - we also need to specify whether the version is included in + * the range or is excluded from the range. This boolean is expected to be set + * to true when the version is included in a range. + * + * Generated from protobuf field bool inclusive = 6; + * @param bool $var + * @return $this + */ + public function setInclusive($var) + { + GPBUtil::checkBool($var); + $this->inclusive = $var; + + return $this; + } + + /** + * Required. Distinguishes between sentinel MIN/MAX versions and normal + * versions. + * + * Generated from protobuf field .grafeas.v1.Version.VersionKind kind = 4; + * @return int + */ + public function getKind() + { + return $this->kind; + } + + /** + * Required. Distinguishes between sentinel MIN/MAX versions and normal + * versions. + * + * Generated from protobuf field .grafeas.v1.Version.VersionKind kind = 4; + * @param int $var + * @return $this + */ + public function setKind($var) + { + GPBUtil::checkEnum($var, \Grafeas\V1\Version\VersionKind::class); + $this->kind = $var; + + return $this; + } + + /** + * Human readable version string. This string is of the form + * :- and is only set when kind is NORMAL. + * + * Generated from protobuf field string full_name = 5; + * @return string + */ + public function getFullName() + { + return $this->full_name; + } + + /** + * Human readable version string. This string is of the form + * :- and is only set when kind is NORMAL. + * + * Generated from protobuf field string full_name = 5; + * @param string $var + * @return $this + */ + public function setFullName($var) + { + GPBUtil::checkString($var, True); + $this->full_name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/Version/VersionKind.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/Version/VersionKind.php new file mode 100644 index 000000000000..d978c7d44cf5 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/Version/VersionKind.php @@ -0,0 +1,71 @@ +grafeas.v1.Version.VersionKind + */ +class VersionKind +{ + /** + * Unknown. + * + * Generated from protobuf enum VERSION_KIND_UNSPECIFIED = 0; + */ + const VERSION_KIND_UNSPECIFIED = 0; + /** + * A standard package version. + * + * Generated from protobuf enum NORMAL = 1; + */ + const NORMAL = 1; + /** + * A special version representing negative infinity. + * + * Generated from protobuf enum MINIMUM = 2; + */ + const MINIMUM = 2; + /** + * A special version representing positive infinity. + * + * Generated from protobuf enum MAXIMUM = 3; + */ + const MAXIMUM = 3; + + private static $valueToName = [ + self::VERSION_KIND_UNSPECIFIED => 'VERSION_KIND_UNSPECIFIED', + self::NORMAL => 'NORMAL', + self::MINIMUM => 'MINIMUM', + self::MAXIMUM => 'MAXIMUM', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(VersionKind::class, \Grafeas\V1\Version_VersionKind::class); + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/Version_VersionKind.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/Version_VersionKind.php new file mode 100644 index 000000000000..681173bb0c70 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/Version_VersionKind.php @@ -0,0 +1,16 @@ +grafeas.v1.VulnerabilityAssessmentNote + */ +class VulnerabilityAssessmentNote extends \Google\Protobuf\Internal\Message +{ + /** + * The title of the note. E.g. `Vex-Debian-11.4` + * + * Generated from protobuf field string title = 1; + */ + protected $title = ''; + /** + * A one sentence description of this Vex. + * + * Generated from protobuf field string short_description = 2; + */ + protected $short_description = ''; + /** + * A detailed description of this Vex. + * + * Generated from protobuf field string long_description = 3; + */ + protected $long_description = ''; + /** + * Identifies the language used by this document, + * corresponding to IETF BCP 47 / RFC 5646. + * + * Generated from protobuf field string language_code = 4; + */ + protected $language_code = ''; + /** + * Publisher details of this Note. + * + * Generated from protobuf field .grafeas.v1.VulnerabilityAssessmentNote.Publisher publisher = 5; + */ + protected $publisher = null; + /** + * The product affected by this vex. + * + * Generated from protobuf field .grafeas.v1.VulnerabilityAssessmentNote.Product product = 6; + */ + protected $product = null; + /** + * Represents a vulnerability assessment for the product. + * + * Generated from protobuf field .grafeas.v1.VulnerabilityAssessmentNote.Assessment assessment = 7; + */ + protected $assessment = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $title + * The title of the note. E.g. `Vex-Debian-11.4` + * @type string $short_description + * A one sentence description of this Vex. + * @type string $long_description + * A detailed description of this Vex. + * @type string $language_code + * Identifies the language used by this document, + * corresponding to IETF BCP 47 / RFC 5646. + * @type \Grafeas\V1\VulnerabilityAssessmentNote\Publisher $publisher + * Publisher details of this Note. + * @type \Grafeas\V1\VulnerabilityAssessmentNote\Product $product + * The product affected by this vex. + * @type \Grafeas\V1\VulnerabilityAssessmentNote\Assessment $assessment + * Represents a vulnerability assessment for the product. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Vex::initOnce(); + parent::__construct($data); + } + + /** + * The title of the note. E.g. `Vex-Debian-11.4` + * + * Generated from protobuf field string title = 1; + * @return string + */ + public function getTitle() + { + return $this->title; + } + + /** + * The title of the note. E.g. `Vex-Debian-11.4` + * + * Generated from protobuf field string title = 1; + * @param string $var + * @return $this + */ + public function setTitle($var) + { + GPBUtil::checkString($var, True); + $this->title = $var; + + return $this; + } + + /** + * A one sentence description of this Vex. + * + * Generated from protobuf field string short_description = 2; + * @return string + */ + public function getShortDescription() + { + return $this->short_description; + } + + /** + * A one sentence description of this Vex. + * + * Generated from protobuf field string short_description = 2; + * @param string $var + * @return $this + */ + public function setShortDescription($var) + { + GPBUtil::checkString($var, True); + $this->short_description = $var; + + return $this; + } + + /** + * A detailed description of this Vex. + * + * Generated from protobuf field string long_description = 3; + * @return string + */ + public function getLongDescription() + { + return $this->long_description; + } + + /** + * A detailed description of this Vex. + * + * Generated from protobuf field string long_description = 3; + * @param string $var + * @return $this + */ + public function setLongDescription($var) + { + GPBUtil::checkString($var, True); + $this->long_description = $var; + + return $this; + } + + /** + * Identifies the language used by this document, + * corresponding to IETF BCP 47 / RFC 5646. + * + * Generated from protobuf field string language_code = 4; + * @return string + */ + public function getLanguageCode() + { + return $this->language_code; + } + + /** + * Identifies the language used by this document, + * corresponding to IETF BCP 47 / RFC 5646. + * + * Generated from protobuf field string language_code = 4; + * @param string $var + * @return $this + */ + public function setLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->language_code = $var; + + return $this; + } + + /** + * Publisher details of this Note. + * + * Generated from protobuf field .grafeas.v1.VulnerabilityAssessmentNote.Publisher publisher = 5; + * @return \Grafeas\V1\VulnerabilityAssessmentNote\Publisher|null + */ + public function getPublisher() + { + return $this->publisher; + } + + public function hasPublisher() + { + return isset($this->publisher); + } + + public function clearPublisher() + { + unset($this->publisher); + } + + /** + * Publisher details of this Note. + * + * Generated from protobuf field .grafeas.v1.VulnerabilityAssessmentNote.Publisher publisher = 5; + * @param \Grafeas\V1\VulnerabilityAssessmentNote\Publisher $var + * @return $this + */ + public function setPublisher($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\VulnerabilityAssessmentNote\Publisher::class); + $this->publisher = $var; + + return $this; + } + + /** + * The product affected by this vex. + * + * Generated from protobuf field .grafeas.v1.VulnerabilityAssessmentNote.Product product = 6; + * @return \Grafeas\V1\VulnerabilityAssessmentNote\Product|null + */ + public function getProduct() + { + return $this->product; + } + + public function hasProduct() + { + return isset($this->product); + } + + public function clearProduct() + { + unset($this->product); + } + + /** + * The product affected by this vex. + * + * Generated from protobuf field .grafeas.v1.VulnerabilityAssessmentNote.Product product = 6; + * @param \Grafeas\V1\VulnerabilityAssessmentNote\Product $var + * @return $this + */ + public function setProduct($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\VulnerabilityAssessmentNote\Product::class); + $this->product = $var; + + return $this; + } + + /** + * Represents a vulnerability assessment for the product. + * + * Generated from protobuf field .grafeas.v1.VulnerabilityAssessmentNote.Assessment assessment = 7; + * @return \Grafeas\V1\VulnerabilityAssessmentNote\Assessment|null + */ + public function getAssessment() + { + return $this->assessment; + } + + public function hasAssessment() + { + return isset($this->assessment); + } + + public function clearAssessment() + { + unset($this->assessment); + } + + /** + * Represents a vulnerability assessment for the product. + * + * Generated from protobuf field .grafeas.v1.VulnerabilityAssessmentNote.Assessment assessment = 7; + * @param \Grafeas\V1\VulnerabilityAssessmentNote\Assessment $var + * @return $this + */ + public function setAssessment($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\VulnerabilityAssessmentNote\Assessment::class); + $this->assessment = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/VulnerabilityAssessmentNote/Assessment.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/VulnerabilityAssessmentNote/Assessment.php new file mode 100644 index 000000000000..c7432ee84dbc --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/VulnerabilityAssessmentNote/Assessment.php @@ -0,0 +1,343 @@ +grafeas.v1.VulnerabilityAssessmentNote.Assessment + */ +class Assessment extends \Google\Protobuf\Internal\Message +{ + /** + * Holds the MITRE standard Common Vulnerabilities and Exposures (CVE) + * tracking number for the vulnerability. + * + * Generated from protobuf field string cve = 1; + */ + protected $cve = ''; + /** + * A one sentence description of this Vex. + * + * Generated from protobuf field string short_description = 2; + */ + protected $short_description = ''; + /** + * A detailed description of this Vex. + * + * Generated from protobuf field string long_description = 3; + */ + protected $long_description = ''; + /** + * Holds a list of references associated with this vulnerability item and + * assessment. These uris have additional information about the + * vulnerability and the assessment itself. E.g. Link to a document which + * details how this assessment concluded the state of this vulnerability. + * + * Generated from protobuf field repeated .grafeas.v1.RelatedUrl related_uris = 4; + */ + private $related_uris; + /** + * Provides the state of this Vulnerability assessment. + * + * Generated from protobuf field .grafeas.v1.VulnerabilityAssessmentNote.Assessment.State state = 5; + */ + protected $state = 0; + /** + * Contains information about the impact of this vulnerability, + * this will change with time. + * + * Generated from protobuf field repeated string impacts = 6; + */ + private $impacts; + /** + * Justification provides the justification when the state of the + * assessment if NOT_AFFECTED. + * + * Generated from protobuf field .grafeas.v1.VulnerabilityAssessmentNote.Assessment.Justification justification = 7; + */ + protected $justification = null; + /** + * Specifies details on how to handle (and presumably, fix) a vulnerability. + * + * Generated from protobuf field repeated .grafeas.v1.VulnerabilityAssessmentNote.Assessment.Remediation remediations = 8; + */ + private $remediations; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $cve + * Holds the MITRE standard Common Vulnerabilities and Exposures (CVE) + * tracking number for the vulnerability. + * @type string $short_description + * A one sentence description of this Vex. + * @type string $long_description + * A detailed description of this Vex. + * @type array<\Grafeas\V1\RelatedUrl>|\Google\Protobuf\Internal\RepeatedField $related_uris + * Holds a list of references associated with this vulnerability item and + * assessment. These uris have additional information about the + * vulnerability and the assessment itself. E.g. Link to a document which + * details how this assessment concluded the state of this vulnerability. + * @type int $state + * Provides the state of this Vulnerability assessment. + * @type array|\Google\Protobuf\Internal\RepeatedField $impacts + * Contains information about the impact of this vulnerability, + * this will change with time. + * @type \Grafeas\V1\VulnerabilityAssessmentNote\Assessment\Justification $justification + * Justification provides the justification when the state of the + * assessment if NOT_AFFECTED. + * @type array<\Grafeas\V1\VulnerabilityAssessmentNote\Assessment\Remediation>|\Google\Protobuf\Internal\RepeatedField $remediations + * Specifies details on how to handle (and presumably, fix) a vulnerability. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Vex::initOnce(); + parent::__construct($data); + } + + /** + * Holds the MITRE standard Common Vulnerabilities and Exposures (CVE) + * tracking number for the vulnerability. + * + * Generated from protobuf field string cve = 1; + * @return string + */ + public function getCve() + { + return $this->cve; + } + + /** + * Holds the MITRE standard Common Vulnerabilities and Exposures (CVE) + * tracking number for the vulnerability. + * + * Generated from protobuf field string cve = 1; + * @param string $var + * @return $this + */ + public function setCve($var) + { + GPBUtil::checkString($var, True); + $this->cve = $var; + + return $this; + } + + /** + * A one sentence description of this Vex. + * + * Generated from protobuf field string short_description = 2; + * @return string + */ + public function getShortDescription() + { + return $this->short_description; + } + + /** + * A one sentence description of this Vex. + * + * Generated from protobuf field string short_description = 2; + * @param string $var + * @return $this + */ + public function setShortDescription($var) + { + GPBUtil::checkString($var, True); + $this->short_description = $var; + + return $this; + } + + /** + * A detailed description of this Vex. + * + * Generated from protobuf field string long_description = 3; + * @return string + */ + public function getLongDescription() + { + return $this->long_description; + } + + /** + * A detailed description of this Vex. + * + * Generated from protobuf field string long_description = 3; + * @param string $var + * @return $this + */ + public function setLongDescription($var) + { + GPBUtil::checkString($var, True); + $this->long_description = $var; + + return $this; + } + + /** + * Holds a list of references associated with this vulnerability item and + * assessment. These uris have additional information about the + * vulnerability and the assessment itself. E.g. Link to a document which + * details how this assessment concluded the state of this vulnerability. + * + * Generated from protobuf field repeated .grafeas.v1.RelatedUrl related_uris = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRelatedUris() + { + return $this->related_uris; + } + + /** + * Holds a list of references associated with this vulnerability item and + * assessment. These uris have additional information about the + * vulnerability and the assessment itself. E.g. Link to a document which + * details how this assessment concluded the state of this vulnerability. + * + * Generated from protobuf field repeated .grafeas.v1.RelatedUrl related_uris = 4; + * @param array<\Grafeas\V1\RelatedUrl>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRelatedUris($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Grafeas\V1\RelatedUrl::class); + $this->related_uris = $arr; + + return $this; + } + + /** + * Provides the state of this Vulnerability assessment. + * + * Generated from protobuf field .grafeas.v1.VulnerabilityAssessmentNote.Assessment.State state = 5; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Provides the state of this Vulnerability assessment. + * + * Generated from protobuf field .grafeas.v1.VulnerabilityAssessmentNote.Assessment.State state = 5; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Grafeas\V1\VulnerabilityAssessmentNote\Assessment\State::class); + $this->state = $var; + + return $this; + } + + /** + * Contains information about the impact of this vulnerability, + * this will change with time. + * + * Generated from protobuf field repeated string impacts = 6; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getImpacts() + { + return $this->impacts; + } + + /** + * Contains information about the impact of this vulnerability, + * this will change with time. + * + * Generated from protobuf field repeated string impacts = 6; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setImpacts($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->impacts = $arr; + + return $this; + } + + /** + * Justification provides the justification when the state of the + * assessment if NOT_AFFECTED. + * + * Generated from protobuf field .grafeas.v1.VulnerabilityAssessmentNote.Assessment.Justification justification = 7; + * @return \Grafeas\V1\VulnerabilityAssessmentNote\Assessment\Justification|null + */ + public function getJustification() + { + return $this->justification; + } + + public function hasJustification() + { + return isset($this->justification); + } + + public function clearJustification() + { + unset($this->justification); + } + + /** + * Justification provides the justification when the state of the + * assessment if NOT_AFFECTED. + * + * Generated from protobuf field .grafeas.v1.VulnerabilityAssessmentNote.Assessment.Justification justification = 7; + * @param \Grafeas\V1\VulnerabilityAssessmentNote\Assessment\Justification $var + * @return $this + */ + public function setJustification($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\VulnerabilityAssessmentNote\Assessment\Justification::class); + $this->justification = $var; + + return $this; + } + + /** + * Specifies details on how to handle (and presumably, fix) a vulnerability. + * + * Generated from protobuf field repeated .grafeas.v1.VulnerabilityAssessmentNote.Assessment.Remediation remediations = 8; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRemediations() + { + return $this->remediations; + } + + /** + * Specifies details on how to handle (and presumably, fix) a vulnerability. + * + * Generated from protobuf field repeated .grafeas.v1.VulnerabilityAssessmentNote.Assessment.Remediation remediations = 8; + * @param array<\Grafeas\V1\VulnerabilityAssessmentNote\Assessment\Remediation>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRemediations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Grafeas\V1\VulnerabilityAssessmentNote\Assessment\Remediation::class); + $this->remediations = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Assessment::class, \Grafeas\V1\VulnerabilityAssessmentNote_Assessment::class); + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/VulnerabilityAssessmentNote/Assessment/Justification.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/VulnerabilityAssessmentNote/Assessment/Justification.php new file mode 100644 index 000000000000..fdb666012d62 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/VulnerabilityAssessmentNote/Assessment/Justification.php @@ -0,0 +1,105 @@ +grafeas.v1.VulnerabilityAssessmentNote.Assessment.Justification + */ +class Justification extends \Google\Protobuf\Internal\Message +{ + /** + * The justification type for this vulnerability. + * + * Generated from protobuf field .grafeas.v1.VulnerabilityAssessmentNote.Assessment.Justification.JustificationType justification_type = 1; + */ + protected $justification_type = 0; + /** + * Additional details on why this justification was chosen. + * + * Generated from protobuf field string details = 2; + */ + protected $details = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $justification_type + * The justification type for this vulnerability. + * @type string $details + * Additional details on why this justification was chosen. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Vex::initOnce(); + parent::__construct($data); + } + + /** + * The justification type for this vulnerability. + * + * Generated from protobuf field .grafeas.v1.VulnerabilityAssessmentNote.Assessment.Justification.JustificationType justification_type = 1; + * @return int + */ + public function getJustificationType() + { + return $this->justification_type; + } + + /** + * The justification type for this vulnerability. + * + * Generated from protobuf field .grafeas.v1.VulnerabilityAssessmentNote.Assessment.Justification.JustificationType justification_type = 1; + * @param int $var + * @return $this + */ + public function setJustificationType($var) + { + GPBUtil::checkEnum($var, \Grafeas\V1\VulnerabilityAssessmentNote\Assessment\Justification\JustificationType::class); + $this->justification_type = $var; + + return $this; + } + + /** + * Additional details on why this justification was chosen. + * + * Generated from protobuf field string details = 2; + * @return string + */ + public function getDetails() + { + return $this->details; + } + + /** + * Additional details on why this justification was chosen. + * + * Generated from protobuf field string details = 2; + * @param string $var + * @return $this + */ + public function setDetails($var) + { + GPBUtil::checkString($var, True); + $this->details = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Justification::class, \Grafeas\V1\VulnerabilityAssessmentNote_Assessment_Justification::class); + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/VulnerabilityAssessmentNote/Assessment/Justification/JustificationType.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/VulnerabilityAssessmentNote/Assessment/Justification/JustificationType.php new file mode 100644 index 000000000000..8d0a24170835 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/VulnerabilityAssessmentNote/Assessment/Justification/JustificationType.php @@ -0,0 +1,94 @@ +grafeas.v1.VulnerabilityAssessmentNote.Assessment.Justification.JustificationType + */ +class JustificationType +{ + /** + * JUSTIFICATION_TYPE_UNSPECIFIED. + * + * Generated from protobuf enum JUSTIFICATION_TYPE_UNSPECIFIED = 0; + */ + const JUSTIFICATION_TYPE_UNSPECIFIED = 0; + /** + * The vulnerable component is not present in the product. + * + * Generated from protobuf enum COMPONENT_NOT_PRESENT = 1; + */ + const COMPONENT_NOT_PRESENT = 1; + /** + * The vulnerable code is not present. Typically this case + * occurs when source code is configured or built in a way that excludes + * the vulnerable code. + * + * Generated from protobuf enum VULNERABLE_CODE_NOT_PRESENT = 2; + */ + const VULNERABLE_CODE_NOT_PRESENT = 2; + /** + * The vulnerable code can not be executed. + * Typically this case occurs when the product includes the vulnerable + * code but does not call or use the vulnerable code. + * + * Generated from protobuf enum VULNERABLE_CODE_NOT_IN_EXECUTE_PATH = 3; + */ + const VULNERABLE_CODE_NOT_IN_EXECUTE_PATH = 3; + /** + * The vulnerable code cannot be controlled by an attacker to exploit + * the vulnerability. + * + * Generated from protobuf enum VULNERABLE_CODE_CANNOT_BE_CONTROLLED_BY_ADVERSARY = 4; + */ + const VULNERABLE_CODE_CANNOT_BE_CONTROLLED_BY_ADVERSARY = 4; + /** + * The product includes built-in protections or features that prevent + * exploitation of the vulnerability. These built-in protections cannot + * be subverted by the attacker and cannot be configured or disabled by + * the user. These mitigations completely prevent exploitation based on + * known attack vectors. + * + * Generated from protobuf enum INLINE_MITIGATIONS_ALREADY_EXIST = 5; + */ + const INLINE_MITIGATIONS_ALREADY_EXIST = 5; + + private static $valueToName = [ + self::JUSTIFICATION_TYPE_UNSPECIFIED => 'JUSTIFICATION_TYPE_UNSPECIFIED', + self::COMPONENT_NOT_PRESENT => 'COMPONENT_NOT_PRESENT', + self::VULNERABLE_CODE_NOT_PRESENT => 'VULNERABLE_CODE_NOT_PRESENT', + self::VULNERABLE_CODE_NOT_IN_EXECUTE_PATH => 'VULNERABLE_CODE_NOT_IN_EXECUTE_PATH', + self::VULNERABLE_CODE_CANNOT_BE_CONTROLLED_BY_ADVERSARY => 'VULNERABLE_CODE_CANNOT_BE_CONTROLLED_BY_ADVERSARY', + self::INLINE_MITIGATIONS_ALREADY_EXIST => 'INLINE_MITIGATIONS_ALREADY_EXIST', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(JustificationType::class, \Grafeas\V1\VulnerabilityAssessmentNote_Assessment_Justification_JustificationType::class); + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/VulnerabilityAssessmentNote/Assessment/Remediation.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/VulnerabilityAssessmentNote/Assessment/Remediation.php new file mode 100644 index 000000000000..43bea6f40ecc --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/VulnerabilityAssessmentNote/Assessment/Remediation.php @@ -0,0 +1,148 @@ +grafeas.v1.VulnerabilityAssessmentNote.Assessment.Remediation + */ +class Remediation extends \Google\Protobuf\Internal\Message +{ + /** + * The type of remediation that can be applied. + * + * Generated from protobuf field .grafeas.v1.VulnerabilityAssessmentNote.Assessment.Remediation.RemediationType remediation_type = 1; + */ + protected $remediation_type = 0; + /** + * Contains a comprehensive human-readable discussion of the remediation. + * + * Generated from protobuf field string details = 2; + */ + protected $details = ''; + /** + * Contains the URL where to obtain the remediation. + * + * Generated from protobuf field .grafeas.v1.RelatedUrl remediation_uri = 3; + */ + protected $remediation_uri = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $remediation_type + * The type of remediation that can be applied. + * @type string $details + * Contains a comprehensive human-readable discussion of the remediation. + * @type \Grafeas\V1\RelatedUrl $remediation_uri + * Contains the URL where to obtain the remediation. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Vex::initOnce(); + parent::__construct($data); + } + + /** + * The type of remediation that can be applied. + * + * Generated from protobuf field .grafeas.v1.VulnerabilityAssessmentNote.Assessment.Remediation.RemediationType remediation_type = 1; + * @return int + */ + public function getRemediationType() + { + return $this->remediation_type; + } + + /** + * The type of remediation that can be applied. + * + * Generated from protobuf field .grafeas.v1.VulnerabilityAssessmentNote.Assessment.Remediation.RemediationType remediation_type = 1; + * @param int $var + * @return $this + */ + public function setRemediationType($var) + { + GPBUtil::checkEnum($var, \Grafeas\V1\VulnerabilityAssessmentNote\Assessment\Remediation\RemediationType::class); + $this->remediation_type = $var; + + return $this; + } + + /** + * Contains a comprehensive human-readable discussion of the remediation. + * + * Generated from protobuf field string details = 2; + * @return string + */ + public function getDetails() + { + return $this->details; + } + + /** + * Contains a comprehensive human-readable discussion of the remediation. + * + * Generated from protobuf field string details = 2; + * @param string $var + * @return $this + */ + public function setDetails($var) + { + GPBUtil::checkString($var, True); + $this->details = $var; + + return $this; + } + + /** + * Contains the URL where to obtain the remediation. + * + * Generated from protobuf field .grafeas.v1.RelatedUrl remediation_uri = 3; + * @return \Grafeas\V1\RelatedUrl|null + */ + public function getRemediationUri() + { + return $this->remediation_uri; + } + + public function hasRemediationUri() + { + return isset($this->remediation_uri); + } + + public function clearRemediationUri() + { + unset($this->remediation_uri); + } + + /** + * Contains the URL where to obtain the remediation. + * + * Generated from protobuf field .grafeas.v1.RelatedUrl remediation_uri = 3; + * @param \Grafeas\V1\RelatedUrl $var + * @return $this + */ + public function setRemediationUri($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\RelatedUrl::class); + $this->remediation_uri = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Remediation::class, \Grafeas\V1\VulnerabilityAssessmentNote_Assessment_Remediation::class); + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/VulnerabilityAssessmentNote/Assessment/Remediation/RemediationType.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/VulnerabilityAssessmentNote/Assessment/Remediation/RemediationType.php new file mode 100644 index 000000000000..66c51c0be9f9 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/VulnerabilityAssessmentNote/Assessment/Remediation/RemediationType.php @@ -0,0 +1,85 @@ +grafeas.v1.VulnerabilityAssessmentNote.Assessment.Remediation.RemediationType + */ +class RemediationType +{ + /** + * No remediation type specified. + * + * Generated from protobuf enum REMEDIATION_TYPE_UNSPECIFIED = 0; + */ + const REMEDIATION_TYPE_UNSPECIFIED = 0; + /** + * A MITIGATION is available. + * + * Generated from protobuf enum MITIGATION = 1; + */ + const MITIGATION = 1; + /** + * No fix is planned. + * + * Generated from protobuf enum NO_FIX_PLANNED = 2; + */ + const NO_FIX_PLANNED = 2; + /** + * Not available. + * + * Generated from protobuf enum NONE_AVAILABLE = 3; + */ + const NONE_AVAILABLE = 3; + /** + * A vendor fix is available. + * + * Generated from protobuf enum VENDOR_FIX = 4; + */ + const VENDOR_FIX = 4; + /** + * A workaround is available. + * + * Generated from protobuf enum WORKAROUND = 5; + */ + const WORKAROUND = 5; + + private static $valueToName = [ + self::REMEDIATION_TYPE_UNSPECIFIED => 'REMEDIATION_TYPE_UNSPECIFIED', + self::MITIGATION => 'MITIGATION', + self::NO_FIX_PLANNED => 'NO_FIX_PLANNED', + self::NONE_AVAILABLE => 'NONE_AVAILABLE', + self::VENDOR_FIX => 'VENDOR_FIX', + self::WORKAROUND => 'WORKAROUND', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(RemediationType::class, \Grafeas\V1\VulnerabilityAssessmentNote_Assessment_Remediation_RemediationType::class); + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/VulnerabilityAssessmentNote/Assessment/State.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/VulnerabilityAssessmentNote/Assessment/State.php new file mode 100644 index 000000000000..69b81a30cd45 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/VulnerabilityAssessmentNote/Assessment/State.php @@ -0,0 +1,79 @@ +grafeas.v1.VulnerabilityAssessmentNote.Assessment.State + */ +class State +{ + /** + * No state is specified. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * This product is known to be affected by this vulnerability. + * + * Generated from protobuf enum AFFECTED = 1; + */ + const AFFECTED = 1; + /** + * This product is known to be not affected by this vulnerability. + * + * Generated from protobuf enum NOT_AFFECTED = 2; + */ + const NOT_AFFECTED = 2; + /** + * This product contains a fix for this vulnerability. + * + * Generated from protobuf enum FIXED = 3; + */ + const FIXED = 3; + /** + * It is not known yet whether these versions are or are not affected + * by the vulnerability. However, it is still under investigation. + * + * Generated from protobuf enum UNDER_INVESTIGATION = 4; + */ + const UNDER_INVESTIGATION = 4; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::AFFECTED => 'AFFECTED', + self::NOT_AFFECTED => 'NOT_AFFECTED', + self::FIXED => 'FIXED', + self::UNDER_INVESTIGATION => 'UNDER_INVESTIGATION', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Grafeas\V1\VulnerabilityAssessmentNote_Assessment_State::class); + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/VulnerabilityAssessmentNote/Product.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/VulnerabilityAssessmentNote/Product.php new file mode 100644 index 000000000000..a7fad624e32d --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/VulnerabilityAssessmentNote/Product.php @@ -0,0 +1,160 @@ +grafeas.v1.VulnerabilityAssessmentNote.Product + */ +class Product extends \Google\Protobuf\Internal\Message +{ + /** + * Name of the product. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * Token that identifies a product so that it can be referred to from other + * parts in the document. There is no predefined format as long as it + * uniquely identifies a group in the context of the current document. + * + * Generated from protobuf field string id = 2; + */ + protected $id = ''; + protected $identifier; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Name of the product. + * @type string $id + * Token that identifies a product so that it can be referred to from other + * parts in the document. There is no predefined format as long as it + * uniquely identifies a group in the context of the current document. + * @type string $generic_uri + * Contains a URI which is vendor-specific. + * Example: The artifact repository URL of an image. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Vex::initOnce(); + parent::__construct($data); + } + + /** + * Name of the product. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Name of the product. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Token that identifies a product so that it can be referred to from other + * parts in the document. There is no predefined format as long as it + * uniquely identifies a group in the context of the current document. + * + * Generated from protobuf field string id = 2; + * @return string + */ + public function getId() + { + return $this->id; + } + + /** + * Token that identifies a product so that it can be referred to from other + * parts in the document. There is no predefined format as long as it + * uniquely identifies a group in the context of the current document. + * + * Generated from protobuf field string id = 2; + * @param string $var + * @return $this + */ + public function setId($var) + { + GPBUtil::checkString($var, True); + $this->id = $var; + + return $this; + } + + /** + * Contains a URI which is vendor-specific. + * Example: The artifact repository URL of an image. + * + * Generated from protobuf field string generic_uri = 3; + * @return string + */ + public function getGenericUri() + { + return $this->readOneof(3); + } + + public function hasGenericUri() + { + return $this->hasOneof(3); + } + + /** + * Contains a URI which is vendor-specific. + * Example: The artifact repository URL of an image. + * + * Generated from protobuf field string generic_uri = 3; + * @param string $var + * @return $this + */ + public function setGenericUri($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * @return string + */ + public function getIdentifier() + { + return $this->whichOneof("identifier"); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Product::class, \Grafeas\V1\VulnerabilityAssessmentNote_Product::class); + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/VulnerabilityAssessmentNote/Publisher.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/VulnerabilityAssessmentNote/Publisher.php new file mode 100644 index 000000000000..2801fd5a85c2 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/VulnerabilityAssessmentNote/Publisher.php @@ -0,0 +1,165 @@ +grafeas.v1.VulnerabilityAssessmentNote.Publisher + */ +class Publisher extends \Google\Protobuf\Internal\Message +{ + /** + * Name of the publisher. + * Examples: 'Google', 'Google Cloud Platform'. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * Provides information about the authority of the issuing party to + * release the document, in particular, the party's constituency and + * responsibilities or other obligations. + * + * Generated from protobuf field string issuing_authority = 2; + */ + protected $issuing_authority = ''; + /** + * The context or namespace. + * Contains a URL which is under control of the issuing party and can + * be used as a globally unique identifier for that issuing party. + * Example: https://csaf.io + * + * Generated from protobuf field string publisher_namespace = 3; + */ + protected $publisher_namespace = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Name of the publisher. + * Examples: 'Google', 'Google Cloud Platform'. + * @type string $issuing_authority + * Provides information about the authority of the issuing party to + * release the document, in particular, the party's constituency and + * responsibilities or other obligations. + * @type string $publisher_namespace + * The context or namespace. + * Contains a URL which is under control of the issuing party and can + * be used as a globally unique identifier for that issuing party. + * Example: https://csaf.io + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Vex::initOnce(); + parent::__construct($data); + } + + /** + * Name of the publisher. + * Examples: 'Google', 'Google Cloud Platform'. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Name of the publisher. + * Examples: 'Google', 'Google Cloud Platform'. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Provides information about the authority of the issuing party to + * release the document, in particular, the party's constituency and + * responsibilities or other obligations. + * + * Generated from protobuf field string issuing_authority = 2; + * @return string + */ + public function getIssuingAuthority() + { + return $this->issuing_authority; + } + + /** + * Provides information about the authority of the issuing party to + * release the document, in particular, the party's constituency and + * responsibilities or other obligations. + * + * Generated from protobuf field string issuing_authority = 2; + * @param string $var + * @return $this + */ + public function setIssuingAuthority($var) + { + GPBUtil::checkString($var, True); + $this->issuing_authority = $var; + + return $this; + } + + /** + * The context or namespace. + * Contains a URL which is under control of the issuing party and can + * be used as a globally unique identifier for that issuing party. + * Example: https://csaf.io + * + * Generated from protobuf field string publisher_namespace = 3; + * @return string + */ + public function getPublisherNamespace() + { + return $this->publisher_namespace; + } + + /** + * The context or namespace. + * Contains a URL which is under control of the issuing party and can + * be used as a globally unique identifier for that issuing party. + * Example: https://csaf.io + * + * Generated from protobuf field string publisher_namespace = 3; + * @param string $var + * @return $this + */ + public function setPublisherNamespace($var) + { + GPBUtil::checkString($var, True); + $this->publisher_namespace = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Publisher::class, \Grafeas\V1\VulnerabilityAssessmentNote_Publisher::class); + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/VulnerabilityAssessmentNote_Assessment.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/VulnerabilityAssessmentNote_Assessment.php new file mode 100644 index 000000000000..37855b2a0967 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/VulnerabilityAssessmentNote_Assessment.php @@ -0,0 +1,16 @@ +grafeas.v1.VulnerabilityNote + */ +class VulnerabilityNote extends \Google\Protobuf\Internal\Message +{ + /** + * The CVSS score of this vulnerability. CVSS score is on a scale of 0 - 10 + * where 0 indicates low severity and 10 indicates high severity. + * + * Generated from protobuf field float cvss_score = 1; + */ + protected $cvss_score = 0.0; + /** + * The note provider assigned severity of this vulnerability. + * + * Generated from protobuf field .grafeas.v1.Severity severity = 2; + */ + protected $severity = 0; + /** + * Details of all known distros and packages affected by this vulnerability. + * + * Generated from protobuf field repeated .grafeas.v1.VulnerabilityNote.Detail details = 3; + */ + private $details; + /** + * The full description of the CVSSv3 for this vulnerability. + * + * Generated from protobuf field .grafeas.v1.CVSSv3 cvss_v3 = 4; + */ + protected $cvss_v3 = null; + /** + * Windows details get their own format because the information format and + * model don't match a normal detail. Specifically Windows updates are done as + * patches, thus Windows vulnerabilities really are a missing package, rather + * than a package being at an incorrect version. + * + * Generated from protobuf field repeated .grafeas.v1.VulnerabilityNote.WindowsDetail windows_details = 5; + */ + private $windows_details; + /** + * The time this information was last changed at the source. This is an + * upstream timestamp from the underlying information source - e.g. Ubuntu + * security tracker. + * + * Generated from protobuf field .google.protobuf.Timestamp source_update_time = 6; + */ + protected $source_update_time = null; + /** + * CVSS version used to populate cvss_score and severity. + * + * Generated from protobuf field .grafeas.v1.CVSSVersion cvss_version = 7; + */ + protected $cvss_version = 0; + /** + * The full description of the v2 CVSS for this vulnerability. + * + * Generated from protobuf field .grafeas.v1.CVSS cvss_v2 = 8; + */ + protected $cvss_v2 = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type float $cvss_score + * The CVSS score of this vulnerability. CVSS score is on a scale of 0 - 10 + * where 0 indicates low severity and 10 indicates high severity. + * @type int $severity + * The note provider assigned severity of this vulnerability. + * @type array<\Grafeas\V1\VulnerabilityNote\Detail>|\Google\Protobuf\Internal\RepeatedField $details + * Details of all known distros and packages affected by this vulnerability. + * @type \Grafeas\V1\CVSSv3 $cvss_v3 + * The full description of the CVSSv3 for this vulnerability. + * @type array<\Grafeas\V1\VulnerabilityNote\WindowsDetail>|\Google\Protobuf\Internal\RepeatedField $windows_details + * Windows details get their own format because the information format and + * model don't match a normal detail. Specifically Windows updates are done as + * patches, thus Windows vulnerabilities really are a missing package, rather + * than a package being at an incorrect version. + * @type \Google\Protobuf\Timestamp $source_update_time + * The time this information was last changed at the source. This is an + * upstream timestamp from the underlying information source - e.g. Ubuntu + * security tracker. + * @type int $cvss_version + * CVSS version used to populate cvss_score and severity. + * @type \Grafeas\V1\CVSS $cvss_v2 + * The full description of the v2 CVSS for this vulnerability. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Vulnerability::initOnce(); + parent::__construct($data); + } + + /** + * The CVSS score of this vulnerability. CVSS score is on a scale of 0 - 10 + * where 0 indicates low severity and 10 indicates high severity. + * + * Generated from protobuf field float cvss_score = 1; + * @return float + */ + public function getCvssScore() + { + return $this->cvss_score; + } + + /** + * The CVSS score of this vulnerability. CVSS score is on a scale of 0 - 10 + * where 0 indicates low severity and 10 indicates high severity. + * + * Generated from protobuf field float cvss_score = 1; + * @param float $var + * @return $this + */ + public function setCvssScore($var) + { + GPBUtil::checkFloat($var); + $this->cvss_score = $var; + + return $this; + } + + /** + * The note provider assigned severity of this vulnerability. + * + * Generated from protobuf field .grafeas.v1.Severity severity = 2; + * @return int + */ + public function getSeverity() + { + return $this->severity; + } + + /** + * The note provider assigned severity of this vulnerability. + * + * Generated from protobuf field .grafeas.v1.Severity severity = 2; + * @param int $var + * @return $this + */ + public function setSeverity($var) + { + GPBUtil::checkEnum($var, \Grafeas\V1\Severity::class); + $this->severity = $var; + + return $this; + } + + /** + * Details of all known distros and packages affected by this vulnerability. + * + * Generated from protobuf field repeated .grafeas.v1.VulnerabilityNote.Detail details = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDetails() + { + return $this->details; + } + + /** + * Details of all known distros and packages affected by this vulnerability. + * + * Generated from protobuf field repeated .grafeas.v1.VulnerabilityNote.Detail details = 3; + * @param array<\Grafeas\V1\VulnerabilityNote\Detail>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDetails($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Grafeas\V1\VulnerabilityNote\Detail::class); + $this->details = $arr; + + return $this; + } + + /** + * The full description of the CVSSv3 for this vulnerability. + * + * Generated from protobuf field .grafeas.v1.CVSSv3 cvss_v3 = 4; + * @return \Grafeas\V1\CVSSv3|null + */ + public function getCvssV3() + { + return $this->cvss_v3; + } + + public function hasCvssV3() + { + return isset($this->cvss_v3); + } + + public function clearCvssV3() + { + unset($this->cvss_v3); + } + + /** + * The full description of the CVSSv3 for this vulnerability. + * + * Generated from protobuf field .grafeas.v1.CVSSv3 cvss_v3 = 4; + * @param \Grafeas\V1\CVSSv3 $var + * @return $this + */ + public function setCvssV3($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\CVSSv3::class); + $this->cvss_v3 = $var; + + return $this; + } + + /** + * Windows details get their own format because the information format and + * model don't match a normal detail. Specifically Windows updates are done as + * patches, thus Windows vulnerabilities really are a missing package, rather + * than a package being at an incorrect version. + * + * Generated from protobuf field repeated .grafeas.v1.VulnerabilityNote.WindowsDetail windows_details = 5; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getWindowsDetails() + { + return $this->windows_details; + } + + /** + * Windows details get their own format because the information format and + * model don't match a normal detail. Specifically Windows updates are done as + * patches, thus Windows vulnerabilities really are a missing package, rather + * than a package being at an incorrect version. + * + * Generated from protobuf field repeated .grafeas.v1.VulnerabilityNote.WindowsDetail windows_details = 5; + * @param array<\Grafeas\V1\VulnerabilityNote\WindowsDetail>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setWindowsDetails($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Grafeas\V1\VulnerabilityNote\WindowsDetail::class); + $this->windows_details = $arr; + + return $this; + } + + /** + * The time this information was last changed at the source. This is an + * upstream timestamp from the underlying information source - e.g. Ubuntu + * security tracker. + * + * Generated from protobuf field .google.protobuf.Timestamp source_update_time = 6; + * @return \Google\Protobuf\Timestamp|null + */ + public function getSourceUpdateTime() + { + return $this->source_update_time; + } + + public function hasSourceUpdateTime() + { + return isset($this->source_update_time); + } + + public function clearSourceUpdateTime() + { + unset($this->source_update_time); + } + + /** + * The time this information was last changed at the source. This is an + * upstream timestamp from the underlying information source - e.g. Ubuntu + * security tracker. + * + * Generated from protobuf field .google.protobuf.Timestamp source_update_time = 6; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setSourceUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->source_update_time = $var; + + return $this; + } + + /** + * CVSS version used to populate cvss_score and severity. + * + * Generated from protobuf field .grafeas.v1.CVSSVersion cvss_version = 7; + * @return int + */ + public function getCvssVersion() + { + return $this->cvss_version; + } + + /** + * CVSS version used to populate cvss_score and severity. + * + * Generated from protobuf field .grafeas.v1.CVSSVersion cvss_version = 7; + * @param int $var + * @return $this + */ + public function setCvssVersion($var) + { + GPBUtil::checkEnum($var, \Grafeas\V1\CVSSVersion::class); + $this->cvss_version = $var; + + return $this; + } + + /** + * The full description of the v2 CVSS for this vulnerability. + * + * Generated from protobuf field .grafeas.v1.CVSS cvss_v2 = 8; + * @return \Grafeas\V1\CVSS|null + */ + public function getCvssV2() + { + return $this->cvss_v2; + } + + public function hasCvssV2() + { + return isset($this->cvss_v2); + } + + public function clearCvssV2() + { + unset($this->cvss_v2); + } + + /** + * The full description of the v2 CVSS for this vulnerability. + * + * Generated from protobuf field .grafeas.v1.CVSS cvss_v2 = 8; + * @param \Grafeas\V1\CVSS $var + * @return $this + */ + public function setCvssV2($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\CVSS::class); + $this->cvss_v2 = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/VulnerabilityNote/Detail.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/VulnerabilityNote/Detail.php new file mode 100644 index 000000000000..8bd53ea558d3 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/VulnerabilityNote/Detail.php @@ -0,0 +1,645 @@ +grafeas.v1.VulnerabilityNote.Detail + */ +class Detail extends \Google\Protobuf\Internal\Message +{ + /** + * The distro assigned severity of this vulnerability. + * + * Generated from protobuf field string severity_name = 1; + */ + protected $severity_name = ''; + /** + * A vendor-specific description of this vulnerability. + * + * Generated from protobuf field string description = 2; + */ + protected $description = ''; + /** + * The type of package; whether native or non native (e.g., ruby gems, + * node.js packages, etc.). + * + * Generated from protobuf field string package_type = 3; + */ + protected $package_type = ''; + /** + * Required. The [CPE URI](https://cpe.mitre.org/specification/) this + * vulnerability affects. + * + * Generated from protobuf field string affected_cpe_uri = 4; + */ + protected $affected_cpe_uri = ''; + /** + * Required. The package this vulnerability affects. + * + * Generated from protobuf field string affected_package = 5; + */ + protected $affected_package = ''; + /** + * The version number at the start of an interval in which this + * vulnerability exists. A vulnerability can affect a package between + * version numbers that are disjoint sets of intervals (example: + * [1.0.0-1.1.0], [2.4.6-2.4.8] and [4.5.6-4.6.8]) each of which will be + * represented in its own Detail. If a specific affected version is provided + * by a vulnerability database, affected_version_start and + * affected_version_end will be the same in that Detail. + * + * Generated from protobuf field .grafeas.v1.Version affected_version_start = 6; + */ + protected $affected_version_start = null; + /** + * The version number at the end of an interval in which this vulnerability + * exists. A vulnerability can affect a package between version numbers + * that are disjoint sets of intervals (example: [1.0.0-1.1.0], + * [2.4.6-2.4.8] and [4.5.6-4.6.8]) each of which will be represented in its + * own Detail. If a specific affected version is provided by a vulnerability + * database, affected_version_start and affected_version_end will be the + * same in that Detail. + * + * Generated from protobuf field .grafeas.v1.Version affected_version_end = 7; + */ + protected $affected_version_end = null; + /** + * The distro recommended [CPE URI](https://cpe.mitre.org/specification/) + * to update to that contains a fix for this vulnerability. It is possible + * for this to be different from the affected_cpe_uri. + * + * Generated from protobuf field string fixed_cpe_uri = 8; + */ + protected $fixed_cpe_uri = ''; + /** + * The distro recommended package to update to that contains a fix for this + * vulnerability. It is possible for this to be different from the + * affected_package. + * + * Generated from protobuf field string fixed_package = 9; + */ + protected $fixed_package = ''; + /** + * The distro recommended version to update to that contains a + * fix for this vulnerability. Setting this to VersionKind.MAXIMUM means no + * such version is yet available. + * + * Generated from protobuf field .grafeas.v1.Version fixed_version = 10; + */ + protected $fixed_version = null; + /** + * Whether this detail is obsolete. Occurrences are expected not to point to + * obsolete details. + * + * Generated from protobuf field bool is_obsolete = 11; + */ + protected $is_obsolete = false; + /** + * The time this information was last changed at the source. This is an + * upstream timestamp from the underlying information source - e.g. Ubuntu + * security tracker. + * + * Generated from protobuf field .google.protobuf.Timestamp source_update_time = 12; + */ + protected $source_update_time = null; + /** + * The source from which the information in this Detail was obtained. + * + * Generated from protobuf field string source = 13; + */ + protected $source = ''; + /** + * The name of the vendor of the product. + * + * Generated from protobuf field string vendor = 14; + */ + protected $vendor = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $severity_name + * The distro assigned severity of this vulnerability. + * @type string $description + * A vendor-specific description of this vulnerability. + * @type string $package_type + * The type of package; whether native or non native (e.g., ruby gems, + * node.js packages, etc.). + * @type string $affected_cpe_uri + * Required. The [CPE URI](https://cpe.mitre.org/specification/) this + * vulnerability affects. + * @type string $affected_package + * Required. The package this vulnerability affects. + * @type \Grafeas\V1\Version $affected_version_start + * The version number at the start of an interval in which this + * vulnerability exists. A vulnerability can affect a package between + * version numbers that are disjoint sets of intervals (example: + * [1.0.0-1.1.0], [2.4.6-2.4.8] and [4.5.6-4.6.8]) each of which will be + * represented in its own Detail. If a specific affected version is provided + * by a vulnerability database, affected_version_start and + * affected_version_end will be the same in that Detail. + * @type \Grafeas\V1\Version $affected_version_end + * The version number at the end of an interval in which this vulnerability + * exists. A vulnerability can affect a package between version numbers + * that are disjoint sets of intervals (example: [1.0.0-1.1.0], + * [2.4.6-2.4.8] and [4.5.6-4.6.8]) each of which will be represented in its + * own Detail. If a specific affected version is provided by a vulnerability + * database, affected_version_start and affected_version_end will be the + * same in that Detail. + * @type string $fixed_cpe_uri + * The distro recommended [CPE URI](https://cpe.mitre.org/specification/) + * to update to that contains a fix for this vulnerability. It is possible + * for this to be different from the affected_cpe_uri. + * @type string $fixed_package + * The distro recommended package to update to that contains a fix for this + * vulnerability. It is possible for this to be different from the + * affected_package. + * @type \Grafeas\V1\Version $fixed_version + * The distro recommended version to update to that contains a + * fix for this vulnerability. Setting this to VersionKind.MAXIMUM means no + * such version is yet available. + * @type bool $is_obsolete + * Whether this detail is obsolete. Occurrences are expected not to point to + * obsolete details. + * @type \Google\Protobuf\Timestamp $source_update_time + * The time this information was last changed at the source. This is an + * upstream timestamp from the underlying information source - e.g. Ubuntu + * security tracker. + * @type string $source + * The source from which the information in this Detail was obtained. + * @type string $vendor + * The name of the vendor of the product. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Vulnerability::initOnce(); + parent::__construct($data); + } + + /** + * The distro assigned severity of this vulnerability. + * + * Generated from protobuf field string severity_name = 1; + * @return string + */ + public function getSeverityName() + { + return $this->severity_name; + } + + /** + * The distro assigned severity of this vulnerability. + * + * Generated from protobuf field string severity_name = 1; + * @param string $var + * @return $this + */ + public function setSeverityName($var) + { + GPBUtil::checkString($var, True); + $this->severity_name = $var; + + return $this; + } + + /** + * A vendor-specific description of this vulnerability. + * + * Generated from protobuf field string description = 2; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * A vendor-specific description of this vulnerability. + * + * Generated from protobuf field string description = 2; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * The type of package; whether native or non native (e.g., ruby gems, + * node.js packages, etc.). + * + * Generated from protobuf field string package_type = 3; + * @return string + */ + public function getPackageType() + { + return $this->package_type; + } + + /** + * The type of package; whether native or non native (e.g., ruby gems, + * node.js packages, etc.). + * + * Generated from protobuf field string package_type = 3; + * @param string $var + * @return $this + */ + public function setPackageType($var) + { + GPBUtil::checkString($var, True); + $this->package_type = $var; + + return $this; + } + + /** + * Required. The [CPE URI](https://cpe.mitre.org/specification/) this + * vulnerability affects. + * + * Generated from protobuf field string affected_cpe_uri = 4; + * @return string + */ + public function getAffectedCpeUri() + { + return $this->affected_cpe_uri; + } + + /** + * Required. The [CPE URI](https://cpe.mitre.org/specification/) this + * vulnerability affects. + * + * Generated from protobuf field string affected_cpe_uri = 4; + * @param string $var + * @return $this + */ + public function setAffectedCpeUri($var) + { + GPBUtil::checkString($var, True); + $this->affected_cpe_uri = $var; + + return $this; + } + + /** + * Required. The package this vulnerability affects. + * + * Generated from protobuf field string affected_package = 5; + * @return string + */ + public function getAffectedPackage() + { + return $this->affected_package; + } + + /** + * Required. The package this vulnerability affects. + * + * Generated from protobuf field string affected_package = 5; + * @param string $var + * @return $this + */ + public function setAffectedPackage($var) + { + GPBUtil::checkString($var, True); + $this->affected_package = $var; + + return $this; + } + + /** + * The version number at the start of an interval in which this + * vulnerability exists. A vulnerability can affect a package between + * version numbers that are disjoint sets of intervals (example: + * [1.0.0-1.1.0], [2.4.6-2.4.8] and [4.5.6-4.6.8]) each of which will be + * represented in its own Detail. If a specific affected version is provided + * by a vulnerability database, affected_version_start and + * affected_version_end will be the same in that Detail. + * + * Generated from protobuf field .grafeas.v1.Version affected_version_start = 6; + * @return \Grafeas\V1\Version|null + */ + public function getAffectedVersionStart() + { + return $this->affected_version_start; + } + + public function hasAffectedVersionStart() + { + return isset($this->affected_version_start); + } + + public function clearAffectedVersionStart() + { + unset($this->affected_version_start); + } + + /** + * The version number at the start of an interval in which this + * vulnerability exists. A vulnerability can affect a package between + * version numbers that are disjoint sets of intervals (example: + * [1.0.0-1.1.0], [2.4.6-2.4.8] and [4.5.6-4.6.8]) each of which will be + * represented in its own Detail. If a specific affected version is provided + * by a vulnerability database, affected_version_start and + * affected_version_end will be the same in that Detail. + * + * Generated from protobuf field .grafeas.v1.Version affected_version_start = 6; + * @param \Grafeas\V1\Version $var + * @return $this + */ + public function setAffectedVersionStart($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\Version::class); + $this->affected_version_start = $var; + + return $this; + } + + /** + * The version number at the end of an interval in which this vulnerability + * exists. A vulnerability can affect a package between version numbers + * that are disjoint sets of intervals (example: [1.0.0-1.1.0], + * [2.4.6-2.4.8] and [4.5.6-4.6.8]) each of which will be represented in its + * own Detail. If a specific affected version is provided by a vulnerability + * database, affected_version_start and affected_version_end will be the + * same in that Detail. + * + * Generated from protobuf field .grafeas.v1.Version affected_version_end = 7; + * @return \Grafeas\V1\Version|null + */ + public function getAffectedVersionEnd() + { + return $this->affected_version_end; + } + + public function hasAffectedVersionEnd() + { + return isset($this->affected_version_end); + } + + public function clearAffectedVersionEnd() + { + unset($this->affected_version_end); + } + + /** + * The version number at the end of an interval in which this vulnerability + * exists. A vulnerability can affect a package between version numbers + * that are disjoint sets of intervals (example: [1.0.0-1.1.0], + * [2.4.6-2.4.8] and [4.5.6-4.6.8]) each of which will be represented in its + * own Detail. If a specific affected version is provided by a vulnerability + * database, affected_version_start and affected_version_end will be the + * same in that Detail. + * + * Generated from protobuf field .grafeas.v1.Version affected_version_end = 7; + * @param \Grafeas\V1\Version $var + * @return $this + */ + public function setAffectedVersionEnd($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\Version::class); + $this->affected_version_end = $var; + + return $this; + } + + /** + * The distro recommended [CPE URI](https://cpe.mitre.org/specification/) + * to update to that contains a fix for this vulnerability. It is possible + * for this to be different from the affected_cpe_uri. + * + * Generated from protobuf field string fixed_cpe_uri = 8; + * @return string + */ + public function getFixedCpeUri() + { + return $this->fixed_cpe_uri; + } + + /** + * The distro recommended [CPE URI](https://cpe.mitre.org/specification/) + * to update to that contains a fix for this vulnerability. It is possible + * for this to be different from the affected_cpe_uri. + * + * Generated from protobuf field string fixed_cpe_uri = 8; + * @param string $var + * @return $this + */ + public function setFixedCpeUri($var) + { + GPBUtil::checkString($var, True); + $this->fixed_cpe_uri = $var; + + return $this; + } + + /** + * The distro recommended package to update to that contains a fix for this + * vulnerability. It is possible for this to be different from the + * affected_package. + * + * Generated from protobuf field string fixed_package = 9; + * @return string + */ + public function getFixedPackage() + { + return $this->fixed_package; + } + + /** + * The distro recommended package to update to that contains a fix for this + * vulnerability. It is possible for this to be different from the + * affected_package. + * + * Generated from protobuf field string fixed_package = 9; + * @param string $var + * @return $this + */ + public function setFixedPackage($var) + { + GPBUtil::checkString($var, True); + $this->fixed_package = $var; + + return $this; + } + + /** + * The distro recommended version to update to that contains a + * fix for this vulnerability. Setting this to VersionKind.MAXIMUM means no + * such version is yet available. + * + * Generated from protobuf field .grafeas.v1.Version fixed_version = 10; + * @return \Grafeas\V1\Version|null + */ + public function getFixedVersion() + { + return $this->fixed_version; + } + + public function hasFixedVersion() + { + return isset($this->fixed_version); + } + + public function clearFixedVersion() + { + unset($this->fixed_version); + } + + /** + * The distro recommended version to update to that contains a + * fix for this vulnerability. Setting this to VersionKind.MAXIMUM means no + * such version is yet available. + * + * Generated from protobuf field .grafeas.v1.Version fixed_version = 10; + * @param \Grafeas\V1\Version $var + * @return $this + */ + public function setFixedVersion($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\Version::class); + $this->fixed_version = $var; + + return $this; + } + + /** + * Whether this detail is obsolete. Occurrences are expected not to point to + * obsolete details. + * + * Generated from protobuf field bool is_obsolete = 11; + * @return bool + */ + public function getIsObsolete() + { + return $this->is_obsolete; + } + + /** + * Whether this detail is obsolete. Occurrences are expected not to point to + * obsolete details. + * + * Generated from protobuf field bool is_obsolete = 11; + * @param bool $var + * @return $this + */ + public function setIsObsolete($var) + { + GPBUtil::checkBool($var); + $this->is_obsolete = $var; + + return $this; + } + + /** + * The time this information was last changed at the source. This is an + * upstream timestamp from the underlying information source - e.g. Ubuntu + * security tracker. + * + * Generated from protobuf field .google.protobuf.Timestamp source_update_time = 12; + * @return \Google\Protobuf\Timestamp|null + */ + public function getSourceUpdateTime() + { + return $this->source_update_time; + } + + public function hasSourceUpdateTime() + { + return isset($this->source_update_time); + } + + public function clearSourceUpdateTime() + { + unset($this->source_update_time); + } + + /** + * The time this information was last changed at the source. This is an + * upstream timestamp from the underlying information source - e.g. Ubuntu + * security tracker. + * + * Generated from protobuf field .google.protobuf.Timestamp source_update_time = 12; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setSourceUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->source_update_time = $var; + + return $this; + } + + /** + * The source from which the information in this Detail was obtained. + * + * Generated from protobuf field string source = 13; + * @return string + */ + public function getSource() + { + return $this->source; + } + + /** + * The source from which the information in this Detail was obtained. + * + * Generated from protobuf field string source = 13; + * @param string $var + * @return $this + */ + public function setSource($var) + { + GPBUtil::checkString($var, True); + $this->source = $var; + + return $this; + } + + /** + * The name of the vendor of the product. + * + * Generated from protobuf field string vendor = 14; + * @return string + */ + public function getVendor() + { + return $this->vendor; + } + + /** + * The name of the vendor of the product. + * + * Generated from protobuf field string vendor = 14; + * @param string $var + * @return $this + */ + public function setVendor($var) + { + GPBUtil::checkString($var, True); + $this->vendor = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Detail::class, \Grafeas\V1\VulnerabilityNote_Detail::class); + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/VulnerabilityNote/WindowsDetail.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/VulnerabilityNote/WindowsDetail.php new file mode 100644 index 000000000000..e20cc151c87d --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/VulnerabilityNote/WindowsDetail.php @@ -0,0 +1,186 @@ +grafeas.v1.VulnerabilityNote.WindowsDetail + */ +class WindowsDetail extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The [CPE URI](https://cpe.mitre.org/specification/) this + * vulnerability affects. + * + * Generated from protobuf field string cpe_uri = 1; + */ + protected $cpe_uri = ''; + /** + * Required. The name of this vulnerability. + * + * Generated from protobuf field string name = 2; + */ + protected $name = ''; + /** + * The description of this vulnerability. + * + * Generated from protobuf field string description = 3; + */ + protected $description = ''; + /** + * Required. The names of the KBs which have hotfixes to mitigate this + * vulnerability. Note that there may be multiple hotfixes (and thus + * multiple KBs) that mitigate a given vulnerability. Currently any listed + * KBs presence is considered a fix. + * + * Generated from protobuf field repeated .grafeas.v1.VulnerabilityNote.WindowsDetail.KnowledgeBase fixing_kbs = 4; + */ + private $fixing_kbs; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $cpe_uri + * Required. The [CPE URI](https://cpe.mitre.org/specification/) this + * vulnerability affects. + * @type string $name + * Required. The name of this vulnerability. + * @type string $description + * The description of this vulnerability. + * @type array<\Grafeas\V1\VulnerabilityNote\WindowsDetail\KnowledgeBase>|\Google\Protobuf\Internal\RepeatedField $fixing_kbs + * Required. The names of the KBs which have hotfixes to mitigate this + * vulnerability. Note that there may be multiple hotfixes (and thus + * multiple KBs) that mitigate a given vulnerability. Currently any listed + * KBs presence is considered a fix. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Vulnerability::initOnce(); + parent::__construct($data); + } + + /** + * Required. The [CPE URI](https://cpe.mitre.org/specification/) this + * vulnerability affects. + * + * Generated from protobuf field string cpe_uri = 1; + * @return string + */ + public function getCpeUri() + { + return $this->cpe_uri; + } + + /** + * Required. The [CPE URI](https://cpe.mitre.org/specification/) this + * vulnerability affects. + * + * Generated from protobuf field string cpe_uri = 1; + * @param string $var + * @return $this + */ + public function setCpeUri($var) + { + GPBUtil::checkString($var, True); + $this->cpe_uri = $var; + + return $this; + } + + /** + * Required. The name of this vulnerability. + * + * Generated from protobuf field string name = 2; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of this vulnerability. + * + * Generated from protobuf field string name = 2; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The description of this vulnerability. + * + * Generated from protobuf field string description = 3; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * The description of this vulnerability. + * + * Generated from protobuf field string description = 3; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * Required. The names of the KBs which have hotfixes to mitigate this + * vulnerability. Note that there may be multiple hotfixes (and thus + * multiple KBs) that mitigate a given vulnerability. Currently any listed + * KBs presence is considered a fix. + * + * Generated from protobuf field repeated .grafeas.v1.VulnerabilityNote.WindowsDetail.KnowledgeBase fixing_kbs = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getFixingKbs() + { + return $this->fixing_kbs; + } + + /** + * Required. The names of the KBs which have hotfixes to mitigate this + * vulnerability. Note that there may be multiple hotfixes (and thus + * multiple KBs) that mitigate a given vulnerability. Currently any listed + * KBs presence is considered a fix. + * + * Generated from protobuf field repeated .grafeas.v1.VulnerabilityNote.WindowsDetail.KnowledgeBase fixing_kbs = 4; + * @param array<\Grafeas\V1\VulnerabilityNote\WindowsDetail\KnowledgeBase>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setFixingKbs($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Grafeas\V1\VulnerabilityNote\WindowsDetail\KnowledgeBase::class); + $this->fixing_kbs = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(WindowsDetail::class, \Grafeas\V1\VulnerabilityNote_WindowsDetail::class); + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/VulnerabilityNote/WindowsDetail/KnowledgeBase.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/VulnerabilityNote/WindowsDetail/KnowledgeBase.php new file mode 100644 index 000000000000..26ec0c58b2f6 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/VulnerabilityNote/WindowsDetail/KnowledgeBase.php @@ -0,0 +1,106 @@ +grafeas.v1.VulnerabilityNote.WindowsDetail.KnowledgeBase + */ +class KnowledgeBase extends \Google\Protobuf\Internal\Message +{ + /** + * The KB name (generally of the form KB[0-9]+ (e.g., KB123456)). + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * A link to the KB in the [Windows update catalog] + * (https://www.catalog.update.microsoft.com/). + * + * Generated from protobuf field string url = 2; + */ + protected $url = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The KB name (generally of the form KB[0-9]+ (e.g., KB123456)). + * @type string $url + * A link to the KB in the [Windows update catalog] + * (https://www.catalog.update.microsoft.com/). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Vulnerability::initOnce(); + parent::__construct($data); + } + + /** + * The KB name (generally of the form KB[0-9]+ (e.g., KB123456)). + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The KB name (generally of the form KB[0-9]+ (e.g., KB123456)). + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * A link to the KB in the [Windows update catalog] + * (https://www.catalog.update.microsoft.com/). + * + * Generated from protobuf field string url = 2; + * @return string + */ + public function getUrl() + { + return $this->url; + } + + /** + * A link to the KB in the [Windows update catalog] + * (https://www.catalog.update.microsoft.com/). + * + * Generated from protobuf field string url = 2; + * @param string $var + * @return $this + */ + public function setUrl($var) + { + GPBUtil::checkString($var, True); + $this->url = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(KnowledgeBase::class, \Grafeas\V1\VulnerabilityNote_WindowsDetail_KnowledgeBase::class); + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/VulnerabilityNote_Detail.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/VulnerabilityNote_Detail.php new file mode 100644 index 000000000000..3406384a9d4f --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/VulnerabilityNote_Detail.php @@ -0,0 +1,16 @@ +grafeas.v1.VulnerabilityOccurrence + */ +class VulnerabilityOccurrence extends \Google\Protobuf\Internal\Message +{ + /** + * The type of package; whether native or non native (e.g., ruby gems, node.js + * packages, etc.). + * + * Generated from protobuf field string type = 1; + */ + protected $type = ''; + /** + * Output only. The note provider assigned severity of this vulnerability. + * + * Generated from protobuf field .grafeas.v1.Severity severity = 2; + */ + protected $severity = 0; + /** + * Output only. The CVSS score of this vulnerability. CVSS score is on a + * scale of 0 - 10 where 0 indicates low severity and 10 indicates high + * severity. + * + * Generated from protobuf field float cvss_score = 3; + */ + protected $cvss_score = 0.0; + /** + * The cvss v3 score for the vulnerability. + * + * Generated from protobuf field .grafeas.v1.CVSS cvssv3 = 10; + */ + protected $cvssv3 = null; + /** + * Required. The set of affected locations and their fixes (if available) + * within the associated resource. + * + * Generated from protobuf field repeated .grafeas.v1.VulnerabilityOccurrence.PackageIssue package_issue = 4; + */ + private $package_issue; + /** + * Output only. A one sentence description of this vulnerability. + * + * Generated from protobuf field string short_description = 5; + */ + protected $short_description = ''; + /** + * Output only. A detailed description of this vulnerability. + * + * Generated from protobuf field string long_description = 6; + */ + protected $long_description = ''; + /** + * Output only. URLs related to this vulnerability. + * + * Generated from protobuf field repeated .grafeas.v1.RelatedUrl related_urls = 7; + */ + private $related_urls; + /** + * The distro assigned severity for this vulnerability when it is available, + * otherwise this is the note provider assigned severity. + * When there are multiple PackageIssues for this vulnerability, they can have + * different effective severities because some might be provided by the distro + * while others are provided by the language ecosystem for a language pack. + * For this reason, it is advised to use the effective severity on the + * PackageIssue level. In the case where multiple PackageIssues have differing + * effective severities, this field should be the highest severity for any of + * the PackageIssues. + * + * Generated from protobuf field .grafeas.v1.Severity effective_severity = 8; + */ + protected $effective_severity = 0; + /** + * Output only. Whether at least one of the affected packages has a fix + * available. + * + * Generated from protobuf field bool fix_available = 9; + */ + protected $fix_available = false; + /** + * Output only. CVSS version used to populate cvss_score and severity. + * + * Generated from protobuf field .grafeas.v1.CVSSVersion cvss_version = 11; + */ + protected $cvss_version = 0; + /** + * The cvss v2 score for the vulnerability. + * + * Generated from protobuf field .grafeas.v1.CVSS cvss_v2 = 12; + */ + protected $cvss_v2 = null; + /** + * Generated from protobuf field .grafeas.v1.VulnerabilityOccurrence.VexAssessment vex_assessment = 13; + */ + protected $vex_assessment = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $type + * The type of package; whether native or non native (e.g., ruby gems, node.js + * packages, etc.). + * @type int $severity + * Output only. The note provider assigned severity of this vulnerability. + * @type float $cvss_score + * Output only. The CVSS score of this vulnerability. CVSS score is on a + * scale of 0 - 10 where 0 indicates low severity and 10 indicates high + * severity. + * @type \Grafeas\V1\CVSS $cvssv3 + * The cvss v3 score for the vulnerability. + * @type array<\Grafeas\V1\VulnerabilityOccurrence\PackageIssue>|\Google\Protobuf\Internal\RepeatedField $package_issue + * Required. The set of affected locations and their fixes (if available) + * within the associated resource. + * @type string $short_description + * Output only. A one sentence description of this vulnerability. + * @type string $long_description + * Output only. A detailed description of this vulnerability. + * @type array<\Grafeas\V1\RelatedUrl>|\Google\Protobuf\Internal\RepeatedField $related_urls + * Output only. URLs related to this vulnerability. + * @type int $effective_severity + * The distro assigned severity for this vulnerability when it is available, + * otherwise this is the note provider assigned severity. + * When there are multiple PackageIssues for this vulnerability, they can have + * different effective severities because some might be provided by the distro + * while others are provided by the language ecosystem for a language pack. + * For this reason, it is advised to use the effective severity on the + * PackageIssue level. In the case where multiple PackageIssues have differing + * effective severities, this field should be the highest severity for any of + * the PackageIssues. + * @type bool $fix_available + * Output only. Whether at least one of the affected packages has a fix + * available. + * @type int $cvss_version + * Output only. CVSS version used to populate cvss_score and severity. + * @type \Grafeas\V1\CVSS $cvss_v2 + * The cvss v2 score for the vulnerability. + * @type \Grafeas\V1\VulnerabilityOccurrence\VexAssessment $vex_assessment + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Vulnerability::initOnce(); + parent::__construct($data); + } + + /** + * The type of package; whether native or non native (e.g., ruby gems, node.js + * packages, etc.). + * + * Generated from protobuf field string type = 1; + * @return string + */ + public function getType() + { + return $this->type; + } + + /** + * The type of package; whether native or non native (e.g., ruby gems, node.js + * packages, etc.). + * + * Generated from protobuf field string type = 1; + * @param string $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkString($var, True); + $this->type = $var; + + return $this; + } + + /** + * Output only. The note provider assigned severity of this vulnerability. + * + * Generated from protobuf field .grafeas.v1.Severity severity = 2; + * @return int + */ + public function getSeverity() + { + return $this->severity; + } + + /** + * Output only. The note provider assigned severity of this vulnerability. + * + * Generated from protobuf field .grafeas.v1.Severity severity = 2; + * @param int $var + * @return $this + */ + public function setSeverity($var) + { + GPBUtil::checkEnum($var, \Grafeas\V1\Severity::class); + $this->severity = $var; + + return $this; + } + + /** + * Output only. The CVSS score of this vulnerability. CVSS score is on a + * scale of 0 - 10 where 0 indicates low severity and 10 indicates high + * severity. + * + * Generated from protobuf field float cvss_score = 3; + * @return float + */ + public function getCvssScore() + { + return $this->cvss_score; + } + + /** + * Output only. The CVSS score of this vulnerability. CVSS score is on a + * scale of 0 - 10 where 0 indicates low severity and 10 indicates high + * severity. + * + * Generated from protobuf field float cvss_score = 3; + * @param float $var + * @return $this + */ + public function setCvssScore($var) + { + GPBUtil::checkFloat($var); + $this->cvss_score = $var; + + return $this; + } + + /** + * The cvss v3 score for the vulnerability. + * + * Generated from protobuf field .grafeas.v1.CVSS cvssv3 = 10; + * @return \Grafeas\V1\CVSS|null + */ + public function getCvssv3() + { + return $this->cvssv3; + } + + public function hasCvssv3() + { + return isset($this->cvssv3); + } + + public function clearCvssv3() + { + unset($this->cvssv3); + } + + /** + * The cvss v3 score for the vulnerability. + * + * Generated from protobuf field .grafeas.v1.CVSS cvssv3 = 10; + * @param \Grafeas\V1\CVSS $var + * @return $this + */ + public function setCvssv3($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\CVSS::class); + $this->cvssv3 = $var; + + return $this; + } + + /** + * Required. The set of affected locations and their fixes (if available) + * within the associated resource. + * + * Generated from protobuf field repeated .grafeas.v1.VulnerabilityOccurrence.PackageIssue package_issue = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getPackageIssue() + { + return $this->package_issue; + } + + /** + * Required. The set of affected locations and their fixes (if available) + * within the associated resource. + * + * Generated from protobuf field repeated .grafeas.v1.VulnerabilityOccurrence.PackageIssue package_issue = 4; + * @param array<\Grafeas\V1\VulnerabilityOccurrence\PackageIssue>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setPackageIssue($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Grafeas\V1\VulnerabilityOccurrence\PackageIssue::class); + $this->package_issue = $arr; + + return $this; + } + + /** + * Output only. A one sentence description of this vulnerability. + * + * Generated from protobuf field string short_description = 5; + * @return string + */ + public function getShortDescription() + { + return $this->short_description; + } + + /** + * Output only. A one sentence description of this vulnerability. + * + * Generated from protobuf field string short_description = 5; + * @param string $var + * @return $this + */ + public function setShortDescription($var) + { + GPBUtil::checkString($var, True); + $this->short_description = $var; + + return $this; + } + + /** + * Output only. A detailed description of this vulnerability. + * + * Generated from protobuf field string long_description = 6; + * @return string + */ + public function getLongDescription() + { + return $this->long_description; + } + + /** + * Output only. A detailed description of this vulnerability. + * + * Generated from protobuf field string long_description = 6; + * @param string $var + * @return $this + */ + public function setLongDescription($var) + { + GPBUtil::checkString($var, True); + $this->long_description = $var; + + return $this; + } + + /** + * Output only. URLs related to this vulnerability. + * + * Generated from protobuf field repeated .grafeas.v1.RelatedUrl related_urls = 7; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRelatedUrls() + { + return $this->related_urls; + } + + /** + * Output only. URLs related to this vulnerability. + * + * Generated from protobuf field repeated .grafeas.v1.RelatedUrl related_urls = 7; + * @param array<\Grafeas\V1\RelatedUrl>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRelatedUrls($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Grafeas\V1\RelatedUrl::class); + $this->related_urls = $arr; + + return $this; + } + + /** + * The distro assigned severity for this vulnerability when it is available, + * otherwise this is the note provider assigned severity. + * When there are multiple PackageIssues for this vulnerability, they can have + * different effective severities because some might be provided by the distro + * while others are provided by the language ecosystem for a language pack. + * For this reason, it is advised to use the effective severity on the + * PackageIssue level. In the case where multiple PackageIssues have differing + * effective severities, this field should be the highest severity for any of + * the PackageIssues. + * + * Generated from protobuf field .grafeas.v1.Severity effective_severity = 8; + * @return int + */ + public function getEffectiveSeverity() + { + return $this->effective_severity; + } + + /** + * The distro assigned severity for this vulnerability when it is available, + * otherwise this is the note provider assigned severity. + * When there are multiple PackageIssues for this vulnerability, they can have + * different effective severities because some might be provided by the distro + * while others are provided by the language ecosystem for a language pack. + * For this reason, it is advised to use the effective severity on the + * PackageIssue level. In the case where multiple PackageIssues have differing + * effective severities, this field should be the highest severity for any of + * the PackageIssues. + * + * Generated from protobuf field .grafeas.v1.Severity effective_severity = 8; + * @param int $var + * @return $this + */ + public function setEffectiveSeverity($var) + { + GPBUtil::checkEnum($var, \Grafeas\V1\Severity::class); + $this->effective_severity = $var; + + return $this; + } + + /** + * Output only. Whether at least one of the affected packages has a fix + * available. + * + * Generated from protobuf field bool fix_available = 9; + * @return bool + */ + public function getFixAvailable() + { + return $this->fix_available; + } + + /** + * Output only. Whether at least one of the affected packages has a fix + * available. + * + * Generated from protobuf field bool fix_available = 9; + * @param bool $var + * @return $this + */ + public function setFixAvailable($var) + { + GPBUtil::checkBool($var); + $this->fix_available = $var; + + return $this; + } + + /** + * Output only. CVSS version used to populate cvss_score and severity. + * + * Generated from protobuf field .grafeas.v1.CVSSVersion cvss_version = 11; + * @return int + */ + public function getCvssVersion() + { + return $this->cvss_version; + } + + /** + * Output only. CVSS version used to populate cvss_score and severity. + * + * Generated from protobuf field .grafeas.v1.CVSSVersion cvss_version = 11; + * @param int $var + * @return $this + */ + public function setCvssVersion($var) + { + GPBUtil::checkEnum($var, \Grafeas\V1\CVSSVersion::class); + $this->cvss_version = $var; + + return $this; + } + + /** + * The cvss v2 score for the vulnerability. + * + * Generated from protobuf field .grafeas.v1.CVSS cvss_v2 = 12; + * @return \Grafeas\V1\CVSS|null + */ + public function getCvssV2() + { + return $this->cvss_v2; + } + + public function hasCvssV2() + { + return isset($this->cvss_v2); + } + + public function clearCvssV2() + { + unset($this->cvss_v2); + } + + /** + * The cvss v2 score for the vulnerability. + * + * Generated from protobuf field .grafeas.v1.CVSS cvss_v2 = 12; + * @param \Grafeas\V1\CVSS $var + * @return $this + */ + public function setCvssV2($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\CVSS::class); + $this->cvss_v2 = $var; + + return $this; + } + + /** + * Generated from protobuf field .grafeas.v1.VulnerabilityOccurrence.VexAssessment vex_assessment = 13; + * @return \Grafeas\V1\VulnerabilityOccurrence\VexAssessment|null + */ + public function getVexAssessment() + { + return $this->vex_assessment; + } + + public function hasVexAssessment() + { + return isset($this->vex_assessment); + } + + public function clearVexAssessment() + { + unset($this->vex_assessment); + } + + /** + * Generated from protobuf field .grafeas.v1.VulnerabilityOccurrence.VexAssessment vex_assessment = 13; + * @param \Grafeas\V1\VulnerabilityOccurrence\VexAssessment $var + * @return $this + */ + public function setVexAssessment($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\VulnerabilityOccurrence\VexAssessment::class); + $this->vex_assessment = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/VulnerabilityOccurrence/PackageIssue.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/VulnerabilityOccurrence/PackageIssue.php new file mode 100644 index 000000000000..50eb18f7d2f5 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/VulnerabilityOccurrence/PackageIssue.php @@ -0,0 +1,429 @@ +grafeas.v1.VulnerabilityOccurrence.PackageIssue + */ +class PackageIssue extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The [CPE URI](https://cpe.mitre.org/specification/) this + * vulnerability was found in. + * + * Generated from protobuf field string affected_cpe_uri = 1; + */ + protected $affected_cpe_uri = ''; + /** + * Required. The package this vulnerability was found in. + * + * Generated from protobuf field string affected_package = 2; + */ + protected $affected_package = ''; + /** + * Required. The version of the package that is installed on the resource + * affected by this vulnerability. + * + * Generated from protobuf field .grafeas.v1.Version affected_version = 3; + */ + protected $affected_version = null; + /** + * The [CPE URI](https://cpe.mitre.org/specification/) this vulnerability + * was fixed in. It is possible for this to be different from the + * affected_cpe_uri. + * + * Generated from protobuf field string fixed_cpe_uri = 4; + */ + protected $fixed_cpe_uri = ''; + /** + * The package this vulnerability was fixed in. It is possible for this to + * be different from the affected_package. + * + * Generated from protobuf field string fixed_package = 5; + */ + protected $fixed_package = ''; + /** + * Required. The version of the package this vulnerability was fixed in. + * Setting this to VersionKind.MAXIMUM means no fix is yet available. + * + * Generated from protobuf field .grafeas.v1.Version fixed_version = 6; + */ + protected $fixed_version = null; + /** + * Output only. Whether a fix is available for this package. + * + * Generated from protobuf field bool fix_available = 7; + */ + protected $fix_available = false; + /** + * The type of package (e.g. OS, MAVEN, GO). + * + * Generated from protobuf field string package_type = 8; + */ + protected $package_type = ''; + /** + * The distro or language system assigned severity for this vulnerability + * when that is available and note provider assigned severity when it is not + * available. + * + * Generated from protobuf field .grafeas.v1.Severity effective_severity = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $effective_severity = 0; + /** + * The location at which this package was found. + * + * Generated from protobuf field repeated .grafeas.v1.FileLocation file_location = 10; + */ + private $file_location; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $affected_cpe_uri + * Required. The [CPE URI](https://cpe.mitre.org/specification/) this + * vulnerability was found in. + * @type string $affected_package + * Required. The package this vulnerability was found in. + * @type \Grafeas\V1\Version $affected_version + * Required. The version of the package that is installed on the resource + * affected by this vulnerability. + * @type string $fixed_cpe_uri + * The [CPE URI](https://cpe.mitre.org/specification/) this vulnerability + * was fixed in. It is possible for this to be different from the + * affected_cpe_uri. + * @type string $fixed_package + * The package this vulnerability was fixed in. It is possible for this to + * be different from the affected_package. + * @type \Grafeas\V1\Version $fixed_version + * Required. The version of the package this vulnerability was fixed in. + * Setting this to VersionKind.MAXIMUM means no fix is yet available. + * @type bool $fix_available + * Output only. Whether a fix is available for this package. + * @type string $package_type + * The type of package (e.g. OS, MAVEN, GO). + * @type int $effective_severity + * The distro or language system assigned severity for this vulnerability + * when that is available and note provider assigned severity when it is not + * available. + * @type array<\Grafeas\V1\FileLocation>|\Google\Protobuf\Internal\RepeatedField $file_location + * The location at which this package was found. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Vulnerability::initOnce(); + parent::__construct($data); + } + + /** + * Required. The [CPE URI](https://cpe.mitre.org/specification/) this + * vulnerability was found in. + * + * Generated from protobuf field string affected_cpe_uri = 1; + * @return string + */ + public function getAffectedCpeUri() + { + return $this->affected_cpe_uri; + } + + /** + * Required. The [CPE URI](https://cpe.mitre.org/specification/) this + * vulnerability was found in. + * + * Generated from protobuf field string affected_cpe_uri = 1; + * @param string $var + * @return $this + */ + public function setAffectedCpeUri($var) + { + GPBUtil::checkString($var, True); + $this->affected_cpe_uri = $var; + + return $this; + } + + /** + * Required. The package this vulnerability was found in. + * + * Generated from protobuf field string affected_package = 2; + * @return string + */ + public function getAffectedPackage() + { + return $this->affected_package; + } + + /** + * Required. The package this vulnerability was found in. + * + * Generated from protobuf field string affected_package = 2; + * @param string $var + * @return $this + */ + public function setAffectedPackage($var) + { + GPBUtil::checkString($var, True); + $this->affected_package = $var; + + return $this; + } + + /** + * Required. The version of the package that is installed on the resource + * affected by this vulnerability. + * + * Generated from protobuf field .grafeas.v1.Version affected_version = 3; + * @return \Grafeas\V1\Version|null + */ + public function getAffectedVersion() + { + return $this->affected_version; + } + + public function hasAffectedVersion() + { + return isset($this->affected_version); + } + + public function clearAffectedVersion() + { + unset($this->affected_version); + } + + /** + * Required. The version of the package that is installed on the resource + * affected by this vulnerability. + * + * Generated from protobuf field .grafeas.v1.Version affected_version = 3; + * @param \Grafeas\V1\Version $var + * @return $this + */ + public function setAffectedVersion($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\Version::class); + $this->affected_version = $var; + + return $this; + } + + /** + * The [CPE URI](https://cpe.mitre.org/specification/) this vulnerability + * was fixed in. It is possible for this to be different from the + * affected_cpe_uri. + * + * Generated from protobuf field string fixed_cpe_uri = 4; + * @return string + */ + public function getFixedCpeUri() + { + return $this->fixed_cpe_uri; + } + + /** + * The [CPE URI](https://cpe.mitre.org/specification/) this vulnerability + * was fixed in. It is possible for this to be different from the + * affected_cpe_uri. + * + * Generated from protobuf field string fixed_cpe_uri = 4; + * @param string $var + * @return $this + */ + public function setFixedCpeUri($var) + { + GPBUtil::checkString($var, True); + $this->fixed_cpe_uri = $var; + + return $this; + } + + /** + * The package this vulnerability was fixed in. It is possible for this to + * be different from the affected_package. + * + * Generated from protobuf field string fixed_package = 5; + * @return string + */ + public function getFixedPackage() + { + return $this->fixed_package; + } + + /** + * The package this vulnerability was fixed in. It is possible for this to + * be different from the affected_package. + * + * Generated from protobuf field string fixed_package = 5; + * @param string $var + * @return $this + */ + public function setFixedPackage($var) + { + GPBUtil::checkString($var, True); + $this->fixed_package = $var; + + return $this; + } + + /** + * Required. The version of the package this vulnerability was fixed in. + * Setting this to VersionKind.MAXIMUM means no fix is yet available. + * + * Generated from protobuf field .grafeas.v1.Version fixed_version = 6; + * @return \Grafeas\V1\Version|null + */ + public function getFixedVersion() + { + return $this->fixed_version; + } + + public function hasFixedVersion() + { + return isset($this->fixed_version); + } + + public function clearFixedVersion() + { + unset($this->fixed_version); + } + + /** + * Required. The version of the package this vulnerability was fixed in. + * Setting this to VersionKind.MAXIMUM means no fix is yet available. + * + * Generated from protobuf field .grafeas.v1.Version fixed_version = 6; + * @param \Grafeas\V1\Version $var + * @return $this + */ + public function setFixedVersion($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\Version::class); + $this->fixed_version = $var; + + return $this; + } + + /** + * Output only. Whether a fix is available for this package. + * + * Generated from protobuf field bool fix_available = 7; + * @return bool + */ + public function getFixAvailable() + { + return $this->fix_available; + } + + /** + * Output only. Whether a fix is available for this package. + * + * Generated from protobuf field bool fix_available = 7; + * @param bool $var + * @return $this + */ + public function setFixAvailable($var) + { + GPBUtil::checkBool($var); + $this->fix_available = $var; + + return $this; + } + + /** + * The type of package (e.g. OS, MAVEN, GO). + * + * Generated from protobuf field string package_type = 8; + * @return string + */ + public function getPackageType() + { + return $this->package_type; + } + + /** + * The type of package (e.g. OS, MAVEN, GO). + * + * Generated from protobuf field string package_type = 8; + * @param string $var + * @return $this + */ + public function setPackageType($var) + { + GPBUtil::checkString($var, True); + $this->package_type = $var; + + return $this; + } + + /** + * The distro or language system assigned severity for this vulnerability + * when that is available and note provider assigned severity when it is not + * available. + * + * Generated from protobuf field .grafeas.v1.Severity effective_severity = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getEffectiveSeverity() + { + return $this->effective_severity; + } + + /** + * The distro or language system assigned severity for this vulnerability + * when that is available and note provider assigned severity when it is not + * available. + * + * Generated from protobuf field .grafeas.v1.Severity effective_severity = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setEffectiveSeverity($var) + { + GPBUtil::checkEnum($var, \Grafeas\V1\Severity::class); + $this->effective_severity = $var; + + return $this; + } + + /** + * The location at which this package was found. + * + * Generated from protobuf field repeated .grafeas.v1.FileLocation file_location = 10; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getFileLocation() + { + return $this->file_location; + } + + /** + * The location at which this package was found. + * + * Generated from protobuf field repeated .grafeas.v1.FileLocation file_location = 10; + * @param array<\Grafeas\V1\FileLocation>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setFileLocation($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Grafeas\V1\FileLocation::class); + $this->file_location = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(PackageIssue::class, \Grafeas\V1\VulnerabilityOccurrence_PackageIssue::class); + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/VulnerabilityOccurrence/VexAssessment.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/VulnerabilityOccurrence/VexAssessment.php new file mode 100644 index 000000000000..da3e263a0a2b --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/VulnerabilityOccurrence/VexAssessment.php @@ -0,0 +1,317 @@ +grafeas.v1.VulnerabilityOccurrence.VexAssessment + */ +class VexAssessment extends \Google\Protobuf\Internal\Message +{ + /** + * Holds the MITRE standard Common Vulnerabilities and Exposures (CVE) + * tracking number for the vulnerability. + * + * Generated from protobuf field string cve = 1; + */ + protected $cve = ''; + /** + * Holds a list of references associated with this vulnerability item and + * assessment. + * + * Generated from protobuf field repeated .grafeas.v1.RelatedUrl related_uris = 2; + */ + private $related_uris; + /** + * The VulnerabilityAssessment note from which this VexAssessment was + * generated. + * This will be of the form: `projects/[PROJECT_ID]/notes/[NOTE_ID]`. + * (-- api-linter: core::0122::name-suffix=disabled + * aip.dev/not-precedent: The suffix is kept for consistency. --) + * + * Generated from protobuf field string note_name = 3; + */ + protected $note_name = ''; + /** + * Provides the state of this Vulnerability assessment. + * + * Generated from protobuf field .grafeas.v1.VulnerabilityAssessmentNote.Assessment.State state = 4; + */ + protected $state = 0; + /** + * Contains information about the impact of this vulnerability, + * this will change with time. + * + * Generated from protobuf field repeated string impacts = 5; + */ + private $impacts; + /** + * Specifies details on how to handle (and presumably, fix) a vulnerability. + * + * Generated from protobuf field repeated .grafeas.v1.VulnerabilityAssessmentNote.Assessment.Remediation remediations = 6; + */ + private $remediations; + /** + * Justification provides the justification when the state of the + * assessment if NOT_AFFECTED. + * + * Generated from protobuf field .grafeas.v1.VulnerabilityAssessmentNote.Assessment.Justification justification = 7; + */ + protected $justification = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $cve + * Holds the MITRE standard Common Vulnerabilities and Exposures (CVE) + * tracking number for the vulnerability. + * @type array<\Grafeas\V1\RelatedUrl>|\Google\Protobuf\Internal\RepeatedField $related_uris + * Holds a list of references associated with this vulnerability item and + * assessment. + * @type string $note_name + * The VulnerabilityAssessment note from which this VexAssessment was + * generated. + * This will be of the form: `projects/[PROJECT_ID]/notes/[NOTE_ID]`. + * (-- api-linter: core::0122::name-suffix=disabled + * aip.dev/not-precedent: The suffix is kept for consistency. --) + * @type int $state + * Provides the state of this Vulnerability assessment. + * @type array|\Google\Protobuf\Internal\RepeatedField $impacts + * Contains information about the impact of this vulnerability, + * this will change with time. + * @type array<\Grafeas\V1\VulnerabilityAssessmentNote\Assessment\Remediation>|\Google\Protobuf\Internal\RepeatedField $remediations + * Specifies details on how to handle (and presumably, fix) a vulnerability. + * @type \Grafeas\V1\VulnerabilityAssessmentNote\Assessment\Justification $justification + * Justification provides the justification when the state of the + * assessment if NOT_AFFECTED. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Vulnerability::initOnce(); + parent::__construct($data); + } + + /** + * Holds the MITRE standard Common Vulnerabilities and Exposures (CVE) + * tracking number for the vulnerability. + * + * Generated from protobuf field string cve = 1; + * @return string + */ + public function getCve() + { + return $this->cve; + } + + /** + * Holds the MITRE standard Common Vulnerabilities and Exposures (CVE) + * tracking number for the vulnerability. + * + * Generated from protobuf field string cve = 1; + * @param string $var + * @return $this + */ + public function setCve($var) + { + GPBUtil::checkString($var, True); + $this->cve = $var; + + return $this; + } + + /** + * Holds a list of references associated with this vulnerability item and + * assessment. + * + * Generated from protobuf field repeated .grafeas.v1.RelatedUrl related_uris = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRelatedUris() + { + return $this->related_uris; + } + + /** + * Holds a list of references associated with this vulnerability item and + * assessment. + * + * Generated from protobuf field repeated .grafeas.v1.RelatedUrl related_uris = 2; + * @param array<\Grafeas\V1\RelatedUrl>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRelatedUris($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Grafeas\V1\RelatedUrl::class); + $this->related_uris = $arr; + + return $this; + } + + /** + * The VulnerabilityAssessment note from which this VexAssessment was + * generated. + * This will be of the form: `projects/[PROJECT_ID]/notes/[NOTE_ID]`. + * (-- api-linter: core::0122::name-suffix=disabled + * aip.dev/not-precedent: The suffix is kept for consistency. --) + * + * Generated from protobuf field string note_name = 3; + * @return string + */ + public function getNoteName() + { + return $this->note_name; + } + + /** + * The VulnerabilityAssessment note from which this VexAssessment was + * generated. + * This will be of the form: `projects/[PROJECT_ID]/notes/[NOTE_ID]`. + * (-- api-linter: core::0122::name-suffix=disabled + * aip.dev/not-precedent: The suffix is kept for consistency. --) + * + * Generated from protobuf field string note_name = 3; + * @param string $var + * @return $this + */ + public function setNoteName($var) + { + GPBUtil::checkString($var, True); + $this->note_name = $var; + + return $this; + } + + /** + * Provides the state of this Vulnerability assessment. + * + * Generated from protobuf field .grafeas.v1.VulnerabilityAssessmentNote.Assessment.State state = 4; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Provides the state of this Vulnerability assessment. + * + * Generated from protobuf field .grafeas.v1.VulnerabilityAssessmentNote.Assessment.State state = 4; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Grafeas\V1\VulnerabilityAssessmentNote\Assessment\State::class); + $this->state = $var; + + return $this; + } + + /** + * Contains information about the impact of this vulnerability, + * this will change with time. + * + * Generated from protobuf field repeated string impacts = 5; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getImpacts() + { + return $this->impacts; + } + + /** + * Contains information about the impact of this vulnerability, + * this will change with time. + * + * Generated from protobuf field repeated string impacts = 5; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setImpacts($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->impacts = $arr; + + return $this; + } + + /** + * Specifies details on how to handle (and presumably, fix) a vulnerability. + * + * Generated from protobuf field repeated .grafeas.v1.VulnerabilityAssessmentNote.Assessment.Remediation remediations = 6; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRemediations() + { + return $this->remediations; + } + + /** + * Specifies details on how to handle (and presumably, fix) a vulnerability. + * + * Generated from protobuf field repeated .grafeas.v1.VulnerabilityAssessmentNote.Assessment.Remediation remediations = 6; + * @param array<\Grafeas\V1\VulnerabilityAssessmentNote\Assessment\Remediation>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRemediations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Grafeas\V1\VulnerabilityAssessmentNote\Assessment\Remediation::class); + $this->remediations = $arr; + + return $this; + } + + /** + * Justification provides the justification when the state of the + * assessment if NOT_AFFECTED. + * + * Generated from protobuf field .grafeas.v1.VulnerabilityAssessmentNote.Assessment.Justification justification = 7; + * @return \Grafeas\V1\VulnerabilityAssessmentNote\Assessment\Justification|null + */ + public function getJustification() + { + return $this->justification; + } + + public function hasJustification() + { + return isset($this->justification); + } + + public function clearJustification() + { + unset($this->justification); + } + + /** + * Justification provides the justification when the state of the + * assessment if NOT_AFFECTED. + * + * Generated from protobuf field .grafeas.v1.VulnerabilityAssessmentNote.Assessment.Justification justification = 7; + * @param \Grafeas\V1\VulnerabilityAssessmentNote\Assessment\Justification $var + * @return $this + */ + public function setJustification($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\VulnerabilityAssessmentNote\Assessment\Justification::class); + $this->justification = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(VexAssessment::class, \Grafeas\V1\VulnerabilityOccurrence_VexAssessment::class); + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/VulnerabilityOccurrence_PackageIssue.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/VulnerabilityOccurrence_PackageIssue.php new file mode 100644 index 000000000000..cc29d1796f14 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/VulnerabilityOccurrence_PackageIssue.php @@ -0,0 +1,16 @@ +grafeas.v1.WindowsUpdate + */ +class WindowsUpdate extends \Google\Protobuf\Internal\Message +{ + /** + * Required - The unique identifier for the update. + * + * Generated from protobuf field .grafeas.v1.WindowsUpdate.Identity identity = 1; + */ + protected $identity = null; + /** + * The localized title of the update. + * + * Generated from protobuf field string title = 2; + */ + protected $title = ''; + /** + * The localized description of the update. + * + * Generated from protobuf field string description = 3; + */ + protected $description = ''; + /** + * The list of categories to which the update belongs. + * + * Generated from protobuf field repeated .grafeas.v1.WindowsUpdate.Category categories = 4; + */ + private $categories; + /** + * The Microsoft Knowledge Base article IDs that are associated with the + * update. + * + * Generated from protobuf field repeated string kb_article_ids = 5; + */ + private $kb_article_ids; + /** + * The hyperlink to the support information for the update. + * + * Generated from protobuf field string support_url = 6; + */ + protected $support_url = ''; + /** + * The last published timestamp of the update. + * + * Generated from protobuf field .google.protobuf.Timestamp last_published_timestamp = 7; + */ + protected $last_published_timestamp = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Grafeas\V1\WindowsUpdate\Identity $identity + * Required - The unique identifier for the update. + * @type string $title + * The localized title of the update. + * @type string $description + * The localized description of the update. + * @type array<\Grafeas\V1\WindowsUpdate\Category>|\Google\Protobuf\Internal\RepeatedField $categories + * The list of categories to which the update belongs. + * @type array|\Google\Protobuf\Internal\RepeatedField $kb_article_ids + * The Microsoft Knowledge Base article IDs that are associated with the + * update. + * @type string $support_url + * The hyperlink to the support information for the update. + * @type \Google\Protobuf\Timestamp $last_published_timestamp + * The last published timestamp of the update. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Upgrade::initOnce(); + parent::__construct($data); + } + + /** + * Required - The unique identifier for the update. + * + * Generated from protobuf field .grafeas.v1.WindowsUpdate.Identity identity = 1; + * @return \Grafeas\V1\WindowsUpdate\Identity|null + */ + public function getIdentity() + { + return $this->identity; + } + + public function hasIdentity() + { + return isset($this->identity); + } + + public function clearIdentity() + { + unset($this->identity); + } + + /** + * Required - The unique identifier for the update. + * + * Generated from protobuf field .grafeas.v1.WindowsUpdate.Identity identity = 1; + * @param \Grafeas\V1\WindowsUpdate\Identity $var + * @return $this + */ + public function setIdentity($var) + { + GPBUtil::checkMessage($var, \Grafeas\V1\WindowsUpdate\Identity::class); + $this->identity = $var; + + return $this; + } + + /** + * The localized title of the update. + * + * Generated from protobuf field string title = 2; + * @return string + */ + public function getTitle() + { + return $this->title; + } + + /** + * The localized title of the update. + * + * Generated from protobuf field string title = 2; + * @param string $var + * @return $this + */ + public function setTitle($var) + { + GPBUtil::checkString($var, True); + $this->title = $var; + + return $this; + } + + /** + * The localized description of the update. + * + * Generated from protobuf field string description = 3; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * The localized description of the update. + * + * Generated from protobuf field string description = 3; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * The list of categories to which the update belongs. + * + * Generated from protobuf field repeated .grafeas.v1.WindowsUpdate.Category categories = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getCategories() + { + return $this->categories; + } + + /** + * The list of categories to which the update belongs. + * + * Generated from protobuf field repeated .grafeas.v1.WindowsUpdate.Category categories = 4; + * @param array<\Grafeas\V1\WindowsUpdate\Category>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setCategories($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Grafeas\V1\WindowsUpdate\Category::class); + $this->categories = $arr; + + return $this; + } + + /** + * The Microsoft Knowledge Base article IDs that are associated with the + * update. + * + * Generated from protobuf field repeated string kb_article_ids = 5; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getKbArticleIds() + { + return $this->kb_article_ids; + } + + /** + * The Microsoft Knowledge Base article IDs that are associated with the + * update. + * + * Generated from protobuf field repeated string kb_article_ids = 5; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setKbArticleIds($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->kb_article_ids = $arr; + + return $this; + } + + /** + * The hyperlink to the support information for the update. + * + * Generated from protobuf field string support_url = 6; + * @return string + */ + public function getSupportUrl() + { + return $this->support_url; + } + + /** + * The hyperlink to the support information for the update. + * + * Generated from protobuf field string support_url = 6; + * @param string $var + * @return $this + */ + public function setSupportUrl($var) + { + GPBUtil::checkString($var, True); + $this->support_url = $var; + + return $this; + } + + /** + * The last published timestamp of the update. + * + * Generated from protobuf field .google.protobuf.Timestamp last_published_timestamp = 7; + * @return \Google\Protobuf\Timestamp|null + */ + public function getLastPublishedTimestamp() + { + return $this->last_published_timestamp; + } + + public function hasLastPublishedTimestamp() + { + return isset($this->last_published_timestamp); + } + + public function clearLastPublishedTimestamp() + { + unset($this->last_published_timestamp); + } + + /** + * The last published timestamp of the update. + * + * Generated from protobuf field .google.protobuf.Timestamp last_published_timestamp = 7; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setLastPublishedTimestamp($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->last_published_timestamp = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/WindowsUpdate/Category.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/WindowsUpdate/Category.php new file mode 100644 index 000000000000..f3fc03d57a42 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/WindowsUpdate/Category.php @@ -0,0 +1,104 @@ +grafeas.v1.WindowsUpdate.Category + */ +class Category extends \Google\Protobuf\Internal\Message +{ + /** + * The identifier of the category. + * + * Generated from protobuf field string category_id = 1; + */ + protected $category_id = ''; + /** + * The localized name of the category. + * + * Generated from protobuf field string name = 2; + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $category_id + * The identifier of the category. + * @type string $name + * The localized name of the category. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Upgrade::initOnce(); + parent::__construct($data); + } + + /** + * The identifier of the category. + * + * Generated from protobuf field string category_id = 1; + * @return string + */ + public function getCategoryId() + { + return $this->category_id; + } + + /** + * The identifier of the category. + * + * Generated from protobuf field string category_id = 1; + * @param string $var + * @return $this + */ + public function setCategoryId($var) + { + GPBUtil::checkString($var, True); + $this->category_id = $var; + + return $this; + } + + /** + * The localized name of the category. + * + * Generated from protobuf field string name = 2; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The localized name of the category. + * + * Generated from protobuf field string name = 2; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Category::class, \Grafeas\V1\WindowsUpdate_Category::class); + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/WindowsUpdate/Identity.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/WindowsUpdate/Identity.php new file mode 100644 index 000000000000..8d4340a93fc8 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/WindowsUpdate/Identity.php @@ -0,0 +1,104 @@ +grafeas.v1.WindowsUpdate.Identity + */ +class Identity extends \Google\Protobuf\Internal\Message +{ + /** + * The revision independent identifier of the update. + * + * Generated from protobuf field string update_id = 1; + */ + protected $update_id = ''; + /** + * The revision number of the update. + * + * Generated from protobuf field int32 revision = 2; + */ + protected $revision = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $update_id + * The revision independent identifier of the update. + * @type int $revision + * The revision number of the update. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Grafeas\V1\Upgrade::initOnce(); + parent::__construct($data); + } + + /** + * The revision independent identifier of the update. + * + * Generated from protobuf field string update_id = 1; + * @return string + */ + public function getUpdateId() + { + return $this->update_id; + } + + /** + * The revision independent identifier of the update. + * + * Generated from protobuf field string update_id = 1; + * @param string $var + * @return $this + */ + public function setUpdateId($var) + { + GPBUtil::checkString($var, True); + $this->update_id = $var; + + return $this; + } + + /** + * The revision number of the update. + * + * Generated from protobuf field int32 revision = 2; + * @return int + */ + public function getRevision() + { + return $this->revision; + } + + /** + * The revision number of the update. + * + * Generated from protobuf field int32 revision = 2; + * @param int $var + * @return $this + */ + public function setRevision($var) + { + GPBUtil::checkInt32($var); + $this->revision = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Identity::class, \Grafeas\V1\WindowsUpdate_Identity::class); + diff --git a/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/WindowsUpdate_Category.php b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/WindowsUpdate_Category.php new file mode 100644 index 000000000000..4acf25cc639c --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/proto/src/Grafeas/V1/WindowsUpdate_Category.php @@ -0,0 +1,16 @@ +setParent($formattedParent) + ->setNotes($notes); + + // Call the API and handle any network failures. + try { + /** @var BatchCreateNotesResponse $response */ + $response = $grafeasClient->batchCreateNotes($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 = GrafeasClient::projectName('[PROJECT]'); + + batch_create_notes_sample($formattedParent); +} +// [END containeranalysis_v1_generated_Grafeas_BatchCreateNotes_sync] diff --git a/owl-bot-staging/Grafeas/v1/samples/V1/GrafeasClient/batch_create_occurrences.php b/owl-bot-staging/Grafeas/v1/samples/V1/GrafeasClient/batch_create_occurrences.php new file mode 100644 index 000000000000..52b5c4f184af --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/samples/V1/GrafeasClient/batch_create_occurrences.php @@ -0,0 +1,75 @@ +setParent($formattedParent) + ->setOccurrences($occurrences); + + // Call the API and handle any network failures. + try { + /** @var BatchCreateOccurrencesResponse $response */ + $response = $grafeasClient->batchCreateOccurrences($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 = GrafeasClient::projectName('[PROJECT]'); + + batch_create_occurrences_sample($formattedParent); +} +// [END containeranalysis_v1_generated_Grafeas_BatchCreateOccurrences_sync] diff --git a/owl-bot-staging/Grafeas/v1/samples/V1/GrafeasClient/create_note.php b/owl-bot-staging/Grafeas/v1/samples/V1/GrafeasClient/create_note.php new file mode 100644 index 000000000000..02b5db64f4a7 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/samples/V1/GrafeasClient/create_note.php @@ -0,0 +1,77 @@ +setParent($formattedParent) + ->setNoteId($noteId) + ->setNote($note); + + // Call the API and handle any network failures. + try { + /** @var Note $response */ + $response = $grafeasClient->createNote($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 = GrafeasClient::projectName('[PROJECT]'); + $noteId = '[NOTE_ID]'; + + create_note_sample($formattedParent, $noteId); +} +// [END containeranalysis_v1_generated_Grafeas_CreateNote_sync] diff --git a/owl-bot-staging/Grafeas/v1/samples/V1/GrafeasClient/create_occurrence.php b/owl-bot-staging/Grafeas/v1/samples/V1/GrafeasClient/create_occurrence.php new file mode 100644 index 000000000000..df3006b54d16 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/samples/V1/GrafeasClient/create_occurrence.php @@ -0,0 +1,74 @@ +setParent($formattedParent) + ->setOccurrence($occurrence); + + // Call the API and handle any network failures. + try { + /** @var Occurrence $response */ + $response = $grafeasClient->createOccurrence($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 = GrafeasClient::projectName('[PROJECT]'); + + create_occurrence_sample($formattedParent); +} +// [END containeranalysis_v1_generated_Grafeas_CreateOccurrence_sync] diff --git a/owl-bot-staging/Grafeas/v1/samples/V1/GrafeasClient/delete_note.php b/owl-bot-staging/Grafeas/v1/samples/V1/GrafeasClient/delete_note.php new file mode 100644 index 000000000000..87c2e15b20f0 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/samples/V1/GrafeasClient/delete_note.php @@ -0,0 +1,70 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + $grafeasClient->deleteNote($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 = GrafeasClient::noteName('[PROJECT]', '[NOTE]'); + + delete_note_sample($formattedName); +} +// [END containeranalysis_v1_generated_Grafeas_DeleteNote_sync] diff --git a/owl-bot-staging/Grafeas/v1/samples/V1/GrafeasClient/delete_occurrence.php b/owl-bot-staging/Grafeas/v1/samples/V1/GrafeasClient/delete_occurrence.php new file mode 100644 index 000000000000..5ec4e1deb526 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/samples/V1/GrafeasClient/delete_occurrence.php @@ -0,0 +1,72 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + $grafeasClient->deleteOccurrence($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 = GrafeasClient::occurrenceName('[PROJECT]', '[OCCURRENCE]'); + + delete_occurrence_sample($formattedName); +} +// [END containeranalysis_v1_generated_Grafeas_DeleteOccurrence_sync] diff --git a/owl-bot-staging/Grafeas/v1/samples/V1/GrafeasClient/get_note.php b/owl-bot-staging/Grafeas/v1/samples/V1/GrafeasClient/get_note.php new file mode 100644 index 000000000000..542b5f662a47 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/samples/V1/GrafeasClient/get_note.php @@ -0,0 +1,72 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var Note $response */ + $response = $grafeasClient->getNote($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 = GrafeasClient::noteName('[PROJECT]', '[NOTE]'); + + get_note_sample($formattedName); +} +// [END containeranalysis_v1_generated_Grafeas_GetNote_sync] diff --git a/owl-bot-staging/Grafeas/v1/samples/V1/GrafeasClient/get_occurrence.php b/owl-bot-staging/Grafeas/v1/samples/V1/GrafeasClient/get_occurrence.php new file mode 100644 index 000000000000..885dd0eab887 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/samples/V1/GrafeasClient/get_occurrence.php @@ -0,0 +1,72 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var Occurrence $response */ + $response = $grafeasClient->getOccurrence($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 = GrafeasClient::occurrenceName('[PROJECT]', '[OCCURRENCE]'); + + get_occurrence_sample($formattedName); +} +// [END containeranalysis_v1_generated_Grafeas_GetOccurrence_sync] diff --git a/owl-bot-staging/Grafeas/v1/samples/V1/GrafeasClient/get_occurrence_note.php b/owl-bot-staging/Grafeas/v1/samples/V1/GrafeasClient/get_occurrence_note.php new file mode 100644 index 000000000000..1356b536ddfb --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/samples/V1/GrafeasClient/get_occurrence_note.php @@ -0,0 +1,73 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var Note $response */ + $response = $grafeasClient->getOccurrenceNote($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 = GrafeasClient::occurrenceName('[PROJECT]', '[OCCURRENCE]'); + + get_occurrence_note_sample($formattedName); +} +// [END containeranalysis_v1_generated_Grafeas_GetOccurrenceNote_sync] diff --git a/owl-bot-staging/Grafeas/v1/samples/V1/GrafeasClient/list_note_occurrences.php b/owl-bot-staging/Grafeas/v1/samples/V1/GrafeasClient/list_note_occurrences.php new file mode 100644 index 000000000000..d617728ecc25 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/samples/V1/GrafeasClient/list_note_occurrences.php @@ -0,0 +1,79 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $grafeasClient->listNoteOccurrences($request); + + /** @var Occurrence $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 +{ + $formattedName = GrafeasClient::noteName('[PROJECT]', '[NOTE]'); + + list_note_occurrences_sample($formattedName); +} +// [END containeranalysis_v1_generated_Grafeas_ListNoteOccurrences_sync] diff --git a/owl-bot-staging/Grafeas/v1/samples/V1/GrafeasClient/list_notes.php b/owl-bot-staging/Grafeas/v1/samples/V1/GrafeasClient/list_notes.php new file mode 100644 index 000000000000..f506ad12e76b --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/samples/V1/GrafeasClient/list_notes.php @@ -0,0 +1,77 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $grafeasClient->listNotes($request); + + /** @var Note $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 = GrafeasClient::projectName('[PROJECT]'); + + list_notes_sample($formattedParent); +} +// [END containeranalysis_v1_generated_Grafeas_ListNotes_sync] diff --git a/owl-bot-staging/Grafeas/v1/samples/V1/GrafeasClient/list_occurrences.php b/owl-bot-staging/Grafeas/v1/samples/V1/GrafeasClient/list_occurrences.php new file mode 100644 index 000000000000..af3b9723d79d --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/samples/V1/GrafeasClient/list_occurrences.php @@ -0,0 +1,77 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $grafeasClient->listOccurrences($request); + + /** @var Occurrence $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 = GrafeasClient::projectName('[PROJECT]'); + + list_occurrences_sample($formattedParent); +} +// [END containeranalysis_v1_generated_Grafeas_ListOccurrences_sync] diff --git a/owl-bot-staging/Grafeas/v1/samples/V1/GrafeasClient/update_note.php b/owl-bot-staging/Grafeas/v1/samples/V1/GrafeasClient/update_note.php new file mode 100644 index 000000000000..ba7151137be7 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/samples/V1/GrafeasClient/update_note.php @@ -0,0 +1,74 @@ +setName($formattedName) + ->setNote($note); + + // Call the API and handle any network failures. + try { + /** @var Note $response */ + $response = $grafeasClient->updateNote($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 = GrafeasClient::noteName('[PROJECT]', '[NOTE]'); + + update_note_sample($formattedName); +} +// [END containeranalysis_v1_generated_Grafeas_UpdateNote_sync] diff --git a/owl-bot-staging/Grafeas/v1/samples/V1/GrafeasClient/update_occurrence.php b/owl-bot-staging/Grafeas/v1/samples/V1/GrafeasClient/update_occurrence.php new file mode 100644 index 000000000000..59320199f236 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/samples/V1/GrafeasClient/update_occurrence.php @@ -0,0 +1,74 @@ +setName($formattedName) + ->setOccurrence($occurrence); + + // Call the API and handle any network failures. + try { + /** @var Occurrence $response */ + $response = $grafeasClient->updateOccurrence($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 = GrafeasClient::occurrenceName('[PROJECT]', '[OCCURRENCE]'); + + update_occurrence_sample($formattedName); +} +// [END containeranalysis_v1_generated_Grafeas_UpdateOccurrence_sync] diff --git a/owl-bot-staging/Grafeas/v1/src/V1/Client/BaseClient/GrafeasBaseClient.php b/owl-bot-staging/Grafeas/v1/src/V1/Client/BaseClient/GrafeasBaseClient.php new file mode 100644 index 000000000000..ae4c13780277 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/src/V1/Client/BaseClient/GrafeasBaseClient.php @@ -0,0 +1,622 @@ + self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../../resources/grafeas_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../../resources/grafeas_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../../resources/grafeas_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../../resources/grafeas_rest_client_config.php', + ], + ], + ]; + } + + /** + * Formats a string containing the fully-qualified path to represent a note + * resource. + * + * @param string $project + * @param string $note + * + * @return string The formatted note resource. + */ + public static function noteName(string $project, string $note): string + { + return self::getPathTemplate('note')->render([ + 'project' => $project, + 'note' => $note, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a occurrence + * resource. + * + * @param string $project + * @param string $occurrence + * + * @return string The formatted occurrence resource. + */ + public static function occurrenceName(string $project, string $occurrence): string + { + return self::getPathTemplate('occurrence')->render([ + 'project' => $project, + 'occurrence' => $occurrence, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a project + * resource. + * + * @param string $project + * + * @return string The formatted project resource. + */ + public static function projectName(string $project): string + { + return self::getPathTemplate('project')->render([ + 'project' => $project, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - note: projects/{project}/notes/{note} + * - occurrence: projects/{project}/occurrences/{occurrence} + * - project: projects/{project} + * + * 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 'containeranalysis.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. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *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' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods 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); + } + + /** 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 new notes in batch. + * + * The async variant is {@see self::batchCreateNotesAsync()} . + * + * @param BatchCreateNotesRequest $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 BatchCreateNotesResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function batchCreateNotes(BatchCreateNotesRequest $request, array $callOptions = []): BatchCreateNotesResponse + { + return $this->startApiCall('BatchCreateNotes', $request, $callOptions)->wait(); + } + + /** + * Creates new occurrences in batch. + * + * The async variant is {@see self::batchCreateOccurrencesAsync()} . + * + * @param BatchCreateOccurrencesRequest $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 BatchCreateOccurrencesResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function batchCreateOccurrences(BatchCreateOccurrencesRequest $request, array $callOptions = []): BatchCreateOccurrencesResponse + { + return $this->startApiCall('BatchCreateOccurrences', $request, $callOptions)->wait(); + } + + /** + * Creates a new note. + * + * The async variant is {@see self::createNoteAsync()} . + * + * @param CreateNoteRequest $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 Note + * + * @throws ApiException Thrown if the API call fails. + */ + public function createNote(CreateNoteRequest $request, array $callOptions = []): Note + { + return $this->startApiCall('CreateNote', $request, $callOptions)->wait(); + } + + /** + * Creates a new occurrence. + * + * The async variant is {@see self::createOccurrenceAsync()} . + * + * @param CreateOccurrenceRequest $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 Occurrence + * + * @throws ApiException Thrown if the API call fails. + */ + public function createOccurrence(CreateOccurrenceRequest $request, array $callOptions = []): Occurrence + { + return $this->startApiCall('CreateOccurrence', $request, $callOptions)->wait(); + } + + /** + * Deletes the specified note. + * + * The async variant is {@see self::deleteNoteAsync()} . + * + * @param DeleteNoteRequest $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 deleteNote(DeleteNoteRequest $request, array $callOptions = []): void + { + $this->startApiCall('DeleteNote', $request, $callOptions)->wait(); + } + + /** + * Deletes the specified occurrence. For example, use this method to delete an + * occurrence when the occurrence is no longer applicable for the given + * resource. + * + * The async variant is {@see self::deleteOccurrenceAsync()} . + * + * @param DeleteOccurrenceRequest $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 deleteOccurrence(DeleteOccurrenceRequest $request, array $callOptions = []): void + { + $this->startApiCall('DeleteOccurrence', $request, $callOptions)->wait(); + } + + /** + * Gets the specified note. + * + * The async variant is {@see self::getNoteAsync()} . + * + * @param GetNoteRequest $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 Note + * + * @throws ApiException Thrown if the API call fails. + */ + public function getNote(GetNoteRequest $request, array $callOptions = []): Note + { + return $this->startApiCall('GetNote', $request, $callOptions)->wait(); + } + + /** + * Gets the specified occurrence. + * + * The async variant is {@see self::getOccurrenceAsync()} . + * + * @param GetOccurrenceRequest $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 Occurrence + * + * @throws ApiException Thrown if the API call fails. + */ + public function getOccurrence(GetOccurrenceRequest $request, array $callOptions = []): Occurrence + { + return $this->startApiCall('GetOccurrence', $request, $callOptions)->wait(); + } + + /** + * Gets the note attached to the specified occurrence. Consumer projects can + * use this method to get a note that belongs to a provider project. + * + * The async variant is {@see self::getOccurrenceNoteAsync()} . + * + * @param GetOccurrenceNoteRequest $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 Note + * + * @throws ApiException Thrown if the API call fails. + */ + public function getOccurrenceNote(GetOccurrenceNoteRequest $request, array $callOptions = []): Note + { + return $this->startApiCall('GetOccurrenceNote', $request, $callOptions)->wait(); + } + + /** + * Lists occurrences referencing the specified note. Provider projects can use + * this method to get all occurrences across consumer projects referencing the + * specified note. + * + * The async variant is {@see self::listNoteOccurrencesAsync()} . + * + * @param ListNoteOccurrencesRequest $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 listNoteOccurrences(ListNoteOccurrencesRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListNoteOccurrences', $request, $callOptions); + } + + /** + * Lists notes for the specified project. + * + * The async variant is {@see self::listNotesAsync()} . + * + * @param ListNotesRequest $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 listNotes(ListNotesRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListNotes', $request, $callOptions); + } + + /** + * Lists occurrences for the specified project. + * + * The async variant is {@see self::listOccurrencesAsync()} . + * + * @param ListOccurrencesRequest $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 listOccurrences(ListOccurrencesRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListOccurrences', $request, $callOptions); + } + + /** + * Updates the specified note. + * + * The async variant is {@see self::updateNoteAsync()} . + * + * @param UpdateNoteRequest $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 Note + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateNote(UpdateNoteRequest $request, array $callOptions = []): Note + { + return $this->startApiCall('UpdateNote', $request, $callOptions)->wait(); + } + + /** + * Updates the specified occurrence. + * + * The async variant is {@see self::updateOccurrenceAsync()} . + * + * @param UpdateOccurrenceRequest $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 Occurrence + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateOccurrence(UpdateOccurrenceRequest $request, array $callOptions = []): Occurrence + { + return $this->startApiCall('UpdateOccurrence', $request, $callOptions)->wait(); + } +} diff --git a/owl-bot-staging/Grafeas/v1/src/V1/Client/GrafeasClient.php b/owl-bot-staging/Grafeas/v1/src/V1/Client/GrafeasClient.php new file mode 100644 index 000000000000..139f7f7da7d6 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/src/V1/Client/GrafeasClient.php @@ -0,0 +1,40 @@ +projectName('[PROJECT]'); + * $notes = []; + * $response = $grafeasClient->batchCreateNotes($formattedParent, $notes); + * } finally { + * $grafeasClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + */ +class GrafeasGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'grafeas.v1.Grafeas'; + + /** The default address of the service. */ + const SERVICE_ADDRESS = 'containeranalysis.googleapis.com'; + + /** The default port of the service. */ + const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = []; + + private static $noteNameTemplate; + + private static $occurrenceNameTemplate; + + private static $projectNameTemplate; + + private static $pathTemplateMap; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/grafeas_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/grafeas_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/grafeas_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/grafeas_rest_client_config.php', + ], + ], + ]; + } + + private static function getNoteNameTemplate() + { + if (self::$noteNameTemplate == null) { + self::$noteNameTemplate = new PathTemplate('projects/{project}/notes/{note}'); + } + + return self::$noteNameTemplate; + } + + private static function getOccurrenceNameTemplate() + { + if (self::$occurrenceNameTemplate == null) { + self::$occurrenceNameTemplate = new PathTemplate('projects/{project}/occurrences/{occurrence}'); + } + + return self::$occurrenceNameTemplate; + } + + private static function getProjectNameTemplate() + { + if (self::$projectNameTemplate == null) { + self::$projectNameTemplate = new PathTemplate('projects/{project}'); + } + + return self::$projectNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'note' => self::getNoteNameTemplate(), + 'occurrence' => self::getOccurrenceNameTemplate(), + 'project' => self::getProjectNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a note + * resource. + * + * @param string $project + * @param string $note + * + * @return string The formatted note resource. + */ + public static function noteName($project, $note) + { + return self::getNoteNameTemplate()->render([ + 'project' => $project, + 'note' => $note, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a occurrence + * resource. + * + * @param string $project + * @param string $occurrence + * + * @return string The formatted occurrence resource. + */ + public static function occurrenceName($project, $occurrence) + { + return self::getOccurrenceNameTemplate()->render([ + 'project' => $project, + 'occurrence' => $occurrence, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a project + * resource. + * + * @param string $project + * + * @return string The formatted project resource. + */ + public static function projectName($project) + { + return self::getProjectNameTemplate()->render([ + 'project' => $project, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - note: projects/{project}/notes/{note} + * - occurrence: projects/{project}/occurrences/{occurrence} + * - project: projects/{project} + * + * 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($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * 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 'containeranalysis.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. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *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' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods 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); + } + + /** + * Creates new notes in batch. + * + * Sample code: + * ``` + * $grafeasClient = new GrafeasClient(); + * try { + * $formattedParent = $grafeasClient->projectName('[PROJECT]'); + * $notes = []; + * $response = $grafeasClient->batchCreateNotes($formattedParent, $notes); + * } finally { + * $grafeasClient->close(); + * } + * ``` + * + * @param string $parent The name of the project in the form of `projects/[PROJECT_ID]`, under which + * the notes are to be created. + * @param array $notes The notes to create. Max allowed length is 1000. + * @param array $optionalArgs { + * 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 \Grafeas\V1\BatchCreateNotesResponse + * + * @throws ApiException if the remote call fails + */ + public function batchCreateNotes($parent, $notes, array $optionalArgs = []) + { + $request = new BatchCreateNotesRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setNotes($notes); + $requestParamHeaders['parent'] = $parent; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('BatchCreateNotes', BatchCreateNotesResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Creates new occurrences in batch. + * + * Sample code: + * ``` + * $grafeasClient = new GrafeasClient(); + * try { + * $formattedParent = $grafeasClient->projectName('[PROJECT]'); + * $occurrences = []; + * $response = $grafeasClient->batchCreateOccurrences($formattedParent, $occurrences); + * } finally { + * $grafeasClient->close(); + * } + * ``` + * + * @param string $parent The name of the project in the form of `projects/[PROJECT_ID]`, under which + * the occurrences are to be created. + * @param Occurrence[] $occurrences The occurrences to create. Max allowed length is 1000. + * @param array $optionalArgs { + * 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 \Grafeas\V1\BatchCreateOccurrencesResponse + * + * @throws ApiException if the remote call fails + */ + public function batchCreateOccurrences($parent, $occurrences, array $optionalArgs = []) + { + $request = new BatchCreateOccurrencesRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setOccurrences($occurrences); + $requestParamHeaders['parent'] = $parent; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('BatchCreateOccurrences', BatchCreateOccurrencesResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Creates a new note. + * + * Sample code: + * ``` + * $grafeasClient = new GrafeasClient(); + * try { + * $formattedParent = $grafeasClient->projectName('[PROJECT]'); + * $noteId = 'note_id'; + * $note = new Note(); + * $response = $grafeasClient->createNote($formattedParent, $noteId, $note); + * } finally { + * $grafeasClient->close(); + * } + * ``` + * + * @param string $parent The name of the project in the form of `projects/[PROJECT_ID]`, under which + * the note is to be created. + * @param string $noteId The ID to use for this note. + * @param Note $note The note to create. + * @param array $optionalArgs { + * 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 \Grafeas\V1\Note + * + * @throws ApiException if the remote call fails + */ + public function createNote($parent, $noteId, $note, array $optionalArgs = []) + { + $request = new CreateNoteRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setNoteId($noteId); + $request->setNote($note); + $requestParamHeaders['parent'] = $parent; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('CreateNote', Note::class, $optionalArgs, $request)->wait(); + } + + /** + * Creates a new occurrence. + * + * Sample code: + * ``` + * $grafeasClient = new GrafeasClient(); + * try { + * $formattedParent = $grafeasClient->projectName('[PROJECT]'); + * $occurrence = new Occurrence(); + * $response = $grafeasClient->createOccurrence($formattedParent, $occurrence); + * } finally { + * $grafeasClient->close(); + * } + * ``` + * + * @param string $parent The name of the project in the form of `projects/[PROJECT_ID]`, under which + * the occurrence is to be created. + * @param Occurrence $occurrence The occurrence to create. + * @param array $optionalArgs { + * 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 \Grafeas\V1\Occurrence + * + * @throws ApiException if the remote call fails + */ + public function createOccurrence($parent, $occurrence, array $optionalArgs = []) + { + $request = new CreateOccurrenceRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setOccurrence($occurrence); + $requestParamHeaders['parent'] = $parent; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('CreateOccurrence', Occurrence::class, $optionalArgs, $request)->wait(); + } + + /** + * Deletes the specified note. + * + * Sample code: + * ``` + * $grafeasClient = new GrafeasClient(); + * try { + * $formattedName = $grafeasClient->noteName('[PROJECT]', '[NOTE]'); + * $grafeasClient->deleteNote($formattedName); + * } finally { + * $grafeasClient->close(); + * } + * ``` + * + * @param string $name The name of the note in the form of + * `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. + * @param array $optionalArgs { + * 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 if the remote call fails + */ + public function deleteNote($name, array $optionalArgs = []) + { + $request = new DeleteNoteRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('DeleteNote', GPBEmpty::class, $optionalArgs, $request)->wait(); + } + + /** + * Deletes the specified occurrence. For example, use this method to delete an + * occurrence when the occurrence is no longer applicable for the given + * resource. + * + * Sample code: + * ``` + * $grafeasClient = new GrafeasClient(); + * try { + * $formattedName = $grafeasClient->occurrenceName('[PROJECT]', '[OCCURRENCE]'); + * $grafeasClient->deleteOccurrence($formattedName); + * } finally { + * $grafeasClient->close(); + * } + * ``` + * + * @param string $name The name of the occurrence in the form of + * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. + * @param array $optionalArgs { + * 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 if the remote call fails + */ + public function deleteOccurrence($name, array $optionalArgs = []) + { + $request = new DeleteOccurrenceRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('DeleteOccurrence', GPBEmpty::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets the specified note. + * + * Sample code: + * ``` + * $grafeasClient = new GrafeasClient(); + * try { + * $formattedName = $grafeasClient->noteName('[PROJECT]', '[NOTE]'); + * $response = $grafeasClient->getNote($formattedName); + * } finally { + * $grafeasClient->close(); + * } + * ``` + * + * @param string $name The name of the note in the form of + * `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. + * @param array $optionalArgs { + * 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 \Grafeas\V1\Note + * + * @throws ApiException if the remote call fails + */ + public function getNote($name, array $optionalArgs = []) + { + $request = new GetNoteRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetNote', Note::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets the specified occurrence. + * + * Sample code: + * ``` + * $grafeasClient = new GrafeasClient(); + * try { + * $formattedName = $grafeasClient->occurrenceName('[PROJECT]', '[OCCURRENCE]'); + * $response = $grafeasClient->getOccurrence($formattedName); + * } finally { + * $grafeasClient->close(); + * } + * ``` + * + * @param string $name The name of the occurrence in the form of + * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. + * @param array $optionalArgs { + * 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 \Grafeas\V1\Occurrence + * + * @throws ApiException if the remote call fails + */ + public function getOccurrence($name, array $optionalArgs = []) + { + $request = new GetOccurrenceRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetOccurrence', Occurrence::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets the note attached to the specified occurrence. Consumer projects can + * use this method to get a note that belongs to a provider project. + * + * Sample code: + * ``` + * $grafeasClient = new GrafeasClient(); + * try { + * $formattedName = $grafeasClient->occurrenceName('[PROJECT]', '[OCCURRENCE]'); + * $response = $grafeasClient->getOccurrenceNote($formattedName); + * } finally { + * $grafeasClient->close(); + * } + * ``` + * + * @param string $name The name of the occurrence in the form of + * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. + * @param array $optionalArgs { + * 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 \Grafeas\V1\Note + * + * @throws ApiException if the remote call fails + */ + public function getOccurrenceNote($name, array $optionalArgs = []) + { + $request = new GetOccurrenceNoteRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetOccurrenceNote', Note::class, $optionalArgs, $request)->wait(); + } + + /** + * Lists occurrences referencing the specified note. Provider projects can use + * this method to get all occurrences across consumer projects referencing the + * specified note. + * + * Sample code: + * ``` + * $grafeasClient = new GrafeasClient(); + * try { + * $formattedName = $grafeasClient->noteName('[PROJECT]', '[NOTE]'); + * // Iterate over pages of elements + * $pagedResponse = $grafeasClient->listNoteOccurrences($formattedName); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $grafeasClient->listNoteOccurrences($formattedName); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $grafeasClient->close(); + * } + * ``` + * + * @param string $name The name of the note to list occurrences for in the form of + * `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. + * @param array $optionalArgs { + * Optional. + * + * @type string $filter + * The filter expression. + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @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 \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listNoteOccurrences($name, array $optionalArgs = []) + { + $request = new ListNoteOccurrencesRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListNoteOccurrences', $optionalArgs, ListNoteOccurrencesResponse::class, $request); + } + + /** + * Lists notes for the specified project. + * + * Sample code: + * ``` + * $grafeasClient = new GrafeasClient(); + * try { + * $formattedParent = $grafeasClient->projectName('[PROJECT]'); + * // Iterate over pages of elements + * $pagedResponse = $grafeasClient->listNotes($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $grafeasClient->listNotes($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $grafeasClient->close(); + * } + * ``` + * + * @param string $parent The name of the project to list notes for in the form of + * `projects/[PROJECT_ID]`. + * @param array $optionalArgs { + * Optional. + * + * @type string $filter + * The filter expression. + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @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 \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listNotes($parent, array $optionalArgs = []) + { + $request = new ListNotesRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListNotes', $optionalArgs, ListNotesResponse::class, $request); + } + + /** + * Lists occurrences for the specified project. + * + * Sample code: + * ``` + * $grafeasClient = new GrafeasClient(); + * try { + * $formattedParent = $grafeasClient->projectName('[PROJECT]'); + * // Iterate over pages of elements + * $pagedResponse = $grafeasClient->listOccurrences($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $grafeasClient->listOccurrences($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $grafeasClient->close(); + * } + * ``` + * + * @param string $parent The name of the project to list occurrences for in the form of + * `projects/[PROJECT_ID]`. + * @param array $optionalArgs { + * Optional. + * + * @type string $filter + * The filter expression. + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @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 \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listOccurrences($parent, array $optionalArgs = []) + { + $request = new ListOccurrencesRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListOccurrences', $optionalArgs, ListOccurrencesResponse::class, $request); + } + + /** + * Updates the specified note. + * + * Sample code: + * ``` + * $grafeasClient = new GrafeasClient(); + * try { + * $formattedName = $grafeasClient->noteName('[PROJECT]', '[NOTE]'); + * $note = new Note(); + * $response = $grafeasClient->updateNote($formattedName, $note); + * } finally { + * $grafeasClient->close(); + * } + * ``` + * + * @param string $name The name of the note in the form of + * `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. + * @param Note $note The updated note. + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * The fields to update. + * @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 \Grafeas\V1\Note + * + * @throws ApiException if the remote call fails + */ + public function updateNote($name, $note, array $optionalArgs = []) + { + $request = new UpdateNoteRequest(); + $requestParamHeaders = []; + $request->setName($name); + $request->setNote($note); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('UpdateNote', Note::class, $optionalArgs, $request)->wait(); + } + + /** + * Updates the specified occurrence. + * + * Sample code: + * ``` + * $grafeasClient = new GrafeasClient(); + * try { + * $formattedName = $grafeasClient->occurrenceName('[PROJECT]', '[OCCURRENCE]'); + * $occurrence = new Occurrence(); + * $response = $grafeasClient->updateOccurrence($formattedName, $occurrence); + * } finally { + * $grafeasClient->close(); + * } + * ``` + * + * @param string $name The name of the occurrence in the form of + * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. + * @param Occurrence $occurrence The updated occurrence. + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * The fields to update. + * @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 \Grafeas\V1\Occurrence + * + * @throws ApiException if the remote call fails + */ + public function updateOccurrence($name, $occurrence, array $optionalArgs = []) + { + $request = new UpdateOccurrenceRequest(); + $requestParamHeaders = []; + $request->setName($name); + $request->setOccurrence($occurrence); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('UpdateOccurrence', Occurrence::class, $optionalArgs, $request)->wait(); + } +} diff --git a/owl-bot-staging/Grafeas/v1/src/V1/GrafeasClient.php b/owl-bot-staging/Grafeas/v1/src/V1/GrafeasClient.php new file mode 100644 index 000000000000..ec675d7f8cbe --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/src/V1/GrafeasClient.php @@ -0,0 +1,34 @@ + [ + 'grafeas.v1.Grafeas' => [ + 'BatchCreateNotes' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Grafeas\V1\BatchCreateNotesResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'BatchCreateOccurrences' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Grafeas\V1\BatchCreateOccurrencesResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'CreateNote' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Grafeas\V1\Note', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'CreateOccurrence' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Grafeas\V1\Occurrence', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'DeleteNote' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'DeleteOccurrence' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetNote' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Grafeas\V1\Note', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetOccurrence' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Grafeas\V1\Occurrence', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetOccurrenceNote' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Grafeas\V1\Note', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'ListNoteOccurrences' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getOccurrences', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Grafeas\V1\ListNoteOccurrencesResponse', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'ListNotes' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getNotes', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Grafeas\V1\ListNotesResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListOccurrences' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getOccurrences', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Grafeas\V1\ListOccurrencesResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'UpdateNote' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Grafeas\V1\Note', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'UpdateOccurrence' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Grafeas\V1\Occurrence', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'templateMap' => [ + 'note' => 'projects/{project}/notes/{note}', + 'occurrence' => 'projects/{project}/occurrences/{occurrence}', + 'project' => 'projects/{project}', + ], + ], + ], +]; diff --git a/owl-bot-staging/Grafeas/v1/src/V1/resources/grafeas_rest_client_config.php b/owl-bot-staging/Grafeas/v1/src/V1/resources/grafeas_rest_client_config.php new file mode 100644 index 000000000000..30b86b499f1a --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/src/V1/resources/grafeas_rest_client_config.php @@ -0,0 +1,172 @@ + [ + 'grafeas.v1.Grafeas' => [ + 'BatchCreateNotes' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*}/notes:batchCreate', + 'body' => '*', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'BatchCreateOccurrences' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*}/occurrences:batchCreate', + 'body' => '*', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'CreateNote' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*}/notes', + 'body' => 'note', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'note_id', + ], + ], + 'CreateOccurrence' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*}/occurrences', + 'body' => 'occurrence', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'DeleteNote' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/notes/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteOccurrence' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/occurrences/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetNote' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/notes/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetOccurrence' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/occurrences/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetOccurrenceNote' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/occurrences/*}/notes', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListNoteOccurrences' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/notes/*}/occurrences', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListNotes' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*}/notes', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListOccurrences' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*}/occurrences', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'UpdateNote' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{name=projects/*/notes/*}', + 'body' => 'note', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'UpdateOccurrence' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{name=projects/*/occurrences/*}', + 'body' => 'occurrence', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/Grafeas/v1/tests/Unit/V1/Client/GrafeasClientTest.php b/owl-bot-staging/Grafeas/v1/tests/Unit/V1/Client/GrafeasClientTest.php new file mode 100644 index 000000000000..d601fa3a0366 --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/tests/Unit/V1/Client/GrafeasClientTest.php @@ -0,0 +1,1108 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return GrafeasClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new GrafeasClient($options); + } + + /** @test */ + public function batchCreateNotesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new BatchCreateNotesResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $notesValue = new Note(); + $notes = [ + 'notesKey' => $notesValue, + ]; + $request = (new BatchCreateNotesRequest()) + ->setParent($formattedParent) + ->setNotes($notes); + $response = $gapicClient->batchCreateNotes($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/grafeas.v1.Grafeas/BatchCreateNotes', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getNotes(); + $this->assertProtobufEquals($notes, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function batchCreateNotesExceptionTest() + { + $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->projectName('[PROJECT]'); + $notesValue = new Note(); + $notes = [ + 'notesKey' => $notesValue, + ]; + $request = (new BatchCreateNotesRequest()) + ->setParent($formattedParent) + ->setNotes($notes); + try { + $gapicClient->batchCreateNotes($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 batchCreateOccurrencesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new BatchCreateOccurrencesResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $occurrences = []; + $request = (new BatchCreateOccurrencesRequest()) + ->setParent($formattedParent) + ->setOccurrences($occurrences); + $response = $gapicClient->batchCreateOccurrences($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/grafeas.v1.Grafeas/BatchCreateOccurrences', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getOccurrences(); + $this->assertProtobufEquals($occurrences, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function batchCreateOccurrencesExceptionTest() + { + $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->projectName('[PROJECT]'); + $occurrences = []; + $request = (new BatchCreateOccurrencesRequest()) + ->setParent($formattedParent) + ->setOccurrences($occurrences); + try { + $gapicClient->batchCreateOccurrences($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 createNoteTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $shortDescription = 'shortDescription-235369287'; + $longDescription = 'longDescription-1747792199'; + $expectedResponse = new Note(); + $expectedResponse->setName($name); + $expectedResponse->setShortDescription($shortDescription); + $expectedResponse->setLongDescription($longDescription); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $noteId = 'noteId2129224840'; + $note = new Note(); + $request = (new CreateNoteRequest()) + ->setParent($formattedParent) + ->setNoteId($noteId) + ->setNote($note); + $response = $gapicClient->createNote($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/grafeas.v1.Grafeas/CreateNote', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getNoteId(); + $this->assertProtobufEquals($noteId, $actualValue); + $actualValue = $actualRequestObject->getNote(); + $this->assertProtobufEquals($note, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createNoteExceptionTest() + { + $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->projectName('[PROJECT]'); + $noteId = 'noteId2129224840'; + $note = new Note(); + $request = (new CreateNoteRequest()) + ->setParent($formattedParent) + ->setNoteId($noteId) + ->setNote($note); + try { + $gapicClient->createNote($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 createOccurrenceTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $resourceUri = 'resourceUri-384040517'; + $noteName = 'noteName1780787896'; + $remediation = 'remediation779381797'; + $expectedResponse = new Occurrence(); + $expectedResponse->setName($name); + $expectedResponse->setResourceUri($resourceUri); + $expectedResponse->setNoteName($noteName); + $expectedResponse->setRemediation($remediation); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $occurrence = new Occurrence(); + $request = (new CreateOccurrenceRequest()) + ->setParent($formattedParent) + ->setOccurrence($occurrence); + $response = $gapicClient->createOccurrence($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/grafeas.v1.Grafeas/CreateOccurrence', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getOccurrence(); + $this->assertProtobufEquals($occurrence, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createOccurrenceExceptionTest() + { + $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->projectName('[PROJECT]'); + $occurrence = new Occurrence(); + $request = (new CreateOccurrenceRequest()) + ->setParent($formattedParent) + ->setOccurrence($occurrence); + try { + $gapicClient->createOccurrence($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 deleteNoteTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->noteName('[PROJECT]', '[NOTE]'); + $request = (new DeleteNoteRequest()) + ->setName($formattedName); + $gapicClient->deleteNote($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/grafeas.v1.Grafeas/DeleteNote', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteNoteExceptionTest() + { + $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->noteName('[PROJECT]', '[NOTE]'); + $request = (new DeleteNoteRequest()) + ->setName($formattedName); + try { + $gapicClient->deleteNote($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 deleteOccurrenceTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->occurrenceName('[PROJECT]', '[OCCURRENCE]'); + $request = (new DeleteOccurrenceRequest()) + ->setName($formattedName); + $gapicClient->deleteOccurrence($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/grafeas.v1.Grafeas/DeleteOccurrence', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteOccurrenceExceptionTest() + { + $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->occurrenceName('[PROJECT]', '[OCCURRENCE]'); + $request = (new DeleteOccurrenceRequest()) + ->setName($formattedName); + try { + $gapicClient->deleteOccurrence($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 getNoteTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $shortDescription = 'shortDescription-235369287'; + $longDescription = 'longDescription-1747792199'; + $expectedResponse = new Note(); + $expectedResponse->setName($name2); + $expectedResponse->setShortDescription($shortDescription); + $expectedResponse->setLongDescription($longDescription); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->noteName('[PROJECT]', '[NOTE]'); + $request = (new GetNoteRequest()) + ->setName($formattedName); + $response = $gapicClient->getNote($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/grafeas.v1.Grafeas/GetNote', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getNoteExceptionTest() + { + $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->noteName('[PROJECT]', '[NOTE]'); + $request = (new GetNoteRequest()) + ->setName($formattedName); + try { + $gapicClient->getNote($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 getOccurrenceTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $resourceUri = 'resourceUri-384040517'; + $noteName = 'noteName1780787896'; + $remediation = 'remediation779381797'; + $expectedResponse = new Occurrence(); + $expectedResponse->setName($name2); + $expectedResponse->setResourceUri($resourceUri); + $expectedResponse->setNoteName($noteName); + $expectedResponse->setRemediation($remediation); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->occurrenceName('[PROJECT]', '[OCCURRENCE]'); + $request = (new GetOccurrenceRequest()) + ->setName($formattedName); + $response = $gapicClient->getOccurrence($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/grafeas.v1.Grafeas/GetOccurrence', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getOccurrenceExceptionTest() + { + $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->occurrenceName('[PROJECT]', '[OCCURRENCE]'); + $request = (new GetOccurrenceRequest()) + ->setName($formattedName); + try { + $gapicClient->getOccurrence($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 getOccurrenceNoteTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $shortDescription = 'shortDescription-235369287'; + $longDescription = 'longDescription-1747792199'; + $expectedResponse = new Note(); + $expectedResponse->setName($name2); + $expectedResponse->setShortDescription($shortDescription); + $expectedResponse->setLongDescription($longDescription); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->occurrenceName('[PROJECT]', '[OCCURRENCE]'); + $request = (new GetOccurrenceNoteRequest()) + ->setName($formattedName); + $response = $gapicClient->getOccurrenceNote($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/grafeas.v1.Grafeas/GetOccurrenceNote', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getOccurrenceNoteExceptionTest() + { + $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->occurrenceName('[PROJECT]', '[OCCURRENCE]'); + $request = (new GetOccurrenceNoteRequest()) + ->setName($formattedName); + try { + $gapicClient->getOccurrenceNote($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 listNoteOccurrencesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $occurrencesElement = new Occurrence(); + $occurrences = [ + $occurrencesElement, + ]; + $expectedResponse = new ListNoteOccurrencesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setOccurrences($occurrences); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->noteName('[PROJECT]', '[NOTE]'); + $request = (new ListNoteOccurrencesRequest()) + ->setName($formattedName); + $response = $gapicClient->listNoteOccurrences($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getOccurrences()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/grafeas.v1.Grafeas/ListNoteOccurrences', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listNoteOccurrencesExceptionTest() + { + $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->noteName('[PROJECT]', '[NOTE]'); + $request = (new ListNoteOccurrencesRequest()) + ->setName($formattedName); + try { + $gapicClient->listNoteOccurrences($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 listNotesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $notesElement = new Note(); + $notes = [ + $notesElement, + ]; + $expectedResponse = new ListNotesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setNotes($notes); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $request = (new ListNotesRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listNotes($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getNotes()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/grafeas.v1.Grafeas/ListNotes', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listNotesExceptionTest() + { + $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->projectName('[PROJECT]'); + $request = (new ListNotesRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listNotes($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 listOccurrencesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $occurrencesElement = new Occurrence(); + $occurrences = [ + $occurrencesElement, + ]; + $expectedResponse = new ListOccurrencesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setOccurrences($occurrences); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $request = (new ListOccurrencesRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listOccurrences($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getOccurrences()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/grafeas.v1.Grafeas/ListOccurrences', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listOccurrencesExceptionTest() + { + $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->projectName('[PROJECT]'); + $request = (new ListOccurrencesRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listOccurrences($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 updateNoteTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $shortDescription = 'shortDescription-235369287'; + $longDescription = 'longDescription-1747792199'; + $expectedResponse = new Note(); + $expectedResponse->setName($name2); + $expectedResponse->setShortDescription($shortDescription); + $expectedResponse->setLongDescription($longDescription); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->noteName('[PROJECT]', '[NOTE]'); + $note = new Note(); + $request = (new UpdateNoteRequest()) + ->setName($formattedName) + ->setNote($note); + $response = $gapicClient->updateNote($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/grafeas.v1.Grafeas/UpdateNote', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $actualValue = $actualRequestObject->getNote(); + $this->assertProtobufEquals($note, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateNoteExceptionTest() + { + $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->noteName('[PROJECT]', '[NOTE]'); + $note = new Note(); + $request = (new UpdateNoteRequest()) + ->setName($formattedName) + ->setNote($note); + try { + $gapicClient->updateNote($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 updateOccurrenceTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $resourceUri = 'resourceUri-384040517'; + $noteName = 'noteName1780787896'; + $remediation = 'remediation779381797'; + $expectedResponse = new Occurrence(); + $expectedResponse->setName($name2); + $expectedResponse->setResourceUri($resourceUri); + $expectedResponse->setNoteName($noteName); + $expectedResponse->setRemediation($remediation); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->occurrenceName('[PROJECT]', '[OCCURRENCE]'); + $occurrence = new Occurrence(); + $request = (new UpdateOccurrenceRequest()) + ->setName($formattedName) + ->setOccurrence($occurrence); + $response = $gapicClient->updateOccurrence($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/grafeas.v1.Grafeas/UpdateOccurrence', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $actualValue = $actualRequestObject->getOccurrence(); + $this->assertProtobufEquals($occurrence, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateOccurrenceExceptionTest() + { + $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->occurrenceName('[PROJECT]', '[OCCURRENCE]'); + $occurrence = new Occurrence(); + $request = (new UpdateOccurrenceRequest()) + ->setName($formattedName) + ->setOccurrence($occurrence); + try { + $gapicClient->updateOccurrence($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 batchCreateNotesAsyncTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new BatchCreateNotesResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $notesValue = new Note(); + $notes = [ + 'notesKey' => $notesValue, + ]; + $request = (new BatchCreateNotesRequest()) + ->setParent($formattedParent) + ->setNotes($notes); + $response = $gapicClient->batchCreateNotesAsync($request)->wait(); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/grafeas.v1.Grafeas/BatchCreateNotes', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getNotes(); + $this->assertProtobufEquals($notes, $actualValue); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/owl-bot-staging/Grafeas/v1/tests/Unit/V1/GrafeasClientTest.php b/owl-bot-staging/Grafeas/v1/tests/Unit/V1/GrafeasClientTest.php new file mode 100644 index 000000000000..8b715d081bcb --- /dev/null +++ b/owl-bot-staging/Grafeas/v1/tests/Unit/V1/GrafeasClientTest.php @@ -0,0 +1,990 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return GrafeasClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new GrafeasClient($options); + } + + /** @test */ + public function batchCreateNotesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new BatchCreateNotesResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $notesValue = new Note(); + $notes = [ + 'notesKey' => $notesValue, + ]; + $response = $gapicClient->batchCreateNotes($formattedParent, $notes); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/grafeas.v1.Grafeas/BatchCreateNotes', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getNotes(); + $this->assertProtobufEquals($notes, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function batchCreateNotesExceptionTest() + { + $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->projectName('[PROJECT]'); + $notesValue = new Note(); + $notes = [ + 'notesKey' => $notesValue, + ]; + try { + $gapicClient->batchCreateNotes($formattedParent, $notes); + // 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 batchCreateOccurrencesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new BatchCreateOccurrencesResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $occurrences = []; + $response = $gapicClient->batchCreateOccurrences($formattedParent, $occurrences); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/grafeas.v1.Grafeas/BatchCreateOccurrences', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getOccurrences(); + $this->assertProtobufEquals($occurrences, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function batchCreateOccurrencesExceptionTest() + { + $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->projectName('[PROJECT]'); + $occurrences = []; + try { + $gapicClient->batchCreateOccurrences($formattedParent, $occurrences); + // 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 createNoteTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $shortDescription = 'shortDescription-235369287'; + $longDescription = 'longDescription-1747792199'; + $expectedResponse = new Note(); + $expectedResponse->setName($name); + $expectedResponse->setShortDescription($shortDescription); + $expectedResponse->setLongDescription($longDescription); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $noteId = 'noteId2129224840'; + $note = new Note(); + $response = $gapicClient->createNote($formattedParent, $noteId, $note); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/grafeas.v1.Grafeas/CreateNote', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getNoteId(); + $this->assertProtobufEquals($noteId, $actualValue); + $actualValue = $actualRequestObject->getNote(); + $this->assertProtobufEquals($note, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createNoteExceptionTest() + { + $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->projectName('[PROJECT]'); + $noteId = 'noteId2129224840'; + $note = new Note(); + try { + $gapicClient->createNote($formattedParent, $noteId, $note); + // 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 createOccurrenceTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $resourceUri = 'resourceUri-384040517'; + $noteName = 'noteName1780787896'; + $remediation = 'remediation779381797'; + $expectedResponse = new Occurrence(); + $expectedResponse->setName($name); + $expectedResponse->setResourceUri($resourceUri); + $expectedResponse->setNoteName($noteName); + $expectedResponse->setRemediation($remediation); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $occurrence = new Occurrence(); + $response = $gapicClient->createOccurrence($formattedParent, $occurrence); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/grafeas.v1.Grafeas/CreateOccurrence', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getOccurrence(); + $this->assertProtobufEquals($occurrence, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createOccurrenceExceptionTest() + { + $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->projectName('[PROJECT]'); + $occurrence = new Occurrence(); + try { + $gapicClient->createOccurrence($formattedParent, $occurrence); + // 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 deleteNoteTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->noteName('[PROJECT]', '[NOTE]'); + $gapicClient->deleteNote($formattedName); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/grafeas.v1.Grafeas/DeleteNote', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteNoteExceptionTest() + { + $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->noteName('[PROJECT]', '[NOTE]'); + try { + $gapicClient->deleteNote($formattedName); + // 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 deleteOccurrenceTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->occurrenceName('[PROJECT]', '[OCCURRENCE]'); + $gapicClient->deleteOccurrence($formattedName); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/grafeas.v1.Grafeas/DeleteOccurrence', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteOccurrenceExceptionTest() + { + $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->occurrenceName('[PROJECT]', '[OCCURRENCE]'); + try { + $gapicClient->deleteOccurrence($formattedName); + // 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 getNoteTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $shortDescription = 'shortDescription-235369287'; + $longDescription = 'longDescription-1747792199'; + $expectedResponse = new Note(); + $expectedResponse->setName($name2); + $expectedResponse->setShortDescription($shortDescription); + $expectedResponse->setLongDescription($longDescription); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->noteName('[PROJECT]', '[NOTE]'); + $response = $gapicClient->getNote($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/grafeas.v1.Grafeas/GetNote', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getNoteExceptionTest() + { + $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->noteName('[PROJECT]', '[NOTE]'); + try { + $gapicClient->getNote($formattedName); + // 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 getOccurrenceTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $resourceUri = 'resourceUri-384040517'; + $noteName = 'noteName1780787896'; + $remediation = 'remediation779381797'; + $expectedResponse = new Occurrence(); + $expectedResponse->setName($name2); + $expectedResponse->setResourceUri($resourceUri); + $expectedResponse->setNoteName($noteName); + $expectedResponse->setRemediation($remediation); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->occurrenceName('[PROJECT]', '[OCCURRENCE]'); + $response = $gapicClient->getOccurrence($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/grafeas.v1.Grafeas/GetOccurrence', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getOccurrenceExceptionTest() + { + $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->occurrenceName('[PROJECT]', '[OCCURRENCE]'); + try { + $gapicClient->getOccurrence($formattedName); + // 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 getOccurrenceNoteTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $shortDescription = 'shortDescription-235369287'; + $longDescription = 'longDescription-1747792199'; + $expectedResponse = new Note(); + $expectedResponse->setName($name2); + $expectedResponse->setShortDescription($shortDescription); + $expectedResponse->setLongDescription($longDescription); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->occurrenceName('[PROJECT]', '[OCCURRENCE]'); + $response = $gapicClient->getOccurrenceNote($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/grafeas.v1.Grafeas/GetOccurrenceNote', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getOccurrenceNoteExceptionTest() + { + $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->occurrenceName('[PROJECT]', '[OCCURRENCE]'); + try { + $gapicClient->getOccurrenceNote($formattedName); + // 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 listNoteOccurrencesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $occurrencesElement = new Occurrence(); + $occurrences = [ + $occurrencesElement, + ]; + $expectedResponse = new ListNoteOccurrencesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setOccurrences($occurrences); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->noteName('[PROJECT]', '[NOTE]'); + $response = $gapicClient->listNoteOccurrences($formattedName); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getOccurrences()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/grafeas.v1.Grafeas/ListNoteOccurrences', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listNoteOccurrencesExceptionTest() + { + $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->noteName('[PROJECT]', '[NOTE]'); + try { + $gapicClient->listNoteOccurrences($formattedName); + // 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 listNotesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $notesElement = new Note(); + $notes = [ + $notesElement, + ]; + $expectedResponse = new ListNotesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setNotes($notes); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $response = $gapicClient->listNotes($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getNotes()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/grafeas.v1.Grafeas/ListNotes', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listNotesExceptionTest() + { + $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->projectName('[PROJECT]'); + try { + $gapicClient->listNotes($formattedParent); + // 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 listOccurrencesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $occurrencesElement = new Occurrence(); + $occurrences = [ + $occurrencesElement, + ]; + $expectedResponse = new ListOccurrencesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setOccurrences($occurrences); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $response = $gapicClient->listOccurrences($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getOccurrences()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/grafeas.v1.Grafeas/ListOccurrences', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listOccurrencesExceptionTest() + { + $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->projectName('[PROJECT]'); + try { + $gapicClient->listOccurrences($formattedParent); + // 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 updateNoteTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $shortDescription = 'shortDescription-235369287'; + $longDescription = 'longDescription-1747792199'; + $expectedResponse = new Note(); + $expectedResponse->setName($name2); + $expectedResponse->setShortDescription($shortDescription); + $expectedResponse->setLongDescription($longDescription); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->noteName('[PROJECT]', '[NOTE]'); + $note = new Note(); + $response = $gapicClient->updateNote($formattedName, $note); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/grafeas.v1.Grafeas/UpdateNote', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $actualValue = $actualRequestObject->getNote(); + $this->assertProtobufEquals($note, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateNoteExceptionTest() + { + $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->noteName('[PROJECT]', '[NOTE]'); + $note = new Note(); + try { + $gapicClient->updateNote($formattedName, $note); + // 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 updateOccurrenceTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $resourceUri = 'resourceUri-384040517'; + $noteName = 'noteName1780787896'; + $remediation = 'remediation779381797'; + $expectedResponse = new Occurrence(); + $expectedResponse->setName($name2); + $expectedResponse->setResourceUri($resourceUri); + $expectedResponse->setNoteName($noteName); + $expectedResponse->setRemediation($remediation); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->occurrenceName('[PROJECT]', '[OCCURRENCE]'); + $occurrence = new Occurrence(); + $response = $gapicClient->updateOccurrence($formattedName, $occurrence); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/grafeas.v1.Grafeas/UpdateOccurrence', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $actualValue = $actualRequestObject->getOccurrence(); + $this->assertProtobufEquals($occurrence, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateOccurrenceExceptionTest() + { + $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->occurrenceName('[PROJECT]', '[OCCURRENCE]'); + $occurrence = new Occurrence(); + try { + $gapicClient->updateOccurrence($formattedName, $occurrence); + // 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()); + } +} diff --git a/owl-bot-staging/Iam/v2/proto/src/GPBMetadata/Google/Iam/V2/Deny.php b/owl-bot-staging/Iam/v2/proto/src/GPBMetadata/Google/Iam/V2/Deny.php new file mode 100644 index 000000000000..6be0cb28fd34 --- /dev/null +++ b/owl-bot-staging/Iam/v2/proto/src/GPBMetadata/Google/Iam/V2/Deny.php @@ -0,0 +1,34 @@ +internalAddGeneratedFile( + ' +Ü +google/iam/v2/deny.proto google.iam.v2"« +DenyRule +denied_principals (  +exception_principals (  +denied_permissions (  +exception_permissions ( + +denial_condition ( 2.google.type.ExprB{ +com.google.iam.v2B DenyRuleProtoPZ)cloud.google.com/go/iam/apiv2/iampb;iampbªGoogle.Cloud.Iam.V2ÊGoogle\\Cloud\\Iam\\V2bproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/owl-bot-staging/Iam/v2/proto/src/GPBMetadata/Google/Iam/V2/Policy.php b/owl-bot-staging/Iam/v2/proto/src/GPBMetadata/Google/Iam/V2/Policy.php new file mode 100644 index 000000000000..c808409e9aa9 Binary files /dev/null and b/owl-bot-staging/Iam/v2/proto/src/GPBMetadata/Google/Iam/V2/Policy.php differ diff --git a/owl-bot-staging/Iam/v2/proto/src/Google/Cloud/Iam/V2/CreatePolicyRequest.php b/owl-bot-staging/Iam/v2/proto/src/Google/Cloud/Iam/V2/CreatePolicyRequest.php new file mode 100644 index 000000000000..867ca9679740 --- /dev/null +++ b/owl-bot-staging/Iam/v2/proto/src/Google/Cloud/Iam/V2/CreatePolicyRequest.php @@ -0,0 +1,215 @@ +google.iam.v2.CreatePolicyRequest + */ +class CreatePolicyRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource that the policy is attached to, along with the kind of policy + * to create. Format: `policies/{attachment_point}/denypolicies` + * The attachment point is identified by its URL-encoded full resource name, + * which means that the forward-slash character, `/`, must be written as + * `%2F`. For example, + * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies`. + * For organizations and folders, use the numeric ID in the full resource + * name. For projects, you can use the alphanumeric or the numeric ID. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $parent = ''; + /** + * Required. The policy to create. + * + * Generated from protobuf field .google.iam.v2.Policy policy = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $policy = null; + /** + * The ID to use for this policy, which will become the final component of + * the policy's resource name. The ID must contain 3 to 63 characters. It can + * contain lowercase letters and numbers, as well as dashes (`-`) and periods + * (`.`). The first character must be a lowercase letter. + * + * Generated from protobuf field string policy_id = 3; + */ + protected $policy_id = ''; + + /** + * @param string $parent Required. The resource that the policy is attached to, along with the kind of policy + * to create. Format: `policies/{attachment_point}/denypolicies` + * + * + * The attachment point is identified by its URL-encoded full resource name, + * which means that the forward-slash character, `/`, must be written as + * `%2F`. For example, + * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies`. + * + * For organizations and folders, use the numeric ID in the full resource + * name. For projects, you can use the alphanumeric or the numeric ID. + * @param \Google\Cloud\Iam\V2\Policy $policy Required. The policy to create. + * @param string $policyId The ID to use for this policy, which will become the final component of + * the policy's resource name. The ID must contain 3 to 63 characters. It can + * contain lowercase letters and numbers, as well as dashes (`-`) and periods + * (`.`). The first character must be a lowercase letter. + * + * @return \Google\Cloud\Iam\V2\CreatePolicyRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\Iam\V2\Policy $policy, string $policyId): self + { + return (new self()) + ->setParent($parent) + ->setPolicy($policy) + ->setPolicyId($policyId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The resource that the policy is attached to, along with the kind of policy + * to create. Format: `policies/{attachment_point}/denypolicies` + * The attachment point is identified by its URL-encoded full resource name, + * which means that the forward-slash character, `/`, must be written as + * `%2F`. For example, + * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies`. + * For organizations and folders, use the numeric ID in the full resource + * name. For projects, you can use the alphanumeric or the numeric ID. + * @type \Google\Cloud\Iam\V2\Policy $policy + * Required. The policy to create. + * @type string $policy_id + * The ID to use for this policy, which will become the final component of + * the policy's resource name. The ID must contain 3 to 63 characters. It can + * contain lowercase letters and numbers, as well as dashes (`-`) and periods + * (`.`). The first character must be a lowercase letter. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Iam\V2\Policy::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource that the policy is attached to, along with the kind of policy + * to create. Format: `policies/{attachment_point}/denypolicies` + * The attachment point is identified by its URL-encoded full resource name, + * which means that the forward-slash character, `/`, must be written as + * `%2F`. For example, + * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies`. + * For organizations and folders, use the numeric ID in the full resource + * name. For projects, you can use the alphanumeric or the numeric ID. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The resource that the policy is attached to, along with the kind of policy + * to create. Format: `policies/{attachment_point}/denypolicies` + * The attachment point is identified by its URL-encoded full resource name, + * which means that the forward-slash character, `/`, must be written as + * `%2F`. For example, + * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies`. + * For organizations and folders, use the numeric ID in the full resource + * name. For projects, you can use the alphanumeric or the numeric ID. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The policy to create. + * + * Generated from protobuf field .google.iam.v2.Policy policy = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Iam\V2\Policy|null + */ + public function getPolicy() + { + return $this->policy; + } + + public function hasPolicy() + { + return isset($this->policy); + } + + public function clearPolicy() + { + unset($this->policy); + } + + /** + * Required. The policy to create. + * + * Generated from protobuf field .google.iam.v2.Policy policy = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Iam\V2\Policy $var + * @return $this + */ + public function setPolicy($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Iam\V2\Policy::class); + $this->policy = $var; + + return $this; + } + + /** + * The ID to use for this policy, which will become the final component of + * the policy's resource name. The ID must contain 3 to 63 characters. It can + * contain lowercase letters and numbers, as well as dashes (`-`) and periods + * (`.`). The first character must be a lowercase letter. + * + * Generated from protobuf field string policy_id = 3; + * @return string + */ + public function getPolicyId() + { + return $this->policy_id; + } + + /** + * The ID to use for this policy, which will become the final component of + * the policy's resource name. The ID must contain 3 to 63 characters. It can + * contain lowercase letters and numbers, as well as dashes (`-`) and periods + * (`.`). The first character must be a lowercase letter. + * + * Generated from protobuf field string policy_id = 3; + * @param string $var + * @return $this + */ + public function setPolicyId($var) + { + GPBUtil::checkString($var, True); + $this->policy_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Iam/v2/proto/src/Google/Cloud/Iam/V2/DeletePolicyRequest.php b/owl-bot-staging/Iam/v2/proto/src/Google/Cloud/Iam/V2/DeletePolicyRequest.php new file mode 100644 index 000000000000..20271807b00b --- /dev/null +++ b/owl-bot-staging/Iam/v2/proto/src/Google/Cloud/Iam/V2/DeletePolicyRequest.php @@ -0,0 +1,163 @@ +google.iam.v2.DeletePolicyRequest + */ +class DeletePolicyRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the policy to delete. Format: + * `policies/{attachment_point}/denypolicies/{policy_id}` + * Use the URL-encoded full resource name, which means that the forward-slash + * character, `/`, must be written as `%2F`. For example, + * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-policy`. + * For organizations and folders, use the numeric ID in the full resource + * name. For projects, you can use the alphanumeric or the numeric ID. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $name = ''; + /** + * Optional. The expected `etag` of the policy to delete. If the value does not match + * the value that is stored in IAM, the request fails with a `409` error code + * and `ABORTED` status. + * If you omit this field, the policy is deleted regardless of its current + * `etag`. + * + * Generated from protobuf field string etag = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $etag = ''; + + /** + * @param string $name Required. The resource name of the policy to delete. Format: + * `policies/{attachment_point}/denypolicies/{policy_id}` + * + * + * Use the URL-encoded full resource name, which means that the forward-slash + * character, `/`, must be written as `%2F`. For example, + * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-policy`. + * + * For organizations and folders, use the numeric ID in the full resource + * name. For projects, you can use the alphanumeric or the numeric ID. + * + * @return \Google\Cloud\Iam\V2\DeletePolicyRequest + * + * @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 resource name of the policy to delete. Format: + * `policies/{attachment_point}/denypolicies/{policy_id}` + * Use the URL-encoded full resource name, which means that the forward-slash + * character, `/`, must be written as `%2F`. For example, + * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-policy`. + * For organizations and folders, use the numeric ID in the full resource + * name. For projects, you can use the alphanumeric or the numeric ID. + * @type string $etag + * Optional. The expected `etag` of the policy to delete. If the value does not match + * the value that is stored in IAM, the request fails with a `409` error code + * and `ABORTED` status. + * If you omit this field, the policy is deleted regardless of its current + * `etag`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Iam\V2\Policy::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the policy to delete. Format: + * `policies/{attachment_point}/denypolicies/{policy_id}` + * Use the URL-encoded full resource name, which means that the forward-slash + * character, `/`, must be written as `%2F`. For example, + * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-policy`. + * For organizations and folders, use the numeric ID in the full resource + * name. For projects, you can use the alphanumeric or the numeric ID. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name of the policy to delete. Format: + * `policies/{attachment_point}/denypolicies/{policy_id}` + * Use the URL-encoded full resource name, which means that the forward-slash + * character, `/`, must be written as `%2F`. For example, + * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-policy`. + * For organizations and folders, use the numeric ID in the full resource + * name. For projects, you can use the alphanumeric or the numeric ID. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Optional. The expected `etag` of the policy to delete. If the value does not match + * the value that is stored in IAM, the request fails with a `409` error code + * and `ABORTED` status. + * If you omit this field, the policy is deleted regardless of its current + * `etag`. + * + * Generated from protobuf field string etag = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * Optional. The expected `etag` of the policy to delete. If the value does not match + * the value that is stored in IAM, the request fails with a `409` error code + * and `ABORTED` status. + * If you omit this field, the policy is deleted regardless of its current + * `etag`. + * + * Generated from protobuf field string etag = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, True); + $this->etag = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Iam/v2/proto/src/Google/Cloud/Iam/V2/DenyRule.php b/owl-bot-staging/Iam/v2/proto/src/Google/Cloud/Iam/V2/DenyRule.php new file mode 100644 index 000000000000..c53d85f881f6 --- /dev/null +++ b/owl-bot-staging/Iam/v2/proto/src/Google/Cloud/Iam/V2/DenyRule.php @@ -0,0 +1,425 @@ +google.iam.v2.DenyRule + */ +class DenyRule extends \Google\Protobuf\Internal\Message +{ + /** + * The identities that are prevented from using one or more permissions on + * Google Cloud resources. This field can contain the following values: + * * `principalSet://goog/public:all`: A special identifier that represents + * any principal that is on the internet, even if they do not have a Google + * Account or are not logged in. + * * `principal://goog/subject/{email_id}`: A specific Google Account. + * Includes Gmail, Cloud Identity, and Google Workspace user accounts. For + * example, `principal://goog/subject/alice@example.com`. + * * `deleted:principal://goog/subject/{email_id}?uid={uid}`: A specific + * Google Account that was deleted recently. For example, + * `deleted:principal://goog/subject/alice@example.com?uid=1234567890`. If + * the Google Account is recovered, this identifier reverts to the standard + * identifier for a Google Account. + * * `principalSet://goog/group/{group_id}`: A Google group. For example, + * `principalSet://goog/group/admins@example.com`. + * * `deleted:principalSet://goog/group/{group_id}?uid={uid}`: A Google group + * that was deleted recently. For example, + * `deleted:principalSet://goog/group/admins@example.com?uid=1234567890`. If + * the Google group is restored, this identifier reverts to the standard + * identifier for a Google group. + * * `principal://iam.googleapis.com/projects/-/serviceAccounts/{service_account_id}`: + * A Google Cloud service account. For example, + * `principal://iam.googleapis.com/projects/-/serviceAccounts/my-service-account@iam.gserviceaccount.com`. + * * `deleted:principal://iam.googleapis.com/projects/-/serviceAccounts/{service_account_id}?uid={uid}`: + * A Google Cloud service account that was deleted recently. For example, + * `deleted:principal://iam.googleapis.com/projects/-/serviceAccounts/my-service-account@iam.gserviceaccount.com?uid=1234567890`. + * If the service account is undeleted, this identifier reverts to the + * standard identifier for a service account. + * * `principalSet://goog/cloudIdentityCustomerId/{customer_id}`: All of the + * principals associated with the specified Google Workspace or Cloud + * Identity customer ID. For example, + * `principalSet://goog/cloudIdentityCustomerId/C01Abc35`. + * + * Generated from protobuf field repeated string denied_principals = 1; + */ + private $denied_principals; + /** + * The identities that are excluded from the deny rule, even if they are + * listed in the `denied_principals`. For example, you could add a Google + * group to the `denied_principals`, then exclude specific users who belong to + * that group. + * This field can contain the same values as the `denied_principals` field, + * excluding `principalSet://goog/public:all`, which represents all users on + * the internet. + * + * Generated from protobuf field repeated string exception_principals = 2; + */ + private $exception_principals; + /** + * The permissions that are explicitly denied by this rule. Each permission + * uses the format `{service_fqdn}/{resource}.{verb}`, where `{service_fqdn}` + * is the fully qualified domain name for the service. For example, + * `iam.googleapis.com/roles.list`. + * + * Generated from protobuf field repeated string denied_permissions = 3; + */ + private $denied_permissions; + /** + * Specifies the permissions that this rule excludes from the set of denied + * permissions given by `denied_permissions`. If a permission appears in + * `denied_permissions` _and_ in `exception_permissions` then it will _not_ be + * denied. + * The excluded permissions can be specified using the same syntax as + * `denied_permissions`. + * + * Generated from protobuf field repeated string exception_permissions = 4; + */ + private $exception_permissions; + /** + * The condition that determines whether this deny rule applies to a request. + * If the condition expression evaluates to `true`, then the deny rule is + * applied; otherwise, the deny rule is not applied. + * Each deny rule is evaluated independently. If this deny rule does not apply + * to a request, other deny rules might still apply. + * The condition can use CEL functions that evaluate + * [resource + * tags](https://cloud.google.com/iam/help/conditions/resource-tags). Other + * functions and operators are not supported. + * + * Generated from protobuf field .google.type.Expr denial_condition = 5; + */ + protected $denial_condition = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $denied_principals + * The identities that are prevented from using one or more permissions on + * Google Cloud resources. This field can contain the following values: + * * `principalSet://goog/public:all`: A special identifier that represents + * any principal that is on the internet, even if they do not have a Google + * Account or are not logged in. + * * `principal://goog/subject/{email_id}`: A specific Google Account. + * Includes Gmail, Cloud Identity, and Google Workspace user accounts. For + * example, `principal://goog/subject/alice@example.com`. + * * `deleted:principal://goog/subject/{email_id}?uid={uid}`: A specific + * Google Account that was deleted recently. For example, + * `deleted:principal://goog/subject/alice@example.com?uid=1234567890`. If + * the Google Account is recovered, this identifier reverts to the standard + * identifier for a Google Account. + * * `principalSet://goog/group/{group_id}`: A Google group. For example, + * `principalSet://goog/group/admins@example.com`. + * * `deleted:principalSet://goog/group/{group_id}?uid={uid}`: A Google group + * that was deleted recently. For example, + * `deleted:principalSet://goog/group/admins@example.com?uid=1234567890`. If + * the Google group is restored, this identifier reverts to the standard + * identifier for a Google group. + * * `principal://iam.googleapis.com/projects/-/serviceAccounts/{service_account_id}`: + * A Google Cloud service account. For example, + * `principal://iam.googleapis.com/projects/-/serviceAccounts/my-service-account@iam.gserviceaccount.com`. + * * `deleted:principal://iam.googleapis.com/projects/-/serviceAccounts/{service_account_id}?uid={uid}`: + * A Google Cloud service account that was deleted recently. For example, + * `deleted:principal://iam.googleapis.com/projects/-/serviceAccounts/my-service-account@iam.gserviceaccount.com?uid=1234567890`. + * If the service account is undeleted, this identifier reverts to the + * standard identifier for a service account. + * * `principalSet://goog/cloudIdentityCustomerId/{customer_id}`: All of the + * principals associated with the specified Google Workspace or Cloud + * Identity customer ID. For example, + * `principalSet://goog/cloudIdentityCustomerId/C01Abc35`. + * @type array|\Google\Protobuf\Internal\RepeatedField $exception_principals + * The identities that are excluded from the deny rule, even if they are + * listed in the `denied_principals`. For example, you could add a Google + * group to the `denied_principals`, then exclude specific users who belong to + * that group. + * This field can contain the same values as the `denied_principals` field, + * excluding `principalSet://goog/public:all`, which represents all users on + * the internet. + * @type array|\Google\Protobuf\Internal\RepeatedField $denied_permissions + * The permissions that are explicitly denied by this rule. Each permission + * uses the format `{service_fqdn}/{resource}.{verb}`, where `{service_fqdn}` + * is the fully qualified domain name for the service. For example, + * `iam.googleapis.com/roles.list`. + * @type array|\Google\Protobuf\Internal\RepeatedField $exception_permissions + * Specifies the permissions that this rule excludes from the set of denied + * permissions given by `denied_permissions`. If a permission appears in + * `denied_permissions` _and_ in `exception_permissions` then it will _not_ be + * denied. + * The excluded permissions can be specified using the same syntax as + * `denied_permissions`. + * @type \Google\Type\Expr $denial_condition + * The condition that determines whether this deny rule applies to a request. + * If the condition expression evaluates to `true`, then the deny rule is + * applied; otherwise, the deny rule is not applied. + * Each deny rule is evaluated independently. If this deny rule does not apply + * to a request, other deny rules might still apply. + * The condition can use CEL functions that evaluate + * [resource + * tags](https://cloud.google.com/iam/help/conditions/resource-tags). Other + * functions and operators are not supported. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Iam\V2\Deny::initOnce(); + parent::__construct($data); + } + + /** + * The identities that are prevented from using one or more permissions on + * Google Cloud resources. This field can contain the following values: + * * `principalSet://goog/public:all`: A special identifier that represents + * any principal that is on the internet, even if they do not have a Google + * Account or are not logged in. + * * `principal://goog/subject/{email_id}`: A specific Google Account. + * Includes Gmail, Cloud Identity, and Google Workspace user accounts. For + * example, `principal://goog/subject/alice@example.com`. + * * `deleted:principal://goog/subject/{email_id}?uid={uid}`: A specific + * Google Account that was deleted recently. For example, + * `deleted:principal://goog/subject/alice@example.com?uid=1234567890`. If + * the Google Account is recovered, this identifier reverts to the standard + * identifier for a Google Account. + * * `principalSet://goog/group/{group_id}`: A Google group. For example, + * `principalSet://goog/group/admins@example.com`. + * * `deleted:principalSet://goog/group/{group_id}?uid={uid}`: A Google group + * that was deleted recently. For example, + * `deleted:principalSet://goog/group/admins@example.com?uid=1234567890`. If + * the Google group is restored, this identifier reverts to the standard + * identifier for a Google group. + * * `principal://iam.googleapis.com/projects/-/serviceAccounts/{service_account_id}`: + * A Google Cloud service account. For example, + * `principal://iam.googleapis.com/projects/-/serviceAccounts/my-service-account@iam.gserviceaccount.com`. + * * `deleted:principal://iam.googleapis.com/projects/-/serviceAccounts/{service_account_id}?uid={uid}`: + * A Google Cloud service account that was deleted recently. For example, + * `deleted:principal://iam.googleapis.com/projects/-/serviceAccounts/my-service-account@iam.gserviceaccount.com?uid=1234567890`. + * If the service account is undeleted, this identifier reverts to the + * standard identifier for a service account. + * * `principalSet://goog/cloudIdentityCustomerId/{customer_id}`: All of the + * principals associated with the specified Google Workspace or Cloud + * Identity customer ID. For example, + * `principalSet://goog/cloudIdentityCustomerId/C01Abc35`. + * + * Generated from protobuf field repeated string denied_principals = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDeniedPrincipals() + { + return $this->denied_principals; + } + + /** + * The identities that are prevented from using one or more permissions on + * Google Cloud resources. This field can contain the following values: + * * `principalSet://goog/public:all`: A special identifier that represents + * any principal that is on the internet, even if they do not have a Google + * Account or are not logged in. + * * `principal://goog/subject/{email_id}`: A specific Google Account. + * Includes Gmail, Cloud Identity, and Google Workspace user accounts. For + * example, `principal://goog/subject/alice@example.com`. + * * `deleted:principal://goog/subject/{email_id}?uid={uid}`: A specific + * Google Account that was deleted recently. For example, + * `deleted:principal://goog/subject/alice@example.com?uid=1234567890`. If + * the Google Account is recovered, this identifier reverts to the standard + * identifier for a Google Account. + * * `principalSet://goog/group/{group_id}`: A Google group. For example, + * `principalSet://goog/group/admins@example.com`. + * * `deleted:principalSet://goog/group/{group_id}?uid={uid}`: A Google group + * that was deleted recently. For example, + * `deleted:principalSet://goog/group/admins@example.com?uid=1234567890`. If + * the Google group is restored, this identifier reverts to the standard + * identifier for a Google group. + * * `principal://iam.googleapis.com/projects/-/serviceAccounts/{service_account_id}`: + * A Google Cloud service account. For example, + * `principal://iam.googleapis.com/projects/-/serviceAccounts/my-service-account@iam.gserviceaccount.com`. + * * `deleted:principal://iam.googleapis.com/projects/-/serviceAccounts/{service_account_id}?uid={uid}`: + * A Google Cloud service account that was deleted recently. For example, + * `deleted:principal://iam.googleapis.com/projects/-/serviceAccounts/my-service-account@iam.gserviceaccount.com?uid=1234567890`. + * If the service account is undeleted, this identifier reverts to the + * standard identifier for a service account. + * * `principalSet://goog/cloudIdentityCustomerId/{customer_id}`: All of the + * principals associated with the specified Google Workspace or Cloud + * Identity customer ID. For example, + * `principalSet://goog/cloudIdentityCustomerId/C01Abc35`. + * + * Generated from protobuf field repeated string denied_principals = 1; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDeniedPrincipals($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->denied_principals = $arr; + + return $this; + } + + /** + * The identities that are excluded from the deny rule, even if they are + * listed in the `denied_principals`. For example, you could add a Google + * group to the `denied_principals`, then exclude specific users who belong to + * that group. + * This field can contain the same values as the `denied_principals` field, + * excluding `principalSet://goog/public:all`, which represents all users on + * the internet. + * + * Generated from protobuf field repeated string exception_principals = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getExceptionPrincipals() + { + return $this->exception_principals; + } + + /** + * The identities that are excluded from the deny rule, even if they are + * listed in the `denied_principals`. For example, you could add a Google + * group to the `denied_principals`, then exclude specific users who belong to + * that group. + * This field can contain the same values as the `denied_principals` field, + * excluding `principalSet://goog/public:all`, which represents all users on + * the internet. + * + * Generated from protobuf field repeated string exception_principals = 2; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setExceptionPrincipals($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->exception_principals = $arr; + + return $this; + } + + /** + * The permissions that are explicitly denied by this rule. Each permission + * uses the format `{service_fqdn}/{resource}.{verb}`, where `{service_fqdn}` + * is the fully qualified domain name for the service. For example, + * `iam.googleapis.com/roles.list`. + * + * Generated from protobuf field repeated string denied_permissions = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDeniedPermissions() + { + return $this->denied_permissions; + } + + /** + * The permissions that are explicitly denied by this rule. Each permission + * uses the format `{service_fqdn}/{resource}.{verb}`, where `{service_fqdn}` + * is the fully qualified domain name for the service. For example, + * `iam.googleapis.com/roles.list`. + * + * Generated from protobuf field repeated string denied_permissions = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDeniedPermissions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->denied_permissions = $arr; + + return $this; + } + + /** + * Specifies the permissions that this rule excludes from the set of denied + * permissions given by `denied_permissions`. If a permission appears in + * `denied_permissions` _and_ in `exception_permissions` then it will _not_ be + * denied. + * The excluded permissions can be specified using the same syntax as + * `denied_permissions`. + * + * Generated from protobuf field repeated string exception_permissions = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getExceptionPermissions() + { + return $this->exception_permissions; + } + + /** + * Specifies the permissions that this rule excludes from the set of denied + * permissions given by `denied_permissions`. If a permission appears in + * `denied_permissions` _and_ in `exception_permissions` then it will _not_ be + * denied. + * The excluded permissions can be specified using the same syntax as + * `denied_permissions`. + * + * Generated from protobuf field repeated string exception_permissions = 4; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setExceptionPermissions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->exception_permissions = $arr; + + return $this; + } + + /** + * The condition that determines whether this deny rule applies to a request. + * If the condition expression evaluates to `true`, then the deny rule is + * applied; otherwise, the deny rule is not applied. + * Each deny rule is evaluated independently. If this deny rule does not apply + * to a request, other deny rules might still apply. + * The condition can use CEL functions that evaluate + * [resource + * tags](https://cloud.google.com/iam/help/conditions/resource-tags). Other + * functions and operators are not supported. + * + * Generated from protobuf field .google.type.Expr denial_condition = 5; + * @return \Google\Type\Expr|null + */ + public function getDenialCondition() + { + return $this->denial_condition; + } + + public function hasDenialCondition() + { + return isset($this->denial_condition); + } + + public function clearDenialCondition() + { + unset($this->denial_condition); + } + + /** + * The condition that determines whether this deny rule applies to a request. + * If the condition expression evaluates to `true`, then the deny rule is + * applied; otherwise, the deny rule is not applied. + * Each deny rule is evaluated independently. If this deny rule does not apply + * to a request, other deny rules might still apply. + * The condition can use CEL functions that evaluate + * [resource + * tags](https://cloud.google.com/iam/help/conditions/resource-tags). Other + * functions and operators are not supported. + * + * Generated from protobuf field .google.type.Expr denial_condition = 5; + * @param \Google\Type\Expr $var + * @return $this + */ + public function setDenialCondition($var) + { + GPBUtil::checkMessage($var, \Google\Type\Expr::class); + $this->denial_condition = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Iam/v2/proto/src/Google/Cloud/Iam/V2/GetPolicyRequest.php b/owl-bot-staging/Iam/v2/proto/src/Google/Cloud/Iam/V2/GetPolicyRequest.php new file mode 100644 index 000000000000..36d1bb72c6f0 --- /dev/null +++ b/owl-bot-staging/Iam/v2/proto/src/Google/Cloud/Iam/V2/GetPolicyRequest.php @@ -0,0 +1,113 @@ +google.iam.v2.GetPolicyRequest + */ +class GetPolicyRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the policy to retrieve. Format: + * `policies/{attachment_point}/denypolicies/{policy_id}` + * Use the URL-encoded full resource name, which means that the forward-slash + * character, `/`, must be written as `%2F`. For example, + * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-policy`. + * For organizations and folders, use the numeric ID in the full resource + * name. For projects, you can use the alphanumeric or the numeric ID. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $name = ''; + + /** + * @param string $name Required. The resource name of the policy to retrieve. Format: + * `policies/{attachment_point}/denypolicies/{policy_id}` + * + * + * Use the URL-encoded full resource name, which means that the forward-slash + * character, `/`, must be written as `%2F`. For example, + * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-policy`. + * + * For organizations and folders, use the numeric ID in the full resource + * name. For projects, you can use the alphanumeric or the numeric ID. + * + * @return \Google\Cloud\Iam\V2\GetPolicyRequest + * + * @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 resource name of the policy to retrieve. Format: + * `policies/{attachment_point}/denypolicies/{policy_id}` + * Use the URL-encoded full resource name, which means that the forward-slash + * character, `/`, must be written as `%2F`. For example, + * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-policy`. + * For organizations and folders, use the numeric ID in the full resource + * name. For projects, you can use the alphanumeric or the numeric ID. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Iam\V2\Policy::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the policy to retrieve. Format: + * `policies/{attachment_point}/denypolicies/{policy_id}` + * Use the URL-encoded full resource name, which means that the forward-slash + * character, `/`, must be written as `%2F`. For example, + * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-policy`. + * For organizations and folders, use the numeric ID in the full resource + * name. For projects, you can use the alphanumeric or the numeric ID. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name of the policy to retrieve. Format: + * `policies/{attachment_point}/denypolicies/{policy_id}` + * Use the URL-encoded full resource name, which means that the forward-slash + * character, `/`, must be written as `%2F`. For example, + * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-policy`. + * For organizations and folders, use the numeric ID in the full resource + * name. For projects, you can use the alphanumeric or the numeric ID. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Iam/v2/proto/src/Google/Cloud/Iam/V2/ListPoliciesRequest.php b/owl-bot-staging/Iam/v2/proto/src/Google/Cloud/Iam/V2/ListPoliciesRequest.php new file mode 100644 index 000000000000..c21c8d14af02 --- /dev/null +++ b/owl-bot-staging/Iam/v2/proto/src/Google/Cloud/Iam/V2/ListPoliciesRequest.php @@ -0,0 +1,199 @@ +google.iam.v2.ListPoliciesRequest + */ +class ListPoliciesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource that the policy is attached to, along with the kind of policy + * to list. Format: + * `policies/{attachment_point}/denypolicies` + * The attachment point is identified by its URL-encoded full resource name, + * which means that the forward-slash character, `/`, must be written as + * `%2F`. For example, + * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies`. + * For organizations and folders, use the numeric ID in the full resource + * name. For projects, you can use the alphanumeric or the numeric ID. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $parent = ''; + /** + * The maximum number of policies to return. IAM ignores this value and uses + * the value 1000. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * A page token received in a [ListPoliciesResponse][google.iam.v2.ListPoliciesResponse]. Provide this token to + * retrieve the next page. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + + /** + * @param string $parent Required. The resource that the policy is attached to, along with the kind of policy + * to list. Format: + * `policies/{attachment_point}/denypolicies` + * + * + * The attachment point is identified by its URL-encoded full resource name, + * which means that the forward-slash character, `/`, must be written as + * `%2F`. For example, + * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies`. + * + * For organizations and folders, use the numeric ID in the full resource + * name. For projects, you can use the alphanumeric or the numeric ID. + * + * @return \Google\Cloud\Iam\V2\ListPoliciesRequest + * + * @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. The resource that the policy is attached to, along with the kind of policy + * to list. Format: + * `policies/{attachment_point}/denypolicies` + * The attachment point is identified by its URL-encoded full resource name, + * which means that the forward-slash character, `/`, must be written as + * `%2F`. For example, + * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies`. + * For organizations and folders, use the numeric ID in the full resource + * name. For projects, you can use the alphanumeric or the numeric ID. + * @type int $page_size + * The maximum number of policies to return. IAM ignores this value and uses + * the value 1000. + * @type string $page_token + * A page token received in a [ListPoliciesResponse][google.iam.v2.ListPoliciesResponse]. Provide this token to + * retrieve the next page. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Iam\V2\Policy::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource that the policy is attached to, along with the kind of policy + * to list. Format: + * `policies/{attachment_point}/denypolicies` + * The attachment point is identified by its URL-encoded full resource name, + * which means that the forward-slash character, `/`, must be written as + * `%2F`. For example, + * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies`. + * For organizations and folders, use the numeric ID in the full resource + * name. For projects, you can use the alphanumeric or the numeric ID. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The resource that the policy is attached to, along with the kind of policy + * to list. Format: + * `policies/{attachment_point}/denypolicies` + * The attachment point is identified by its URL-encoded full resource name, + * which means that the forward-slash character, `/`, must be written as + * `%2F`. For example, + * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies`. + * For organizations and folders, use the numeric ID in the full resource + * name. For projects, you can use the alphanumeric or the numeric ID. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The maximum number of policies to return. IAM ignores this value and uses + * the value 1000. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of policies to return. IAM ignores this value and uses + * the value 1000. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * A page token received in a [ListPoliciesResponse][google.iam.v2.ListPoliciesResponse]. Provide this token to + * retrieve the next page. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * A page token received in a [ListPoliciesResponse][google.iam.v2.ListPoliciesResponse]. Provide this token to + * retrieve the next page. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Iam/v2/proto/src/Google/Cloud/Iam/V2/ListPoliciesResponse.php b/owl-bot-staging/Iam/v2/proto/src/Google/Cloud/Iam/V2/ListPoliciesResponse.php new file mode 100644 index 000000000000..c2749f099b28 --- /dev/null +++ b/owl-bot-staging/Iam/v2/proto/src/Google/Cloud/Iam/V2/ListPoliciesResponse.php @@ -0,0 +1,105 @@ +google.iam.v2.ListPoliciesResponse + */ +class ListPoliciesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Metadata for the policies that are attached to the resource. + * + * Generated from protobuf field repeated .google.iam.v2.Policy policies = 1; + */ + private $policies; + /** + * A page token that you can use in a [ListPoliciesRequest][google.iam.v2.ListPoliciesRequest] to retrieve the + * next page. If this field is omitted, there are no additional pages. + * + * 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\Iam\V2\Policy>|\Google\Protobuf\Internal\RepeatedField $policies + * Metadata for the policies that are attached to the resource. + * @type string $next_page_token + * A page token that you can use in a [ListPoliciesRequest][google.iam.v2.ListPoliciesRequest] to retrieve the + * next page. If this field is omitted, there are no additional pages. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Iam\V2\Policy::initOnce(); + parent::__construct($data); + } + + /** + * Metadata for the policies that are attached to the resource. + * + * Generated from protobuf field repeated .google.iam.v2.Policy policies = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getPolicies() + { + return $this->policies; + } + + /** + * Metadata for the policies that are attached to the resource. + * + * Generated from protobuf field repeated .google.iam.v2.Policy policies = 1; + * @param array<\Google\Cloud\Iam\V2\Policy>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setPolicies($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Iam\V2\Policy::class); + $this->policies = $arr; + + return $this; + } + + /** + * A page token that you can use in a [ListPoliciesRequest][google.iam.v2.ListPoliciesRequest] to retrieve the + * next page. If this field is omitted, there are no additional pages. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A page token that you can use in a [ListPoliciesRequest][google.iam.v2.ListPoliciesRequest] to retrieve the + * next page. If this field is omitted, there are no additional pages. + * + * 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/Iam/v2/proto/src/Google/Cloud/Iam/V2/PoliciesGrpcClient.php b/owl-bot-staging/Iam/v2/proto/src/Google/Cloud/Iam/V2/PoliciesGrpcClient.php new file mode 100644 index 000000000000..c4e5d79b4cdb --- /dev/null +++ b/owl-bot-staging/Iam/v2/proto/src/Google/Cloud/Iam/V2/PoliciesGrpcClient.php @@ -0,0 +1,124 @@ +_simpleRequest('/google.iam.v2.Policies/ListPolicies', + $argument, + ['\Google\Cloud\Iam\V2\ListPoliciesResponse', 'decode'], + $metadata, $options); + } + + /** + * Gets a policy. + * @param \Google\Cloud\Iam\V2\GetPolicyRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function GetPolicy(\Google\Cloud\Iam\V2\GetPolicyRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.iam.v2.Policies/GetPolicy', + $argument, + ['\Google\Cloud\Iam\V2\Policy', 'decode'], + $metadata, $options); + } + + /** + * Creates a policy. + * @param \Google\Cloud\Iam\V2\CreatePolicyRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function CreatePolicy(\Google\Cloud\Iam\V2\CreatePolicyRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.iam.v2.Policies/CreatePolicy', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Updates the specified policy. + * + * You can update only the rules and the display name for the policy. + * + * To update a policy, you should use a read-modify-write loop: + * + * 1. Use [GetPolicy][google.iam.v2.Policies.GetPolicy] to read the current version of the policy. + * 2. Modify the policy as needed. + * 3. Use `UpdatePolicy` to write the updated policy. + * + * This pattern helps prevent conflicts between concurrent updates. + * @param \Google\Cloud\Iam\V2\UpdatePolicyRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function UpdatePolicy(\Google\Cloud\Iam\V2\UpdatePolicyRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.iam.v2.Policies/UpdatePolicy', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Deletes a policy. This action is permanent. + * @param \Google\Cloud\Iam\V2\DeletePolicyRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function DeletePolicy(\Google\Cloud\Iam\V2\DeletePolicyRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.iam.v2.Policies/DeletePolicy', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + +} diff --git a/owl-bot-staging/Iam/v2/proto/src/Google/Cloud/Iam/V2/Policy.php b/owl-bot-staging/Iam/v2/proto/src/Google/Cloud/Iam/V2/Policy.php new file mode 100644 index 000000000000..79dfa8b27141 --- /dev/null +++ b/owl-bot-staging/Iam/v2/proto/src/Google/Cloud/Iam/V2/Policy.php @@ -0,0 +1,505 @@ +google.iam.v2.Policy + */ +class Policy extends \Google\Protobuf\Internal\Message +{ + /** + * Immutable. The resource name of the `Policy`, which must be unique. Format: + * `policies/{attachment_point}/denypolicies/{policy_id}` + * The attachment point is identified by its URL-encoded full resource name, + * which means that the forward-slash character, `/`, must be written as + * `%2F`. For example, + * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-deny-policy`. + * For organizations and folders, use the numeric ID in the full resource + * name. For projects, requests can use the alphanumeric or the numeric ID. + * Responses always contain the numeric ID. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + */ + protected $name = ''; + /** + * Immutable. The globally unique ID of the `Policy`. Assigned automatically when the + * `Policy` is created. + * + * Generated from protobuf field string uid = 2 [(.google.api.field_behavior) = IMMUTABLE]; + */ + protected $uid = ''; + /** + * Output only. The kind of the `Policy`. Always contains the value `DenyPolicy`. + * + * Generated from protobuf field string kind = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $kind = ''; + /** + * A user-specified description of the `Policy`. This value can be up to 63 + * characters. + * + * Generated from protobuf field string display_name = 4; + */ + protected $display_name = ''; + /** + * A key-value map to store arbitrary metadata for the `Policy`. Keys + * can be up to 63 characters. Values can be up to 255 characters. + * + * Generated from protobuf field map annotations = 5; + */ + private $annotations; + /** + * An opaque tag that identifies the current version of the `Policy`. IAM uses + * this value to help manage concurrent updates, so they do not cause one + * update to be overwritten by another. + * If this field is present in a [CreatePolicy][] request, the value is + * ignored. + * + * Generated from protobuf field string etag = 6; + */ + protected $etag = ''; + /** + * Output only. The time when the `Policy` was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. The time when the `Policy` was last updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * Output only. The time when the `Policy` was deleted. Empty if the policy is not deleted. + * + * Generated from protobuf field .google.protobuf.Timestamp delete_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $delete_time = null; + /** + * A list of rules that specify the behavior of the `Policy`. All of the rules + * should be of the `kind` specified in the `Policy`. + * + * Generated from protobuf field repeated .google.iam.v2.PolicyRule rules = 10; + */ + private $rules; + /** + * Immutable. Specifies that this policy is managed by an authority and can only be + * modified by that authority. Usage is restricted. + * + * Generated from protobuf field string managing_authority = 11 [(.google.api.field_behavior) = IMMUTABLE]; + */ + protected $managing_authority = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Immutable. The resource name of the `Policy`, which must be unique. Format: + * `policies/{attachment_point}/denypolicies/{policy_id}` + * The attachment point is identified by its URL-encoded full resource name, + * which means that the forward-slash character, `/`, must be written as + * `%2F`. For example, + * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-deny-policy`. + * For organizations and folders, use the numeric ID in the full resource + * name. For projects, requests can use the alphanumeric or the numeric ID. + * Responses always contain the numeric ID. + * @type string $uid + * Immutable. The globally unique ID of the `Policy`. Assigned automatically when the + * `Policy` is created. + * @type string $kind + * Output only. The kind of the `Policy`. Always contains the value `DenyPolicy`. + * @type string $display_name + * A user-specified description of the `Policy`. This value can be up to 63 + * characters. + * @type array|\Google\Protobuf\Internal\MapField $annotations + * A key-value map to store arbitrary metadata for the `Policy`. Keys + * can be up to 63 characters. Values can be up to 255 characters. + * @type string $etag + * An opaque tag that identifies the current version of the `Policy`. IAM uses + * this value to help manage concurrent updates, so they do not cause one + * update to be overwritten by another. + * If this field is present in a [CreatePolicy][] request, the value is + * ignored. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The time when the `Policy` was created. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. The time when the `Policy` was last updated. + * @type \Google\Protobuf\Timestamp $delete_time + * Output only. The time when the `Policy` was deleted. Empty if the policy is not deleted. + * @type array<\Google\Cloud\Iam\V2\PolicyRule>|\Google\Protobuf\Internal\RepeatedField $rules + * A list of rules that specify the behavior of the `Policy`. All of the rules + * should be of the `kind` specified in the `Policy`. + * @type string $managing_authority + * Immutable. Specifies that this policy is managed by an authority and can only be + * modified by that authority. Usage is restricted. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Iam\V2\Policy::initOnce(); + parent::__construct($data); + } + + /** + * Immutable. The resource name of the `Policy`, which must be unique. Format: + * `policies/{attachment_point}/denypolicies/{policy_id}` + * The attachment point is identified by its URL-encoded full resource name, + * which means that the forward-slash character, `/`, must be written as + * `%2F`. For example, + * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-deny-policy`. + * For organizations and folders, use the numeric ID in the full resource + * name. For projects, requests can use the alphanumeric or the numeric ID. + * Responses always contain the numeric ID. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Immutable. The resource name of the `Policy`, which must be unique. Format: + * `policies/{attachment_point}/denypolicies/{policy_id}` + * The attachment point is identified by its URL-encoded full resource name, + * which means that the forward-slash character, `/`, must be written as + * `%2F`. For example, + * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-deny-policy`. + * For organizations and folders, use the numeric ID in the full resource + * name. For projects, requests can use the alphanumeric or the numeric ID. + * Responses always contain the numeric ID. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Immutable. The globally unique ID of the `Policy`. Assigned automatically when the + * `Policy` is created. + * + * Generated from protobuf field string uid = 2 [(.google.api.field_behavior) = IMMUTABLE]; + * @return string + */ + public function getUid() + { + return $this->uid; + } + + /** + * Immutable. The globally unique ID of the `Policy`. Assigned automatically when the + * `Policy` is created. + * + * Generated from protobuf field string uid = 2 [(.google.api.field_behavior) = IMMUTABLE]; + * @param string $var + * @return $this + */ + public function setUid($var) + { + GPBUtil::checkString($var, True); + $this->uid = $var; + + return $this; + } + + /** + * Output only. The kind of the `Policy`. Always contains the value `DenyPolicy`. + * + * Generated from protobuf field string kind = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getKind() + { + return $this->kind; + } + + /** + * Output only. The kind of the `Policy`. Always contains the value `DenyPolicy`. + * + * Generated from protobuf field string kind = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setKind($var) + { + GPBUtil::checkString($var, True); + $this->kind = $var; + + return $this; + } + + /** + * A user-specified description of the `Policy`. This value can be up to 63 + * characters. + * + * Generated from protobuf field string display_name = 4; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * A user-specified description of the `Policy`. This value can be up to 63 + * characters. + * + * Generated from protobuf field string display_name = 4; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * A key-value map to store arbitrary metadata for the `Policy`. Keys + * can be up to 63 characters. Values can be up to 255 characters. + * + * Generated from protobuf field map annotations = 5; + * @return \Google\Protobuf\Internal\MapField + */ + public function getAnnotations() + { + return $this->annotations; + } + + /** + * A key-value map to store arbitrary metadata for the `Policy`. Keys + * can be up to 63 characters. Values can be up to 255 characters. + * + * Generated from protobuf field map annotations = 5; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setAnnotations($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->annotations = $arr; + + return $this; + } + + /** + * An opaque tag that identifies the current version of the `Policy`. IAM uses + * this value to help manage concurrent updates, so they do not cause one + * update to be overwritten by another. + * If this field is present in a [CreatePolicy][] request, the value is + * ignored. + * + * Generated from protobuf field string etag = 6; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * An opaque tag that identifies the current version of the `Policy`. IAM uses + * this value to help manage concurrent updates, so they do not cause one + * update to be overwritten by another. + * If this field is present in a [CreatePolicy][] request, the value is + * ignored. + * + * Generated from protobuf field string etag = 6; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, True); + $this->etag = $var; + + return $this; + } + + /** + * Output only. The time when the `Policy` was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 7 [(.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 when the `Policy` was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 7 [(.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 when the `Policy` was last updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 8 [(.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 when the `Policy` was last updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 8 [(.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 time when the `Policy` was deleted. Empty if the policy is not deleted. + * + * Generated from protobuf field .google.protobuf.Timestamp delete_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getDeleteTime() + { + return $this->delete_time; + } + + public function hasDeleteTime() + { + return isset($this->delete_time); + } + + public function clearDeleteTime() + { + unset($this->delete_time); + } + + /** + * Output only. The time when the `Policy` was deleted. Empty if the policy is not deleted. + * + * Generated from protobuf field .google.protobuf.Timestamp delete_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setDeleteTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->delete_time = $var; + + return $this; + } + + /** + * A list of rules that specify the behavior of the `Policy`. All of the rules + * should be of the `kind` specified in the `Policy`. + * + * Generated from protobuf field repeated .google.iam.v2.PolicyRule rules = 10; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRules() + { + return $this->rules; + } + + /** + * A list of rules that specify the behavior of the `Policy`. All of the rules + * should be of the `kind` specified in the `Policy`. + * + * Generated from protobuf field repeated .google.iam.v2.PolicyRule rules = 10; + * @param array<\Google\Cloud\Iam\V2\PolicyRule>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRules($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Iam\V2\PolicyRule::class); + $this->rules = $arr; + + return $this; + } + + /** + * Immutable. Specifies that this policy is managed by an authority and can only be + * modified by that authority. Usage is restricted. + * + * Generated from protobuf field string managing_authority = 11 [(.google.api.field_behavior) = IMMUTABLE]; + * @return string + */ + public function getManagingAuthority() + { + return $this->managing_authority; + } + + /** + * Immutable. Specifies that this policy is managed by an authority and can only be + * modified by that authority. Usage is restricted. + * + * Generated from protobuf field string managing_authority = 11 [(.google.api.field_behavior) = IMMUTABLE]; + * @param string $var + * @return $this + */ + public function setManagingAuthority($var) + { + GPBUtil::checkString($var, True); + $this->managing_authority = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Iam/v2/proto/src/Google/Cloud/Iam/V2/PolicyOperationMetadata.php b/owl-bot-staging/Iam/v2/proto/src/Google/Cloud/Iam/V2/PolicyOperationMetadata.php new file mode 100644 index 000000000000..bcaa57148115 --- /dev/null +++ b/owl-bot-staging/Iam/v2/proto/src/Google/Cloud/Iam/V2/PolicyOperationMetadata.php @@ -0,0 +1,77 @@ +google.iam.v2.PolicyOperationMetadata + */ +class PolicyOperationMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * Timestamp when the `google.longrunning.Operation` was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 1; + */ + protected $create_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Timestamp $create_time + * Timestamp when the `google.longrunning.Operation` was created. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Iam\V2\Policy::initOnce(); + parent::__construct($data); + } + + /** + * Timestamp when the `google.longrunning.Operation` was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 1; + * @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); + } + + /** + * Timestamp when the `google.longrunning.Operation` was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 1; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Iam/v2/proto/src/Google/Cloud/Iam/V2/PolicyRule.php b/owl-bot-staging/Iam/v2/proto/src/Google/Cloud/Iam/V2/PolicyRule.php new file mode 100644 index 000000000000..2691d8de2f72 --- /dev/null +++ b/owl-bot-staging/Iam/v2/proto/src/Google/Cloud/Iam/V2/PolicyRule.php @@ -0,0 +1,113 @@ +google.iam.v2.PolicyRule + */ +class PolicyRule extends \Google\Protobuf\Internal\Message +{ + /** + * A user-specified description of the rule. This value can be up to 256 + * characters. + * + * Generated from protobuf field string description = 1; + */ + protected $description = ''; + protected $kind; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Iam\V2\DenyRule $deny_rule + * A rule for a deny policy. + * @type string $description + * A user-specified description of the rule. This value can be up to 256 + * characters. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Iam\V2\Policy::initOnce(); + parent::__construct($data); + } + + /** + * A rule for a deny policy. + * + * Generated from protobuf field .google.iam.v2.DenyRule deny_rule = 2; + * @return \Google\Cloud\Iam\V2\DenyRule|null + */ + public function getDenyRule() + { + return $this->readOneof(2); + } + + public function hasDenyRule() + { + return $this->hasOneof(2); + } + + /** + * A rule for a deny policy. + * + * Generated from protobuf field .google.iam.v2.DenyRule deny_rule = 2; + * @param \Google\Cloud\Iam\V2\DenyRule $var + * @return $this + */ + public function setDenyRule($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Iam\V2\DenyRule::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * A user-specified description of the rule. This value can be up to 256 + * characters. + * + * Generated from protobuf field string description = 1; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * A user-specified description of the rule. This value can be up to 256 + * characters. + * + * Generated from protobuf field string description = 1; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * @return string + */ + public function getKind() + { + return $this->whichOneof("kind"); + } + +} + diff --git a/owl-bot-staging/Iam/v2/proto/src/Google/Cloud/Iam/V2/UpdatePolicyRequest.php b/owl-bot-staging/Iam/v2/proto/src/Google/Cloud/Iam/V2/UpdatePolicyRequest.php new file mode 100644 index 000000000000..da476fab3dce --- /dev/null +++ b/owl-bot-staging/Iam/v2/proto/src/Google/Cloud/Iam/V2/UpdatePolicyRequest.php @@ -0,0 +1,89 @@ +google.iam.v2.UpdatePolicyRequest + */ +class UpdatePolicyRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The policy to update. + * To prevent conflicting updates, the `etag` value must match the value that + * is stored in IAM. If the `etag` values do not match, the request fails with + * a `409` error code and `ABORTED` status. + * + * Generated from protobuf field .google.iam.v2.Policy policy = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $policy = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Iam\V2\Policy $policy + * Required. The policy to update. + * To prevent conflicting updates, the `etag` value must match the value that + * is stored in IAM. If the `etag` values do not match, the request fails with + * a `409` error code and `ABORTED` status. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Iam\V2\Policy::initOnce(); + parent::__construct($data); + } + + /** + * Required. The policy to update. + * To prevent conflicting updates, the `etag` value must match the value that + * is stored in IAM. If the `etag` values do not match, the request fails with + * a `409` error code and `ABORTED` status. + * + * Generated from protobuf field .google.iam.v2.Policy policy = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Iam\V2\Policy|null + */ + public function getPolicy() + { + return $this->policy; + } + + public function hasPolicy() + { + return isset($this->policy); + } + + public function clearPolicy() + { + unset($this->policy); + } + + /** + * Required. The policy to update. + * To prevent conflicting updates, the `etag` value must match the value that + * is stored in IAM. If the `etag` values do not match, the request fails with + * a `409` error code and `ABORTED` status. + * + * Generated from protobuf field .google.iam.v2.Policy policy = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Iam\V2\Policy $var + * @return $this + */ + public function setPolicy($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Iam\V2\Policy::class); + $this->policy = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Iam/v2/samples/V2/PoliciesClient/create_policy.php b/owl-bot-staging/Iam/v2/samples/V2/PoliciesClient/create_policy.php new file mode 100644 index 000000000000..2ee2e8390987 --- /dev/null +++ b/owl-bot-staging/Iam/v2/samples/V2/PoliciesClient/create_policy.php @@ -0,0 +1,94 @@ +setParent($parent) + ->setPolicy($policy); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $policiesClient->createPolicy($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Policy $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 +{ + $parent = '[PARENT]'; + + create_policy_sample($parent); +} +// [END iam_v2_generated_Policies_CreatePolicy_sync] diff --git a/owl-bot-staging/Iam/v2/samples/V2/PoliciesClient/delete_policy.php b/owl-bot-staging/Iam/v2/samples/V2/PoliciesClient/delete_policy.php new file mode 100644 index 000000000000..876a094b094d --- /dev/null +++ b/owl-bot-staging/Iam/v2/samples/V2/PoliciesClient/delete_policy.php @@ -0,0 +1,91 @@ +setName($name); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $policiesClient->deletePolicy($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Policy $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 +{ + $name = '[NAME]'; + + delete_policy_sample($name); +} +// [END iam_v2_generated_Policies_DeletePolicy_sync] diff --git a/owl-bot-staging/Iam/v2/samples/V2/PoliciesClient/get_policy.php b/owl-bot-staging/Iam/v2/samples/V2/PoliciesClient/get_policy.php new file mode 100644 index 000000000000..7575444009f0 --- /dev/null +++ b/owl-bot-staging/Iam/v2/samples/V2/PoliciesClient/get_policy.php @@ -0,0 +1,79 @@ +setName($name); + + // Call the API and handle any network failures. + try { + /** @var Policy $response */ + $response = $policiesClient->getPolicy($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 +{ + $name = '[NAME]'; + + get_policy_sample($name); +} +// [END iam_v2_generated_Policies_GetPolicy_sync] diff --git a/owl-bot-staging/Iam/v2/samples/V2/PoliciesClient/list_policies.php b/owl-bot-staging/Iam/v2/samples/V2/PoliciesClient/list_policies.php new file mode 100644 index 000000000000..ae213c70df4f --- /dev/null +++ b/owl-bot-staging/Iam/v2/samples/V2/PoliciesClient/list_policies.php @@ -0,0 +1,90 @@ +setParent($parent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $policiesClient->listPolicies($request); + + /** @var Policy $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 +{ + $parent = '[PARENT]'; + + list_policies_sample($parent); +} +// [END iam_v2_generated_Policies_ListPolicies_sync] diff --git a/owl-bot-staging/Iam/v2/samples/V2/PoliciesClient/update_policy.php b/owl-bot-staging/Iam/v2/samples/V2/PoliciesClient/update_policy.php new file mode 100644 index 000000000000..9475cc0bab18 --- /dev/null +++ b/owl-bot-staging/Iam/v2/samples/V2/PoliciesClient/update_policy.php @@ -0,0 +1,81 @@ +setPolicy($policy); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $policiesClient->updatePolicy($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Policy $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()); + } +} +// [END iam_v2_generated_Policies_UpdatePolicy_sync] diff --git a/owl-bot-staging/Iam/v2/src/V2/Client/BaseClient/PoliciesBaseClient.php b/owl-bot-staging/Iam/v2/src/V2/Client/BaseClient/PoliciesBaseClient.php new file mode 100644 index 000000000000..a5d6916c406c --- /dev/null +++ b/owl-bot-staging/Iam/v2/src/V2/Client/BaseClient/PoliciesBaseClient.php @@ -0,0 +1,340 @@ + self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../../resources/policies_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../../resources/policies_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../../resources/policies_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../../resources/policies_rest_client_config.php', + ], + ], + ]; + } + + /** + * 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; + } + + /** + * 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 'iam.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. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *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' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods 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 policy. + * + * The async variant is {@see self::createPolicyAsync()} . + * + * @param CreatePolicyRequest $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 createPolicy(CreatePolicyRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('CreatePolicy', $request, $callOptions)->wait(); + } + + /** + * Deletes a policy. This action is permanent. + * + * The async variant is {@see self::deletePolicyAsync()} . + * + * @param DeletePolicyRequest $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 deletePolicy(DeletePolicyRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('DeletePolicy', $request, $callOptions)->wait(); + } + + /** + * Gets a policy. + * + * The async variant is {@see self::getPolicyAsync()} . + * + * @param GetPolicyRequest $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 Policy + * + * @throws ApiException Thrown if the API call fails. + */ + public function getPolicy(GetPolicyRequest $request, array $callOptions = []): Policy + { + return $this->startApiCall('GetPolicy', $request, $callOptions)->wait(); + } + + /** + * Retrieves the policies of the specified kind that are attached to a + * resource. + * + * The response lists only policy metadata. In particular, policy rules are + * omitted. + * + * The async variant is {@see self::listPoliciesAsync()} . + * + * @param ListPoliciesRequest $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 listPolicies(ListPoliciesRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListPolicies', $request, $callOptions); + } + + /** + * Updates the specified policy. + * + * You can update only the rules and the display name for the policy. + * + * To update a policy, you should use a read-modify-write loop: + * + * 1. Use [GetPolicy][google.iam.v2.Policies.GetPolicy] to read the current version of the policy. + * 2. Modify the policy as needed. + * 3. Use `UpdatePolicy` to write the updated policy. + * + * This pattern helps prevent conflicts between concurrent updates. + * + * The async variant is {@see self::updatePolicyAsync()} . + * + * @param UpdatePolicyRequest $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 updatePolicy(UpdatePolicyRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('UpdatePolicy', $request, $callOptions)->wait(); + } +} diff --git a/owl-bot-staging/Iam/v2/src/V2/Client/PoliciesClient.php b/owl-bot-staging/Iam/v2/src/V2/Client/PoliciesClient.php new file mode 100644 index 000000000000..c32e6d26b538 --- /dev/null +++ b/owl-bot-staging/Iam/v2/src/V2/Client/PoliciesClient.php @@ -0,0 +1,40 @@ +createPolicy($parent, $policy); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $policiesClient->createPolicy($parent, $policy); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $policiesClient->resumeOperation($operationName, 'createPolicy'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $policiesClient->close(); + * } + * ``` + */ +class PoliciesGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.iam.v2.Policies'; + + /** The default address of the service. */ + const SERVICE_ADDRESS = 'iam.googleapis.com'; + + /** The default port of the service. */ + const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + ]; + + private $operationsClient; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/policies_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/policies_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/policies_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/policies_rest_client_config.php', + ], + ], + ]; + } + + /** + * 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; + } + + /** + * 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 'iam.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. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *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' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods 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); + } + + /** + * Creates a policy. + * + * Sample code: + * ``` + * $policiesClient = new PoliciesClient(); + * try { + * $parent = 'parent'; + * $policy = new Policy(); + * $operationResponse = $policiesClient->createPolicy($parent, $policy); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $policiesClient->createPolicy($parent, $policy); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $policiesClient->resumeOperation($operationName, 'createPolicy'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $policiesClient->close(); + * } + * ``` + * + * @param string $parent Required. The resource that the policy is attached to, along with the kind of policy + * to create. Format: `policies/{attachment_point}/denypolicies` + * + * + * The attachment point is identified by its URL-encoded full resource name, + * which means that the forward-slash character, `/`, must be written as + * `%2F`. For example, + * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies`. + * + * For organizations and folders, use the numeric ID in the full resource + * name. For projects, you can use the alphanumeric or the numeric ID. + * @param Policy $policy Required. The policy to create. + * @param array $optionalArgs { + * Optional. + * + * @type string $policyId + * The ID to use for this policy, which will become the final component of + * the policy's resource name. The ID must contain 3 to 63 characters. It can + * contain lowercase letters and numbers, as well as dashes (`-`) and periods + * (`.`). The first character must be a lowercase letter. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function createPolicy($parent, $policy, array $optionalArgs = []) + { + $request = new CreatePolicyRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setPolicy($policy); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['policyId'])) { + $request->setPolicyId($optionalArgs['policyId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreatePolicy', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Deletes a policy. This action is permanent. + * + * Sample code: + * ``` + * $policiesClient = new PoliciesClient(); + * try { + * $name = 'name'; + * $operationResponse = $policiesClient->deletePolicy($name); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $policiesClient->deletePolicy($name); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $policiesClient->resumeOperation($operationName, 'deletePolicy'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $policiesClient->close(); + * } + * ``` + * + * @param string $name Required. The resource name of the policy to delete. Format: + * `policies/{attachment_point}/denypolicies/{policy_id}` + * + * + * Use the URL-encoded full resource name, which means that the forward-slash + * character, `/`, must be written as `%2F`. For example, + * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-policy`. + * + * For organizations and folders, use the numeric ID in the full resource + * name. For projects, you can use the alphanumeric or the numeric ID. + * @param array $optionalArgs { + * Optional. + * + * @type string $etag + * Optional. The expected `etag` of the policy to delete. If the value does not match + * the value that is stored in IAM, the request fails with a `409` error code + * and `ABORTED` status. + * + * If you omit this field, the policy is deleted regardless of its current + * `etag`. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function deletePolicy($name, array $optionalArgs = []) + { + $request = new DeletePolicyRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['etag'])) { + $request->setEtag($optionalArgs['etag']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('DeletePolicy', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Gets a policy. + * + * Sample code: + * ``` + * $policiesClient = new PoliciesClient(); + * try { + * $name = 'name'; + * $response = $policiesClient->getPolicy($name); + * } finally { + * $policiesClient->close(); + * } + * ``` + * + * @param string $name Required. The resource name of the policy to retrieve. Format: + * `policies/{attachment_point}/denypolicies/{policy_id}` + * + * + * Use the URL-encoded full resource name, which means that the forward-slash + * character, `/`, must be written as `%2F`. For example, + * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-policy`. + * + * For organizations and folders, use the numeric ID in the full resource + * name. For projects, you can use the alphanumeric or the numeric ID. + * @param array $optionalArgs { + * 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 \Google\Cloud\Iam\V2\Policy + * + * @throws ApiException if the remote call fails + */ + public function getPolicy($name, array $optionalArgs = []) + { + $request = new GetPolicyRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetPolicy', Policy::class, $optionalArgs, $request)->wait(); + } + + /** + * Retrieves the policies of the specified kind that are attached to a + * resource. + * + * The response lists only policy metadata. In particular, policy rules are + * omitted. + * + * Sample code: + * ``` + * $policiesClient = new PoliciesClient(); + * try { + * $parent = 'parent'; + * // Iterate over pages of elements + * $pagedResponse = $policiesClient->listPolicies($parent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $policiesClient->listPolicies($parent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $policiesClient->close(); + * } + * ``` + * + * @param string $parent Required. The resource that the policy is attached to, along with the kind of policy + * to list. Format: + * `policies/{attachment_point}/denypolicies` + * + * + * The attachment point is identified by its URL-encoded full resource name, + * which means that the forward-slash character, `/`, must be written as + * `%2F`. For example, + * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies`. + * + * For organizations and folders, use the numeric ID in the full resource + * name. For projects, you can use the alphanumeric or the numeric ID. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @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 \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listPolicies($parent, array $optionalArgs = []) + { + $request = new ListPoliciesRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListPolicies', $optionalArgs, ListPoliciesResponse::class, $request); + } + + /** + * Updates the specified policy. + * + * You can update only the rules and the display name for the policy. + * + * To update a policy, you should use a read-modify-write loop: + * + * 1. Use [GetPolicy][google.iam.v2.Policies.GetPolicy] to read the current version of the policy. + * 2. Modify the policy as needed. + * 3. Use `UpdatePolicy` to write the updated policy. + * + * This pattern helps prevent conflicts between concurrent updates. + * + * Sample code: + * ``` + * $policiesClient = new PoliciesClient(); + * try { + * $policy = new Policy(); + * $operationResponse = $policiesClient->updatePolicy($policy); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $policiesClient->updatePolicy($policy); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $policiesClient->resumeOperation($operationName, 'updatePolicy'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $policiesClient->close(); + * } + * ``` + * + * @param Policy $policy Required. The policy to update. + * + * To prevent conflicting updates, the `etag` value must match the value that + * is stored in IAM. If the `etag` values do not match, the request fails with + * a `409` error code and `ABORTED` status. + * @param array $optionalArgs { + * 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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function updatePolicy($policy, array $optionalArgs = []) + { + $request = new UpdatePolicyRequest(); + $requestParamHeaders = []; + $request->setPolicy($policy); + $requestParamHeaders['policy.name'] = $policy->getName(); + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('UpdatePolicy', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } +} diff --git a/owl-bot-staging/Iam/v2/src/V2/PoliciesClient.php b/owl-bot-staging/Iam/v2/src/V2/PoliciesClient.php new file mode 100644 index 000000000000..d0acebc4ea23 --- /dev/null +++ b/owl-bot-staging/Iam/v2/src/V2/PoliciesClient.php @@ -0,0 +1,34 @@ + [ + 'google.iam.v2.Policies' => [ + 'CreatePolicy' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Iam\V2\Policy', + 'metadataReturnType' => '\Google\Cloud\Iam\V2\PolicyOperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'DeletePolicy' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Iam\V2\Policy', + 'metadataReturnType' => '\Google\Cloud\Iam\V2\PolicyOperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'UpdatePolicy' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Iam\V2\Policy', + 'metadataReturnType' => '\Google\Cloud\Iam\V2\PolicyOperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'policy.name', + 'fieldAccessors' => [ + 'getPolicy', + 'getName', + ], + ], + ], + ], + 'GetPolicy' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Iam\V2\Policy', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'ListPolicies' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getPolicies', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Iam\V2\ListPoliciesResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + ], + ], +]; diff --git a/owl-bot-staging/Iam/v2/src/V2/resources/policies_rest_client_config.php b/owl-bot-staging/Iam/v2/src/V2/resources/policies_rest_client_config.php new file mode 100644 index 000000000000..37374681f440 --- /dev/null +++ b/owl-bot-staging/Iam/v2/src/V2/resources/policies_rest_client_config.php @@ -0,0 +1,80 @@ + [ + 'google.iam.v2.Policies' => [ + 'CreatePolicy' => [ + 'method' => 'post', + 'uriTemplate' => '/v2/{parent=policies/*/*}', + 'body' => 'policy', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'DeletePolicy' => [ + 'method' => 'delete', + 'uriTemplate' => '/v2/{name=policies/*/*/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetPolicy' => [ + 'method' => 'get', + 'uriTemplate' => '/v2/{name=policies/*/*/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListPolicies' => [ + 'method' => 'get', + 'uriTemplate' => '/v2/{parent=policies/*/*}', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'UpdatePolicy' => [ + 'method' => 'put', + 'uriTemplate' => '/v2/{policy.name=policies/*/*/*}', + 'body' => 'policy', + 'placeholders' => [ + 'policy.name' => [ + 'getters' => [ + 'getPolicy', + 'getName', + ], + ], + ], + ], + ], + 'google.longrunning.Operations' => [ + 'GetOperation' => [ + 'method' => 'get', + 'uriTemplate' => '/v2/{name=policies/*/*/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/Iam/v2/tests/Unit/V2/Client/PoliciesClientTest.php b/owl-bot-staging/Iam/v2/tests/Unit/V2/Client/PoliciesClientTest.php new file mode 100644 index 000000000000..7168f54bc3ed --- /dev/null +++ b/owl-bot-staging/Iam/v2/tests/Unit/V2/Client/PoliciesClientTest.php @@ -0,0 +1,702 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return PoliciesClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new PoliciesClient($options); + } + + /** @test */ + public function createPolicyTest() + { + $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/createPolicyTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $uid = 'uid115792'; + $kind = 'kind3292052'; + $displayName = 'displayName1615086568'; + $etag = 'etag3123477'; + $managingAuthority = 'managingAuthority617792550'; + $expectedResponse = new Policy(); + $expectedResponse->setName($name); + $expectedResponse->setUid($uid); + $expectedResponse->setKind($kind); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setEtag($etag); + $expectedResponse->setManagingAuthority($managingAuthority); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createPolicyTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $parent = 'parent-995424086'; + $policy = new Policy(); + $request = (new CreatePolicyRequest()) + ->setParent($parent) + ->setPolicy($policy); + $response = $gapicClient->createPolicy($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.iam.v2.Policies/CreatePolicy', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($parent, $actualValue); + $actualValue = $actualApiRequestObject->getPolicy(); + $this->assertProtobufEquals($policy, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createPolicyTest'); + $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 createPolicyExceptionTest() + { + $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/createPolicyTest'); + $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 + $parent = 'parent-995424086'; + $policy = new Policy(); + $request = (new CreatePolicyRequest()) + ->setParent($parent) + ->setPolicy($policy); + $response = $gapicClient->createPolicy($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createPolicyTest'); + 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 deletePolicyTest() + { + $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/deletePolicyTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name2 = 'name2-1052831874'; + $uid = 'uid115792'; + $kind = 'kind3292052'; + $displayName = 'displayName1615086568'; + $etag2 = 'etag2-1293302904'; + $managingAuthority = 'managingAuthority617792550'; + $expectedResponse = new Policy(); + $expectedResponse->setName($name2); + $expectedResponse->setUid($uid); + $expectedResponse->setKind($kind); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setEtag($etag2); + $expectedResponse->setManagingAuthority($managingAuthority); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deletePolicyTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $name = 'name3373707'; + $request = (new DeletePolicyRequest()) + ->setName($name); + $response = $gapicClient->deletePolicy($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.iam.v2.Policies/DeletePolicy', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($name, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deletePolicyTest'); + $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 deletePolicyExceptionTest() + { + $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/deletePolicyTest'); + $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 + $name = 'name3373707'; + $request = (new DeletePolicyRequest()) + ->setName($name); + $response = $gapicClient->deletePolicy($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deletePolicyTest'); + 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 getPolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $uid = 'uid115792'; + $kind = 'kind3292052'; + $displayName = 'displayName1615086568'; + $etag = 'etag3123477'; + $managingAuthority = 'managingAuthority617792550'; + $expectedResponse = new Policy(); + $expectedResponse->setName($name2); + $expectedResponse->setUid($uid); + $expectedResponse->setKind($kind); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setEtag($etag); + $expectedResponse->setManagingAuthority($managingAuthority); + $transport->addResponse($expectedResponse); + // Mock request + $name = 'name3373707'; + $request = (new GetPolicyRequest()) + ->setName($name); + $response = $gapicClient->getPolicy($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.iam.v2.Policies/GetPolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($name, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getPolicyExceptionTest() + { + $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 + $name = 'name3373707'; + $request = (new GetPolicyRequest()) + ->setName($name); + try { + $gapicClient->getPolicy($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 listPoliciesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $policiesElement = new Policy(); + $policies = [ + $policiesElement, + ]; + $expectedResponse = new ListPoliciesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setPolicies($policies); + $transport->addResponse($expectedResponse); + // Mock request + $parent = 'parent-995424086'; + $request = (new ListPoliciesRequest()) + ->setParent($parent); + $response = $gapicClient->listPolicies($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getPolicies()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.iam.v2.Policies/ListPolicies', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($parent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listPoliciesExceptionTest() + { + $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 + $parent = 'parent-995424086'; + $request = (new ListPoliciesRequest()) + ->setParent($parent); + try { + $gapicClient->listPolicies($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 updatePolicyTest() + { + $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/updatePolicyTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $uid = 'uid115792'; + $kind = 'kind3292052'; + $displayName = 'displayName1615086568'; + $etag = 'etag3123477'; + $managingAuthority = 'managingAuthority617792550'; + $expectedResponse = new Policy(); + $expectedResponse->setName($name); + $expectedResponse->setUid($uid); + $expectedResponse->setKind($kind); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setEtag($etag); + $expectedResponse->setManagingAuthority($managingAuthority); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updatePolicyTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $policy = new Policy(); + $request = (new UpdatePolicyRequest()) + ->setPolicy($policy); + $response = $gapicClient->updatePolicy($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.iam.v2.Policies/UpdatePolicy', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getPolicy(); + $this->assertProtobufEquals($policy, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updatePolicyTest'); + $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 updatePolicyExceptionTest() + { + $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/updatePolicyTest'); + $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 + $policy = new Policy(); + $request = (new UpdatePolicyRequest()) + ->setPolicy($policy); + $response = $gapicClient->updatePolicy($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updatePolicyTest'); + 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 createPolicyAsyncTest() + { + $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/createPolicyTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $uid = 'uid115792'; + $kind = 'kind3292052'; + $displayName = 'displayName1615086568'; + $etag = 'etag3123477'; + $managingAuthority = 'managingAuthority617792550'; + $expectedResponse = new Policy(); + $expectedResponse->setName($name); + $expectedResponse->setUid($uid); + $expectedResponse->setKind($kind); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setEtag($etag); + $expectedResponse->setManagingAuthority($managingAuthority); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createPolicyTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $parent = 'parent-995424086'; + $policy = new Policy(); + $request = (new CreatePolicyRequest()) + ->setParent($parent) + ->setPolicy($policy); + $response = $gapicClient->createPolicyAsync($request)->wait(); + $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.iam.v2.Policies/CreatePolicy', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($parent, $actualValue); + $actualValue = $actualApiRequestObject->getPolicy(); + $this->assertProtobufEquals($policy, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createPolicyTest'); + $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()); + } +} diff --git a/owl-bot-staging/Iam/v2/tests/Unit/V2/PoliciesClientTest.php b/owl-bot-staging/Iam/v2/tests/Unit/V2/PoliciesClientTest.php new file mode 100644 index 000000000000..9f1626edc41d --- /dev/null +++ b/owl-bot-staging/Iam/v2/tests/Unit/V2/PoliciesClientTest.php @@ -0,0 +1,595 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return PoliciesClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new PoliciesClient($options); + } + + /** @test */ + public function createPolicyTest() + { + $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/createPolicyTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $uid = 'uid115792'; + $kind = 'kind3292052'; + $displayName = 'displayName1615086568'; + $etag = 'etag3123477'; + $managingAuthority = 'managingAuthority617792550'; + $expectedResponse = new Policy(); + $expectedResponse->setName($name); + $expectedResponse->setUid($uid); + $expectedResponse->setKind($kind); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setEtag($etag); + $expectedResponse->setManagingAuthority($managingAuthority); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createPolicyTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $parent = 'parent-995424086'; + $policy = new Policy(); + $response = $gapicClient->createPolicy($parent, $policy); + $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.iam.v2.Policies/CreatePolicy', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($parent, $actualValue); + $actualValue = $actualApiRequestObject->getPolicy(); + $this->assertProtobufEquals($policy, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createPolicyTest'); + $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 createPolicyExceptionTest() + { + $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/createPolicyTest'); + $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 + $parent = 'parent-995424086'; + $policy = new Policy(); + $response = $gapicClient->createPolicy($parent, $policy); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createPolicyTest'); + 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 deletePolicyTest() + { + $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/deletePolicyTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name2 = 'name2-1052831874'; + $uid = 'uid115792'; + $kind = 'kind3292052'; + $displayName = 'displayName1615086568'; + $etag2 = 'etag2-1293302904'; + $managingAuthority = 'managingAuthority617792550'; + $expectedResponse = new Policy(); + $expectedResponse->setName($name2); + $expectedResponse->setUid($uid); + $expectedResponse->setKind($kind); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setEtag($etag2); + $expectedResponse->setManagingAuthority($managingAuthority); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deletePolicyTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $name = 'name3373707'; + $response = $gapicClient->deletePolicy($name); + $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.iam.v2.Policies/DeletePolicy', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($name, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deletePolicyTest'); + $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 deletePolicyExceptionTest() + { + $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/deletePolicyTest'); + $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 + $name = 'name3373707'; + $response = $gapicClient->deletePolicy($name); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deletePolicyTest'); + 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 getPolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $uid = 'uid115792'; + $kind = 'kind3292052'; + $displayName = 'displayName1615086568'; + $etag = 'etag3123477'; + $managingAuthority = 'managingAuthority617792550'; + $expectedResponse = new Policy(); + $expectedResponse->setName($name2); + $expectedResponse->setUid($uid); + $expectedResponse->setKind($kind); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setEtag($etag); + $expectedResponse->setManagingAuthority($managingAuthority); + $transport->addResponse($expectedResponse); + // Mock request + $name = 'name3373707'; + $response = $gapicClient->getPolicy($name); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.iam.v2.Policies/GetPolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($name, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getPolicyExceptionTest() + { + $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 + $name = 'name3373707'; + try { + $gapicClient->getPolicy($name); + // 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 listPoliciesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $policiesElement = new Policy(); + $policies = [ + $policiesElement, + ]; + $expectedResponse = new ListPoliciesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setPolicies($policies); + $transport->addResponse($expectedResponse); + // Mock request + $parent = 'parent-995424086'; + $response = $gapicClient->listPolicies($parent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getPolicies()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.iam.v2.Policies/ListPolicies', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($parent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listPoliciesExceptionTest() + { + $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 + $parent = 'parent-995424086'; + try { + $gapicClient->listPolicies($parent); + // 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 updatePolicyTest() + { + $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/updatePolicyTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $uid = 'uid115792'; + $kind = 'kind3292052'; + $displayName = 'displayName1615086568'; + $etag = 'etag3123477'; + $managingAuthority = 'managingAuthority617792550'; + $expectedResponse = new Policy(); + $expectedResponse->setName($name); + $expectedResponse->setUid($uid); + $expectedResponse->setKind($kind); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setEtag($etag); + $expectedResponse->setManagingAuthority($managingAuthority); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updatePolicyTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $policy = new Policy(); + $response = $gapicClient->updatePolicy($policy); + $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.iam.v2.Policies/UpdatePolicy', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getPolicy(); + $this->assertProtobufEquals($policy, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updatePolicyTest'); + $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 updatePolicyExceptionTest() + { + $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/updatePolicyTest'); + $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 + $policy = new Policy(); + $response = $gapicClient->updatePolicy($policy); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updatePolicyTest'); + 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()); + } +} diff --git a/owl-bot-staging/Ids/v1/proto/src/GPBMetadata/Google/Cloud/Ids/V1/Ids.php b/owl-bot-staging/Ids/v1/proto/src/GPBMetadata/Google/Cloud/Ids/V1/Ids.php new file mode 100644 index 000000000000..5d1b58ea372f Binary files /dev/null and b/owl-bot-staging/Ids/v1/proto/src/GPBMetadata/Google/Cloud/Ids/V1/Ids.php differ diff --git a/owl-bot-staging/Ids/v1/proto/src/Google/Cloud/Ids/V1/CreateEndpointRequest.php b/owl-bot-staging/Ids/v1/proto/src/Google/Cloud/Ids/V1/CreateEndpointRequest.php new file mode 100644 index 000000000000..928ba143eaf5 --- /dev/null +++ b/owl-bot-staging/Ids/v1/proto/src/Google/Cloud/Ids/V1/CreateEndpointRequest.php @@ -0,0 +1,260 @@ +google.cloud.ids.v1.CreateEndpointRequest + */ +class CreateEndpointRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The endpoint's parent. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The endpoint identifier. This will be part of the endpoint's + * resource name. + * This value must start with a lowercase letter followed by up to 62 + * lowercase letters, numbers, or hyphens, and cannot end with a hyphen. + * Values that do not match this pattern will trigger an INVALID_ARGUMENT + * error. + * + * Generated from protobuf field string endpoint_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $endpoint_id = ''; + /** + * Required. The endpoint to create. + * + * Generated from protobuf field .google.cloud.ids.v1.Endpoint endpoint = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $endpoint = null; + /** + * An optional request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4; + */ + protected $request_id = ''; + + /** + * @param string $parent Required. The endpoint's parent. Please see + * {@see IDSClient::locationName()} for help formatting this field. + * @param \Google\Cloud\Ids\V1\Endpoint $endpoint Required. The endpoint to create. + * @param string $endpointId Required. The endpoint identifier. This will be part of the endpoint's + * resource name. + * This value must start with a lowercase letter followed by up to 62 + * lowercase letters, numbers, or hyphens, and cannot end with a hyphen. + * Values that do not match this pattern will trigger an INVALID_ARGUMENT + * error. + * + * @return \Google\Cloud\Ids\V1\CreateEndpointRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\Ids\V1\Endpoint $endpoint, string $endpointId): self + { + return (new self()) + ->setParent($parent) + ->setEndpoint($endpoint) + ->setEndpointId($endpointId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The endpoint's parent. + * @type string $endpoint_id + * Required. The endpoint identifier. This will be part of the endpoint's + * resource name. + * This value must start with a lowercase letter followed by up to 62 + * lowercase letters, numbers, or hyphens, and cannot end with a hyphen. + * Values that do not match this pattern will trigger an INVALID_ARGUMENT + * error. + * @type \Google\Cloud\Ids\V1\Endpoint $endpoint + * Required. The endpoint to create. + * @type string $request_id + * An optional request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Ids\V1\Ids::initOnce(); + parent::__construct($data); + } + + /** + * Required. The endpoint's parent. + * + * 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. The endpoint's parent. + * + * 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. The endpoint identifier. This will be part of the endpoint's + * resource name. + * This value must start with a lowercase letter followed by up to 62 + * lowercase letters, numbers, or hyphens, and cannot end with a hyphen. + * Values that do not match this pattern will trigger an INVALID_ARGUMENT + * error. + * + * Generated from protobuf field string endpoint_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getEndpointId() + { + return $this->endpoint_id; + } + + /** + * Required. The endpoint identifier. This will be part of the endpoint's + * resource name. + * This value must start with a lowercase letter followed by up to 62 + * lowercase letters, numbers, or hyphens, and cannot end with a hyphen. + * Values that do not match this pattern will trigger an INVALID_ARGUMENT + * error. + * + * Generated from protobuf field string endpoint_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setEndpointId($var) + { + GPBUtil::checkString($var, True); + $this->endpoint_id = $var; + + return $this; + } + + /** + * Required. The endpoint to create. + * + * Generated from protobuf field .google.cloud.ids.v1.Endpoint endpoint = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Ids\V1\Endpoint|null + */ + public function getEndpoint() + { + return $this->endpoint; + } + + public function hasEndpoint() + { + return isset($this->endpoint); + } + + public function clearEndpoint() + { + unset($this->endpoint); + } + + /** + * Required. The endpoint to create. + * + * Generated from protobuf field .google.cloud.ids.v1.Endpoint endpoint = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Ids\V1\Endpoint $var + * @return $this + */ + public function setEndpoint($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Ids\V1\Endpoint::class); + $this->endpoint = $var; + + return $this; + } + + /** + * An optional request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * An optional request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4; + * @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/Ids/v1/proto/src/Google/Cloud/Ids/V1/DeleteEndpointRequest.php b/owl-bot-staging/Ids/v1/proto/src/Google/Cloud/Ids/V1/DeleteEndpointRequest.php new file mode 100644 index 000000000000..fa24daaf67d1 --- /dev/null +++ b/owl-bot-staging/Ids/v1/proto/src/Google/Cloud/Ids/V1/DeleteEndpointRequest.php @@ -0,0 +1,153 @@ +google.cloud.ids.v1.DeleteEndpointRequest + */ +class DeleteEndpointRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the endpoint to delete. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * An optional request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2; + */ + protected $request_id = ''; + + /** + * @param string $name Required. The name of the endpoint to delete. Please see + * {@see IDSClient::endpointName()} for help formatting this field. + * + * @return \Google\Cloud\Ids\V1\DeleteEndpointRequest + * + * @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 endpoint to delete. + * @type string $request_id + * An optional request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Ids\V1\Ids::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the endpoint to delete. + * + * 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 endpoint to delete. + * + * 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 request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * An optional request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2; + * @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/Ids/v1/proto/src/Google/Cloud/Ids/V1/Endpoint.php b/owl-bot-staging/Ids/v1/proto/src/Google/Cloud/Ids/V1/Endpoint.php new file mode 100644 index 000000000000..f6410808a084 --- /dev/null +++ b/owl-bot-staging/Ids/v1/proto/src/Google/Cloud/Ids/V1/Endpoint.php @@ -0,0 +1,432 @@ +google.cloud.ids.v1.Endpoint + */ +class Endpoint extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The name of the endpoint. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $name = ''; + /** + * Output only. The create time timestamp. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. The update time timestamp. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * The labels of the endpoint. + * + * Generated from protobuf field map labels = 4; + */ + private $labels; + /** + * Required. The fully qualified URL of the network to which the IDS Endpoint is + * attached. + * + * Generated from protobuf field string network = 5 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $network = ''; + /** + * Output only. The fully qualified URL of the endpoint's ILB Forwarding Rule. + * + * Generated from protobuf field string endpoint_forwarding_rule = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $endpoint_forwarding_rule = ''; + /** + * Output only. The IP address of the IDS Endpoint's ILB. + * + * Generated from protobuf field string endpoint_ip = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $endpoint_ip = ''; + /** + * User-provided description of the endpoint + * + * Generated from protobuf field string description = 8; + */ + protected $description = ''; + /** + * Required. Lowest threat severity that this endpoint will alert on. + * + * Generated from protobuf field .google.cloud.ids.v1.Endpoint.Severity severity = 9 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $severity = 0; + /** + * Output only. Current state of the endpoint. + * + * Generated from protobuf field .google.cloud.ids.v1.Endpoint.State state = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Whether the endpoint should report traffic logs in addition to threat logs. + * + * Generated from protobuf field bool traffic_logs = 13; + */ + protected $traffic_logs = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Output only. The name of the endpoint. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The create time timestamp. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. The update time timestamp. + * @type array|\Google\Protobuf\Internal\MapField $labels + * The labels of the endpoint. + * @type string $network + * Required. The fully qualified URL of the network to which the IDS Endpoint is + * attached. + * @type string $endpoint_forwarding_rule + * Output only. The fully qualified URL of the endpoint's ILB Forwarding Rule. + * @type string $endpoint_ip + * Output only. The IP address of the IDS Endpoint's ILB. + * @type string $description + * User-provided description of the endpoint + * @type int $severity + * Required. Lowest threat severity that this endpoint will alert on. + * @type int $state + * Output only. Current state of the endpoint. + * @type bool $traffic_logs + * Whether the endpoint should report traffic logs in addition to threat logs. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Ids\V1\Ids::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The name of the endpoint. + * + * 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 endpoint. + * + * 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 create time timestamp. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.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 create time timestamp. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.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 update time timestamp. + * + * 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 update time timestamp. + * + * 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; + } + + /** + * The labels of the endpoint. + * + * Generated from protobuf field map labels = 4; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * The labels of the endpoint. + * + * Generated from protobuf field map labels = 4; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + + /** + * Required. The fully qualified URL of the network to which the IDS Endpoint is + * attached. + * + * Generated from protobuf field string network = 5 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getNetwork() + { + return $this->network; + } + + /** + * Required. The fully qualified URL of the network to which the IDS Endpoint is + * attached. + * + * Generated from protobuf field string network = 5 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setNetwork($var) + { + GPBUtil::checkString($var, True); + $this->network = $var; + + return $this; + } + + /** + * Output only. The fully qualified URL of the endpoint's ILB Forwarding Rule. + * + * Generated from protobuf field string endpoint_forwarding_rule = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getEndpointForwardingRule() + { + return $this->endpoint_forwarding_rule; + } + + /** + * Output only. The fully qualified URL of the endpoint's ILB Forwarding Rule. + * + * Generated from protobuf field string endpoint_forwarding_rule = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setEndpointForwardingRule($var) + { + GPBUtil::checkString($var, True); + $this->endpoint_forwarding_rule = $var; + + return $this; + } + + /** + * Output only. The IP address of the IDS Endpoint's ILB. + * + * Generated from protobuf field string endpoint_ip = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getEndpointIp() + { + return $this->endpoint_ip; + } + + /** + * Output only. The IP address of the IDS Endpoint's ILB. + * + * Generated from protobuf field string endpoint_ip = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setEndpointIp($var) + { + GPBUtil::checkString($var, True); + $this->endpoint_ip = $var; + + return $this; + } + + /** + * User-provided description of the endpoint + * + * Generated from protobuf field string description = 8; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * User-provided description of the endpoint + * + * Generated from protobuf field string description = 8; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * Required. Lowest threat severity that this endpoint will alert on. + * + * Generated from protobuf field .google.cloud.ids.v1.Endpoint.Severity severity = 9 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getSeverity() + { + return $this->severity; + } + + /** + * Required. Lowest threat severity that this endpoint will alert on. + * + * Generated from protobuf field .google.cloud.ids.v1.Endpoint.Severity severity = 9 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setSeverity($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Ids\V1\Endpoint\Severity::class); + $this->severity = $var; + + return $this; + } + + /** + * Output only. Current state of the endpoint. + * + * Generated from protobuf field .google.cloud.ids.v1.Endpoint.State state = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. Current state of the endpoint. + * + * Generated from protobuf field .google.cloud.ids.v1.Endpoint.State state = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Ids\V1\Endpoint\State::class); + $this->state = $var; + + return $this; + } + + /** + * Whether the endpoint should report traffic logs in addition to threat logs. + * + * Generated from protobuf field bool traffic_logs = 13; + * @return bool + */ + public function getTrafficLogs() + { + return $this->traffic_logs; + } + + /** + * Whether the endpoint should report traffic logs in addition to threat logs. + * + * Generated from protobuf field bool traffic_logs = 13; + * @param bool $var + * @return $this + */ + public function setTrafficLogs($var) + { + GPBUtil::checkBool($var); + $this->traffic_logs = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Ids/v1/proto/src/Google/Cloud/Ids/V1/Endpoint/Severity.php b/owl-bot-staging/Ids/v1/proto/src/Google/Cloud/Ids/V1/Endpoint/Severity.php new file mode 100644 index 000000000000..77b6813c9be8 --- /dev/null +++ b/owl-bot-staging/Ids/v1/proto/src/Google/Cloud/Ids/V1/Endpoint/Severity.php @@ -0,0 +1,85 @@ +google.cloud.ids.v1.Endpoint.Severity + */ +class Severity +{ + /** + * Not set. + * + * Generated from protobuf enum SEVERITY_UNSPECIFIED = 0; + */ + const SEVERITY_UNSPECIFIED = 0; + /** + * Informational alerts. + * + * Generated from protobuf enum INFORMATIONAL = 1; + */ + const INFORMATIONAL = 1; + /** + * Low severity alerts. + * + * Generated from protobuf enum LOW = 2; + */ + const LOW = 2; + /** + * Medium severity alerts. + * + * Generated from protobuf enum MEDIUM = 3; + */ + const MEDIUM = 3; + /** + * High severity alerts. + * + * Generated from protobuf enum HIGH = 4; + */ + const HIGH = 4; + /** + * Critical severity alerts. + * + * Generated from protobuf enum CRITICAL = 5; + */ + const CRITICAL = 5; + + private static $valueToName = [ + self::SEVERITY_UNSPECIFIED => 'SEVERITY_UNSPECIFIED', + self::INFORMATIONAL => 'INFORMATIONAL', + self::LOW => 'LOW', + self::MEDIUM => 'MEDIUM', + self::HIGH => 'HIGH', + self::CRITICAL => 'CRITICAL', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Severity::class, \Google\Cloud\Ids\V1\Endpoint_Severity::class); + diff --git a/owl-bot-staging/Ids/v1/proto/src/Google/Cloud/Ids/V1/Endpoint/State.php b/owl-bot-staging/Ids/v1/proto/src/Google/Cloud/Ids/V1/Endpoint/State.php new file mode 100644 index 000000000000..35c39ce9be00 --- /dev/null +++ b/owl-bot-staging/Ids/v1/proto/src/Google/Cloud/Ids/V1/Endpoint/State.php @@ -0,0 +1,71 @@ +google.cloud.ids.v1.Endpoint.State + */ +class State +{ + /** + * Not set. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * Being created. + * + * Generated from protobuf enum CREATING = 1; + */ + const CREATING = 1; + /** + * Active and ready for traffic. + * + * Generated from protobuf enum READY = 2; + */ + const READY = 2; + /** + * Being deleted. + * + * Generated from protobuf enum DELETING = 3; + */ + const DELETING = 3; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::CREATING => 'CREATING', + self::READY => 'READY', + self::DELETING => 'DELETING', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\Ids\V1\Endpoint_State::class); + diff --git a/owl-bot-staging/Ids/v1/proto/src/Google/Cloud/Ids/V1/Endpoint_Severity.php b/owl-bot-staging/Ids/v1/proto/src/Google/Cloud/Ids/V1/Endpoint_Severity.php new file mode 100644 index 000000000000..a1b5a3b821ed --- /dev/null +++ b/owl-bot-staging/Ids/v1/proto/src/Google/Cloud/Ids/V1/Endpoint_Severity.php @@ -0,0 +1,16 @@ +google.cloud.ids.v1.GetEndpointRequest + */ +class GetEndpointRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the endpoint to retrieve. + * Format: `projects/{project}/locations/{location}/endpoints/{endpoint}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The name of the endpoint to retrieve. + * Format: `projects/{project}/locations/{location}/endpoints/{endpoint}` + * Please see {@see IDSClient::endpointName()} for help formatting this field. + * + * @return \Google\Cloud\Ids\V1\GetEndpointRequest + * + * @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 endpoint to retrieve. + * Format: `projects/{project}/locations/{location}/endpoints/{endpoint}` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Ids\V1\Ids::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the endpoint to retrieve. + * Format: `projects/{project}/locations/{location}/endpoints/{endpoint}` + * + * 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 endpoint to retrieve. + * Format: `projects/{project}/locations/{location}/endpoints/{endpoint}` + * + * 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; + } + +} + diff --git a/owl-bot-staging/Ids/v1/proto/src/Google/Cloud/Ids/V1/IDSGrpcClient.php b/owl-bot-staging/Ids/v1/proto/src/Google/Cloud/Ids/V1/IDSGrpcClient.php new file mode 100644 index 000000000000..0a13a2ac72a0 --- /dev/null +++ b/owl-bot-staging/Ids/v1/proto/src/Google/Cloud/Ids/V1/IDSGrpcClient.php @@ -0,0 +1,95 @@ +_simpleRequest('/google.cloud.ids.v1.IDS/ListEndpoints', + $argument, + ['\Google\Cloud\Ids\V1\ListEndpointsResponse', 'decode'], + $metadata, $options); + } + + /** + * Gets details of a single Endpoint. + * @param \Google\Cloud\Ids\V1\GetEndpointRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function GetEndpoint(\Google\Cloud\Ids\V1\GetEndpointRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.ids.v1.IDS/GetEndpoint', + $argument, + ['\Google\Cloud\Ids\V1\Endpoint', 'decode'], + $metadata, $options); + } + + /** + * Creates a new Endpoint in a given project and location. + * @param \Google\Cloud\Ids\V1\CreateEndpointRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function CreateEndpoint(\Google\Cloud\Ids\V1\CreateEndpointRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.ids.v1.IDS/CreateEndpoint', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Deletes a single Endpoint. + * @param \Google\Cloud\Ids\V1\DeleteEndpointRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function DeleteEndpoint(\Google\Cloud\Ids\V1\DeleteEndpointRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.ids.v1.IDS/DeleteEndpoint', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + +} diff --git a/owl-bot-staging/Ids/v1/proto/src/Google/Cloud/Ids/V1/ListEndpointsRequest.php b/owl-bot-staging/Ids/v1/proto/src/Google/Cloud/Ids/V1/ListEndpointsRequest.php new file mode 100644 index 000000000000..e566c2aff1b6 --- /dev/null +++ b/owl-bot-staging/Ids/v1/proto/src/Google/Cloud/Ids/V1/ListEndpointsRequest.php @@ -0,0 +1,239 @@ +google.cloud.ids.v1.ListEndpointsRequest + */ +class ListEndpointsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent, which owns this collection of endpoints. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. The maximum number of endpoints to return. The service may return fewer + * than this value. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Optional. A page token, received from a previous `ListEndpoints` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListEndpoints` must + * match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = ''; + /** + * Optional. The filter expression, following the syntax outlined in + * https://google.aip.dev/160. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $filter = ''; + /** + * Optional. One or more fields to compare and use to sort the output. + * See https://google.aip.dev/132#ordering. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $order_by = ''; + + /** + * @param string $parent Required. The parent, which owns this collection of endpoints. Please see + * {@see IDSClient::locationName()} for help formatting this field. + * + * @return \Google\Cloud\Ids\V1\ListEndpointsRequest + * + * @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. The parent, which owns this collection of endpoints. + * @type int $page_size + * Optional. The maximum number of endpoints to return. The service may return fewer + * than this value. + * @type string $page_token + * Optional. A page token, received from a previous `ListEndpoints` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListEndpoints` must + * match the call that provided the page token. + * @type string $filter + * Optional. The filter expression, following the syntax outlined in + * https://google.aip.dev/160. + * @type string $order_by + * Optional. One or more fields to compare and use to sort the output. + * See https://google.aip.dev/132#ordering. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Ids\V1\Ids::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent, which owns this collection of endpoints. + * + * 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. The parent, which owns this collection of endpoints. + * + * 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. The maximum number of endpoints to return. The service may return fewer + * than this value. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. The maximum number of endpoints to return. The service may return fewer + * than this value. + * + * 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 page token, received from a previous `ListEndpoints` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListEndpoints` must + * match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. A page token, received from a previous `ListEndpoints` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListEndpoints` must + * match the call that provided the page token. + * + * 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. The filter expression, following the syntax outlined in + * https://google.aip.dev/160. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Optional. The filter expression, following the syntax outlined in + * https://google.aip.dev/160. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Optional. One or more fields to compare and use to sort the output. + * See https://google.aip.dev/132#ordering. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Optional. One or more fields to compare and use to sort the output. + * See https://google.aip.dev/132#ordering. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Ids/v1/proto/src/Google/Cloud/Ids/V1/ListEndpointsResponse.php b/owl-bot-staging/Ids/v1/proto/src/Google/Cloud/Ids/V1/ListEndpointsResponse.php new file mode 100644 index 000000000000..c24d54eeef07 --- /dev/null +++ b/owl-bot-staging/Ids/v1/proto/src/Google/Cloud/Ids/V1/ListEndpointsResponse.php @@ -0,0 +1,137 @@ +google.cloud.ids.v1.ListEndpointsResponse + */ +class ListEndpointsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of endpoints response. + * + * Generated from protobuf field repeated .google.cloud.ids.v1.Endpoint endpoints = 1; + */ + private $endpoints; + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + */ + private $unreachable; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Ids\V1\Endpoint>|\Google\Protobuf\Internal\RepeatedField $endpoints + * The list of endpoints response. + * @type string $next_page_token + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Locations that could not be reached. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Ids\V1\Ids::initOnce(); + parent::__construct($data); + } + + /** + * The list of endpoints response. + * + * Generated from protobuf field repeated .google.cloud.ids.v1.Endpoint endpoints = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getEndpoints() + { + return $this->endpoints; + } + + /** + * The list of endpoints response. + * + * Generated from protobuf field repeated .google.cloud.ids.v1.Endpoint endpoints = 1; + * @param array<\Google\Cloud\Ids\V1\Endpoint>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setEndpoints($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Ids\V1\Endpoint::class); + $this->endpoints = $arr; + + return $this; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * 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; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUnreachable($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->unreachable = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Ids/v1/proto/src/Google/Cloud/Ids/V1/OperationMetadata.php b/owl-bot-staging/Ids/v1/proto/src/Google/Cloud/Ids/V1/OperationMetadata.php new file mode 100644 index 000000000000..50e0d626665f --- /dev/null +++ b/owl-bot-staging/Ids/v1/proto/src/Google/Cloud/Ids/V1/OperationMetadata.php @@ -0,0 +1,303 @@ +google.cloud.ids.v1.OperationMetadata + */ +class OperationMetadata 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. Server-defined resource path for the target of the operation. + * + * Generated from protobuf field string target = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $target = ''; + /** + * Output only. Name of the verb executed by the operation. + * + * Generated from protobuf field string verb = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $verb = ''; + /** + * Output only. Human-readable status of the operation, if any. + * + * Generated from protobuf field string status_message = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $status_message = ''; + /** + * Output only. Identifies whether the user has requested cancellation + * of the operation. Operations that have successfully been cancelled + * have [Operation.error][] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, + * corresponding to `Code.CANCELLED`. + * + * Generated from protobuf field bool requested_cancellation = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $requested_cancellation = false; + /** + * Output only. API version used to start the operation. + * + * Generated from protobuf field string api_version = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $api_version = ''; + + /** + * 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 string $target + * Output only. Server-defined resource path for the target of the operation. + * @type string $verb + * Output only. Name of the verb executed by the operation. + * @type string $status_message + * Output only. Human-readable status of the operation, if any. + * @type bool $requested_cancellation + * Output only. Identifies whether the user has requested cancellation + * of the operation. Operations that have successfully been cancelled + * have [Operation.error][] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, + * corresponding to `Code.CANCELLED`. + * @type string $api_version + * Output only. API version used to start the operation. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Ids\V1\Ids::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. Server-defined resource path for the target of the operation. + * + * Generated from protobuf field string target = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getTarget() + { + return $this->target; + } + + /** + * Output only. Server-defined resource path for the target of the operation. + * + * Generated from protobuf field string target = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setTarget($var) + { + GPBUtil::checkString($var, True); + $this->target = $var; + + return $this; + } + + /** + * Output only. Name of the verb executed by the operation. + * + * Generated from protobuf field string verb = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getVerb() + { + return $this->verb; + } + + /** + * Output only. Name of the verb executed by the operation. + * + * Generated from protobuf field string verb = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setVerb($var) + { + GPBUtil::checkString($var, True); + $this->verb = $var; + + return $this; + } + + /** + * Output only. Human-readable status of the operation, if any. + * + * Generated from protobuf field string status_message = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getStatusMessage() + { + return $this->status_message; + } + + /** + * Output only. Human-readable status of the operation, if any. + * + * Generated from protobuf field string status_message = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setStatusMessage($var) + { + GPBUtil::checkString($var, True); + $this->status_message = $var; + + return $this; + } + + /** + * Output only. Identifies whether the user has requested cancellation + * of the operation. Operations that have successfully been cancelled + * have [Operation.error][] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, + * corresponding to `Code.CANCELLED`. + * + * Generated from protobuf field bool requested_cancellation = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return bool + */ + public function getRequestedCancellation() + { + return $this->requested_cancellation; + } + + /** + * Output only. Identifies whether the user has requested cancellation + * of the operation. Operations that have successfully been cancelled + * have [Operation.error][] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, + * corresponding to `Code.CANCELLED`. + * + * Generated from protobuf field bool requested_cancellation = 6 [(.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. API version used to start the operation. + * + * Generated from protobuf field string api_version = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getApiVersion() + { + return $this->api_version; + } + + /** + * Output only. API version used to start the operation. + * + * Generated from protobuf field string api_version = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setApiVersion($var) + { + GPBUtil::checkString($var, True); + $this->api_version = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Ids/v1/samples/V1/IDSClient/create_endpoint.php b/owl-bot-staging/Ids/v1/samples/V1/IDSClient/create_endpoint.php new file mode 100644 index 000000000000..69bb4df67f35 --- /dev/null +++ b/owl-bot-staging/Ids/v1/samples/V1/IDSClient/create_endpoint.php @@ -0,0 +1,105 @@ +setNetwork($endpointNetwork) + ->setSeverity($endpointSeverity); + $request = (new CreateEndpointRequest()) + ->setParent($formattedParent) + ->setEndpointId($endpointId) + ->setEndpoint($endpoint); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $iDSClient->createEndpoint($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Endpoint $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 +{ + $formattedParent = IDSClient::locationName('[PROJECT]', '[LOCATION]'); + $endpointId = '[ENDPOINT_ID]'; + $endpointNetwork = '[NETWORK]'; + $endpointSeverity = Severity::SEVERITY_UNSPECIFIED; + + create_endpoint_sample($formattedParent, $endpointId, $endpointNetwork, $endpointSeverity); +} +// [END ids_v1_generated_IDS_CreateEndpoint_sync] diff --git a/owl-bot-staging/Ids/v1/samples/V1/IDSClient/delete_endpoint.php b/owl-bot-staging/Ids/v1/samples/V1/IDSClient/delete_endpoint.php new file mode 100644 index 000000000000..976c16e80b30 --- /dev/null +++ b/owl-bot-staging/Ids/v1/samples/V1/IDSClient/delete_endpoint.php @@ -0,0 +1,80 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $iDSClient->deleteEndpoint($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + printf('Operation completed successfully.' . PHP_EOL); + } 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 = IDSClient::endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); + + delete_endpoint_sample($formattedName); +} +// [END ids_v1_generated_IDS_DeleteEndpoint_sync] diff --git a/owl-bot-staging/Ids/v1/samples/V1/IDSClient/get_endpoint.php b/owl-bot-staging/Ids/v1/samples/V1/IDSClient/get_endpoint.php new file mode 100644 index 000000000000..d20808f2425d --- /dev/null +++ b/owl-bot-staging/Ids/v1/samples/V1/IDSClient/get_endpoint.php @@ -0,0 +1,72 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var Endpoint $response */ + $response = $iDSClient->getEndpoint($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 = IDSClient::endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); + + get_endpoint_sample($formattedName); +} +// [END ids_v1_generated_IDS_GetEndpoint_sync] diff --git a/owl-bot-staging/Ids/v1/samples/V1/IDSClient/list_endpoints.php b/owl-bot-staging/Ids/v1/samples/V1/IDSClient/list_endpoints.php new file mode 100644 index 000000000000..d2ddc056f15b --- /dev/null +++ b/owl-bot-staging/Ids/v1/samples/V1/IDSClient/list_endpoints.php @@ -0,0 +1,76 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $iDSClient->listEndpoints($request); + + /** @var Endpoint $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 = IDSClient::locationName('[PROJECT]', '[LOCATION]'); + + list_endpoints_sample($formattedParent); +} +// [END ids_v1_generated_IDS_ListEndpoints_sync] diff --git a/owl-bot-staging/Ids/v1/src/V1/Client/BaseClient/IDSBaseClient.php b/owl-bot-staging/Ids/v1/src/V1/Client/BaseClient/IDSBaseClient.php new file mode 100644 index 000000000000..77bc41b4e216 --- /dev/null +++ b/owl-bot-staging/Ids/v1/src/V1/Client/BaseClient/IDSBaseClient.php @@ -0,0 +1,368 @@ + self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../../resources/ids_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../../resources/ids_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../../resources/ids_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../../resources/ids_rest_client_config.php', + ], + ], + ]; + } + + /** + * 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 endpoint + * resource. + * + * @param string $project + * @param string $location + * @param string $endpoint + * + * @return string The formatted endpoint resource. + */ + public static function endpointName(string $project, string $location, string $endpoint): string + { + return self::getPathTemplate('endpoint')->render([ + 'project' => $project, + 'location' => $location, + 'endpoint' => $endpoint, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a location + * resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted location resource. + */ + public static function locationName(string $project, string $location): string + { + return self::getPathTemplate('location')->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - endpoint: projects/{project}/locations/{location}/endpoints/{endpoint} + * - location: projects/{project}/locations/{location} + * + * 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 'ids.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. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *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' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods 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 Endpoint in a given project and location. + * + * The async variant is {@see self::createEndpointAsync()} . + * + * @param CreateEndpointRequest $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 createEndpoint(CreateEndpointRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('CreateEndpoint', $request, $callOptions)->wait(); + } + + /** + * Deletes a single Endpoint. + * + * The async variant is {@see self::deleteEndpointAsync()} . + * + * @param DeleteEndpointRequest $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 deleteEndpoint(DeleteEndpointRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('DeleteEndpoint', $request, $callOptions)->wait(); + } + + /** + * Gets details of a single Endpoint. + * + * The async variant is {@see self::getEndpointAsync()} . + * + * @param GetEndpointRequest $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 Endpoint + * + * @throws ApiException Thrown if the API call fails. + */ + public function getEndpoint(GetEndpointRequest $request, array $callOptions = []): Endpoint + { + return $this->startApiCall('GetEndpoint', $request, $callOptions)->wait(); + } + + /** + * Lists Endpoints in a given project and location. + * + * The async variant is {@see self::listEndpointsAsync()} . + * + * @param ListEndpointsRequest $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 listEndpoints(ListEndpointsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListEndpoints', $request, $callOptions); + } +} diff --git a/owl-bot-staging/Ids/v1/src/V1/Client/IDSClient.php b/owl-bot-staging/Ids/v1/src/V1/Client/IDSClient.php new file mode 100644 index 000000000000..3d4df2debdaf --- /dev/null +++ b/owl-bot-staging/Ids/v1/src/V1/Client/IDSClient.php @@ -0,0 +1,40 @@ +locationName('[PROJECT]', '[LOCATION]'); + * $endpointId = 'endpoint_id'; + * $endpoint = new Endpoint(); + * $operationResponse = $iDSClient->createEndpoint($formattedParent, $endpointId, $endpoint); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $iDSClient->createEndpoint($formattedParent, $endpointId, $endpoint); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $iDSClient->resumeOperation($operationName, 'createEndpoint'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $iDSClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + */ +class IDSGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.ids.v1.IDS'; + + /** The default address of the service. */ + const SERVICE_ADDRESS = 'ids.googleapis.com'; + + /** The default port of the service. */ + const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + ]; + + private static $endpointNameTemplate; + + private static $locationNameTemplate; + + private static $pathTemplateMap; + + private $operationsClient; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/ids_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/ids_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/ids_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/ids_rest_client_config.php', + ], + ], + ]; + } + + private static function getEndpointNameTemplate() + { + if (self::$endpointNameTemplate == null) { + self::$endpointNameTemplate = new PathTemplate('projects/{project}/locations/{location}/endpoints/{endpoint}'); + } + + return self::$endpointNameTemplate; + } + + private static function getLocationNameTemplate() + { + if (self::$locationNameTemplate == null) { + self::$locationNameTemplate = new PathTemplate('projects/{project}/locations/{location}'); + } + + return self::$locationNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'endpoint' => self::getEndpointNameTemplate(), + 'location' => self::getLocationNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a endpoint + * resource. + * + * @param string $project + * @param string $location + * @param string $endpoint + * + * @return string The formatted endpoint resource. + */ + public static function endpointName($project, $location, $endpoint) + { + return self::getEndpointNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'endpoint' => $endpoint, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a location + * resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted location resource. + */ + public static function locationName($project, $location) + { + return self::getLocationNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - endpoint: projects/{project}/locations/{location}/endpoints/{endpoint} + * - location: projects/{project}/locations/{location} + * + * 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($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * 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; + } + + /** + * 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 'ids.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. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *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' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods 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); + } + + /** + * Creates a new Endpoint in a given project and location. + * + * Sample code: + * ``` + * $iDSClient = new IDSClient(); + * try { + * $formattedParent = $iDSClient->locationName('[PROJECT]', '[LOCATION]'); + * $endpointId = 'endpoint_id'; + * $endpoint = new Endpoint(); + * $operationResponse = $iDSClient->createEndpoint($formattedParent, $endpointId, $endpoint); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $iDSClient->createEndpoint($formattedParent, $endpointId, $endpoint); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $iDSClient->resumeOperation($operationName, 'createEndpoint'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $iDSClient->close(); + * } + * ``` + * + * @param string $parent Required. The endpoint's parent. + * @param string $endpointId Required. The endpoint identifier. This will be part of the endpoint's + * resource name. + * This value must start with a lowercase letter followed by up to 62 + * lowercase letters, numbers, or hyphens, and cannot end with a hyphen. + * Values that do not match this pattern will trigger an INVALID_ARGUMENT + * error. + * @param Endpoint $endpoint Required. The endpoint to create. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * An optional request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function createEndpoint($parent, $endpointId, $endpoint, array $optionalArgs = []) + { + $request = new CreateEndpointRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setEndpointId($endpointId); + $request->setEndpoint($endpoint); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateEndpoint', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Deletes a single Endpoint. + * + * Sample code: + * ``` + * $iDSClient = new IDSClient(); + * try { + * $formattedName = $iDSClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); + * $operationResponse = $iDSClient->deleteEndpoint($formattedName); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $iDSClient->deleteEndpoint($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $iDSClient->resumeOperation($operationName, 'deleteEndpoint'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $iDSClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the endpoint to delete. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * An optional request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function deleteEndpoint($name, array $optionalArgs = []) + { + $request = new DeleteEndpointRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('DeleteEndpoint', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Gets details of a single Endpoint. + * + * Sample code: + * ``` + * $iDSClient = new IDSClient(); + * try { + * $formattedName = $iDSClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); + * $response = $iDSClient->getEndpoint($formattedName); + * } finally { + * $iDSClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the endpoint to retrieve. + * Format: `projects/{project}/locations/{location}/endpoints/{endpoint}` + * @param array $optionalArgs { + * 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 \Google\Cloud\Ids\V1\Endpoint + * + * @throws ApiException if the remote call fails + */ + public function getEndpoint($name, array $optionalArgs = []) + { + $request = new GetEndpointRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetEndpoint', Endpoint::class, $optionalArgs, $request)->wait(); + } + + /** + * Lists Endpoints in a given project and location. + * + * Sample code: + * ``` + * $iDSClient = new IDSClient(); + * try { + * $formattedParent = $iDSClient->locationName('[PROJECT]', '[LOCATION]'); + * // Iterate over pages of elements + * $pagedResponse = $iDSClient->listEndpoints($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $iDSClient->listEndpoints($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $iDSClient->close(); + * } + * ``` + * + * @param string $parent Required. The parent, which owns this collection of endpoints. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type string $filter + * Optional. The filter expression, following the syntax outlined in + * https://google.aip.dev/160. + * @type string $orderBy + * Optional. One or more fields to compare and use to sort the output. + * See https://google.aip.dev/132#ordering. + * @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 \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listEndpoints($parent, array $optionalArgs = []) + { + $request = new ListEndpointsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListEndpoints', $optionalArgs, ListEndpointsResponse::class, $request); + } +} diff --git a/owl-bot-staging/Ids/v1/src/V1/IDSClient.php b/owl-bot-staging/Ids/v1/src/V1/IDSClient.php new file mode 100644 index 000000000000..62686deb8190 --- /dev/null +++ b/owl-bot-staging/Ids/v1/src/V1/IDSClient.php @@ -0,0 +1,34 @@ + [ + 'google.cloud.ids.v1.IDS' => [ + 'CreateEndpoint' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Ids\V1\Endpoint', + 'metadataReturnType' => '\Google\Cloud\Ids\V1\OperationMetadata', + 'initialPollDelayMillis' => '5000', + 'pollDelayMultiplier' => '2.0', + 'maxPollDelayMillis' => '45000', + 'totalPollTimeoutMillis' => '3600000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'DeleteEndpoint' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\Ids\V1\OperationMetadata', + 'initialPollDelayMillis' => '5000', + 'pollDelayMultiplier' => '2.0', + 'maxPollDelayMillis' => '45000', + 'totalPollTimeoutMillis' => '3600000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetEndpoint' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Ids\V1\Endpoint', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'ListEndpoints' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getEndpoints', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Ids\V1\ListEndpointsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'templateMap' => [ + 'endpoint' => 'projects/{project}/locations/{location}/endpoints/{endpoint}', + 'location' => 'projects/{project}/locations/{location}', + ], + ], + ], +]; diff --git a/owl-bot-staging/Ids/v1/src/V1/resources/ids_rest_client_config.php b/owl-bot-staging/Ids/v1/src/V1/resources/ids_rest_client_config.php new file mode 100644 index 000000000000..e81293b497d7 --- /dev/null +++ b/owl-bot-staging/Ids/v1/src/V1/resources/ids_rest_client_config.php @@ -0,0 +1,165 @@ + [ + 'google.cloud.ids.v1.IDS' => [ + 'CreateEndpoint' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/endpoints', + 'body' => 'endpoint', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'endpoint_id', + ], + ], + 'DeleteEndpoint' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/endpoints/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetEndpoint' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/endpoints/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListEndpoints' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/endpoints', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + ], + 'google.cloud.location.Locations' => [ + 'GetLocation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListLocations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*}/locations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + 'google.iam.v1.IAMPolicy' => [ + 'GetIamPolicy' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/endpoints/*}:getIamPolicy', + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + 'SetIamPolicy' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/endpoints/*}:setIamPolicy', + 'body' => '*', + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + 'TestIamPermissions' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/endpoints/*}:testIamPermissions', + 'body' => '*', + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + ], + 'google.longrunning.Operations' => [ + 'CancelOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}:cancel', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteOperation' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetOperation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListOperations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*}/operations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/Ids/v1/tests/Unit/V1/Client/IDSClientTest.php b/owl-bot-staging/Ids/v1/tests/Unit/V1/Client/IDSClientTest.php new file mode 100644 index 000000000000..15d1d4cd2a76 --- /dev/null +++ b/owl-bot-staging/Ids/v1/tests/Unit/V1/Client/IDSClientTest.php @@ -0,0 +1,580 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return IDSClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new IDSClient($options); + } + + /** @test */ + public function createEndpointTest() + { + $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/createEndpointTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $network = 'network1843485230'; + $endpointForwardingRule = 'endpointForwardingRule-1878786988'; + $endpointIp = 'endpointIp-1135808495'; + $description = 'description-1724546052'; + $trafficLogs = false; + $expectedResponse = new Endpoint(); + $expectedResponse->setName($name); + $expectedResponse->setNetwork($network); + $expectedResponse->setEndpointForwardingRule($endpointForwardingRule); + $expectedResponse->setEndpointIp($endpointIp); + $expectedResponse->setDescription($description); + $expectedResponse->setTrafficLogs($trafficLogs); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createEndpointTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $endpointId = 'endpointId-1135808507'; + $endpoint = new Endpoint(); + $endpointNetwork = 'endpointNetwork1670861529'; + $endpoint->setNetwork($endpointNetwork); + $endpointSeverity = Severity::SEVERITY_UNSPECIFIED; + $endpoint->setSeverity($endpointSeverity); + $request = (new CreateEndpointRequest()) + ->setParent($formattedParent) + ->setEndpointId($endpointId) + ->setEndpoint($endpoint); + $response = $gapicClient->createEndpoint($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.cloud.ids.v1.IDS/CreateEndpoint', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getEndpointId(); + $this->assertProtobufEquals($endpointId, $actualValue); + $actualValue = $actualApiRequestObject->getEndpoint(); + $this->assertProtobufEquals($endpoint, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createEndpointTest'); + $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 createEndpointExceptionTest() + { + $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/createEndpointTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $endpointId = 'endpointId-1135808507'; + $endpoint = new Endpoint(); + $endpointNetwork = 'endpointNetwork1670861529'; + $endpoint->setNetwork($endpointNetwork); + $endpointSeverity = Severity::SEVERITY_UNSPECIFIED; + $endpoint->setSeverity($endpointSeverity); + $request = (new CreateEndpointRequest()) + ->setParent($formattedParent) + ->setEndpointId($endpointId) + ->setEndpoint($endpoint); + $response = $gapicClient->createEndpoint($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createEndpointTest'); + 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 deleteEndpointTest() + { + $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/deleteEndpointTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteEndpointTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); + $request = (new DeleteEndpointRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteEndpoint($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.cloud.ids.v1.IDS/DeleteEndpoint', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteEndpointTest'); + $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 deleteEndpointExceptionTest() + { + $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/deleteEndpointTest'); + $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->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); + $request = (new DeleteEndpointRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteEndpoint($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteEndpointTest'); + 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 getEndpointTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $network = 'network1843485230'; + $endpointForwardingRule = 'endpointForwardingRule-1878786988'; + $endpointIp = 'endpointIp-1135808495'; + $description = 'description-1724546052'; + $trafficLogs = false; + $expectedResponse = new Endpoint(); + $expectedResponse->setName($name2); + $expectedResponse->setNetwork($network); + $expectedResponse->setEndpointForwardingRule($endpointForwardingRule); + $expectedResponse->setEndpointIp($endpointIp); + $expectedResponse->setDescription($description); + $expectedResponse->setTrafficLogs($trafficLogs); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); + $request = (new GetEndpointRequest()) + ->setName($formattedName); + $response = $gapicClient->getEndpoint($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.ids.v1.IDS/GetEndpoint', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getEndpointExceptionTest() + { + $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->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); + $request = (new GetEndpointRequest()) + ->setName($formattedName); + try { + $gapicClient->getEndpoint($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 listEndpointsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $endpointsElement = new Endpoint(); + $endpoints = [ + $endpointsElement, + ]; + $expectedResponse = new ListEndpointsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setEndpoints($endpoints); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListEndpointsRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listEndpoints($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getEndpoints()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.ids.v1.IDS/ListEndpoints', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listEndpointsExceptionTest() + { + $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->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListEndpointsRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listEndpoints($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 createEndpointAsyncTest() + { + $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/createEndpointTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $network = 'network1843485230'; + $endpointForwardingRule = 'endpointForwardingRule-1878786988'; + $endpointIp = 'endpointIp-1135808495'; + $description = 'description-1724546052'; + $trafficLogs = false; + $expectedResponse = new Endpoint(); + $expectedResponse->setName($name); + $expectedResponse->setNetwork($network); + $expectedResponse->setEndpointForwardingRule($endpointForwardingRule); + $expectedResponse->setEndpointIp($endpointIp); + $expectedResponse->setDescription($description); + $expectedResponse->setTrafficLogs($trafficLogs); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createEndpointTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $endpointId = 'endpointId-1135808507'; + $endpoint = new Endpoint(); + $endpointNetwork = 'endpointNetwork1670861529'; + $endpoint->setNetwork($endpointNetwork); + $endpointSeverity = Severity::SEVERITY_UNSPECIFIED; + $endpoint->setSeverity($endpointSeverity); + $request = (new CreateEndpointRequest()) + ->setParent($formattedParent) + ->setEndpointId($endpointId) + ->setEndpoint($endpoint); + $response = $gapicClient->createEndpointAsync($request)->wait(); + $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.cloud.ids.v1.IDS/CreateEndpoint', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getEndpointId(); + $this->assertProtobufEquals($endpointId, $actualValue); + $actualValue = $actualApiRequestObject->getEndpoint(); + $this->assertProtobufEquals($endpoint, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createEndpointTest'); + $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()); + } +} diff --git a/owl-bot-staging/Ids/v1/tests/Unit/V1/IDSClientTest.php b/owl-bot-staging/Ids/v1/tests/Unit/V1/IDSClientTest.php new file mode 100644 index 000000000000..f80141f86c8a --- /dev/null +++ b/owl-bot-staging/Ids/v1/tests/Unit/V1/IDSClientTest.php @@ -0,0 +1,468 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return IDSClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new IDSClient($options); + } + + /** @test */ + public function createEndpointTest() + { + $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/createEndpointTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $network = 'network1843485230'; + $endpointForwardingRule = 'endpointForwardingRule-1878786988'; + $endpointIp = 'endpointIp-1135808495'; + $description = 'description-1724546052'; + $trafficLogs = false; + $expectedResponse = new Endpoint(); + $expectedResponse->setName($name); + $expectedResponse->setNetwork($network); + $expectedResponse->setEndpointForwardingRule($endpointForwardingRule); + $expectedResponse->setEndpointIp($endpointIp); + $expectedResponse->setDescription($description); + $expectedResponse->setTrafficLogs($trafficLogs); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createEndpointTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $endpointId = 'endpointId-1135808507'; + $endpoint = new Endpoint(); + $endpointNetwork = 'endpointNetwork1670861529'; + $endpoint->setNetwork($endpointNetwork); + $endpointSeverity = Severity::SEVERITY_UNSPECIFIED; + $endpoint->setSeverity($endpointSeverity); + $response = $gapicClient->createEndpoint($formattedParent, $endpointId, $endpoint); + $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.cloud.ids.v1.IDS/CreateEndpoint', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getEndpointId(); + $this->assertProtobufEquals($endpointId, $actualValue); + $actualValue = $actualApiRequestObject->getEndpoint(); + $this->assertProtobufEquals($endpoint, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createEndpointTest'); + $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 createEndpointExceptionTest() + { + $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/createEndpointTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $endpointId = 'endpointId-1135808507'; + $endpoint = new Endpoint(); + $endpointNetwork = 'endpointNetwork1670861529'; + $endpoint->setNetwork($endpointNetwork); + $endpointSeverity = Severity::SEVERITY_UNSPECIFIED; + $endpoint->setSeverity($endpointSeverity); + $response = $gapicClient->createEndpoint($formattedParent, $endpointId, $endpoint); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createEndpointTest'); + 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 deleteEndpointTest() + { + $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/deleteEndpointTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteEndpointTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); + $response = $gapicClient->deleteEndpoint($formattedName); + $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.cloud.ids.v1.IDS/DeleteEndpoint', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteEndpointTest'); + $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 deleteEndpointExceptionTest() + { + $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/deleteEndpointTest'); + $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->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); + $response = $gapicClient->deleteEndpoint($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteEndpointTest'); + 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 getEndpointTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $network = 'network1843485230'; + $endpointForwardingRule = 'endpointForwardingRule-1878786988'; + $endpointIp = 'endpointIp-1135808495'; + $description = 'description-1724546052'; + $trafficLogs = false; + $expectedResponse = new Endpoint(); + $expectedResponse->setName($name2); + $expectedResponse->setNetwork($network); + $expectedResponse->setEndpointForwardingRule($endpointForwardingRule); + $expectedResponse->setEndpointIp($endpointIp); + $expectedResponse->setDescription($description); + $expectedResponse->setTrafficLogs($trafficLogs); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); + $response = $gapicClient->getEndpoint($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.ids.v1.IDS/GetEndpoint', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getEndpointExceptionTest() + { + $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->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); + try { + $gapicClient->getEndpoint($formattedName); + // 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 listEndpointsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $endpointsElement = new Endpoint(); + $endpoints = [ + $endpointsElement, + ]; + $expectedResponse = new ListEndpointsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setEndpoints($endpoints); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->listEndpoints($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getEndpoints()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.ids.v1.IDS/ListEndpoints', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listEndpointsExceptionTest() + { + $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->locationName('[PROJECT]', '[LOCATION]'); + try { + $gapicClient->listEndpoints($formattedParent); + // 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()); + } +} diff --git a/owl-bot-staging/KmsInventory/v1/proto/src/GPBMetadata/Google/Cloud/Kms/Inventory/V1/KeyDashboardService.php b/owl-bot-staging/KmsInventory/v1/proto/src/GPBMetadata/Google/Cloud/Kms/Inventory/V1/KeyDashboardService.php new file mode 100644 index 000000000000..2edaf07fe9dc --- /dev/null +++ b/owl-bot-staging/KmsInventory/v1/proto/src/GPBMetadata/Google/Cloud/Kms/Inventory/V1/KeyDashboardService.php @@ -0,0 +1,43 @@ +internalAddGeneratedFile( + ' +¸ +9google/cloud/kms/inventory/v1/key_dashboard_service.protogoogle.cloud.kms.inventory.v1google/api/client.protogoogle/api/field_behavior.protogoogle/api/resource.proto#google/cloud/kms/v1/resources.proto" +ListCryptoKeysRequestC +parent ( B3àAúA- ++cloudresourcemanager.googleapis.com/Project + page_size (BàA + +page_token ( BàA"f +ListCryptoKeysResponse3 + crypto_keys ( 2.google.cloud.kms.v1.CryptoKey +next_page_token ( 2› +KeyDashboardService² +ListCryptoKeys4.google.cloud.kms.inventory.v1.ListCryptoKeysRequest5.google.cloud.kms.inventory.v1.ListCryptoKeysResponse"3‚Óä“$"/v1/{parent=projects/*}/cryptoKeysÚAparentOÊAkmsinventory.googleapis.comÒA.https://www.googleapis.com/auth/cloud-platformBà +!com.google.cloud.kms.inventory.v1BKeyDashboardServiceProtoPZ?cloud.google.com/go/kms/inventory/apiv1/inventorypb;inventorypbøªGoogle.Cloud.Kms.Inventory.V1ÊGoogle\\Cloud\\Kms\\Inventory\\V1bproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/owl-bot-staging/KmsInventory/v1/proto/src/GPBMetadata/Google/Cloud/Kms/Inventory/V1/KeyTrackingService.php b/owl-bot-staging/KmsInventory/v1/proto/src/GPBMetadata/Google/Cloud/Kms/Inventory/V1/KeyTrackingService.php new file mode 100644 index 000000000000..7014d34a4725 --- /dev/null +++ b/owl-bot-staging/KmsInventory/v1/proto/src/GPBMetadata/Google/Cloud/Kms/Inventory/V1/KeyTrackingService.php @@ -0,0 +1,86 @@ +internalAddGeneratedFile( + ' +Œ +8google/cloud/kms/inventory/v1/key_tracking_service.protogoogle.cloud.kms.inventory.v1google/api/client.protogoogle/api/field_behavior.protogoogle/api/resource.protogoogle/protobuf/timestamp.proto"r +#GetProtectedResourcesSummaryRequestK +name ( B=àAúA7 +5kmsinventory.googleapis.com/ProtectedResourcesSummary"à +ProtectedResourcesSummary +name (  +resource_count ( + project_count (c +resource_types ( 2K.google.cloud.kms.inventory.v1.ProtectedResourcesSummary.ResourceTypesEntryc +cloud_products ( 2K.google.cloud.kms.inventory.v1.ProtectedResourcesSummary.CloudProductsEntryZ + locations ( 2G.google.cloud.kms.inventory.v1.ProtectedResourcesSummary.LocationsEntry4 +ResourceTypesEntry +key (  +value (:84 +CloudProductsEntry +key (  +value (:80 +LocationsEntry +key (  +value (:8:ÁêA½ +5kmsinventory.googleapis.com/ProtectedResourcesSummarymprojects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/protectedResourcesSummary”projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}/protectedResourcesSummary"° +SearchProtectedResourcesRequestG +scope ( B8àAúA2 +0cloudresourcemanager.googleapis.com/Organization + +crypto_key ( B àAúA +* + page_size ( + +page_token ( "Š + SearchProtectedResourcesResponseM +protected_resources ( 20.google.cloud.kms.inventory.v1.ProtectedResource +next_page_token ( "ù +ProtectedResource +name (  +project (  + +project_id (  + cloud_product (  + resource_type (  +location ( L +labels ( 2<.google.cloud.kms.inventory.v1.ProtectedResource.LabelsEntryI +crypto_key_version ( B-úA* +(cloudkms.googleapis.com/CryptoKeyVersionJ +crypto_key_versions + ( B-úA* +(cloudkms.googleapis.com/CryptoKeyVersion4 + create_time ( 2.google.protobuf.TimestampBàA- + LabelsEntry +key (  +value ( :8:\'êA$ +cloudasset.googleapis.com/Asset*2Ú +KeyTrackingService +GetProtectedResourcesSummaryB.google.cloud.kms.inventory.v1.GetProtectedResourcesSummaryRequest8.google.cloud.kms.inventory.v1.ProtectedResourcesSummary"c‚Óä“VT/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/**}/protectedResourcesSummaryÚAnameî +SearchProtectedResources>.google.cloud.kms.inventory.v1.SearchProtectedResourcesRequest?.google.cloud.kms.inventory.v1.SearchProtectedResourcesResponse"Q‚Óä“75/v1/{scope=organizations/*}/protectedResources:searchÚAscope, crypto_keyOÊAkmsinventory.googleapis.comÒA.https://www.googleapis.com/auth/cloud-platformB +!com.google.cloud.kms.inventory.v1BKeyTrackingServiceProtoPZ?cloud.google.com/go/kms/inventory/apiv1/inventorypb;inventorypbøªGoogle.Cloud.Kms.Inventory.V1ÊGoogle\\Cloud\\Kms\\Inventory\\V1bproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/owl-bot-staging/KmsInventory/v1/proto/src/Google/Cloud/Kms/Inventory/V1/GetProtectedResourcesSummaryRequest.php b/owl-bot-staging/KmsInventory/v1/proto/src/Google/Cloud/Kms/Inventory/V1/GetProtectedResourcesSummaryRequest.php new file mode 100644 index 000000000000..7b7250aae22c --- /dev/null +++ b/owl-bot-staging/KmsInventory/v1/proto/src/Google/Cloud/Kms/Inventory/V1/GetProtectedResourcesSummaryRequest.php @@ -0,0 +1,87 @@ +google.cloud.kms.inventory.v1.GetProtectedResourcesSummaryRequest + */ +class GetProtectedResourcesSummaryRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the + * [CryptoKey][google.cloud.kms.v1.CryptoKey]. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The resource name of the + * [CryptoKey][google.cloud.kms.v1.CryptoKey]. Please see + * {@see KeyTrackingServiceClient::protectedResourcesSummaryName()} for help formatting this field. + * + * @return \Google\Cloud\Kms\Inventory\V1\GetProtectedResourcesSummaryRequest + * + * @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 resource name of the + * [CryptoKey][google.cloud.kms.v1.CryptoKey]. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Kms\Inventory\V1\KeyTrackingService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the + * [CryptoKey][google.cloud.kms.v1.CryptoKey]. + * + * 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 resource name of the + * [CryptoKey][google.cloud.kms.v1.CryptoKey]. + * + * 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; + } + +} + diff --git a/owl-bot-staging/KmsInventory/v1/proto/src/Google/Cloud/Kms/Inventory/V1/KeyDashboardServiceGrpcClient.php b/owl-bot-staging/KmsInventory/v1/proto/src/Google/Cloud/Kms/Inventory/V1/KeyDashboardServiceGrpcClient.php new file mode 100644 index 000000000000..38e37f90e10c --- /dev/null +++ b/owl-bot-staging/KmsInventory/v1/proto/src/Google/Cloud/Kms/Inventory/V1/KeyDashboardServiceGrpcClient.php @@ -0,0 +1,52 @@ +_simpleRequest('/google.cloud.kms.inventory.v1.KeyDashboardService/ListCryptoKeys', + $argument, + ['\Google\Cloud\Kms\Inventory\V1\ListCryptoKeysResponse', 'decode'], + $metadata, $options); + } + +} diff --git a/owl-bot-staging/KmsInventory/v1/proto/src/Google/Cloud/Kms/Inventory/V1/KeyTrackingServiceGrpcClient.php b/owl-bot-staging/KmsInventory/v1/proto/src/Google/Cloud/Kms/Inventory/V1/KeyTrackingServiceGrpcClient.php new file mode 100644 index 000000000000..b23521fc0eee --- /dev/null +++ b/owl-bot-staging/KmsInventory/v1/proto/src/Google/Cloud/Kms/Inventory/V1/KeyTrackingServiceGrpcClient.php @@ -0,0 +1,71 @@ +_simpleRequest('/google.cloud.kms.inventory.v1.KeyTrackingService/GetProtectedResourcesSummary', + $argument, + ['\Google\Cloud\Kms\Inventory\V1\ProtectedResourcesSummary', 'decode'], + $metadata, $options); + } + + /** + * Returns metadata about the resources protected by the given Cloud KMS + * [CryptoKey][google.cloud.kms.v1.CryptoKey] in the given Cloud organization. + * @param \Google\Cloud\Kms\Inventory\V1\SearchProtectedResourcesRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function SearchProtectedResources(\Google\Cloud\Kms\Inventory\V1\SearchProtectedResourcesRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.kms.inventory.v1.KeyTrackingService/SearchProtectedResources', + $argument, + ['\Google\Cloud\Kms\Inventory\V1\SearchProtectedResourcesResponse', 'decode'], + $metadata, $options); + } + +} diff --git a/owl-bot-staging/KmsInventory/v1/proto/src/Google/Cloud/Kms/Inventory/V1/ListCryptoKeysRequest.php b/owl-bot-staging/KmsInventory/v1/proto/src/Google/Cloud/Kms/Inventory/V1/ListCryptoKeysRequest.php new file mode 100644 index 000000000000..005fec032720 --- /dev/null +++ b/owl-bot-staging/KmsInventory/v1/proto/src/Google/Cloud/Kms/Inventory/V1/ListCryptoKeysRequest.php @@ -0,0 +1,167 @@ +google.cloud.kms.inventory.v1.ListCryptoKeysRequest + */ +class ListCryptoKeysRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The Google Cloud project for which to retrieve key metadata, in + * the format `projects/*` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. The maximum number of keys to return. The service may return + * fewer than this value. If unspecified, at most 1000 keys will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Optional. Pass this into a subsequent request in order to receive the next + * page of results. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = ''; + + /** + * @param string $parent Required. The Google Cloud project for which to retrieve key metadata, in + * the format `projects/*` + * Please see {@see KeyDashboardServiceClient::projectName()} for help formatting this field. + * + * @return \Google\Cloud\Kms\Inventory\V1\ListCryptoKeysRequest + * + * @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. The Google Cloud project for which to retrieve key metadata, in + * the format `projects/*` + * @type int $page_size + * Optional. The maximum number of keys to return. The service may return + * fewer than this value. If unspecified, at most 1000 keys will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + * @type string $page_token + * Optional. Pass this into a subsequent request in order to receive the next + * page of results. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Kms\Inventory\V1\KeyDashboardService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The Google Cloud project for which to retrieve key metadata, in + * the format `projects/*` + * + * 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. The Google Cloud project for which to retrieve key metadata, in + * the format `projects/*` + * + * 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. The maximum number of keys to return. The service may return + * fewer than this value. If unspecified, at most 1000 keys will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. The maximum number of keys to return. The service may return + * fewer than this value. If unspecified, at most 1000 keys will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + * + * 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. Pass this into a subsequent request in order to receive the next + * page of results. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. Pass this into a subsequent request in order to receive the next + * page of results. + * + * 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; + } + +} + diff --git a/owl-bot-staging/KmsInventory/v1/proto/src/Google/Cloud/Kms/Inventory/V1/ListCryptoKeysResponse.php b/owl-bot-staging/KmsInventory/v1/proto/src/Google/Cloud/Kms/Inventory/V1/ListCryptoKeysResponse.php new file mode 100644 index 000000000000..eaecf70d100d --- /dev/null +++ b/owl-bot-staging/KmsInventory/v1/proto/src/Google/Cloud/Kms/Inventory/V1/ListCryptoKeysResponse.php @@ -0,0 +1,106 @@ +google.cloud.kms.inventory.v1.ListCryptoKeysResponse + */ +class ListCryptoKeysResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of [CryptoKeys][google.cloud.kms.v1.CryptoKey]. + * + * Generated from protobuf field repeated .google.cloud.kms.v1.CryptoKey crypto_keys = 1; + */ + private $crypto_keys; + /** + * The page token returned from the previous response if the next page is + * desired. + * + * 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\Kms\V1\CryptoKey>|\Google\Protobuf\Internal\RepeatedField $crypto_keys + * The list of [CryptoKeys][google.cloud.kms.v1.CryptoKey]. + * @type string $next_page_token + * The page token returned from the previous response if the next page is + * desired. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Kms\Inventory\V1\KeyDashboardService::initOnce(); + parent::__construct($data); + } + + /** + * The list of [CryptoKeys][google.cloud.kms.v1.CryptoKey]. + * + * Generated from protobuf field repeated .google.cloud.kms.v1.CryptoKey crypto_keys = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getCryptoKeys() + { + return $this->crypto_keys; + } + + /** + * The list of [CryptoKeys][google.cloud.kms.v1.CryptoKey]. + * + * Generated from protobuf field repeated .google.cloud.kms.v1.CryptoKey crypto_keys = 1; + * @param array<\Google\Cloud\Kms\V1\CryptoKey>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setCryptoKeys($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Kms\V1\CryptoKey::class); + $this->crypto_keys = $arr; + + return $this; + } + + /** + * The page token returned from the previous response if the next page is + * desired. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * The page token returned from the previous response if the next page is + * desired. + * + * 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/KmsInventory/v1/proto/src/Google/Cloud/Kms/Inventory/V1/ProtectedResource.php b/owl-bot-staging/KmsInventory/v1/proto/src/Google/Cloud/Kms/Inventory/V1/ProtectedResource.php new file mode 100644 index 000000000000..7be056de11f6 --- /dev/null +++ b/owl-bot-staging/KmsInventory/v1/proto/src/Google/Cloud/Kms/Inventory/V1/ProtectedResource.php @@ -0,0 +1,447 @@ +google.cloud.kms.inventory.v1.ProtectedResource + */ +class ProtectedResource extends \Google\Protobuf\Internal\Message +{ + /** + * The full resource name of the resource. + * Example: + * `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * Format: `projects/{PROJECT_NUMBER}`. + * + * Generated from protobuf field string project = 2; + */ + protected $project = ''; + /** + * The ID of the project that owns the resource. + * + * Generated from protobuf field string project_id = 9; + */ + protected $project_id = ''; + /** + * The Cloud product that owns the resource. + * Example: `compute` + * + * Generated from protobuf field string cloud_product = 8; + */ + protected $cloud_product = ''; + /** + * Example: `compute.googleapis.com/Disk` + * + * Generated from protobuf field string resource_type = 3; + */ + protected $resource_type = ''; + /** + * Location can be `global`, regional like `us-east1`, or zonal like + * `us-west1-b`. + * + * Generated from protobuf field string location = 4; + */ + protected $location = ''; + /** + * A key-value pair of the resource's labels (v1) to their values. + * + * Generated from protobuf field map labels = 5; + */ + private $labels; + /** + * The name of the Cloud KMS + * [CryptoKeyVersion](https://cloud.google.com/kms/docs/reference/rest/v1/projects.locations.keyRings.cryptoKeys.cryptoKeyVersions?hl=en) + * used to protect this resource via CMEK. This field is empty if the + * Google Cloud product owning the resource does not provide key version data + * to Asset Inventory. If there are multiple key versions protecting the + * resource, then this is same value as the first element of + * crypto_key_versions. + * + * Generated from protobuf field string crypto_key_version = 6 [(.google.api.resource_reference) = { + */ + protected $crypto_key_version = ''; + /** + * The names of the Cloud KMS + * [CryptoKeyVersion](https://cloud.google.com/kms/docs/reference/rest/v1/projects.locations.keyRings.cryptoKeys.cryptoKeyVersions?hl=en) + * used to protect this resource via CMEK. This field is empty if the + * Google Cloud product owning the resource does not provide key versions data + * to Asset Inventory. The first element of this field is stored in + * crypto_key_version. + * + * Generated from protobuf field repeated string crypto_key_versions = 10 [(.google.api.resource_reference) = { + */ + private $crypto_key_versions; + /** + * Output only. The time at which this resource was created. The granularity + * is in seconds. Timestamp.nanos will always be 0. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The full resource name of the resource. + * Example: + * `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`. + * @type string $project + * Format: `projects/{PROJECT_NUMBER}`. + * @type string $project_id + * The ID of the project that owns the resource. + * @type string $cloud_product + * The Cloud product that owns the resource. + * Example: `compute` + * @type string $resource_type + * Example: `compute.googleapis.com/Disk` + * @type string $location + * Location can be `global`, regional like `us-east1`, or zonal like + * `us-west1-b`. + * @type array|\Google\Protobuf\Internal\MapField $labels + * A key-value pair of the resource's labels (v1) to their values. + * @type string $crypto_key_version + * The name of the Cloud KMS + * [CryptoKeyVersion](https://cloud.google.com/kms/docs/reference/rest/v1/projects.locations.keyRings.cryptoKeys.cryptoKeyVersions?hl=en) + * used to protect this resource via CMEK. This field is empty if the + * Google Cloud product owning the resource does not provide key version data + * to Asset Inventory. If there are multiple key versions protecting the + * resource, then this is same value as the first element of + * crypto_key_versions. + * @type array|\Google\Protobuf\Internal\RepeatedField $crypto_key_versions + * The names of the Cloud KMS + * [CryptoKeyVersion](https://cloud.google.com/kms/docs/reference/rest/v1/projects.locations.keyRings.cryptoKeys.cryptoKeyVersions?hl=en) + * used to protect this resource via CMEK. This field is empty if the + * Google Cloud product owning the resource does not provide key versions data + * to Asset Inventory. The first element of this field is stored in + * crypto_key_version. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The time at which this resource was created. The granularity + * is in seconds. Timestamp.nanos will always be 0. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Kms\Inventory\V1\KeyTrackingService::initOnce(); + parent::__construct($data); + } + + /** + * The full resource name of the resource. + * Example: + * `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The full resource name of the resource. + * Example: + * `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Format: `projects/{PROJECT_NUMBER}`. + * + * Generated from protobuf field string project = 2; + * @return string + */ + public function getProject() + { + return $this->project; + } + + /** + * Format: `projects/{PROJECT_NUMBER}`. + * + * Generated from protobuf field string project = 2; + * @param string $var + * @return $this + */ + public function setProject($var) + { + GPBUtil::checkString($var, True); + $this->project = $var; + + return $this; + } + + /** + * The ID of the project that owns the resource. + * + * Generated from protobuf field string project_id = 9; + * @return string + */ + public function getProjectId() + { + return $this->project_id; + } + + /** + * The ID of the project that owns the resource. + * + * Generated from protobuf field string project_id = 9; + * @param string $var + * @return $this + */ + public function setProjectId($var) + { + GPBUtil::checkString($var, True); + $this->project_id = $var; + + return $this; + } + + /** + * The Cloud product that owns the resource. + * Example: `compute` + * + * Generated from protobuf field string cloud_product = 8; + * @return string + */ + public function getCloudProduct() + { + return $this->cloud_product; + } + + /** + * The Cloud product that owns the resource. + * Example: `compute` + * + * Generated from protobuf field string cloud_product = 8; + * @param string $var + * @return $this + */ + public function setCloudProduct($var) + { + GPBUtil::checkString($var, True); + $this->cloud_product = $var; + + return $this; + } + + /** + * Example: `compute.googleapis.com/Disk` + * + * Generated from protobuf field string resource_type = 3; + * @return string + */ + public function getResourceType() + { + return $this->resource_type; + } + + /** + * Example: `compute.googleapis.com/Disk` + * + * Generated from protobuf field string resource_type = 3; + * @param string $var + * @return $this + */ + public function setResourceType($var) + { + GPBUtil::checkString($var, True); + $this->resource_type = $var; + + return $this; + } + + /** + * Location can be `global`, regional like `us-east1`, or zonal like + * `us-west1-b`. + * + * Generated from protobuf field string location = 4; + * @return string + */ + public function getLocation() + { + return $this->location; + } + + /** + * Location can be `global`, regional like `us-east1`, or zonal like + * `us-west1-b`. + * + * Generated from protobuf field string location = 4; + * @param string $var + * @return $this + */ + public function setLocation($var) + { + GPBUtil::checkString($var, True); + $this->location = $var; + + return $this; + } + + /** + * A key-value pair of the resource's labels (v1) to their values. + * + * Generated from protobuf field map labels = 5; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * A key-value pair of the resource's labels (v1) to their values. + * + * Generated from protobuf field map labels = 5; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + + /** + * The name of the Cloud KMS + * [CryptoKeyVersion](https://cloud.google.com/kms/docs/reference/rest/v1/projects.locations.keyRings.cryptoKeys.cryptoKeyVersions?hl=en) + * used to protect this resource via CMEK. This field is empty if the + * Google Cloud product owning the resource does not provide key version data + * to Asset Inventory. If there are multiple key versions protecting the + * resource, then this is same value as the first element of + * crypto_key_versions. + * + * Generated from protobuf field string crypto_key_version = 6 [(.google.api.resource_reference) = { + * @return string + */ + public function getCryptoKeyVersion() + { + return $this->crypto_key_version; + } + + /** + * The name of the Cloud KMS + * [CryptoKeyVersion](https://cloud.google.com/kms/docs/reference/rest/v1/projects.locations.keyRings.cryptoKeys.cryptoKeyVersions?hl=en) + * used to protect this resource via CMEK. This field is empty if the + * Google Cloud product owning the resource does not provide key version data + * to Asset Inventory. If there are multiple key versions protecting the + * resource, then this is same value as the first element of + * crypto_key_versions. + * + * Generated from protobuf field string crypto_key_version = 6 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setCryptoKeyVersion($var) + { + GPBUtil::checkString($var, True); + $this->crypto_key_version = $var; + + return $this; + } + + /** + * The names of the Cloud KMS + * [CryptoKeyVersion](https://cloud.google.com/kms/docs/reference/rest/v1/projects.locations.keyRings.cryptoKeys.cryptoKeyVersions?hl=en) + * used to protect this resource via CMEK. This field is empty if the + * Google Cloud product owning the resource does not provide key versions data + * to Asset Inventory. The first element of this field is stored in + * crypto_key_version. + * + * Generated from protobuf field repeated string crypto_key_versions = 10 [(.google.api.resource_reference) = { + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getCryptoKeyVersions() + { + return $this->crypto_key_versions; + } + + /** + * The names of the Cloud KMS + * [CryptoKeyVersion](https://cloud.google.com/kms/docs/reference/rest/v1/projects.locations.keyRings.cryptoKeys.cryptoKeyVersions?hl=en) + * used to protect this resource via CMEK. This field is empty if the + * Google Cloud product owning the resource does not provide key versions data + * to Asset Inventory. The first element of this field is stored in + * crypto_key_version. + * + * Generated from protobuf field repeated string crypto_key_versions = 10 [(.google.api.resource_reference) = { + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setCryptoKeyVersions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->crypto_key_versions = $arr; + + return $this; + } + + /** + * Output only. The time at which this resource was created. The granularity + * is in seconds. Timestamp.nanos will always be 0. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 7 [(.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 at which this resource was created. The granularity + * is in seconds. Timestamp.nanos will always be 0. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 7 [(.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; + } + +} + diff --git a/owl-bot-staging/KmsInventory/v1/proto/src/Google/Cloud/Kms/Inventory/V1/ProtectedResourcesSummary.php b/owl-bot-staging/KmsInventory/v1/proto/src/Google/Cloud/Kms/Inventory/V1/ProtectedResourcesSummary.php new file mode 100644 index 000000000000..6bc4e0544967 --- /dev/null +++ b/owl-bot-staging/KmsInventory/v1/proto/src/Google/Cloud/Kms/Inventory/V1/ProtectedResourcesSummary.php @@ -0,0 +1,254 @@ +google.cloud.kms.inventory.v1.ProtectedResourcesSummary + */ +class ProtectedResourcesSummary extends \Google\Protobuf\Internal\Message +{ + /** + * The full name of the ProtectedResourcesSummary resource. + * Example: + * projects/test-project/locations/us/keyRings/test-keyring/cryptoKeys/test-key/protectedResourcesSummary + * + * Generated from protobuf field string name = 5; + */ + protected $name = ''; + /** + * The total number of protected resources in the same Cloud organization as + * the key. + * + * Generated from protobuf field int64 resource_count = 1; + */ + protected $resource_count = 0; + /** + * The number of distinct Cloud projects in the same Cloud organization as the + * key that have resources protected by the key. + * + * Generated from protobuf field int32 project_count = 2; + */ + protected $project_count = 0; + /** + * The number of resources protected by the key grouped by resource type. + * + * Generated from protobuf field map resource_types = 3; + */ + private $resource_types; + /** + * The number of resources protected by the key grouped by Cloud product. + * + * Generated from protobuf field map cloud_products = 6; + */ + private $cloud_products; + /** + * The number of resources protected by the key grouped by region. + * + * Generated from protobuf field map locations = 4; + */ + private $locations; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The full name of the ProtectedResourcesSummary resource. + * Example: + * projects/test-project/locations/us/keyRings/test-keyring/cryptoKeys/test-key/protectedResourcesSummary + * @type int|string $resource_count + * The total number of protected resources in the same Cloud organization as + * the key. + * @type int $project_count + * The number of distinct Cloud projects in the same Cloud organization as the + * key that have resources protected by the key. + * @type array|\Google\Protobuf\Internal\MapField $resource_types + * The number of resources protected by the key grouped by resource type. + * @type array|\Google\Protobuf\Internal\MapField $cloud_products + * The number of resources protected by the key grouped by Cloud product. + * @type array|\Google\Protobuf\Internal\MapField $locations + * The number of resources protected by the key grouped by region. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Kms\Inventory\V1\KeyTrackingService::initOnce(); + parent::__construct($data); + } + + /** + * The full name of the ProtectedResourcesSummary resource. + * Example: + * projects/test-project/locations/us/keyRings/test-keyring/cryptoKeys/test-key/protectedResourcesSummary + * + * Generated from protobuf field string name = 5; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The full name of the ProtectedResourcesSummary resource. + * Example: + * projects/test-project/locations/us/keyRings/test-keyring/cryptoKeys/test-key/protectedResourcesSummary + * + * Generated from protobuf field string name = 5; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The total number of protected resources in the same Cloud organization as + * the key. + * + * Generated from protobuf field int64 resource_count = 1; + * @return int|string + */ + public function getResourceCount() + { + return $this->resource_count; + } + + /** + * The total number of protected resources in the same Cloud organization as + * the key. + * + * Generated from protobuf field int64 resource_count = 1; + * @param int|string $var + * @return $this + */ + public function setResourceCount($var) + { + GPBUtil::checkInt64($var); + $this->resource_count = $var; + + return $this; + } + + /** + * The number of distinct Cloud projects in the same Cloud organization as the + * key that have resources protected by the key. + * + * Generated from protobuf field int32 project_count = 2; + * @return int + */ + public function getProjectCount() + { + return $this->project_count; + } + + /** + * The number of distinct Cloud projects in the same Cloud organization as the + * key that have resources protected by the key. + * + * Generated from protobuf field int32 project_count = 2; + * @param int $var + * @return $this + */ + public function setProjectCount($var) + { + GPBUtil::checkInt32($var); + $this->project_count = $var; + + return $this; + } + + /** + * The number of resources protected by the key grouped by resource type. + * + * Generated from protobuf field map resource_types = 3; + * @return \Google\Protobuf\Internal\MapField + */ + public function getResourceTypes() + { + return $this->resource_types; + } + + /** + * The number of resources protected by the key grouped by resource type. + * + * Generated from protobuf field map resource_types = 3; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setResourceTypes($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::INT64); + $this->resource_types = $arr; + + return $this; + } + + /** + * The number of resources protected by the key grouped by Cloud product. + * + * Generated from protobuf field map cloud_products = 6; + * @return \Google\Protobuf\Internal\MapField + */ + public function getCloudProducts() + { + return $this->cloud_products; + } + + /** + * The number of resources protected by the key grouped by Cloud product. + * + * Generated from protobuf field map cloud_products = 6; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setCloudProducts($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::INT64); + $this->cloud_products = $arr; + + return $this; + } + + /** + * The number of resources protected by the key grouped by region. + * + * Generated from protobuf field map locations = 4; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLocations() + { + return $this->locations; + } + + /** + * The number of resources protected by the key grouped by region. + * + * Generated from protobuf field map locations = 4; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLocations($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::INT64); + $this->locations = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/KmsInventory/v1/proto/src/Google/Cloud/Kms/Inventory/V1/SearchProtectedResourcesRequest.php b/owl-bot-staging/KmsInventory/v1/proto/src/Google/Cloud/Kms/Inventory/V1/SearchProtectedResourcesRequest.php new file mode 100644 index 000000000000..9ef9326de649 --- /dev/null +++ b/owl-bot-staging/KmsInventory/v1/proto/src/Google/Cloud/Kms/Inventory/V1/SearchProtectedResourcesRequest.php @@ -0,0 +1,228 @@ +google.cloud.kms.inventory.v1.SearchProtectedResourcesRequest + */ +class SearchProtectedResourcesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Resource name of the organization. + * Example: organizations/123 + * + * Generated from protobuf field string scope = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $scope = ''; + /** + * Required. The resource name of the + * [CryptoKey][google.cloud.kms.v1.CryptoKey]. + * + * Generated from protobuf field string crypto_key = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $crypto_key = ''; + /** + * The maximum number of resources to return. The service may return fewer + * than this value. + * If unspecified, at most 500 resources will be returned. + * The maximum value is 500; values above 500 will be coerced to 500. + * + * Generated from protobuf field int32 page_size = 3; + */ + protected $page_size = 0; + /** + * A page token, received from a previous + * [KeyTrackingService.SearchProtectedResources][google.cloud.kms.inventory.v1.KeyTrackingService.SearchProtectedResources] + * call. Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * [KeyTrackingService.SearchProtectedResources][google.cloud.kms.inventory.v1.KeyTrackingService.SearchProtectedResources] + * must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 4; + */ + protected $page_token = ''; + + /** + * @param string $scope Required. Resource name of the organization. + * Example: organizations/123 + * Please see {@see KeyTrackingServiceClient::organizationName()} for help formatting this field. + * @param string $cryptoKey Required. The resource name of the + * [CryptoKey][google.cloud.kms.v1.CryptoKey]. + * + * @return \Google\Cloud\Kms\Inventory\V1\SearchProtectedResourcesRequest + * + * @experimental + */ + public static function build(string $scope, string $cryptoKey): self + { + return (new self()) + ->setScope($scope) + ->setCryptoKey($cryptoKey); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $scope + * Required. Resource name of the organization. + * Example: organizations/123 + * @type string $crypto_key + * Required. The resource name of the + * [CryptoKey][google.cloud.kms.v1.CryptoKey]. + * @type int $page_size + * The maximum number of resources to return. The service may return fewer + * than this value. + * If unspecified, at most 500 resources will be returned. + * The maximum value is 500; values above 500 will be coerced to 500. + * @type string $page_token + * A page token, received from a previous + * [KeyTrackingService.SearchProtectedResources][google.cloud.kms.inventory.v1.KeyTrackingService.SearchProtectedResources] + * call. Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * [KeyTrackingService.SearchProtectedResources][google.cloud.kms.inventory.v1.KeyTrackingService.SearchProtectedResources] + * must match the call that provided the page token. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Kms\Inventory\V1\KeyTrackingService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Resource name of the organization. + * Example: organizations/123 + * + * Generated from protobuf field string scope = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getScope() + { + return $this->scope; + } + + /** + * Required. Resource name of the organization. + * Example: organizations/123 + * + * Generated from protobuf field string scope = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setScope($var) + { + GPBUtil::checkString($var, True); + $this->scope = $var; + + return $this; + } + + /** + * Required. The resource name of the + * [CryptoKey][google.cloud.kms.v1.CryptoKey]. + * + * Generated from protobuf field string crypto_key = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getCryptoKey() + { + return $this->crypto_key; + } + + /** + * Required. The resource name of the + * [CryptoKey][google.cloud.kms.v1.CryptoKey]. + * + * Generated from protobuf field string crypto_key = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setCryptoKey($var) + { + GPBUtil::checkString($var, True); + $this->crypto_key = $var; + + return $this; + } + + /** + * The maximum number of resources to return. The service may return fewer + * than this value. + * If unspecified, at most 500 resources will be returned. + * The maximum value is 500; values above 500 will be coerced to 500. + * + * Generated from protobuf field int32 page_size = 3; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of resources to return. The service may return fewer + * than this value. + * If unspecified, at most 500 resources will be returned. + * The maximum value is 500; values above 500 will be coerced to 500. + * + * Generated from protobuf field int32 page_size = 3; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * A page token, received from a previous + * [KeyTrackingService.SearchProtectedResources][google.cloud.kms.inventory.v1.KeyTrackingService.SearchProtectedResources] + * call. Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * [KeyTrackingService.SearchProtectedResources][google.cloud.kms.inventory.v1.KeyTrackingService.SearchProtectedResources] + * must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 4; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * A page token, received from a previous + * [KeyTrackingService.SearchProtectedResources][google.cloud.kms.inventory.v1.KeyTrackingService.SearchProtectedResources] + * call. Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * [KeyTrackingService.SearchProtectedResources][google.cloud.kms.inventory.v1.KeyTrackingService.SearchProtectedResources] + * must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 4; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/KmsInventory/v1/proto/src/Google/Cloud/Kms/Inventory/V1/SearchProtectedResourcesResponse.php b/owl-bot-staging/KmsInventory/v1/proto/src/Google/Cloud/Kms/Inventory/V1/SearchProtectedResourcesResponse.php new file mode 100644 index 000000000000..d587533d91d3 --- /dev/null +++ b/owl-bot-staging/KmsInventory/v1/proto/src/Google/Cloud/Kms/Inventory/V1/SearchProtectedResourcesResponse.php @@ -0,0 +1,106 @@ +google.cloud.kms.inventory.v1.SearchProtectedResourcesResponse + */ +class SearchProtectedResourcesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Protected resources for this page. + * + * Generated from protobuf field repeated .google.cloud.kms.inventory.v1.ProtectedResource protected_resources = 1; + */ + private $protected_resources; + /** + * A token that can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * 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\Kms\Inventory\V1\ProtectedResource>|\Google\Protobuf\Internal\RepeatedField $protected_resources + * Protected resources for this page. + * @type string $next_page_token + * A token that can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Kms\Inventory\V1\KeyTrackingService::initOnce(); + parent::__construct($data); + } + + /** + * Protected resources for this page. + * + * Generated from protobuf field repeated .google.cloud.kms.inventory.v1.ProtectedResource protected_resources = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getProtectedResources() + { + return $this->protected_resources; + } + + /** + * Protected resources for this page. + * + * Generated from protobuf field repeated .google.cloud.kms.inventory.v1.ProtectedResource protected_resources = 1; + * @param array<\Google\Cloud\Kms\Inventory\V1\ProtectedResource>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setProtectedResources($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Kms\Inventory\V1\ProtectedResource::class); + $this->protected_resources = $arr; + + return $this; + } + + /** + * A token that can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token that can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * 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/KmsInventory/v1/samples/V1/KeyDashboardServiceClient/list_crypto_keys.php b/owl-bot-staging/KmsInventory/v1/samples/V1/KeyDashboardServiceClient/list_crypto_keys.php new file mode 100644 index 000000000000..5a132d445883 --- /dev/null +++ b/owl-bot-staging/KmsInventory/v1/samples/V1/KeyDashboardServiceClient/list_crypto_keys.php @@ -0,0 +1,79 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $keyDashboardServiceClient->listCryptoKeys($request); + + /** @var CryptoKey $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 = KeyDashboardServiceClient::projectName('[PROJECT]'); + + list_crypto_keys_sample($formattedParent); +} +// [END kmsinventory_v1_generated_KeyDashboardService_ListCryptoKeys_sync] diff --git a/owl-bot-staging/KmsInventory/v1/samples/V1/KeyTrackingServiceClient/get_protected_resources_summary.php b/owl-bot-staging/KmsInventory/v1/samples/V1/KeyTrackingServiceClient/get_protected_resources_summary.php new file mode 100644 index 000000000000..5e75b04511e6 --- /dev/null +++ b/owl-bot-staging/KmsInventory/v1/samples/V1/KeyTrackingServiceClient/get_protected_resources_summary.php @@ -0,0 +1,81 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var ProtectedResourcesSummary $response */ + $response = $keyTrackingServiceClient->getProtectedResourcesSummary($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 = KeyTrackingServiceClient::protectedResourcesSummaryName( + '[PROJECT]', + '[LOCATION]', + '[KEY_RING]', + '[CRYPTO_KEY]' + ); + + get_protected_resources_summary_sample($formattedName); +} +// [END kmsinventory_v1_generated_KeyTrackingService_GetProtectedResourcesSummary_sync] diff --git a/owl-bot-staging/KmsInventory/v1/samples/V1/KeyTrackingServiceClient/search_protected_resources.php b/owl-bot-staging/KmsInventory/v1/samples/V1/KeyTrackingServiceClient/search_protected_resources.php new file mode 100644 index 000000000000..66730ec42a67 --- /dev/null +++ b/owl-bot-staging/KmsInventory/v1/samples/V1/KeyTrackingServiceClient/search_protected_resources.php @@ -0,0 +1,82 @@ +setScope($formattedScope) + ->setCryptoKey($cryptoKey); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $keyTrackingServiceClient->searchProtectedResources($request); + + /** @var ProtectedResource $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 +{ + $formattedScope = KeyTrackingServiceClient::organizationName('[ORGANIZATION]'); + $cryptoKey = '[CRYPTO_KEY]'; + + search_protected_resources_sample($formattedScope, $cryptoKey); +} +// [END kmsinventory_v1_generated_KeyTrackingService_SearchProtectedResources_sync] diff --git a/owl-bot-staging/KmsInventory/v1/src/V1/Client/BaseClient/KeyDashboardServiceBaseClient.php b/owl-bot-staging/KmsInventory/v1/src/V1/Client/BaseClient/KeyDashboardServiceBaseClient.php new file mode 100644 index 000000000000..dca227419416 --- /dev/null +++ b/owl-bot-staging/KmsInventory/v1/src/V1/Client/BaseClient/KeyDashboardServiceBaseClient.php @@ -0,0 +1,234 @@ + self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../../resources/key_dashboard_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../../resources/key_dashboard_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../../resources/key_dashboard_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../../resources/key_dashboard_service_rest_client_config.php', + ], + ], + ]; + } + + /** + * Formats a string containing the fully-qualified path to represent a project + * resource. + * + * @param string $project + * + * @return string The formatted project resource. + */ + public static function projectName(string $project): string + { + return self::getPathTemplate('project')->render([ + 'project' => $project, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - project: projects/{project} + * + * 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 'kmsinventory.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. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *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' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods 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); + } + + /** 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); + } + + /** + * Returns cryptographic keys managed by Cloud KMS in a given Cloud project. + * Note that this data is sourced from snapshots, meaning it may not + * completely reflect the actual state of key metadata at call time. + * + * The async variant is {@see self::listCryptoKeysAsync()} . + * + * @param ListCryptoKeysRequest $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 listCryptoKeys(ListCryptoKeysRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListCryptoKeys', $request, $callOptions); + } +} diff --git a/owl-bot-staging/KmsInventory/v1/src/V1/Client/BaseClient/KeyTrackingServiceBaseClient.php b/owl-bot-staging/KmsInventory/v1/src/V1/Client/BaseClient/KeyTrackingServiceBaseClient.php new file mode 100644 index 000000000000..639241f51a3f --- /dev/null +++ b/owl-bot-staging/KmsInventory/v1/src/V1/Client/BaseClient/KeyTrackingServiceBaseClient.php @@ -0,0 +1,334 @@ + self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../../resources/key_tracking_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../../resources/key_tracking_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../../resources/key_tracking_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../../resources/key_tracking_service_rest_client_config.php', + ], + ], + ]; + } + + /** + * Formats a string containing the fully-qualified path to represent a organization + * resource. + * + * @param string $organization + * + * @return string The formatted organization resource. + */ + public static function organizationName(string $organization): string + { + return self::getPathTemplate('organization')->render([ + 'organization' => $organization, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_location_key_ring_crypto_key_crypto_key_version_protectedResourcesSummary + * resource. + * + * @param string $project + * @param string $location + * @param string $keyRing + * @param string $cryptoKey + * @param string $cryptoKeyVersion + * + * @return string The formatted project_location_key_ring_crypto_key_crypto_key_version_protectedResourcesSummary resource. + */ + public static function projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName(string $project, string $location, string $keyRing, string $cryptoKey, string $cryptoKeyVersion): string + { + return self::getPathTemplate('projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummary')->render([ + 'project' => $project, + 'location' => $location, + 'key_ring' => $keyRing, + 'crypto_key' => $cryptoKey, + 'crypto_key_version' => $cryptoKeyVersion, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_location_key_ring_crypto_key_protectedResourcesSummary resource. + * + * @param string $project + * @param string $location + * @param string $keyRing + * @param string $cryptoKey + * + * @return string The formatted project_location_key_ring_crypto_key_protectedResourcesSummary resource. + */ + public static function projectLocationKeyRingCryptoKeyProtectedResourcesSummaryName(string $project, string $location, string $keyRing, string $cryptoKey): string + { + return self::getPathTemplate('projectLocationKeyRingCryptoKeyProtectedResourcesSummary')->render([ + 'project' => $project, + 'location' => $location, + 'key_ring' => $keyRing, + 'crypto_key' => $cryptoKey, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * protected_resources_summary resource. + * + * @param string $project + * @param string $location + * @param string $keyRing + * @param string $cryptoKey + * + * @return string The formatted protected_resources_summary resource. + */ + public static function protectedResourcesSummaryName(string $project, string $location, string $keyRing, string $cryptoKey): string + { + return self::getPathTemplate('protectedResourcesSummary')->render([ + 'project' => $project, + 'location' => $location, + 'key_ring' => $keyRing, + 'crypto_key' => $cryptoKey, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - organization: organizations/{organization} + * - projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummary: projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}/protectedResourcesSummary + * - projectLocationKeyRingCryptoKeyProtectedResourcesSummary: projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/protectedResourcesSummary + * - protectedResourcesSummary: projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/protectedResourcesSummary + * + * 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 'kmsinventory.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. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *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' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods 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); + } + + /** 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); + } + + /** + * Returns aggregate information about the resources protected by the given + * Cloud KMS [CryptoKey][google.cloud.kms.v1.CryptoKey]. Only resources within + * the same Cloud organization as the key will be returned. The project that + * holds the key must be part of an organization in order for this call to + * succeed. + * + * The async variant is {@see self::getProtectedResourcesSummaryAsync()} . + * + * @param GetProtectedResourcesSummaryRequest $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 ProtectedResourcesSummary + * + * @throws ApiException Thrown if the API call fails. + */ + public function getProtectedResourcesSummary(GetProtectedResourcesSummaryRequest $request, array $callOptions = []): ProtectedResourcesSummary + { + return $this->startApiCall('GetProtectedResourcesSummary', $request, $callOptions)->wait(); + } + + /** + * Returns metadata about the resources protected by the given Cloud KMS + * [CryptoKey][google.cloud.kms.v1.CryptoKey] in the given Cloud organization. + * + * The async variant is {@see self::searchProtectedResourcesAsync()} . + * + * @param SearchProtectedResourcesRequest $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 searchProtectedResources(SearchProtectedResourcesRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('SearchProtectedResources', $request, $callOptions); + } +} diff --git a/owl-bot-staging/KmsInventory/v1/src/V1/Client/KeyDashboardServiceClient.php b/owl-bot-staging/KmsInventory/v1/src/V1/Client/KeyDashboardServiceClient.php new file mode 100644 index 000000000000..c13e04007ebd --- /dev/null +++ b/owl-bot-staging/KmsInventory/v1/src/V1/Client/KeyDashboardServiceClient.php @@ -0,0 +1,40 @@ +projectName('[PROJECT]'); + * // Iterate over pages of elements + * $pagedResponse = $keyDashboardServiceClient->listCryptoKeys($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $keyDashboardServiceClient->listCryptoKeys($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $keyDashboardServiceClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + */ +class KeyDashboardServiceGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.kms.inventory.v1.KeyDashboardService'; + + /** The default address of the service. */ + const SERVICE_ADDRESS = 'kmsinventory.googleapis.com'; + + /** The default port of the service. */ + const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + ]; + + private static $projectNameTemplate; + + private static $pathTemplateMap; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/key_dashboard_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/key_dashboard_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/key_dashboard_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/key_dashboard_service_rest_client_config.php', + ], + ], + ]; + } + + private static function getProjectNameTemplate() + { + if (self::$projectNameTemplate == null) { + self::$projectNameTemplate = new PathTemplate('projects/{project}'); + } + + return self::$projectNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'project' => self::getProjectNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a project + * resource. + * + * @param string $project + * + * @return string The formatted project resource. + */ + public static function projectName($project) + { + return self::getProjectNameTemplate()->render([ + 'project' => $project, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - project: projects/{project} + * + * 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($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * 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 'kmsinventory.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. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *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' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods 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); + } + + /** + * Returns cryptographic keys managed by Cloud KMS in a given Cloud project. + * Note that this data is sourced from snapshots, meaning it may not + * completely reflect the actual state of key metadata at call time. + * + * Sample code: + * ``` + * $keyDashboardServiceClient = new KeyDashboardServiceClient(); + * try { + * $formattedParent = $keyDashboardServiceClient->projectName('[PROJECT]'); + * // Iterate over pages of elements + * $pagedResponse = $keyDashboardServiceClient->listCryptoKeys($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $keyDashboardServiceClient->listCryptoKeys($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $keyDashboardServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The Google Cloud project for which to retrieve key metadata, in + * the format `projects/*` + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @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 \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listCryptoKeys($parent, array $optionalArgs = []) + { + $request = new ListCryptoKeysRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListCryptoKeys', $optionalArgs, ListCryptoKeysResponse::class, $request); + } +} diff --git a/owl-bot-staging/KmsInventory/v1/src/V1/Gapic/KeyTrackingServiceGapicClient.php b/owl-bot-staging/KmsInventory/v1/src/V1/Gapic/KeyTrackingServiceGapicClient.php new file mode 100644 index 000000000000..7e12032907aa --- /dev/null +++ b/owl-bot-staging/KmsInventory/v1/src/V1/Gapic/KeyTrackingServiceGapicClient.php @@ -0,0 +1,465 @@ +protectedResourcesSummaryName('[PROJECT]', '[LOCATION]', '[KEY_RING]', '[CRYPTO_KEY]'); + * $response = $keyTrackingServiceClient->getProtectedResourcesSummary($formattedName); + * } finally { + * $keyTrackingServiceClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + */ +class KeyTrackingServiceGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.kms.inventory.v1.KeyTrackingService'; + + /** The default address of the service. */ + const SERVICE_ADDRESS = 'kmsinventory.googleapis.com'; + + /** The default port of the service. */ + const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + ]; + + private static $organizationNameTemplate; + + private static $projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryNameTemplate; + + private static $projectLocationKeyRingCryptoKeyProtectedResourcesSummaryNameTemplate; + + private static $protectedResourcesSummaryNameTemplate; + + private static $pathTemplateMap; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/key_tracking_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/key_tracking_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/key_tracking_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/key_tracking_service_rest_client_config.php', + ], + ], + ]; + } + + private static function getOrganizationNameTemplate() + { + if (self::$organizationNameTemplate == null) { + self::$organizationNameTemplate = new PathTemplate('organizations/{organization}'); + } + + return self::$organizationNameTemplate; + } + + private static function getProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryNameTemplate() + { + if (self::$projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryNameTemplate == null) { + self::$projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryNameTemplate = new PathTemplate('projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}/protectedResourcesSummary'); + } + + return self::$projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryNameTemplate; + } + + private static function getProjectLocationKeyRingCryptoKeyProtectedResourcesSummaryNameTemplate() + { + if (self::$projectLocationKeyRingCryptoKeyProtectedResourcesSummaryNameTemplate == null) { + self::$projectLocationKeyRingCryptoKeyProtectedResourcesSummaryNameTemplate = new PathTemplate('projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/protectedResourcesSummary'); + } + + return self::$projectLocationKeyRingCryptoKeyProtectedResourcesSummaryNameTemplate; + } + + private static function getProtectedResourcesSummaryNameTemplate() + { + if (self::$protectedResourcesSummaryNameTemplate == null) { + self::$protectedResourcesSummaryNameTemplate = new PathTemplate('projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/protectedResourcesSummary'); + } + + return self::$protectedResourcesSummaryNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'organization' => self::getOrganizationNameTemplate(), + 'projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummary' => self::getProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryNameTemplate(), + 'projectLocationKeyRingCryptoKeyProtectedResourcesSummary' => self::getProjectLocationKeyRingCryptoKeyProtectedResourcesSummaryNameTemplate(), + 'protectedResourcesSummary' => self::getProtectedResourcesSummaryNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a organization + * resource. + * + * @param string $organization + * + * @return string The formatted organization resource. + */ + public static function organizationName($organization) + { + return self::getOrganizationNameTemplate()->render([ + 'organization' => $organization, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_location_key_ring_crypto_key_crypto_key_version_protectedResourcesSummary + * resource. + * + * @param string $project + * @param string $location + * @param string $keyRing + * @param string $cryptoKey + * @param string $cryptoKeyVersion + * + * @return string The formatted project_location_key_ring_crypto_key_crypto_key_version_protectedResourcesSummary resource. + */ + public static function projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName($project, $location, $keyRing, $cryptoKey, $cryptoKeyVersion) + { + return self::getProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'key_ring' => $keyRing, + 'crypto_key' => $cryptoKey, + 'crypto_key_version' => $cryptoKeyVersion, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_location_key_ring_crypto_key_protectedResourcesSummary resource. + * + * @param string $project + * @param string $location + * @param string $keyRing + * @param string $cryptoKey + * + * @return string The formatted project_location_key_ring_crypto_key_protectedResourcesSummary resource. + */ + public static function projectLocationKeyRingCryptoKeyProtectedResourcesSummaryName($project, $location, $keyRing, $cryptoKey) + { + return self::getProjectLocationKeyRingCryptoKeyProtectedResourcesSummaryNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'key_ring' => $keyRing, + 'crypto_key' => $cryptoKey, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * protected_resources_summary resource. + * + * @param string $project + * @param string $location + * @param string $keyRing + * @param string $cryptoKey + * + * @return string The formatted protected_resources_summary resource. + */ + public static function protectedResourcesSummaryName($project, $location, $keyRing, $cryptoKey) + { + return self::getProtectedResourcesSummaryNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'key_ring' => $keyRing, + 'crypto_key' => $cryptoKey, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - organization: organizations/{organization} + * - projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummary: projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}/protectedResourcesSummary + * - projectLocationKeyRingCryptoKeyProtectedResourcesSummary: projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/protectedResourcesSummary + * - protectedResourcesSummary: projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/protectedResourcesSummary + * + * 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($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * 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 'kmsinventory.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. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *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' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods 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); + } + + /** + * Returns aggregate information about the resources protected by the given + * Cloud KMS [CryptoKey][google.cloud.kms.v1.CryptoKey]. Only resources within + * the same Cloud organization as the key will be returned. The project that + * holds the key must be part of an organization in order for this call to + * succeed. + * + * Sample code: + * ``` + * $keyTrackingServiceClient = new KeyTrackingServiceClient(); + * try { + * $formattedName = $keyTrackingServiceClient->protectedResourcesSummaryName('[PROJECT]', '[LOCATION]', '[KEY_RING]', '[CRYPTO_KEY]'); + * $response = $keyTrackingServiceClient->getProtectedResourcesSummary($formattedName); + * } finally { + * $keyTrackingServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The resource name of the + * [CryptoKey][google.cloud.kms.v1.CryptoKey]. + * @param array $optionalArgs { + * 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 \Google\Cloud\Kms\Inventory\V1\ProtectedResourcesSummary + * + * @throws ApiException if the remote call fails + */ + public function getProtectedResourcesSummary($name, array $optionalArgs = []) + { + $request = new GetProtectedResourcesSummaryRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetProtectedResourcesSummary', ProtectedResourcesSummary::class, $optionalArgs, $request)->wait(); + } + + /** + * Returns metadata about the resources protected by the given Cloud KMS + * [CryptoKey][google.cloud.kms.v1.CryptoKey] in the given Cloud organization. + * + * Sample code: + * ``` + * $keyTrackingServiceClient = new KeyTrackingServiceClient(); + * try { + * $formattedScope = $keyTrackingServiceClient->organizationName('[ORGANIZATION]'); + * $cryptoKey = 'crypto_key'; + * // Iterate over pages of elements + * $pagedResponse = $keyTrackingServiceClient->searchProtectedResources($formattedScope, $cryptoKey); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $keyTrackingServiceClient->searchProtectedResources($formattedScope, $cryptoKey); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $keyTrackingServiceClient->close(); + * } + * ``` + * + * @param string $scope Required. Resource name of the organization. + * Example: organizations/123 + * @param string $cryptoKey Required. The resource name of the + * [CryptoKey][google.cloud.kms.v1.CryptoKey]. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @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 \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function searchProtectedResources($scope, $cryptoKey, array $optionalArgs = []) + { + $request = new SearchProtectedResourcesRequest(); + $requestParamHeaders = []; + $request->setScope($scope); + $request->setCryptoKey($cryptoKey); + $requestParamHeaders['scope'] = $scope; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('SearchProtectedResources', $optionalArgs, SearchProtectedResourcesResponse::class, $request); + } +} diff --git a/owl-bot-staging/KmsInventory/v1/src/V1/KeyDashboardServiceClient.php b/owl-bot-staging/KmsInventory/v1/src/V1/KeyDashboardServiceClient.php new file mode 100644 index 000000000000..56c2bef12cc6 --- /dev/null +++ b/owl-bot-staging/KmsInventory/v1/src/V1/KeyDashboardServiceClient.php @@ -0,0 +1,34 @@ + [ + 'google.cloud.kms.inventory.v1.KeyDashboardService' => [ + 'ListCryptoKeys' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getCryptoKeys', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Kms\Inventory\V1\ListCryptoKeysResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'templateMap' => [ + 'project' => 'projects/{project}', + ], + ], + ], +]; diff --git a/owl-bot-staging/KmsInventory/v1/src/V1/resources/key_dashboard_service_rest_client_config.php b/owl-bot-staging/KmsInventory/v1/src/V1/resources/key_dashboard_service_rest_client_config.php new file mode 100644 index 000000000000..274fe7cfe3c4 --- /dev/null +++ b/owl-bot-staging/KmsInventory/v1/src/V1/resources/key_dashboard_service_rest_client_config.php @@ -0,0 +1,20 @@ + [ + 'google.cloud.kms.inventory.v1.KeyDashboardService' => [ + 'ListCryptoKeys' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*}/cryptoKeys', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/KmsInventory/v1/src/V1/resources/key_tracking_service_client_config.json b/owl-bot-staging/KmsInventory/v1/src/V1/resources/key_tracking_service_client_config.json new file mode 100644 index 000000000000..678f0fd92d49 --- /dev/null +++ b/owl-bot-staging/KmsInventory/v1/src/V1/resources/key_tracking_service_client_config.json @@ -0,0 +1,42 @@ +{ + "interfaces": { + "google.cloud.kms.inventory.v1.KeyTrackingService": { + "retry_codes": { + "no_retry_codes": [], + "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 + }, + "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": { + "GetProtectedResourcesSummary": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "SearchProtectedResources": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + } + } + } + } +} diff --git a/owl-bot-staging/KmsInventory/v1/src/V1/resources/key_tracking_service_descriptor_config.php b/owl-bot-staging/KmsInventory/v1/src/V1/resources/key_tracking_service_descriptor_config.php new file mode 100644 index 000000000000..307849943e35 --- /dev/null +++ b/owl-bot-staging/KmsInventory/v1/src/V1/resources/key_tracking_service_descriptor_config.php @@ -0,0 +1,46 @@ + [ + 'google.cloud.kms.inventory.v1.KeyTrackingService' => [ + 'GetProtectedResourcesSummary' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Kms\Inventory\V1\ProtectedResourcesSummary', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'SearchProtectedResources' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getProtectedResources', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Kms\Inventory\V1\SearchProtectedResourcesResponse', + 'headerParams' => [ + [ + 'keyName' => 'scope', + 'fieldAccessors' => [ + 'getScope', + ], + ], + ], + ], + 'templateMap' => [ + 'organization' => 'organizations/{organization}', + 'projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummary' => 'projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}/protectedResourcesSummary', + 'projectLocationKeyRingCryptoKeyProtectedResourcesSummary' => 'projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/protectedResourcesSummary', + 'protectedResourcesSummary' => 'projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/protectedResourcesSummary', + ], + ], + ], +]; diff --git a/owl-bot-staging/KmsInventory/v1/src/V1/resources/key_tracking_service_rest_client_config.php b/owl-bot-staging/KmsInventory/v1/src/V1/resources/key_tracking_service_rest_client_config.php new file mode 100644 index 000000000000..08261eceedea --- /dev/null +++ b/owl-bot-staging/KmsInventory/v1/src/V1/resources/key_tracking_service_rest_client_config.php @@ -0,0 +1,31 @@ + [ + 'google.cloud.kms.inventory.v1.KeyTrackingService' => [ + 'GetProtectedResourcesSummary' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/**}/protectedResourcesSummary', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'SearchProtectedResources' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{scope=organizations/*}/protectedResources:search', + 'placeholders' => [ + 'scope' => [ + 'getters' => [ + 'getScope', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/KmsInventory/v1/tests/Unit/V1/Client/KeyDashboardServiceClientTest.php b/owl-bot-staging/KmsInventory/v1/tests/Unit/V1/Client/KeyDashboardServiceClientTest.php new file mode 100644 index 000000000000..c1b4c2ffd2f4 --- /dev/null +++ b/owl-bot-staging/KmsInventory/v1/tests/Unit/V1/Client/KeyDashboardServiceClientTest.php @@ -0,0 +1,172 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return KeyDashboardServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new KeyDashboardServiceClient($options); + } + + /** @test */ + public function listCryptoKeysTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $cryptoKeysElement = new CryptoKey(); + $cryptoKeys = [ + $cryptoKeysElement, + ]; + $expectedResponse = new ListCryptoKeysResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setCryptoKeys($cryptoKeys); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $request = (new ListCryptoKeysRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listCryptoKeys($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getCryptoKeys()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.kms.inventory.v1.KeyDashboardService/ListCryptoKeys', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listCryptoKeysExceptionTest() + { + $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->projectName('[PROJECT]'); + $request = (new ListCryptoKeysRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listCryptoKeys($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 listCryptoKeysAsyncTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $cryptoKeysElement = new CryptoKey(); + $cryptoKeys = [ + $cryptoKeysElement, + ]; + $expectedResponse = new ListCryptoKeysResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setCryptoKeys($cryptoKeys); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $request = (new ListCryptoKeysRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listCryptoKeysAsync($request)->wait(); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getCryptoKeys()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.kms.inventory.v1.KeyDashboardService/ListCryptoKeys', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/owl-bot-staging/KmsInventory/v1/tests/Unit/V1/Client/KeyTrackingServiceClientTest.php b/owl-bot-staging/KmsInventory/v1/tests/Unit/V1/Client/KeyTrackingServiceClientTest.php new file mode 100644 index 000000000000..56eaa775fc50 --- /dev/null +++ b/owl-bot-staging/KmsInventory/v1/tests/Unit/V1/Client/KeyTrackingServiceClientTest.php @@ -0,0 +1,244 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return KeyTrackingServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new KeyTrackingServiceClient($options); + } + + /** @test */ + public function getProtectedResourcesSummaryTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $resourceCount = 287552926; + $projectCount = 953448343; + $expectedResponse = new ProtectedResourcesSummary(); + $expectedResponse->setName($name2); + $expectedResponse->setResourceCount($resourceCount); + $expectedResponse->setProjectCount($projectCount); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->protectedResourcesSummaryName('[PROJECT]', '[LOCATION]', '[KEY_RING]', '[CRYPTO_KEY]'); + $request = (new GetProtectedResourcesSummaryRequest()) + ->setName($formattedName); + $response = $gapicClient->getProtectedResourcesSummary($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.kms.inventory.v1.KeyTrackingService/GetProtectedResourcesSummary', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getProtectedResourcesSummaryExceptionTest() + { + $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->protectedResourcesSummaryName('[PROJECT]', '[LOCATION]', '[KEY_RING]', '[CRYPTO_KEY]'); + $request = (new GetProtectedResourcesSummaryRequest()) + ->setName($formattedName); + try { + $gapicClient->getProtectedResourcesSummary($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 searchProtectedResourcesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $protectedResourcesElement = new ProtectedResource(); + $protectedResources = [ + $protectedResourcesElement, + ]; + $expectedResponse = new SearchProtectedResourcesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setProtectedResources($protectedResources); + $transport->addResponse($expectedResponse); + // Mock request + $formattedScope = $gapicClient->organizationName('[ORGANIZATION]'); + $cryptoKey = 'cryptoKey-1992067615'; + $request = (new SearchProtectedResourcesRequest()) + ->setScope($formattedScope) + ->setCryptoKey($cryptoKey); + $response = $gapicClient->searchProtectedResources($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getProtectedResources()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.kms.inventory.v1.KeyTrackingService/SearchProtectedResources', $actualFuncCall); + $actualValue = $actualRequestObject->getScope(); + $this->assertProtobufEquals($formattedScope, $actualValue); + $actualValue = $actualRequestObject->getCryptoKey(); + $this->assertProtobufEquals($cryptoKey, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function searchProtectedResourcesExceptionTest() + { + $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 + $formattedScope = $gapicClient->organizationName('[ORGANIZATION]'); + $cryptoKey = 'cryptoKey-1992067615'; + $request = (new SearchProtectedResourcesRequest()) + ->setScope($formattedScope) + ->setCryptoKey($cryptoKey); + try { + $gapicClient->searchProtectedResources($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 getProtectedResourcesSummaryAsyncTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $resourceCount = 287552926; + $projectCount = 953448343; + $expectedResponse = new ProtectedResourcesSummary(); + $expectedResponse->setName($name2); + $expectedResponse->setResourceCount($resourceCount); + $expectedResponse->setProjectCount($projectCount); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->protectedResourcesSummaryName('[PROJECT]', '[LOCATION]', '[KEY_RING]', '[CRYPTO_KEY]'); + $request = (new GetProtectedResourcesSummaryRequest()) + ->setName($formattedName); + $response = $gapicClient->getProtectedResourcesSummaryAsync($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.cloud.kms.inventory.v1.KeyTrackingService/GetProtectedResourcesSummary', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/owl-bot-staging/KmsInventory/v1/tests/Unit/V1/KeyDashboardServiceClientTest.php b/owl-bot-staging/KmsInventory/v1/tests/Unit/V1/KeyDashboardServiceClientTest.php new file mode 100644 index 000000000000..4c66de1b4fb7 --- /dev/null +++ b/owl-bot-staging/KmsInventory/v1/tests/Unit/V1/KeyDashboardServiceClientTest.php @@ -0,0 +1,130 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return KeyDashboardServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new KeyDashboardServiceClient($options); + } + + /** @test */ + public function listCryptoKeysTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $cryptoKeysElement = new CryptoKey(); + $cryptoKeys = [ + $cryptoKeysElement, + ]; + $expectedResponse = new ListCryptoKeysResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setCryptoKeys($cryptoKeys); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $response = $gapicClient->listCryptoKeys($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getCryptoKeys()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.kms.inventory.v1.KeyDashboardService/ListCryptoKeys', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listCryptoKeysExceptionTest() + { + $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->projectName('[PROJECT]'); + try { + $gapicClient->listCryptoKeys($formattedParent); + // 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()); + } +} diff --git a/owl-bot-staging/KmsInventory/v1/tests/Unit/V1/KeyTrackingServiceClientTest.php b/owl-bot-staging/KmsInventory/v1/tests/Unit/V1/KeyTrackingServiceClientTest.php new file mode 100644 index 000000000000..7a4d3aa61374 --- /dev/null +++ b/owl-bot-staging/KmsInventory/v1/tests/Unit/V1/KeyTrackingServiceClientTest.php @@ -0,0 +1,199 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return KeyTrackingServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new KeyTrackingServiceClient($options); + } + + /** @test */ + public function getProtectedResourcesSummaryTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $resourceCount = 287552926; + $projectCount = 953448343; + $expectedResponse = new ProtectedResourcesSummary(); + $expectedResponse->setName($name2); + $expectedResponse->setResourceCount($resourceCount); + $expectedResponse->setProjectCount($projectCount); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->protectedResourcesSummaryName('[PROJECT]', '[LOCATION]', '[KEY_RING]', '[CRYPTO_KEY]'); + $response = $gapicClient->getProtectedResourcesSummary($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.kms.inventory.v1.KeyTrackingService/GetProtectedResourcesSummary', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getProtectedResourcesSummaryExceptionTest() + { + $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->protectedResourcesSummaryName('[PROJECT]', '[LOCATION]', '[KEY_RING]', '[CRYPTO_KEY]'); + try { + $gapicClient->getProtectedResourcesSummary($formattedName); + // 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 searchProtectedResourcesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $protectedResourcesElement = new ProtectedResource(); + $protectedResources = [ + $protectedResourcesElement, + ]; + $expectedResponse = new SearchProtectedResourcesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setProtectedResources($protectedResources); + $transport->addResponse($expectedResponse); + // Mock request + $formattedScope = $gapicClient->organizationName('[ORGANIZATION]'); + $cryptoKey = 'cryptoKey-1992067615'; + $response = $gapicClient->searchProtectedResources($formattedScope, $cryptoKey); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getProtectedResources()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.kms.inventory.v1.KeyTrackingService/SearchProtectedResources', $actualFuncCall); + $actualValue = $actualRequestObject->getScope(); + $this->assertProtobufEquals($formattedScope, $actualValue); + $actualValue = $actualRequestObject->getCryptoKey(); + $this->assertProtobufEquals($cryptoKey, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function searchProtectedResourcesExceptionTest() + { + $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 + $formattedScope = $gapicClient->organizationName('[ORGANIZATION]'); + $cryptoKey = 'cryptoKey-1992067615'; + try { + $gapicClient->searchProtectedResources($formattedScope, $cryptoKey); + // 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()); + } +} diff --git a/owl-bot-staging/Language/v1/proto/src/GPBMetadata/Google/Cloud/Language/V1/LanguageService.php b/owl-bot-staging/Language/v1/proto/src/GPBMetadata/Google/Cloud/Language/V1/LanguageService.php new file mode 100644 index 000000000000..7f60456d9b89 Binary files /dev/null and b/owl-bot-staging/Language/v1/proto/src/GPBMetadata/Google/Cloud/Language/V1/LanguageService.php differ diff --git a/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/AnalyzeEntitiesRequest.php b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/AnalyzeEntitiesRequest.php new file mode 100644 index 000000000000..484f7cd05f8b --- /dev/null +++ b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/AnalyzeEntitiesRequest.php @@ -0,0 +1,140 @@ +google.cloud.language.v1.AnalyzeEntitiesRequest + */ +class AnalyzeEntitiesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Input document. + * + * Generated from protobuf field .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $document = null; + /** + * The encoding type used by the API to calculate offsets. + * + * Generated from protobuf field .google.cloud.language.v1.EncodingType encoding_type = 2; + */ + protected $encoding_type = 0; + + /** + * @param \Google\Cloud\Language\V1\Document $document Required. Input document. + * @param int $encodingType The encoding type used by the API to calculate offsets. + * For allowed values, use constants defined on {@see \Google\Cloud\Language\V1\EncodingType} + * + * @return \Google\Cloud\Language\V1\AnalyzeEntitiesRequest + * + * @experimental + */ + public static function build(\Google\Cloud\Language\V1\Document $document, int $encodingType): self + { + return (new self()) + ->setDocument($document) + ->setEncodingType($encodingType); + } + + /** + * @param \Google\Cloud\Language\V1\Document $document Required. Input document. + * + * @return \Google\Cloud\Language\V1\AnalyzeEntitiesRequest + * + * @experimental + */ + public static function buildFromDocument(\Google\Cloud\Language\V1\Document $document): self + { + return (new self()) + ->setDocument($document); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Language\V1\Document $document + * Required. Input document. + * @type int $encoding_type + * The encoding type used by the API to calculate offsets. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Language\V1\LanguageService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Input document. + * + * Generated from protobuf field .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Language\V1\Document|null + */ + public function getDocument() + { + return $this->document; + } + + public function hasDocument() + { + return isset($this->document); + } + + public function clearDocument() + { + unset($this->document); + } + + /** + * Required. Input document. + * + * Generated from protobuf field .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Language\V1\Document $var + * @return $this + */ + public function setDocument($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Language\V1\Document::class); + $this->document = $var; + + return $this; + } + + /** + * The encoding type used by the API to calculate offsets. + * + * Generated from protobuf field .google.cloud.language.v1.EncodingType encoding_type = 2; + * @return int + */ + public function getEncodingType() + { + return $this->encoding_type; + } + + /** + * The encoding type used by the API to calculate offsets. + * + * Generated from protobuf field .google.cloud.language.v1.EncodingType encoding_type = 2; + * @param int $var + * @return $this + */ + public function setEncodingType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Language\V1\EncodingType::class); + $this->encoding_type = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/AnalyzeEntitiesResponse.php b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/AnalyzeEntitiesResponse.php new file mode 100644 index 000000000000..ef8b012b81de --- /dev/null +++ b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/AnalyzeEntitiesResponse.php @@ -0,0 +1,113 @@ +google.cloud.language.v1.AnalyzeEntitiesResponse + */ +class AnalyzeEntitiesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The recognized entities in the input document. + * + * Generated from protobuf field repeated .google.cloud.language.v1.Entity entities = 1; + */ + private $entities; + /** + * The language of the text, which will be the same as the language specified + * in the request or, if not specified, the automatically-detected language. + * See [Document.language][google.cloud.language.v1.Document.language] field + * for more details. + * + * Generated from protobuf field string language = 2; + */ + protected $language = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Language\V1\Entity>|\Google\Protobuf\Internal\RepeatedField $entities + * The recognized entities in the input document. + * @type string $language + * The language of the text, which will be the same as the language specified + * in the request or, if not specified, the automatically-detected language. + * See [Document.language][google.cloud.language.v1.Document.language] field + * for more details. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Language\V1\LanguageService::initOnce(); + parent::__construct($data); + } + + /** + * The recognized entities in the input document. + * + * Generated from protobuf field repeated .google.cloud.language.v1.Entity entities = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getEntities() + { + return $this->entities; + } + + /** + * The recognized entities in the input document. + * + * Generated from protobuf field repeated .google.cloud.language.v1.Entity entities = 1; + * @param array<\Google\Cloud\Language\V1\Entity>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setEntities($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Language\V1\Entity::class); + $this->entities = $arr; + + return $this; + } + + /** + * The language of the text, which will be the same as the language specified + * in the request or, if not specified, the automatically-detected language. + * See [Document.language][google.cloud.language.v1.Document.language] field + * for more details. + * + * Generated from protobuf field string language = 2; + * @return string + */ + public function getLanguage() + { + return $this->language; + } + + /** + * The language of the text, which will be the same as the language specified + * in the request or, if not specified, the automatically-detected language. + * See [Document.language][google.cloud.language.v1.Document.language] field + * for more details. + * + * Generated from protobuf field string language = 2; + * @param string $var + * @return $this + */ + public function setLanguage($var) + { + GPBUtil::checkString($var, True); + $this->language = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/AnalyzeEntitySentimentRequest.php b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/AnalyzeEntitySentimentRequest.php new file mode 100644 index 000000000000..e804e4b00e3c --- /dev/null +++ b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/AnalyzeEntitySentimentRequest.php @@ -0,0 +1,140 @@ +google.cloud.language.v1.AnalyzeEntitySentimentRequest + */ +class AnalyzeEntitySentimentRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Input document. + * + * Generated from protobuf field .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $document = null; + /** + * The encoding type used by the API to calculate offsets. + * + * Generated from protobuf field .google.cloud.language.v1.EncodingType encoding_type = 2; + */ + protected $encoding_type = 0; + + /** + * @param \Google\Cloud\Language\V1\Document $document Required. Input document. + * @param int $encodingType The encoding type used by the API to calculate offsets. + * For allowed values, use constants defined on {@see \Google\Cloud\Language\V1\EncodingType} + * + * @return \Google\Cloud\Language\V1\AnalyzeEntitySentimentRequest + * + * @experimental + */ + public static function build(\Google\Cloud\Language\V1\Document $document, int $encodingType): self + { + return (new self()) + ->setDocument($document) + ->setEncodingType($encodingType); + } + + /** + * @param \Google\Cloud\Language\V1\Document $document Required. Input document. + * + * @return \Google\Cloud\Language\V1\AnalyzeEntitySentimentRequest + * + * @experimental + */ + public static function buildFromDocument(\Google\Cloud\Language\V1\Document $document): self + { + return (new self()) + ->setDocument($document); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Language\V1\Document $document + * Required. Input document. + * @type int $encoding_type + * The encoding type used by the API to calculate offsets. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Language\V1\LanguageService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Input document. + * + * Generated from protobuf field .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Language\V1\Document|null + */ + public function getDocument() + { + return $this->document; + } + + public function hasDocument() + { + return isset($this->document); + } + + public function clearDocument() + { + unset($this->document); + } + + /** + * Required. Input document. + * + * Generated from protobuf field .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Language\V1\Document $var + * @return $this + */ + public function setDocument($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Language\V1\Document::class); + $this->document = $var; + + return $this; + } + + /** + * The encoding type used by the API to calculate offsets. + * + * Generated from protobuf field .google.cloud.language.v1.EncodingType encoding_type = 2; + * @return int + */ + public function getEncodingType() + { + return $this->encoding_type; + } + + /** + * The encoding type used by the API to calculate offsets. + * + * Generated from protobuf field .google.cloud.language.v1.EncodingType encoding_type = 2; + * @param int $var + * @return $this + */ + public function setEncodingType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Language\V1\EncodingType::class); + $this->encoding_type = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/AnalyzeEntitySentimentResponse.php b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/AnalyzeEntitySentimentResponse.php new file mode 100644 index 000000000000..af5c81037f0e --- /dev/null +++ b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/AnalyzeEntitySentimentResponse.php @@ -0,0 +1,113 @@ +google.cloud.language.v1.AnalyzeEntitySentimentResponse + */ +class AnalyzeEntitySentimentResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The recognized entities in the input document with associated sentiments. + * + * Generated from protobuf field repeated .google.cloud.language.v1.Entity entities = 1; + */ + private $entities; + /** + * The language of the text, which will be the same as the language specified + * in the request or, if not specified, the automatically-detected language. + * See [Document.language][google.cloud.language.v1.Document.language] field + * for more details. + * + * Generated from protobuf field string language = 2; + */ + protected $language = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Language\V1\Entity>|\Google\Protobuf\Internal\RepeatedField $entities + * The recognized entities in the input document with associated sentiments. + * @type string $language + * The language of the text, which will be the same as the language specified + * in the request or, if not specified, the automatically-detected language. + * See [Document.language][google.cloud.language.v1.Document.language] field + * for more details. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Language\V1\LanguageService::initOnce(); + parent::__construct($data); + } + + /** + * The recognized entities in the input document with associated sentiments. + * + * Generated from protobuf field repeated .google.cloud.language.v1.Entity entities = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getEntities() + { + return $this->entities; + } + + /** + * The recognized entities in the input document with associated sentiments. + * + * Generated from protobuf field repeated .google.cloud.language.v1.Entity entities = 1; + * @param array<\Google\Cloud\Language\V1\Entity>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setEntities($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Language\V1\Entity::class); + $this->entities = $arr; + + return $this; + } + + /** + * The language of the text, which will be the same as the language specified + * in the request or, if not specified, the automatically-detected language. + * See [Document.language][google.cloud.language.v1.Document.language] field + * for more details. + * + * Generated from protobuf field string language = 2; + * @return string + */ + public function getLanguage() + { + return $this->language; + } + + /** + * The language of the text, which will be the same as the language specified + * in the request or, if not specified, the automatically-detected language. + * See [Document.language][google.cloud.language.v1.Document.language] field + * for more details. + * + * Generated from protobuf field string language = 2; + * @param string $var + * @return $this + */ + public function setLanguage($var) + { + GPBUtil::checkString($var, True); + $this->language = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/AnalyzeSentimentRequest.php b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/AnalyzeSentimentRequest.php new file mode 100644 index 000000000000..511269b456fb --- /dev/null +++ b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/AnalyzeSentimentRequest.php @@ -0,0 +1,140 @@ +google.cloud.language.v1.AnalyzeSentimentRequest + */ +class AnalyzeSentimentRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Input document. + * + * Generated from protobuf field .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $document = null; + /** + * The encoding type used by the API to calculate sentence offsets. + * + * Generated from protobuf field .google.cloud.language.v1.EncodingType encoding_type = 2; + */ + protected $encoding_type = 0; + + /** + * @param \Google\Cloud\Language\V1\Document $document Required. Input document. + * @param int $encodingType The encoding type used by the API to calculate sentence offsets. + * For allowed values, use constants defined on {@see \Google\Cloud\Language\V1\EncodingType} + * + * @return \Google\Cloud\Language\V1\AnalyzeSentimentRequest + * + * @experimental + */ + public static function build(\Google\Cloud\Language\V1\Document $document, int $encodingType): self + { + return (new self()) + ->setDocument($document) + ->setEncodingType($encodingType); + } + + /** + * @param \Google\Cloud\Language\V1\Document $document Required. Input document. + * + * @return \Google\Cloud\Language\V1\AnalyzeSentimentRequest + * + * @experimental + */ + public static function buildFromDocument(\Google\Cloud\Language\V1\Document $document): self + { + return (new self()) + ->setDocument($document); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Language\V1\Document $document + * Required. Input document. + * @type int $encoding_type + * The encoding type used by the API to calculate sentence offsets. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Language\V1\LanguageService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Input document. + * + * Generated from protobuf field .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Language\V1\Document|null + */ + public function getDocument() + { + return $this->document; + } + + public function hasDocument() + { + return isset($this->document); + } + + public function clearDocument() + { + unset($this->document); + } + + /** + * Required. Input document. + * + * Generated from protobuf field .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Language\V1\Document $var + * @return $this + */ + public function setDocument($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Language\V1\Document::class); + $this->document = $var; + + return $this; + } + + /** + * The encoding type used by the API to calculate sentence offsets. + * + * Generated from protobuf field .google.cloud.language.v1.EncodingType encoding_type = 2; + * @return int + */ + public function getEncodingType() + { + return $this->encoding_type; + } + + /** + * The encoding type used by the API to calculate sentence offsets. + * + * Generated from protobuf field .google.cloud.language.v1.EncodingType encoding_type = 2; + * @param int $var + * @return $this + */ + public function setEncodingType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Language\V1\EncodingType::class); + $this->encoding_type = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/AnalyzeSentimentResponse.php b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/AnalyzeSentimentResponse.php new file mode 100644 index 000000000000..fb1beedbc146 --- /dev/null +++ b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/AnalyzeSentimentResponse.php @@ -0,0 +1,157 @@ +google.cloud.language.v1.AnalyzeSentimentResponse + */ +class AnalyzeSentimentResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The overall sentiment of the input document. + * + * Generated from protobuf field .google.cloud.language.v1.Sentiment document_sentiment = 1; + */ + protected $document_sentiment = null; + /** + * The language of the text, which will be the same as the language specified + * in the request or, if not specified, the automatically-detected language. + * See [Document.language][google.cloud.language.v1.Document.language] field + * for more details. + * + * Generated from protobuf field string language = 2; + */ + protected $language = ''; + /** + * The sentiment for all the sentences in the document. + * + * Generated from protobuf field repeated .google.cloud.language.v1.Sentence sentences = 3; + */ + private $sentences; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Language\V1\Sentiment $document_sentiment + * The overall sentiment of the input document. + * @type string $language + * The language of the text, which will be the same as the language specified + * in the request or, if not specified, the automatically-detected language. + * See [Document.language][google.cloud.language.v1.Document.language] field + * for more details. + * @type array<\Google\Cloud\Language\V1\Sentence>|\Google\Protobuf\Internal\RepeatedField $sentences + * The sentiment for all the sentences in the document. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Language\V1\LanguageService::initOnce(); + parent::__construct($data); + } + + /** + * The overall sentiment of the input document. + * + * Generated from protobuf field .google.cloud.language.v1.Sentiment document_sentiment = 1; + * @return \Google\Cloud\Language\V1\Sentiment|null + */ + public function getDocumentSentiment() + { + return $this->document_sentiment; + } + + public function hasDocumentSentiment() + { + return isset($this->document_sentiment); + } + + public function clearDocumentSentiment() + { + unset($this->document_sentiment); + } + + /** + * The overall sentiment of the input document. + * + * Generated from protobuf field .google.cloud.language.v1.Sentiment document_sentiment = 1; + * @param \Google\Cloud\Language\V1\Sentiment $var + * @return $this + */ + public function setDocumentSentiment($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Language\V1\Sentiment::class); + $this->document_sentiment = $var; + + return $this; + } + + /** + * The language of the text, which will be the same as the language specified + * in the request or, if not specified, the automatically-detected language. + * See [Document.language][google.cloud.language.v1.Document.language] field + * for more details. + * + * Generated from protobuf field string language = 2; + * @return string + */ + public function getLanguage() + { + return $this->language; + } + + /** + * The language of the text, which will be the same as the language specified + * in the request or, if not specified, the automatically-detected language. + * See [Document.language][google.cloud.language.v1.Document.language] field + * for more details. + * + * Generated from protobuf field string language = 2; + * @param string $var + * @return $this + */ + public function setLanguage($var) + { + GPBUtil::checkString($var, True); + $this->language = $var; + + return $this; + } + + /** + * The sentiment for all the sentences in the document. + * + * Generated from protobuf field repeated .google.cloud.language.v1.Sentence sentences = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSentences() + { + return $this->sentences; + } + + /** + * The sentiment for all the sentences in the document. + * + * Generated from protobuf field repeated .google.cloud.language.v1.Sentence sentences = 3; + * @param array<\Google\Cloud\Language\V1\Sentence>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSentences($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Language\V1\Sentence::class); + $this->sentences = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/AnalyzeSyntaxRequest.php b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/AnalyzeSyntaxRequest.php new file mode 100644 index 000000000000..d85748a9484a --- /dev/null +++ b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/AnalyzeSyntaxRequest.php @@ -0,0 +1,140 @@ +google.cloud.language.v1.AnalyzeSyntaxRequest + */ +class AnalyzeSyntaxRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Input document. + * + * Generated from protobuf field .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $document = null; + /** + * The encoding type used by the API to calculate offsets. + * + * Generated from protobuf field .google.cloud.language.v1.EncodingType encoding_type = 2; + */ + protected $encoding_type = 0; + + /** + * @param \Google\Cloud\Language\V1\Document $document Required. Input document. + * @param int $encodingType The encoding type used by the API to calculate offsets. + * For allowed values, use constants defined on {@see \Google\Cloud\Language\V1\EncodingType} + * + * @return \Google\Cloud\Language\V1\AnalyzeSyntaxRequest + * + * @experimental + */ + public static function build(\Google\Cloud\Language\V1\Document $document, int $encodingType): self + { + return (new self()) + ->setDocument($document) + ->setEncodingType($encodingType); + } + + /** + * @param \Google\Cloud\Language\V1\Document $document Required. Input document. + * + * @return \Google\Cloud\Language\V1\AnalyzeSyntaxRequest + * + * @experimental + */ + public static function buildFromDocument(\Google\Cloud\Language\V1\Document $document): self + { + return (new self()) + ->setDocument($document); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Language\V1\Document $document + * Required. Input document. + * @type int $encoding_type + * The encoding type used by the API to calculate offsets. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Language\V1\LanguageService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Input document. + * + * Generated from protobuf field .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Language\V1\Document|null + */ + public function getDocument() + { + return $this->document; + } + + public function hasDocument() + { + return isset($this->document); + } + + public function clearDocument() + { + unset($this->document); + } + + /** + * Required. Input document. + * + * Generated from protobuf field .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Language\V1\Document $var + * @return $this + */ + public function setDocument($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Language\V1\Document::class); + $this->document = $var; + + return $this; + } + + /** + * The encoding type used by the API to calculate offsets. + * + * Generated from protobuf field .google.cloud.language.v1.EncodingType encoding_type = 2; + * @return int + */ + public function getEncodingType() + { + return $this->encoding_type; + } + + /** + * The encoding type used by the API to calculate offsets. + * + * Generated from protobuf field .google.cloud.language.v1.EncodingType encoding_type = 2; + * @param int $var + * @return $this + */ + public function setEncodingType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Language\V1\EncodingType::class); + $this->encoding_type = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/AnalyzeSyntaxResponse.php b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/AnalyzeSyntaxResponse.php new file mode 100644 index 000000000000..9672f9f4b43a --- /dev/null +++ b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/AnalyzeSyntaxResponse.php @@ -0,0 +1,147 @@ +google.cloud.language.v1.AnalyzeSyntaxResponse + */ +class AnalyzeSyntaxResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Sentences in the input document. + * + * Generated from protobuf field repeated .google.cloud.language.v1.Sentence sentences = 1; + */ + private $sentences; + /** + * Tokens, along with their syntactic information, in the input document. + * + * Generated from protobuf field repeated .google.cloud.language.v1.Token tokens = 2; + */ + private $tokens; + /** + * The language of the text, which will be the same as the language specified + * in the request or, if not specified, the automatically-detected language. + * See [Document.language][google.cloud.language.v1.Document.language] field + * for more details. + * + * Generated from protobuf field string language = 3; + */ + protected $language = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Language\V1\Sentence>|\Google\Protobuf\Internal\RepeatedField $sentences + * Sentences in the input document. + * @type array<\Google\Cloud\Language\V1\Token>|\Google\Protobuf\Internal\RepeatedField $tokens + * Tokens, along with their syntactic information, in the input document. + * @type string $language + * The language of the text, which will be the same as the language specified + * in the request or, if not specified, the automatically-detected language. + * See [Document.language][google.cloud.language.v1.Document.language] field + * for more details. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Language\V1\LanguageService::initOnce(); + parent::__construct($data); + } + + /** + * Sentences in the input document. + * + * Generated from protobuf field repeated .google.cloud.language.v1.Sentence sentences = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSentences() + { + return $this->sentences; + } + + /** + * Sentences in the input document. + * + * Generated from protobuf field repeated .google.cloud.language.v1.Sentence sentences = 1; + * @param array<\Google\Cloud\Language\V1\Sentence>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSentences($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Language\V1\Sentence::class); + $this->sentences = $arr; + + return $this; + } + + /** + * Tokens, along with their syntactic information, in the input document. + * + * Generated from protobuf field repeated .google.cloud.language.v1.Token tokens = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTokens() + { + return $this->tokens; + } + + /** + * Tokens, along with their syntactic information, in the input document. + * + * Generated from protobuf field repeated .google.cloud.language.v1.Token tokens = 2; + * @param array<\Google\Cloud\Language\V1\Token>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTokens($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Language\V1\Token::class); + $this->tokens = $arr; + + return $this; + } + + /** + * The language of the text, which will be the same as the language specified + * in the request or, if not specified, the automatically-detected language. + * See [Document.language][google.cloud.language.v1.Document.language] field + * for more details. + * + * Generated from protobuf field string language = 3; + * @return string + */ + public function getLanguage() + { + return $this->language; + } + + /** + * The language of the text, which will be the same as the language specified + * in the request or, if not specified, the automatically-detected language. + * See [Document.language][google.cloud.language.v1.Document.language] field + * for more details. + * + * Generated from protobuf field string language = 3; + * @param string $var + * @return $this + */ + public function setLanguage($var) + { + GPBUtil::checkString($var, True); + $this->language = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/AnnotateTextRequest.php b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/AnnotateTextRequest.php new file mode 100644 index 000000000000..e5b11c63f559 --- /dev/null +++ b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/AnnotateTextRequest.php @@ -0,0 +1,189 @@ +google.cloud.language.v1.AnnotateTextRequest + */ +class AnnotateTextRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Input document. + * + * Generated from protobuf field .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $document = null; + /** + * Required. The enabled features. + * + * Generated from protobuf field .google.cloud.language.v1.AnnotateTextRequest.Features features = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $features = null; + /** + * The encoding type used by the API to calculate offsets. + * + * Generated from protobuf field .google.cloud.language.v1.EncodingType encoding_type = 3; + */ + protected $encoding_type = 0; + + /** + * @param \Google\Cloud\Language\V1\Document $document Required. Input document. + * @param \Google\Cloud\Language\V1\AnnotateTextRequest\Features $features Required. The enabled features. + * @param int $encodingType The encoding type used by the API to calculate offsets. + * For allowed values, use constants defined on {@see \Google\Cloud\Language\V1\EncodingType} + * + * @return \Google\Cloud\Language\V1\AnnotateTextRequest + * + * @experimental + */ + public static function build(\Google\Cloud\Language\V1\Document $document, \Google\Cloud\Language\V1\AnnotateTextRequest\Features $features, int $encodingType): self + { + return (new self()) + ->setDocument($document) + ->setFeatures($features) + ->setEncodingType($encodingType); + } + + /** + * @param \Google\Cloud\Language\V1\Document $document Required. Input document. + * @param \Google\Cloud\Language\V1\AnnotateTextRequest\Features $features Required. The enabled features. + * + * @return \Google\Cloud\Language\V1\AnnotateTextRequest + * + * @experimental + */ + public static function buildFromDocumentFeatures(\Google\Cloud\Language\V1\Document $document, \Google\Cloud\Language\V1\AnnotateTextRequest\Features $features): self + { + return (new self()) + ->setDocument($document) + ->setFeatures($features); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Language\V1\Document $document + * Required. Input document. + * @type \Google\Cloud\Language\V1\AnnotateTextRequest\Features $features + * Required. The enabled features. + * @type int $encoding_type + * The encoding type used by the API to calculate offsets. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Language\V1\LanguageService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Input document. + * + * Generated from protobuf field .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Language\V1\Document|null + */ + public function getDocument() + { + return $this->document; + } + + public function hasDocument() + { + return isset($this->document); + } + + public function clearDocument() + { + unset($this->document); + } + + /** + * Required. Input document. + * + * Generated from protobuf field .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Language\V1\Document $var + * @return $this + */ + public function setDocument($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Language\V1\Document::class); + $this->document = $var; + + return $this; + } + + /** + * Required. The enabled features. + * + * Generated from protobuf field .google.cloud.language.v1.AnnotateTextRequest.Features features = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Language\V1\AnnotateTextRequest\Features|null + */ + public function getFeatures() + { + return $this->features; + } + + public function hasFeatures() + { + return isset($this->features); + } + + public function clearFeatures() + { + unset($this->features); + } + + /** + * Required. The enabled features. + * + * Generated from protobuf field .google.cloud.language.v1.AnnotateTextRequest.Features features = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Language\V1\AnnotateTextRequest\Features $var + * @return $this + */ + public function setFeatures($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Language\V1\AnnotateTextRequest\Features::class); + $this->features = $var; + + return $this; + } + + /** + * The encoding type used by the API to calculate offsets. + * + * Generated from protobuf field .google.cloud.language.v1.EncodingType encoding_type = 3; + * @return int + */ + public function getEncodingType() + { + return $this->encoding_type; + } + + /** + * The encoding type used by the API to calculate offsets. + * + * Generated from protobuf field .google.cloud.language.v1.EncodingType encoding_type = 3; + * @param int $var + * @return $this + */ + public function setEncodingType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Language\V1\EncodingType::class); + $this->encoding_type = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/AnnotateTextRequest/Features.php b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/AnnotateTextRequest/Features.php new file mode 100644 index 000000000000..a22187d595ae --- /dev/null +++ b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/AnnotateTextRequest/Features.php @@ -0,0 +1,255 @@ +google.cloud.language.v1.AnnotateTextRequest.Features + */ +class Features extends \Google\Protobuf\Internal\Message +{ + /** + * Extract syntax information. + * + * Generated from protobuf field bool extract_syntax = 1; + */ + protected $extract_syntax = false; + /** + * Extract entities. + * + * Generated from protobuf field bool extract_entities = 2; + */ + protected $extract_entities = false; + /** + * Extract document-level sentiment. + * + * Generated from protobuf field bool extract_document_sentiment = 3; + */ + protected $extract_document_sentiment = false; + /** + * Extract entities and their associated sentiment. + * + * Generated from protobuf field bool extract_entity_sentiment = 4; + */ + protected $extract_entity_sentiment = false; + /** + * Classify the full document into categories. + * + * Generated from protobuf field bool classify_text = 6; + */ + protected $classify_text = false; + /** + * The model options to use for classification. Defaults to v1 options + * if not specified. Only used if `classify_text` is set to true. + * + * Generated from protobuf field .google.cloud.language.v1.ClassificationModelOptions classification_model_options = 10; + */ + protected $classification_model_options = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $extract_syntax + * Extract syntax information. + * @type bool $extract_entities + * Extract entities. + * @type bool $extract_document_sentiment + * Extract document-level sentiment. + * @type bool $extract_entity_sentiment + * Extract entities and their associated sentiment. + * @type bool $classify_text + * Classify the full document into categories. + * @type \Google\Cloud\Language\V1\ClassificationModelOptions $classification_model_options + * The model options to use for classification. Defaults to v1 options + * if not specified. Only used if `classify_text` is set to true. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Language\V1\LanguageService::initOnce(); + parent::__construct($data); + } + + /** + * Extract syntax information. + * + * Generated from protobuf field bool extract_syntax = 1; + * @return bool + */ + public function getExtractSyntax() + { + return $this->extract_syntax; + } + + /** + * Extract syntax information. + * + * Generated from protobuf field bool extract_syntax = 1; + * @param bool $var + * @return $this + */ + public function setExtractSyntax($var) + { + GPBUtil::checkBool($var); + $this->extract_syntax = $var; + + return $this; + } + + /** + * Extract entities. + * + * Generated from protobuf field bool extract_entities = 2; + * @return bool + */ + public function getExtractEntities() + { + return $this->extract_entities; + } + + /** + * Extract entities. + * + * Generated from protobuf field bool extract_entities = 2; + * @param bool $var + * @return $this + */ + public function setExtractEntities($var) + { + GPBUtil::checkBool($var); + $this->extract_entities = $var; + + return $this; + } + + /** + * Extract document-level sentiment. + * + * Generated from protobuf field bool extract_document_sentiment = 3; + * @return bool + */ + public function getExtractDocumentSentiment() + { + return $this->extract_document_sentiment; + } + + /** + * Extract document-level sentiment. + * + * Generated from protobuf field bool extract_document_sentiment = 3; + * @param bool $var + * @return $this + */ + public function setExtractDocumentSentiment($var) + { + GPBUtil::checkBool($var); + $this->extract_document_sentiment = $var; + + return $this; + } + + /** + * Extract entities and their associated sentiment. + * + * Generated from protobuf field bool extract_entity_sentiment = 4; + * @return bool + */ + public function getExtractEntitySentiment() + { + return $this->extract_entity_sentiment; + } + + /** + * Extract entities and their associated sentiment. + * + * Generated from protobuf field bool extract_entity_sentiment = 4; + * @param bool $var + * @return $this + */ + public function setExtractEntitySentiment($var) + { + GPBUtil::checkBool($var); + $this->extract_entity_sentiment = $var; + + return $this; + } + + /** + * Classify the full document into categories. + * + * Generated from protobuf field bool classify_text = 6; + * @return bool + */ + public function getClassifyText() + { + return $this->classify_text; + } + + /** + * Classify the full document into categories. + * + * Generated from protobuf field bool classify_text = 6; + * @param bool $var + * @return $this + */ + public function setClassifyText($var) + { + GPBUtil::checkBool($var); + $this->classify_text = $var; + + return $this; + } + + /** + * The model options to use for classification. Defaults to v1 options + * if not specified. Only used if `classify_text` is set to true. + * + * Generated from protobuf field .google.cloud.language.v1.ClassificationModelOptions classification_model_options = 10; + * @return \Google\Cloud\Language\V1\ClassificationModelOptions|null + */ + public function getClassificationModelOptions() + { + return $this->classification_model_options; + } + + public function hasClassificationModelOptions() + { + return isset($this->classification_model_options); + } + + public function clearClassificationModelOptions() + { + unset($this->classification_model_options); + } + + /** + * The model options to use for classification. Defaults to v1 options + * if not specified. Only used if `classify_text` is set to true. + * + * Generated from protobuf field .google.cloud.language.v1.ClassificationModelOptions classification_model_options = 10; + * @param \Google\Cloud\Language\V1\ClassificationModelOptions $var + * @return $this + */ + public function setClassificationModelOptions($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Language\V1\ClassificationModelOptions::class); + $this->classification_model_options = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Features::class, \Google\Cloud\Language\V1\AnnotateTextRequest_Features::class); + diff --git a/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/AnnotateTextRequest_Features.php b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/AnnotateTextRequest_Features.php new file mode 100644 index 000000000000..e02aca7493ec --- /dev/null +++ b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/AnnotateTextRequest_Features.php @@ -0,0 +1,16 @@ +google.cloud.language.v1.AnnotateTextResponse + */ +class AnnotateTextResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Sentences in the input document. Populated if the user enables + * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax]. + * + * Generated from protobuf field repeated .google.cloud.language.v1.Sentence sentences = 1; + */ + private $sentences; + /** + * Tokens, along with their syntactic information, in the input document. + * Populated if the user enables + * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax]. + * + * Generated from protobuf field repeated .google.cloud.language.v1.Token tokens = 2; + */ + private $tokens; + /** + * Entities, along with their semantic information, in the input document. + * Populated if the user enables + * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities]. + * + * Generated from protobuf field repeated .google.cloud.language.v1.Entity entities = 3; + */ + private $entities; + /** + * The overall sentiment for the document. Populated if the user enables + * [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_document_sentiment]. + * + * Generated from protobuf field .google.cloud.language.v1.Sentiment document_sentiment = 4; + */ + protected $document_sentiment = null; + /** + * The language of the text, which will be the same as the language specified + * in the request or, if not specified, the automatically-detected language. + * See [Document.language][google.cloud.language.v1.Document.language] field + * for more details. + * + * Generated from protobuf field string language = 5; + */ + protected $language = ''; + /** + * Categories identified in the input document. + * + * Generated from protobuf field repeated .google.cloud.language.v1.ClassificationCategory categories = 6; + */ + private $categories; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Language\V1\Sentence>|\Google\Protobuf\Internal\RepeatedField $sentences + * Sentences in the input document. Populated if the user enables + * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax]. + * @type array<\Google\Cloud\Language\V1\Token>|\Google\Protobuf\Internal\RepeatedField $tokens + * Tokens, along with their syntactic information, in the input document. + * Populated if the user enables + * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax]. + * @type array<\Google\Cloud\Language\V1\Entity>|\Google\Protobuf\Internal\RepeatedField $entities + * Entities, along with their semantic information, in the input document. + * Populated if the user enables + * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities]. + * @type \Google\Cloud\Language\V1\Sentiment $document_sentiment + * The overall sentiment for the document. Populated if the user enables + * [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_document_sentiment]. + * @type string $language + * The language of the text, which will be the same as the language specified + * in the request or, if not specified, the automatically-detected language. + * See [Document.language][google.cloud.language.v1.Document.language] field + * for more details. + * @type array<\Google\Cloud\Language\V1\ClassificationCategory>|\Google\Protobuf\Internal\RepeatedField $categories + * Categories identified in the input document. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Language\V1\LanguageService::initOnce(); + parent::__construct($data); + } + + /** + * Sentences in the input document. Populated if the user enables + * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax]. + * + * Generated from protobuf field repeated .google.cloud.language.v1.Sentence sentences = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSentences() + { + return $this->sentences; + } + + /** + * Sentences in the input document. Populated if the user enables + * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax]. + * + * Generated from protobuf field repeated .google.cloud.language.v1.Sentence sentences = 1; + * @param array<\Google\Cloud\Language\V1\Sentence>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSentences($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Language\V1\Sentence::class); + $this->sentences = $arr; + + return $this; + } + + /** + * Tokens, along with their syntactic information, in the input document. + * Populated if the user enables + * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax]. + * + * Generated from protobuf field repeated .google.cloud.language.v1.Token tokens = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTokens() + { + return $this->tokens; + } + + /** + * Tokens, along with their syntactic information, in the input document. + * Populated if the user enables + * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax]. + * + * Generated from protobuf field repeated .google.cloud.language.v1.Token tokens = 2; + * @param array<\Google\Cloud\Language\V1\Token>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTokens($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Language\V1\Token::class); + $this->tokens = $arr; + + return $this; + } + + /** + * Entities, along with their semantic information, in the input document. + * Populated if the user enables + * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities]. + * + * Generated from protobuf field repeated .google.cloud.language.v1.Entity entities = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getEntities() + { + return $this->entities; + } + + /** + * Entities, along with their semantic information, in the input document. + * Populated if the user enables + * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities]. + * + * Generated from protobuf field repeated .google.cloud.language.v1.Entity entities = 3; + * @param array<\Google\Cloud\Language\V1\Entity>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setEntities($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Language\V1\Entity::class); + $this->entities = $arr; + + return $this; + } + + /** + * The overall sentiment for the document. Populated if the user enables + * [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_document_sentiment]. + * + * Generated from protobuf field .google.cloud.language.v1.Sentiment document_sentiment = 4; + * @return \Google\Cloud\Language\V1\Sentiment|null + */ + public function getDocumentSentiment() + { + return $this->document_sentiment; + } + + public function hasDocumentSentiment() + { + return isset($this->document_sentiment); + } + + public function clearDocumentSentiment() + { + unset($this->document_sentiment); + } + + /** + * The overall sentiment for the document. Populated if the user enables + * [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_document_sentiment]. + * + * Generated from protobuf field .google.cloud.language.v1.Sentiment document_sentiment = 4; + * @param \Google\Cloud\Language\V1\Sentiment $var + * @return $this + */ + public function setDocumentSentiment($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Language\V1\Sentiment::class); + $this->document_sentiment = $var; + + return $this; + } + + /** + * The language of the text, which will be the same as the language specified + * in the request or, if not specified, the automatically-detected language. + * See [Document.language][google.cloud.language.v1.Document.language] field + * for more details. + * + * Generated from protobuf field string language = 5; + * @return string + */ + public function getLanguage() + { + return $this->language; + } + + /** + * The language of the text, which will be the same as the language specified + * in the request or, if not specified, the automatically-detected language. + * See [Document.language][google.cloud.language.v1.Document.language] field + * for more details. + * + * Generated from protobuf field string language = 5; + * @param string $var + * @return $this + */ + public function setLanguage($var) + { + GPBUtil::checkString($var, True); + $this->language = $var; + + return $this; + } + + /** + * Categories identified in the input document. + * + * Generated from protobuf field repeated .google.cloud.language.v1.ClassificationCategory categories = 6; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getCategories() + { + return $this->categories; + } + + /** + * Categories identified in the input document. + * + * Generated from protobuf field repeated .google.cloud.language.v1.ClassificationCategory categories = 6; + * @param array<\Google\Cloud\Language\V1\ClassificationCategory>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setCategories($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Language\V1\ClassificationCategory::class); + $this->categories = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/ClassificationCategory.php b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/ClassificationCategory.php new file mode 100644 index 000000000000..48536b20188e --- /dev/null +++ b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/ClassificationCategory.php @@ -0,0 +1,109 @@ +google.cloud.language.v1.ClassificationCategory + */ +class ClassificationCategory extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the category representing the document, from the [predefined + * taxonomy](https://cloud.google.com/natural-language/docs/categories). + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * The classifier's confidence of the category. Number represents how certain + * the classifier is that this category represents the given text. + * + * Generated from protobuf field float confidence = 2; + */ + protected $confidence = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The name of the category representing the document, from the [predefined + * taxonomy](https://cloud.google.com/natural-language/docs/categories). + * @type float $confidence + * The classifier's confidence of the category. Number represents how certain + * the classifier is that this category represents the given text. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Language\V1\LanguageService::initOnce(); + parent::__construct($data); + } + + /** + * The name of the category representing the document, from the [predefined + * taxonomy](https://cloud.google.com/natural-language/docs/categories). + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The name of the category representing the document, from the [predefined + * taxonomy](https://cloud.google.com/natural-language/docs/categories). + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The classifier's confidence of the category. Number represents how certain + * the classifier is that this category represents the given text. + * + * Generated from protobuf field float confidence = 2; + * @return float + */ + public function getConfidence() + { + return $this->confidence; + } + + /** + * The classifier's confidence of the category. Number represents how certain + * the classifier is that this category represents the given text. + * + * Generated from protobuf field float confidence = 2; + * @param float $var + * @return $this + */ + public function setConfidence($var) + { + GPBUtil::checkFloat($var); + $this->confidence = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/ClassificationModelOptions.php b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/ClassificationModelOptions.php new file mode 100644 index 000000000000..dc546f8a8822 --- /dev/null +++ b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/ClassificationModelOptions.php @@ -0,0 +1,117 @@ +google.cloud.language.v1.ClassificationModelOptions + */ +class ClassificationModelOptions extends \Google\Protobuf\Internal\Message +{ + protected $model_type; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Language\V1\ClassificationModelOptions\V1Model $v1_model + * Setting this field will use the V1 model and V1 content categories + * version. The V1 model is a legacy model; support for this will be + * discontinued in the future. + * @type \Google\Cloud\Language\V1\ClassificationModelOptions\V2Model $v2_model + * Setting this field will use the V2 model with the appropriate content + * categories version. The V2 model is a better performing model. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Language\V1\LanguageService::initOnce(); + parent::__construct($data); + } + + /** + * Setting this field will use the V1 model and V1 content categories + * version. The V1 model is a legacy model; support for this will be + * discontinued in the future. + * + * Generated from protobuf field .google.cloud.language.v1.ClassificationModelOptions.V1Model v1_model = 1; + * @return \Google\Cloud\Language\V1\ClassificationModelOptions\V1Model|null + */ + public function getV1Model() + { + return $this->readOneof(1); + } + + public function hasV1Model() + { + return $this->hasOneof(1); + } + + /** + * Setting this field will use the V1 model and V1 content categories + * version. The V1 model is a legacy model; support for this will be + * discontinued in the future. + * + * Generated from protobuf field .google.cloud.language.v1.ClassificationModelOptions.V1Model v1_model = 1; + * @param \Google\Cloud\Language\V1\ClassificationModelOptions\V1Model $var + * @return $this + */ + public function setV1Model($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Language\V1\ClassificationModelOptions\V1Model::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * Setting this field will use the V2 model with the appropriate content + * categories version. The V2 model is a better performing model. + * + * Generated from protobuf field .google.cloud.language.v1.ClassificationModelOptions.V2Model v2_model = 2; + * @return \Google\Cloud\Language\V1\ClassificationModelOptions\V2Model|null + */ + public function getV2Model() + { + return $this->readOneof(2); + } + + public function hasV2Model() + { + return $this->hasOneof(2); + } + + /** + * Setting this field will use the V2 model with the appropriate content + * categories version. The V2 model is a better performing model. + * + * Generated from protobuf field .google.cloud.language.v1.ClassificationModelOptions.V2Model v2_model = 2; + * @param \Google\Cloud\Language\V1\ClassificationModelOptions\V2Model $var + * @return $this + */ + public function setV2Model($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Language\V1\ClassificationModelOptions\V2Model::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * @return string + */ + public function getModelType() + { + return $this->whichOneof("model_type"); + } + +} + diff --git a/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/ClassificationModelOptions/V1Model.php b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/ClassificationModelOptions/V1Model.php new file mode 100644 index 000000000000..e6ac49f77646 --- /dev/null +++ b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/ClassificationModelOptions/V1Model.php @@ -0,0 +1,36 @@ +google.cloud.language.v1.ClassificationModelOptions.V1Model + */ +class V1Model extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Language\V1\LanguageService::initOnce(); + parent::__construct($data); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(V1Model::class, \Google\Cloud\Language\V1\ClassificationModelOptions_V1Model::class); + diff --git a/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/ClassificationModelOptions/V2Model.php b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/ClassificationModelOptions/V2Model.php new file mode 100644 index 000000000000..d4bbc1b08794 --- /dev/null +++ b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/ClassificationModelOptions/V2Model.php @@ -0,0 +1,70 @@ +google.cloud.language.v1.ClassificationModelOptions.V2Model + */ +class V2Model extends \Google\Protobuf\Internal\Message +{ + /** + * The content categories used for classification. + * + * Generated from protobuf field .google.cloud.language.v1.ClassificationModelOptions.V2Model.ContentCategoriesVersion content_categories_version = 1; + */ + protected $content_categories_version = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $content_categories_version + * The content categories used for classification. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Language\V1\LanguageService::initOnce(); + parent::__construct($data); + } + + /** + * The content categories used for classification. + * + * Generated from protobuf field .google.cloud.language.v1.ClassificationModelOptions.V2Model.ContentCategoriesVersion content_categories_version = 1; + * @return int + */ + public function getContentCategoriesVersion() + { + return $this->content_categories_version; + } + + /** + * The content categories used for classification. + * + * Generated from protobuf field .google.cloud.language.v1.ClassificationModelOptions.V2Model.ContentCategoriesVersion content_categories_version = 1; + * @param int $var + * @return $this + */ + public function setContentCategoriesVersion($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Language\V1\ClassificationModelOptions\V2Model\ContentCategoriesVersion::class); + $this->content_categories_version = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(V2Model::class, \Google\Cloud\Language\V1\ClassificationModelOptions_V2Model::class); + diff --git a/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/ClassificationModelOptions/V2Model/ContentCategoriesVersion.php b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/ClassificationModelOptions/V2Model/ContentCategoriesVersion.php new file mode 100644 index 000000000000..5c9434822a5b --- /dev/null +++ b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/ClassificationModelOptions/V2Model/ContentCategoriesVersion.php @@ -0,0 +1,65 @@ +google.cloud.language.v1.ClassificationModelOptions.V2Model.ContentCategoriesVersion + */ +class ContentCategoriesVersion +{ + /** + * If `ContentCategoriesVersion` is not specified, this option will + * default to `V1`. + * + * Generated from protobuf enum CONTENT_CATEGORIES_VERSION_UNSPECIFIED = 0; + */ + const CONTENT_CATEGORIES_VERSION_UNSPECIFIED = 0; + /** + * Legacy content categories of our initial launch in 2017. + * + * Generated from protobuf enum V1 = 1; + */ + const V1 = 1; + /** + * Updated content categories in 2022. + * + * Generated from protobuf enum V2 = 2; + */ + const V2 = 2; + + private static $valueToName = [ + self::CONTENT_CATEGORIES_VERSION_UNSPECIFIED => 'CONTENT_CATEGORIES_VERSION_UNSPECIFIED', + self::V1 => 'V1', + self::V2 => 'V2', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ContentCategoriesVersion::class, \Google\Cloud\Language\V1\ClassificationModelOptions_V2Model_ContentCategoriesVersion::class); + diff --git a/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/ClassificationModelOptions_V1Model.php b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/ClassificationModelOptions_V1Model.php new file mode 100644 index 000000000000..b1b22eddc453 --- /dev/null +++ b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/ClassificationModelOptions_V1Model.php @@ -0,0 +1,16 @@ +google.cloud.language.v1.ClassifyTextRequest + */ +class ClassifyTextRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Input document. + * + * Generated from protobuf field .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $document = null; + /** + * Model options to use for classification. Defaults to v1 options if not + * specified. + * + * Generated from protobuf field .google.cloud.language.v1.ClassificationModelOptions classification_model_options = 3; + */ + protected $classification_model_options = null; + + /** + * @param \Google\Cloud\Language\V1\Document $document Required. Input document. + * + * @return \Google\Cloud\Language\V1\ClassifyTextRequest + * + * @experimental + */ + public static function build(\Google\Cloud\Language\V1\Document $document): self + { + return (new self()) + ->setDocument($document); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Language\V1\Document $document + * Required. Input document. + * @type \Google\Cloud\Language\V1\ClassificationModelOptions $classification_model_options + * Model options to use for classification. Defaults to v1 options if not + * specified. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Language\V1\LanguageService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Input document. + * + * Generated from protobuf field .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Language\V1\Document|null + */ + public function getDocument() + { + return $this->document; + } + + public function hasDocument() + { + return isset($this->document); + } + + public function clearDocument() + { + unset($this->document); + } + + /** + * Required. Input document. + * + * Generated from protobuf field .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Language\V1\Document $var + * @return $this + */ + public function setDocument($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Language\V1\Document::class); + $this->document = $var; + + return $this; + } + + /** + * Model options to use for classification. Defaults to v1 options if not + * specified. + * + * Generated from protobuf field .google.cloud.language.v1.ClassificationModelOptions classification_model_options = 3; + * @return \Google\Cloud\Language\V1\ClassificationModelOptions|null + */ + public function getClassificationModelOptions() + { + return $this->classification_model_options; + } + + public function hasClassificationModelOptions() + { + return isset($this->classification_model_options); + } + + public function clearClassificationModelOptions() + { + unset($this->classification_model_options); + } + + /** + * Model options to use for classification. Defaults to v1 options if not + * specified. + * + * Generated from protobuf field .google.cloud.language.v1.ClassificationModelOptions classification_model_options = 3; + * @param \Google\Cloud\Language\V1\ClassificationModelOptions $var + * @return $this + */ + public function setClassificationModelOptions($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Language\V1\ClassificationModelOptions::class); + $this->classification_model_options = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/ClassifyTextResponse.php b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/ClassifyTextResponse.php new file mode 100644 index 000000000000..3ace816bfb6e --- /dev/null +++ b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/ClassifyTextResponse.php @@ -0,0 +1,67 @@ +google.cloud.language.v1.ClassifyTextResponse + */ +class ClassifyTextResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Categories representing the input document. + * + * Generated from protobuf field repeated .google.cloud.language.v1.ClassificationCategory categories = 1; + */ + private $categories; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Language\V1\ClassificationCategory>|\Google\Protobuf\Internal\RepeatedField $categories + * Categories representing the input document. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Language\V1\LanguageService::initOnce(); + parent::__construct($data); + } + + /** + * Categories representing the input document. + * + * Generated from protobuf field repeated .google.cloud.language.v1.ClassificationCategory categories = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getCategories() + { + return $this->categories; + } + + /** + * Categories representing the input document. + * + * Generated from protobuf field repeated .google.cloud.language.v1.ClassificationCategory categories = 1; + * @param array<\Google\Cloud\Language\V1\ClassificationCategory>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setCategories($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Language\V1\ClassificationCategory::class); + $this->categories = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/DependencyEdge.php b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/DependencyEdge.php new file mode 100644 index 000000000000..87559c773111 --- /dev/null +++ b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/DependencyEdge.php @@ -0,0 +1,119 @@ +google.cloud.language.v1.DependencyEdge + */ +class DependencyEdge extends \Google\Protobuf\Internal\Message +{ + /** + * Represents the head of this token in the dependency tree. + * This is the index of the token which has an arc going to this token. + * The index is the position of the token in the array of tokens returned + * by the API method. If this token is a root token, then the + * `head_token_index` is its own index. + * + * Generated from protobuf field int32 head_token_index = 1; + */ + protected $head_token_index = 0; + /** + * The parse label for the token. + * + * Generated from protobuf field .google.cloud.language.v1.DependencyEdge.Label label = 2; + */ + protected $label = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $head_token_index + * Represents the head of this token in the dependency tree. + * This is the index of the token which has an arc going to this token. + * The index is the position of the token in the array of tokens returned + * by the API method. If this token is a root token, then the + * `head_token_index` is its own index. + * @type int $label + * The parse label for the token. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Language\V1\LanguageService::initOnce(); + parent::__construct($data); + } + + /** + * Represents the head of this token in the dependency tree. + * This is the index of the token which has an arc going to this token. + * The index is the position of the token in the array of tokens returned + * by the API method. If this token is a root token, then the + * `head_token_index` is its own index. + * + * Generated from protobuf field int32 head_token_index = 1; + * @return int + */ + public function getHeadTokenIndex() + { + return $this->head_token_index; + } + + /** + * Represents the head of this token in the dependency tree. + * This is the index of the token which has an arc going to this token. + * The index is the position of the token in the array of tokens returned + * by the API method. If this token is a root token, then the + * `head_token_index` is its own index. + * + * Generated from protobuf field int32 head_token_index = 1; + * @param int $var + * @return $this + */ + public function setHeadTokenIndex($var) + { + GPBUtil::checkInt32($var); + $this->head_token_index = $var; + + return $this; + } + + /** + * The parse label for the token. + * + * Generated from protobuf field .google.cloud.language.v1.DependencyEdge.Label label = 2; + * @return int + */ + public function getLabel() + { + return $this->label; + } + + /** + * The parse label for the token. + * + * Generated from protobuf field .google.cloud.language.v1.DependencyEdge.Label label = 2; + * @param int $var + * @return $this + */ + public function setLabel($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Language\V1\DependencyEdge\Label::class); + $this->label = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/DependencyEdge/Label.php b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/DependencyEdge/Label.php new file mode 100644 index 000000000000..cd6d7039830c --- /dev/null +++ b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/DependencyEdge/Label.php @@ -0,0 +1,628 @@ +google.cloud.language.v1.DependencyEdge.Label + */ +class Label +{ + /** + * Unknown + * + * Generated from protobuf enum UNKNOWN = 0; + */ + const UNKNOWN = 0; + /** + * Abbreviation modifier + * + * Generated from protobuf enum ABBREV = 1; + */ + const ABBREV = 1; + /** + * Adjectival complement + * + * Generated from protobuf enum ACOMP = 2; + */ + const ACOMP = 2; + /** + * Adverbial clause modifier + * + * Generated from protobuf enum ADVCL = 3; + */ + const ADVCL = 3; + /** + * Adverbial modifier + * + * Generated from protobuf enum ADVMOD = 4; + */ + const ADVMOD = 4; + /** + * Adjectival modifier of an NP + * + * Generated from protobuf enum AMOD = 5; + */ + const AMOD = 5; + /** + * Appositional modifier of an NP + * + * Generated from protobuf enum APPOS = 6; + */ + const APPOS = 6; + /** + * Attribute dependent of a copular verb + * + * Generated from protobuf enum ATTR = 7; + */ + const ATTR = 7; + /** + * Auxiliary (non-main) verb + * + * Generated from protobuf enum AUX = 8; + */ + const AUX = 8; + /** + * Passive auxiliary + * + * Generated from protobuf enum AUXPASS = 9; + */ + const AUXPASS = 9; + /** + * Coordinating conjunction + * + * Generated from protobuf enum CC = 10; + */ + const CC = 10; + /** + * Clausal complement of a verb or adjective + * + * Generated from protobuf enum CCOMP = 11; + */ + const CCOMP = 11; + /** + * Conjunct + * + * Generated from protobuf enum CONJ = 12; + */ + const CONJ = 12; + /** + * Clausal subject + * + * Generated from protobuf enum CSUBJ = 13; + */ + const CSUBJ = 13; + /** + * Clausal passive subject + * + * Generated from protobuf enum CSUBJPASS = 14; + */ + const CSUBJPASS = 14; + /** + * Dependency (unable to determine) + * + * Generated from protobuf enum DEP = 15; + */ + const DEP = 15; + /** + * Determiner + * + * Generated from protobuf enum DET = 16; + */ + const DET = 16; + /** + * Discourse + * + * Generated from protobuf enum DISCOURSE = 17; + */ + const DISCOURSE = 17; + /** + * Direct object + * + * Generated from protobuf enum DOBJ = 18; + */ + const DOBJ = 18; + /** + * Expletive + * + * Generated from protobuf enum EXPL = 19; + */ + const EXPL = 19; + /** + * Goes with (part of a word in a text not well edited) + * + * Generated from protobuf enum GOESWITH = 20; + */ + const GOESWITH = 20; + /** + * Indirect object + * + * Generated from protobuf enum IOBJ = 21; + */ + const IOBJ = 21; + /** + * Marker (word introducing a subordinate clause) + * + * Generated from protobuf enum MARK = 22; + */ + const MARK = 22; + /** + * Multi-word expression + * + * Generated from protobuf enum MWE = 23; + */ + const MWE = 23; + /** + * Multi-word verbal expression + * + * Generated from protobuf enum MWV = 24; + */ + const MWV = 24; + /** + * Negation modifier + * + * Generated from protobuf enum NEG = 25; + */ + const NEG = 25; + /** + * Noun compound modifier + * + * Generated from protobuf enum NN = 26; + */ + const NN = 26; + /** + * Noun phrase used as an adverbial modifier + * + * Generated from protobuf enum NPADVMOD = 27; + */ + const NPADVMOD = 27; + /** + * Nominal subject + * + * Generated from protobuf enum NSUBJ = 28; + */ + const NSUBJ = 28; + /** + * Passive nominal subject + * + * Generated from protobuf enum NSUBJPASS = 29; + */ + const NSUBJPASS = 29; + /** + * Numeric modifier of a noun + * + * Generated from protobuf enum NUM = 30; + */ + const NUM = 30; + /** + * Element of compound number + * + * Generated from protobuf enum NUMBER = 31; + */ + const NUMBER = 31; + /** + * Punctuation mark + * + * Generated from protobuf enum P = 32; + */ + const P = 32; + /** + * Parataxis relation + * + * Generated from protobuf enum PARATAXIS = 33; + */ + const PARATAXIS = 33; + /** + * Participial modifier + * + * Generated from protobuf enum PARTMOD = 34; + */ + const PARTMOD = 34; + /** + * The complement of a preposition is a clause + * + * Generated from protobuf enum PCOMP = 35; + */ + const PCOMP = 35; + /** + * Object of a preposition + * + * Generated from protobuf enum POBJ = 36; + */ + const POBJ = 36; + /** + * Possession modifier + * + * Generated from protobuf enum POSS = 37; + */ + const POSS = 37; + /** + * Postverbal negative particle + * + * Generated from protobuf enum POSTNEG = 38; + */ + const POSTNEG = 38; + /** + * Predicate complement + * + * Generated from protobuf enum PRECOMP = 39; + */ + const PRECOMP = 39; + /** + * Preconjunt + * + * Generated from protobuf enum PRECONJ = 40; + */ + const PRECONJ = 40; + /** + * Predeterminer + * + * Generated from protobuf enum PREDET = 41; + */ + const PREDET = 41; + /** + * Prefix + * + * Generated from protobuf enum PREF = 42; + */ + const PREF = 42; + /** + * Prepositional modifier + * + * Generated from protobuf enum PREP = 43; + */ + const PREP = 43; + /** + * The relationship between a verb and verbal morpheme + * + * Generated from protobuf enum PRONL = 44; + */ + const PRONL = 44; + /** + * Particle + * + * Generated from protobuf enum PRT = 45; + */ + const PRT = 45; + /** + * Associative or possessive marker + * + * Generated from protobuf enum PS = 46; + */ + const PS = 46; + /** + * Quantifier phrase modifier + * + * Generated from protobuf enum QUANTMOD = 47; + */ + const QUANTMOD = 47; + /** + * Relative clause modifier + * + * Generated from protobuf enum RCMOD = 48; + */ + const RCMOD = 48; + /** + * Complementizer in relative clause + * + * Generated from protobuf enum RCMODREL = 49; + */ + const RCMODREL = 49; + /** + * Ellipsis without a preceding predicate + * + * Generated from protobuf enum RDROP = 50; + */ + const RDROP = 50; + /** + * Referent + * + * Generated from protobuf enum REF = 51; + */ + const REF = 51; + /** + * Remnant + * + * Generated from protobuf enum REMNANT = 52; + */ + const REMNANT = 52; + /** + * Reparandum + * + * Generated from protobuf enum REPARANDUM = 53; + */ + const REPARANDUM = 53; + /** + * Root + * + * Generated from protobuf enum ROOT = 54; + */ + const ROOT = 54; + /** + * Suffix specifying a unit of number + * + * Generated from protobuf enum SNUM = 55; + */ + const SNUM = 55; + /** + * Suffix + * + * Generated from protobuf enum SUFF = 56; + */ + const SUFF = 56; + /** + * Temporal modifier + * + * Generated from protobuf enum TMOD = 57; + */ + const TMOD = 57; + /** + * Topic marker + * + * Generated from protobuf enum TOPIC = 58; + */ + const TOPIC = 58; + /** + * Clause headed by an infinite form of the verb that modifies a noun + * + * Generated from protobuf enum VMOD = 59; + */ + const VMOD = 59; + /** + * Vocative + * + * Generated from protobuf enum VOCATIVE = 60; + */ + const VOCATIVE = 60; + /** + * Open clausal complement + * + * Generated from protobuf enum XCOMP = 61; + */ + const XCOMP = 61; + /** + * Name suffix + * + * Generated from protobuf enum SUFFIX = 62; + */ + const SUFFIX = 62; + /** + * Name title + * + * Generated from protobuf enum TITLE = 63; + */ + const TITLE = 63; + /** + * Adverbial phrase modifier + * + * Generated from protobuf enum ADVPHMOD = 64; + */ + const ADVPHMOD = 64; + /** + * Causative auxiliary + * + * Generated from protobuf enum AUXCAUS = 65; + */ + const AUXCAUS = 65; + /** + * Helper auxiliary + * + * Generated from protobuf enum AUXVV = 66; + */ + const AUXVV = 66; + /** + * Rentaishi (Prenominal modifier) + * + * Generated from protobuf enum DTMOD = 67; + */ + const DTMOD = 67; + /** + * Foreign words + * + * Generated from protobuf enum FOREIGN = 68; + */ + const FOREIGN = 68; + /** + * Keyword + * + * Generated from protobuf enum KW = 69; + */ + const KW = 69; + /** + * List for chains of comparable items + * + * Generated from protobuf enum LIST = 70; + */ + const PBLIST = 70; + /** + * Nominalized clause + * + * Generated from protobuf enum NOMC = 71; + */ + const NOMC = 71; + /** + * Nominalized clausal subject + * + * Generated from protobuf enum NOMCSUBJ = 72; + */ + const NOMCSUBJ = 72; + /** + * Nominalized clausal passive + * + * Generated from protobuf enum NOMCSUBJPASS = 73; + */ + const NOMCSUBJPASS = 73; + /** + * Compound of numeric modifier + * + * Generated from protobuf enum NUMC = 74; + */ + const NUMC = 74; + /** + * Copula + * + * Generated from protobuf enum COP = 75; + */ + const COP = 75; + /** + * Dislocated relation (for fronted/topicalized elements) + * + * Generated from protobuf enum DISLOCATED = 76; + */ + const DISLOCATED = 76; + /** + * Aspect marker + * + * Generated from protobuf enum ASP = 77; + */ + const ASP = 77; + /** + * Genitive modifier + * + * Generated from protobuf enum GMOD = 78; + */ + const GMOD = 78; + /** + * Genitive object + * + * Generated from protobuf enum GOBJ = 79; + */ + const GOBJ = 79; + /** + * Infinitival modifier + * + * Generated from protobuf enum INFMOD = 80; + */ + const INFMOD = 80; + /** + * Measure + * + * Generated from protobuf enum MES = 81; + */ + const MES = 81; + /** + * Nominal complement of a noun + * + * Generated from protobuf enum NCOMP = 82; + */ + const NCOMP = 82; + + private static $valueToName = [ + self::UNKNOWN => 'UNKNOWN', + self::ABBREV => 'ABBREV', + self::ACOMP => 'ACOMP', + self::ADVCL => 'ADVCL', + self::ADVMOD => 'ADVMOD', + self::AMOD => 'AMOD', + self::APPOS => 'APPOS', + self::ATTR => 'ATTR', + self::AUX => 'AUX', + self::AUXPASS => 'AUXPASS', + self::CC => 'CC', + self::CCOMP => 'CCOMP', + self::CONJ => 'CONJ', + self::CSUBJ => 'CSUBJ', + self::CSUBJPASS => 'CSUBJPASS', + self::DEP => 'DEP', + self::DET => 'DET', + self::DISCOURSE => 'DISCOURSE', + self::DOBJ => 'DOBJ', + self::EXPL => 'EXPL', + self::GOESWITH => 'GOESWITH', + self::IOBJ => 'IOBJ', + self::MARK => 'MARK', + self::MWE => 'MWE', + self::MWV => 'MWV', + self::NEG => 'NEG', + self::NN => 'NN', + self::NPADVMOD => 'NPADVMOD', + self::NSUBJ => 'NSUBJ', + self::NSUBJPASS => 'NSUBJPASS', + self::NUM => 'NUM', + self::NUMBER => 'NUMBER', + self::P => 'P', + self::PARATAXIS => 'PARATAXIS', + self::PARTMOD => 'PARTMOD', + self::PCOMP => 'PCOMP', + self::POBJ => 'POBJ', + self::POSS => 'POSS', + self::POSTNEG => 'POSTNEG', + self::PRECOMP => 'PRECOMP', + self::PRECONJ => 'PRECONJ', + self::PREDET => 'PREDET', + self::PREF => 'PREF', + self::PREP => 'PREP', + self::PRONL => 'PRONL', + self::PRT => 'PRT', + self::PS => 'PS', + self::QUANTMOD => 'QUANTMOD', + self::RCMOD => 'RCMOD', + self::RCMODREL => 'RCMODREL', + self::RDROP => 'RDROP', + self::REF => 'REF', + self::REMNANT => 'REMNANT', + self::REPARANDUM => 'REPARANDUM', + self::ROOT => 'ROOT', + self::SNUM => 'SNUM', + self::SUFF => 'SUFF', + self::TMOD => 'TMOD', + self::TOPIC => 'TOPIC', + self::VMOD => 'VMOD', + self::VOCATIVE => 'VOCATIVE', + self::XCOMP => 'XCOMP', + self::SUFFIX => 'SUFFIX', + self::TITLE => 'TITLE', + self::ADVPHMOD => 'ADVPHMOD', + self::AUXCAUS => 'AUXCAUS', + self::AUXVV => 'AUXVV', + self::DTMOD => 'DTMOD', + self::FOREIGN => 'FOREIGN', + self::KW => 'KW', + self::PBLIST => 'LIST', + self::NOMC => 'NOMC', + self::NOMCSUBJ => 'NOMCSUBJ', + self::NOMCSUBJPASS => 'NOMCSUBJPASS', + self::NUMC => 'NUMC', + self::COP => 'COP', + self::DISLOCATED => 'DISLOCATED', + self::ASP => 'ASP', + self::GMOD => 'GMOD', + self::GOBJ => 'GOBJ', + self::INFMOD => 'INFMOD', + self::MES => 'MES', + self::NCOMP => 'NCOMP', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + $pbconst = __CLASS__. '::PB' . strtoupper($name); + if (!defined($pbconst)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($pbconst); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Label::class, \Google\Cloud\Language\V1\DependencyEdge_Label::class); + diff --git a/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/DependencyEdge_Label.php b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/DependencyEdge_Label.php new file mode 100644 index 000000000000..4d8f234314ba --- /dev/null +++ b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/DependencyEdge_Label.php @@ -0,0 +1,16 @@ +google.cloud.language.v1.Document + */ +class Document extends \Google\Protobuf\Internal\Message +{ + /** + * Required. If the type is not set or is `TYPE_UNSPECIFIED`, + * returns an `INVALID_ARGUMENT` error. + * + * Generated from protobuf field .google.cloud.language.v1.Document.Type type = 1; + */ + protected $type = 0; + /** + * The language of the document (if not specified, the language is + * automatically detected). Both ISO and BCP-47 language codes are + * accepted.
+ * [Language + * Support](https://cloud.google.com/natural-language/docs/languages) lists + * currently supported languages for each API method. If the language (either + * specified by the caller or automatically detected) is not supported by the + * called API method, an `INVALID_ARGUMENT` error is returned. + * + * Generated from protobuf field string language = 4; + */ + protected $language = ''; + protected $source; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $type + * Required. If the type is not set or is `TYPE_UNSPECIFIED`, + * returns an `INVALID_ARGUMENT` error. + * @type string $content + * The content of the input in string format. + * Cloud audit logging exempt since it is based on user data. + * @type string $gcs_content_uri + * The Google Cloud Storage URI where the file content is located. + * This URI must be of the form: gs://bucket_name/object_name. For more + * details, see https://cloud.google.com/storage/docs/reference-uris. + * NOTE: Cloud Storage object versioning is not supported. + * @type string $language + * The language of the document (if not specified, the language is + * automatically detected). Both ISO and BCP-47 language codes are + * accepted.
+ * [Language + * Support](https://cloud.google.com/natural-language/docs/languages) lists + * currently supported languages for each API method. If the language (either + * specified by the caller or automatically detected) is not supported by the + * called API method, an `INVALID_ARGUMENT` error is returned. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Language\V1\LanguageService::initOnce(); + parent::__construct($data); + } + + /** + * Required. If the type is not set or is `TYPE_UNSPECIFIED`, + * returns an `INVALID_ARGUMENT` error. + * + * Generated from protobuf field .google.cloud.language.v1.Document.Type type = 1; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * Required. If the type is not set or is `TYPE_UNSPECIFIED`, + * returns an `INVALID_ARGUMENT` error. + * + * Generated from protobuf field .google.cloud.language.v1.Document.Type type = 1; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Language\V1\Document\Type::class); + $this->type = $var; + + return $this; + } + + /** + * The content of the input in string format. + * Cloud audit logging exempt since it is based on user data. + * + * Generated from protobuf field string content = 2; + * @return string + */ + public function getContent() + { + return $this->readOneof(2); + } + + public function hasContent() + { + return $this->hasOneof(2); + } + + /** + * The content of the input in string format. + * Cloud audit logging exempt since it is based on user data. + * + * Generated from protobuf field string content = 2; + * @param string $var + * @return $this + */ + public function setContent($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * The Google Cloud Storage URI where the file content is located. + * This URI must be of the form: gs://bucket_name/object_name. For more + * details, see https://cloud.google.com/storage/docs/reference-uris. + * NOTE: Cloud Storage object versioning is not supported. + * + * Generated from protobuf field string gcs_content_uri = 3; + * @return string + */ + public function getGcsContentUri() + { + return $this->readOneof(3); + } + + public function hasGcsContentUri() + { + return $this->hasOneof(3); + } + + /** + * The Google Cloud Storage URI where the file content is located. + * This URI must be of the form: gs://bucket_name/object_name. For more + * details, see https://cloud.google.com/storage/docs/reference-uris. + * NOTE: Cloud Storage object versioning is not supported. + * + * Generated from protobuf field string gcs_content_uri = 3; + * @param string $var + * @return $this + */ + public function setGcsContentUri($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * The language of the document (if not specified, the language is + * automatically detected). Both ISO and BCP-47 language codes are + * accepted.
+ * [Language + * Support](https://cloud.google.com/natural-language/docs/languages) lists + * currently supported languages for each API method. If the language (either + * specified by the caller or automatically detected) is not supported by the + * called API method, an `INVALID_ARGUMENT` error is returned. + * + * Generated from protobuf field string language = 4; + * @return string + */ + public function getLanguage() + { + return $this->language; + } + + /** + * The language of the document (if not specified, the language is + * automatically detected). Both ISO and BCP-47 language codes are + * accepted.
+ * [Language + * Support](https://cloud.google.com/natural-language/docs/languages) lists + * currently supported languages for each API method. If the language (either + * specified by the caller or automatically detected) is not supported by the + * called API method, an `INVALID_ARGUMENT` error is returned. + * + * Generated from protobuf field string language = 4; + * @param string $var + * @return $this + */ + public function setLanguage($var) + { + GPBUtil::checkString($var, True); + $this->language = $var; + + return $this; + } + + /** + * @return string + */ + public function getSource() + { + return $this->whichOneof("source"); + } + +} + diff --git a/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/Document/Type.php b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/Document/Type.php new file mode 100644 index 000000000000..00069f59a85c --- /dev/null +++ b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/Document/Type.php @@ -0,0 +1,64 @@ +google.cloud.language.v1.Document.Type + */ +class Type +{ + /** + * The content type is not specified. + * + * Generated from protobuf enum TYPE_UNSPECIFIED = 0; + */ + const TYPE_UNSPECIFIED = 0; + /** + * Plain text + * + * Generated from protobuf enum PLAIN_TEXT = 1; + */ + const PLAIN_TEXT = 1; + /** + * HTML + * + * Generated from protobuf enum HTML = 2; + */ + const HTML = 2; + + private static $valueToName = [ + self::TYPE_UNSPECIFIED => 'TYPE_UNSPECIFIED', + self::PLAIN_TEXT => 'PLAIN_TEXT', + self::HTML => 'HTML', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Type::class, \Google\Cloud\Language\V1\Document_Type::class); + diff --git a/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/Document_Type.php b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/Document_Type.php new file mode 100644 index 000000000000..a28599b289b6 --- /dev/null +++ b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/Document_Type.php @@ -0,0 +1,16 @@ +google.cloud.language.v1.EncodingType + */ +class EncodingType +{ + /** + * If `EncodingType` is not specified, encoding-dependent information (such as + * `begin_offset`) will be set at `-1`. + * + * Generated from protobuf enum NONE = 0; + */ + const NONE = 0; + /** + * Encoding-dependent information (such as `begin_offset`) is calculated based + * on the UTF-8 encoding of the input. C++ and Go are examples of languages + * that use this encoding natively. + * + * Generated from protobuf enum UTF8 = 1; + */ + const UTF8 = 1; + /** + * Encoding-dependent information (such as `begin_offset`) is calculated based + * on the UTF-16 encoding of the input. Java and JavaScript are examples of + * languages that use this encoding natively. + * + * Generated from protobuf enum UTF16 = 2; + */ + const UTF16 = 2; + /** + * Encoding-dependent information (such as `begin_offset`) is calculated based + * on the UTF-32 encoding of the input. Python is an example of a language + * that uses this encoding natively. + * + * Generated from protobuf enum UTF32 = 3; + */ + const UTF32 = 3; + + private static $valueToName = [ + self::NONE => 'NONE', + self::UTF8 => 'UTF8', + self::UTF16 => 'UTF16', + self::UTF32 => 'UTF32', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/Entity.php b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/Entity.php new file mode 100644 index 000000000000..948b75127f67 --- /dev/null +++ b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/Entity.php @@ -0,0 +1,293 @@ +google.cloud.language.v1.Entity + */ +class Entity extends \Google\Protobuf\Internal\Message +{ + /** + * The representative name for the entity. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * The entity type. + * + * Generated from protobuf field .google.cloud.language.v1.Entity.Type type = 2; + */ + protected $type = 0; + /** + * Metadata associated with the entity. + * For most entity types, the metadata is a Wikipedia URL (`wikipedia_url`) + * and Knowledge Graph MID (`mid`), if they are available. For the metadata + * associated with other entity types, see the Type table below. + * + * Generated from protobuf field map metadata = 3; + */ + private $metadata; + /** + * The salience score associated with the entity in the [0, 1.0] range. + * The salience score for an entity provides information about the + * importance or centrality of that entity to the entire document text. + * Scores closer to 0 are less salient, while scores closer to 1.0 are highly + * salient. + * + * Generated from protobuf field float salience = 4; + */ + protected $salience = 0.0; + /** + * The mentions of this entity in the input document. The API currently + * supports proper noun mentions. + * + * Generated from protobuf field repeated .google.cloud.language.v1.EntityMention mentions = 5; + */ + private $mentions; + /** + * For calls to [AnalyzeEntitySentiment][] or if + * [AnnotateTextRequest.Features.extract_entity_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entity_sentiment] + * is set to true, this field will contain the aggregate sentiment expressed + * for this entity in the provided document. + * + * Generated from protobuf field .google.cloud.language.v1.Sentiment sentiment = 6; + */ + protected $sentiment = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The representative name for the entity. + * @type int $type + * The entity type. + * @type array|\Google\Protobuf\Internal\MapField $metadata + * Metadata associated with the entity. + * For most entity types, the metadata is a Wikipedia URL (`wikipedia_url`) + * and Knowledge Graph MID (`mid`), if they are available. For the metadata + * associated with other entity types, see the Type table below. + * @type float $salience + * The salience score associated with the entity in the [0, 1.0] range. + * The salience score for an entity provides information about the + * importance or centrality of that entity to the entire document text. + * Scores closer to 0 are less salient, while scores closer to 1.0 are highly + * salient. + * @type array<\Google\Cloud\Language\V1\EntityMention>|\Google\Protobuf\Internal\RepeatedField $mentions + * The mentions of this entity in the input document. The API currently + * supports proper noun mentions. + * @type \Google\Cloud\Language\V1\Sentiment $sentiment + * For calls to [AnalyzeEntitySentiment][] or if + * [AnnotateTextRequest.Features.extract_entity_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entity_sentiment] + * is set to true, this field will contain the aggregate sentiment expressed + * for this entity in the provided document. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Language\V1\LanguageService::initOnce(); + parent::__construct($data); + } + + /** + * The representative name for the entity. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The representative name for the entity. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The entity type. + * + * Generated from protobuf field .google.cloud.language.v1.Entity.Type type = 2; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * The entity type. + * + * Generated from protobuf field .google.cloud.language.v1.Entity.Type type = 2; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Language\V1\Entity\Type::class); + $this->type = $var; + + return $this; + } + + /** + * Metadata associated with the entity. + * For most entity types, the metadata is a Wikipedia URL (`wikipedia_url`) + * and Knowledge Graph MID (`mid`), if they are available. For the metadata + * associated with other entity types, see the Type table below. + * + * Generated from protobuf field map metadata = 3; + * @return \Google\Protobuf\Internal\MapField + */ + public function getMetadata() + { + return $this->metadata; + } + + /** + * Metadata associated with the entity. + * For most entity types, the metadata is a Wikipedia URL (`wikipedia_url`) + * and Knowledge Graph MID (`mid`), if they are available. For the metadata + * associated with other entity types, see the Type table below. + * + * Generated from protobuf field map metadata = 3; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setMetadata($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->metadata = $arr; + + return $this; + } + + /** + * The salience score associated with the entity in the [0, 1.0] range. + * The salience score for an entity provides information about the + * importance or centrality of that entity to the entire document text. + * Scores closer to 0 are less salient, while scores closer to 1.0 are highly + * salient. + * + * Generated from protobuf field float salience = 4; + * @return float + */ + public function getSalience() + { + return $this->salience; + } + + /** + * The salience score associated with the entity in the [0, 1.0] range. + * The salience score for an entity provides information about the + * importance or centrality of that entity to the entire document text. + * Scores closer to 0 are less salient, while scores closer to 1.0 are highly + * salient. + * + * Generated from protobuf field float salience = 4; + * @param float $var + * @return $this + */ + public function setSalience($var) + { + GPBUtil::checkFloat($var); + $this->salience = $var; + + return $this; + } + + /** + * The mentions of this entity in the input document. The API currently + * supports proper noun mentions. + * + * Generated from protobuf field repeated .google.cloud.language.v1.EntityMention mentions = 5; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getMentions() + { + return $this->mentions; + } + + /** + * The mentions of this entity in the input document. The API currently + * supports proper noun mentions. + * + * Generated from protobuf field repeated .google.cloud.language.v1.EntityMention mentions = 5; + * @param array<\Google\Cloud\Language\V1\EntityMention>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setMentions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Language\V1\EntityMention::class); + $this->mentions = $arr; + + return $this; + } + + /** + * For calls to [AnalyzeEntitySentiment][] or if + * [AnnotateTextRequest.Features.extract_entity_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entity_sentiment] + * is set to true, this field will contain the aggregate sentiment expressed + * for this entity in the provided document. + * + * Generated from protobuf field .google.cloud.language.v1.Sentiment sentiment = 6; + * @return \Google\Cloud\Language\V1\Sentiment|null + */ + public function getSentiment() + { + return $this->sentiment; + } + + public function hasSentiment() + { + return isset($this->sentiment); + } + + public function clearSentiment() + { + unset($this->sentiment); + } + + /** + * For calls to [AnalyzeEntitySentiment][] or if + * [AnnotateTextRequest.Features.extract_entity_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entity_sentiment] + * is set to true, this field will contain the aggregate sentiment expressed + * for this entity in the provided document. + * + * Generated from protobuf field .google.cloud.language.v1.Sentiment sentiment = 6; + * @param \Google\Cloud\Language\V1\Sentiment $var + * @return $this + */ + public function setSentiment($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Language\V1\Sentiment::class); + $this->sentiment = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/Entity/Type.php b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/Entity/Type.php new file mode 100644 index 000000000000..a54bb0c4b4fb --- /dev/null +++ b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/Entity/Type.php @@ -0,0 +1,163 @@ +google.cloud.language.v1.Entity.Type + */ +class Type +{ + /** + * Unknown + * + * Generated from protobuf enum UNKNOWN = 0; + */ + const UNKNOWN = 0; + /** + * Person + * + * Generated from protobuf enum PERSON = 1; + */ + const PERSON = 1; + /** + * Location + * + * Generated from protobuf enum LOCATION = 2; + */ + const LOCATION = 2; + /** + * Organization + * + * Generated from protobuf enum ORGANIZATION = 3; + */ + const ORGANIZATION = 3; + /** + * Event + * + * Generated from protobuf enum EVENT = 4; + */ + const EVENT = 4; + /** + * Artwork + * + * Generated from protobuf enum WORK_OF_ART = 5; + */ + const WORK_OF_ART = 5; + /** + * Consumer product + * + * Generated from protobuf enum CONSUMER_GOOD = 6; + */ + const CONSUMER_GOOD = 6; + /** + * Other types of entities + * + * Generated from protobuf enum OTHER = 7; + */ + const OTHER = 7; + /** + * Phone number + * The metadata lists the phone number, formatted according to local + * convention, plus whichever additional elements appear in the text: + * * `number` - the actual number, broken down into sections as per local + * convention + * * `national_prefix` - country code, if detected + * * `area_code` - region or area code, if detected + * * `extension` - phone extension (to be dialed after connection), if + * detected + * + * Generated from protobuf enum PHONE_NUMBER = 9; + */ + const PHONE_NUMBER = 9; + /** + * Address + * The metadata identifies the street number and locality plus whichever + * additional elements appear in the text: + * * `street_number` - street number + * * `locality` - city or town + * * `street_name` - street/route name, if detected + * * `postal_code` - postal code, if detected + * * `country` - country, if detected< + * * `broad_region` - administrative area, such as the state, if detected + * * `narrow_region` - smaller administrative area, such as county, if + * detected + * * `sublocality` - used in Asian addresses to demark a district within a + * city, if detected + * + * Generated from protobuf enum ADDRESS = 10; + */ + const ADDRESS = 10; + /** + * Date + * The metadata identifies the components of the date: + * * `year` - four digit year, if detected + * * `month` - two digit month number, if detected + * * `day` - two digit day number, if detected + * + * Generated from protobuf enum DATE = 11; + */ + const DATE = 11; + /** + * Number + * The metadata is the number itself. + * + * Generated from protobuf enum NUMBER = 12; + */ + const NUMBER = 12; + /** + * Price + * The metadata identifies the `value` and `currency`. + * + * Generated from protobuf enum PRICE = 13; + */ + const PRICE = 13; + + private static $valueToName = [ + self::UNKNOWN => 'UNKNOWN', + self::PERSON => 'PERSON', + self::LOCATION => 'LOCATION', + self::ORGANIZATION => 'ORGANIZATION', + self::EVENT => 'EVENT', + self::WORK_OF_ART => 'WORK_OF_ART', + self::CONSUMER_GOOD => 'CONSUMER_GOOD', + self::OTHER => 'OTHER', + self::PHONE_NUMBER => 'PHONE_NUMBER', + self::ADDRESS => 'ADDRESS', + self::DATE => 'DATE', + self::NUMBER => 'NUMBER', + self::PRICE => 'PRICE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Type::class, \Google\Cloud\Language\V1\Entity_Type::class); + diff --git a/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/EntityMention.php b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/EntityMention.php new file mode 100644 index 000000000000..4fc395029bad --- /dev/null +++ b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/EntityMention.php @@ -0,0 +1,168 @@ +google.cloud.language.v1.EntityMention + */ +class EntityMention extends \Google\Protobuf\Internal\Message +{ + /** + * The mention text. + * + * Generated from protobuf field .google.cloud.language.v1.TextSpan text = 1; + */ + protected $text = null; + /** + * The type of the entity mention. + * + * Generated from protobuf field .google.cloud.language.v1.EntityMention.Type type = 2; + */ + protected $type = 0; + /** + * For calls to [AnalyzeEntitySentiment][] or if + * [AnnotateTextRequest.Features.extract_entity_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entity_sentiment] + * is set to true, this field will contain the sentiment expressed for this + * mention of the entity in the provided document. + * + * Generated from protobuf field .google.cloud.language.v1.Sentiment sentiment = 3; + */ + protected $sentiment = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Language\V1\TextSpan $text + * The mention text. + * @type int $type + * The type of the entity mention. + * @type \Google\Cloud\Language\V1\Sentiment $sentiment + * For calls to [AnalyzeEntitySentiment][] or if + * [AnnotateTextRequest.Features.extract_entity_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entity_sentiment] + * is set to true, this field will contain the sentiment expressed for this + * mention of the entity in the provided document. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Language\V1\LanguageService::initOnce(); + parent::__construct($data); + } + + /** + * The mention text. + * + * Generated from protobuf field .google.cloud.language.v1.TextSpan text = 1; + * @return \Google\Cloud\Language\V1\TextSpan|null + */ + public function getText() + { + return $this->text; + } + + public function hasText() + { + return isset($this->text); + } + + public function clearText() + { + unset($this->text); + } + + /** + * The mention text. + * + * Generated from protobuf field .google.cloud.language.v1.TextSpan text = 1; + * @param \Google\Cloud\Language\V1\TextSpan $var + * @return $this + */ + public function setText($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Language\V1\TextSpan::class); + $this->text = $var; + + return $this; + } + + /** + * The type of the entity mention. + * + * Generated from protobuf field .google.cloud.language.v1.EntityMention.Type type = 2; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * The type of the entity mention. + * + * Generated from protobuf field .google.cloud.language.v1.EntityMention.Type type = 2; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Language\V1\EntityMention\Type::class); + $this->type = $var; + + return $this; + } + + /** + * For calls to [AnalyzeEntitySentiment][] or if + * [AnnotateTextRequest.Features.extract_entity_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entity_sentiment] + * is set to true, this field will contain the sentiment expressed for this + * mention of the entity in the provided document. + * + * Generated from protobuf field .google.cloud.language.v1.Sentiment sentiment = 3; + * @return \Google\Cloud\Language\V1\Sentiment|null + */ + public function getSentiment() + { + return $this->sentiment; + } + + public function hasSentiment() + { + return isset($this->sentiment); + } + + public function clearSentiment() + { + unset($this->sentiment); + } + + /** + * For calls to [AnalyzeEntitySentiment][] or if + * [AnnotateTextRequest.Features.extract_entity_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entity_sentiment] + * is set to true, this field will contain the sentiment expressed for this + * mention of the entity in the provided document. + * + * Generated from protobuf field .google.cloud.language.v1.Sentiment sentiment = 3; + * @param \Google\Cloud\Language\V1\Sentiment $var + * @return $this + */ + public function setSentiment($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Language\V1\Sentiment::class); + $this->sentiment = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/EntityMention/Type.php b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/EntityMention/Type.php new file mode 100644 index 000000000000..2fd75a738dfd --- /dev/null +++ b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/EntityMention/Type.php @@ -0,0 +1,64 @@ +google.cloud.language.v1.EntityMention.Type + */ +class Type +{ + /** + * Unknown + * + * Generated from protobuf enum TYPE_UNKNOWN = 0; + */ + const TYPE_UNKNOWN = 0; + /** + * Proper name + * + * Generated from protobuf enum PROPER = 1; + */ + const PROPER = 1; + /** + * Common noun (or noun compound) + * + * Generated from protobuf enum COMMON = 2; + */ + const COMMON = 2; + + private static $valueToName = [ + self::TYPE_UNKNOWN => 'TYPE_UNKNOWN', + self::PROPER => 'PROPER', + self::COMMON => 'COMMON', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Type::class, \Google\Cloud\Language\V1\EntityMention_Type::class); + diff --git a/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/EntityMention_Type.php b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/EntityMention_Type.php new file mode 100644 index 000000000000..187da39bbc0a --- /dev/null +++ b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/EntityMention_Type.php @@ -0,0 +1,16 @@ +_simpleRequest('/google.cloud.language.v1.LanguageService/AnalyzeSentiment', + $argument, + ['\Google\Cloud\Language\V1\AnalyzeSentimentResponse', 'decode'], + $metadata, $options); + } + + /** + * Finds named entities (currently proper names and common nouns) in the text + * along with entity types, salience, mentions for each entity, and + * other properties. + * @param \Google\Cloud\Language\V1\AnalyzeEntitiesRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function AnalyzeEntities(\Google\Cloud\Language\V1\AnalyzeEntitiesRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.language.v1.LanguageService/AnalyzeEntities', + $argument, + ['\Google\Cloud\Language\V1\AnalyzeEntitiesResponse', 'decode'], + $metadata, $options); + } + + /** + * Finds entities, similar to + * [AnalyzeEntities][google.cloud.language.v1.LanguageService.AnalyzeEntities] + * in the text and analyzes sentiment associated with each entity and its + * mentions. + * @param \Google\Cloud\Language\V1\AnalyzeEntitySentimentRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function AnalyzeEntitySentiment(\Google\Cloud\Language\V1\AnalyzeEntitySentimentRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.language.v1.LanguageService/AnalyzeEntitySentiment', + $argument, + ['\Google\Cloud\Language\V1\AnalyzeEntitySentimentResponse', 'decode'], + $metadata, $options); + } + + /** + * Analyzes the syntax of the text and provides sentence boundaries and + * tokenization along with part of speech tags, dependency trees, and other + * properties. + * @param \Google\Cloud\Language\V1\AnalyzeSyntaxRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function AnalyzeSyntax(\Google\Cloud\Language\V1\AnalyzeSyntaxRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.language.v1.LanguageService/AnalyzeSyntax', + $argument, + ['\Google\Cloud\Language\V1\AnalyzeSyntaxResponse', 'decode'], + $metadata, $options); + } + + /** + * Classifies a document into categories. + * @param \Google\Cloud\Language\V1\ClassifyTextRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function ClassifyText(\Google\Cloud\Language\V1\ClassifyTextRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.language.v1.LanguageService/ClassifyText', + $argument, + ['\Google\Cloud\Language\V1\ClassifyTextResponse', 'decode'], + $metadata, $options); + } + + /** + * A convenience method that provides all the features that analyzeSentiment, + * analyzeEntities, and analyzeSyntax provide in one call. + * @param \Google\Cloud\Language\V1\AnnotateTextRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function AnnotateText(\Google\Cloud\Language\V1\AnnotateTextRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.language.v1.LanguageService/AnnotateText', + $argument, + ['\Google\Cloud\Language\V1\AnnotateTextResponse', 'decode'], + $metadata, $options); + } + +} diff --git a/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/PartOfSpeech.php b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/PartOfSpeech.php new file mode 100644 index 000000000000..91ec89536ef9 --- /dev/null +++ b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/PartOfSpeech.php @@ -0,0 +1,443 @@ +google.cloud.language.v1.PartOfSpeech + */ +class PartOfSpeech extends \Google\Protobuf\Internal\Message +{ + /** + * The part of speech tag. + * + * Generated from protobuf field .google.cloud.language.v1.PartOfSpeech.Tag tag = 1; + */ + protected $tag = 0; + /** + * The grammatical aspect. + * + * Generated from protobuf field .google.cloud.language.v1.PartOfSpeech.Aspect aspect = 2; + */ + protected $aspect = 0; + /** + * The grammatical case. + * + * Generated from protobuf field .google.cloud.language.v1.PartOfSpeech.Case case = 3; + */ + protected $case = 0; + /** + * The grammatical form. + * + * Generated from protobuf field .google.cloud.language.v1.PartOfSpeech.Form form = 4; + */ + protected $form = 0; + /** + * The grammatical gender. + * + * Generated from protobuf field .google.cloud.language.v1.PartOfSpeech.Gender gender = 5; + */ + protected $gender = 0; + /** + * The grammatical mood. + * + * Generated from protobuf field .google.cloud.language.v1.PartOfSpeech.Mood mood = 6; + */ + protected $mood = 0; + /** + * The grammatical number. + * + * Generated from protobuf field .google.cloud.language.v1.PartOfSpeech.Number number = 7; + */ + protected $number = 0; + /** + * The grammatical person. + * + * Generated from protobuf field .google.cloud.language.v1.PartOfSpeech.Person person = 8; + */ + protected $person = 0; + /** + * The grammatical properness. + * + * Generated from protobuf field .google.cloud.language.v1.PartOfSpeech.Proper proper = 9; + */ + protected $proper = 0; + /** + * The grammatical reciprocity. + * + * Generated from protobuf field .google.cloud.language.v1.PartOfSpeech.Reciprocity reciprocity = 10; + */ + protected $reciprocity = 0; + /** + * The grammatical tense. + * + * Generated from protobuf field .google.cloud.language.v1.PartOfSpeech.Tense tense = 11; + */ + protected $tense = 0; + /** + * The grammatical voice. + * + * Generated from protobuf field .google.cloud.language.v1.PartOfSpeech.Voice voice = 12; + */ + protected $voice = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $tag + * The part of speech tag. + * @type int $aspect + * The grammatical aspect. + * @type int $case + * The grammatical case. + * @type int $form + * The grammatical form. + * @type int $gender + * The grammatical gender. + * @type int $mood + * The grammatical mood. + * @type int $number + * The grammatical number. + * @type int $person + * The grammatical person. + * @type int $proper + * The grammatical properness. + * @type int $reciprocity + * The grammatical reciprocity. + * @type int $tense + * The grammatical tense. + * @type int $voice + * The grammatical voice. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Language\V1\LanguageService::initOnce(); + parent::__construct($data); + } + + /** + * The part of speech tag. + * + * Generated from protobuf field .google.cloud.language.v1.PartOfSpeech.Tag tag = 1; + * @return int + */ + public function getTag() + { + return $this->tag; + } + + /** + * The part of speech tag. + * + * Generated from protobuf field .google.cloud.language.v1.PartOfSpeech.Tag tag = 1; + * @param int $var + * @return $this + */ + public function setTag($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Language\V1\PartOfSpeech\Tag::class); + $this->tag = $var; + + return $this; + } + + /** + * The grammatical aspect. + * + * Generated from protobuf field .google.cloud.language.v1.PartOfSpeech.Aspect aspect = 2; + * @return int + */ + public function getAspect() + { + return $this->aspect; + } + + /** + * The grammatical aspect. + * + * Generated from protobuf field .google.cloud.language.v1.PartOfSpeech.Aspect aspect = 2; + * @param int $var + * @return $this + */ + public function setAspect($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Language\V1\PartOfSpeech\Aspect::class); + $this->aspect = $var; + + return $this; + } + + /** + * The grammatical case. + * + * Generated from protobuf field .google.cloud.language.v1.PartOfSpeech.Case case = 3; + * @return int + */ + public function getCase() + { + return $this->case; + } + + /** + * The grammatical case. + * + * Generated from protobuf field .google.cloud.language.v1.PartOfSpeech.Case case = 3; + * @param int $var + * @return $this + */ + public function setCase($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Language\V1\PartOfSpeech\PBCase::class); + $this->case = $var; + + return $this; + } + + /** + * The grammatical form. + * + * Generated from protobuf field .google.cloud.language.v1.PartOfSpeech.Form form = 4; + * @return int + */ + public function getForm() + { + return $this->form; + } + + /** + * The grammatical form. + * + * Generated from protobuf field .google.cloud.language.v1.PartOfSpeech.Form form = 4; + * @param int $var + * @return $this + */ + public function setForm($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Language\V1\PartOfSpeech\Form::class); + $this->form = $var; + + return $this; + } + + /** + * The grammatical gender. + * + * Generated from protobuf field .google.cloud.language.v1.PartOfSpeech.Gender gender = 5; + * @return int + */ + public function getGender() + { + return $this->gender; + } + + /** + * The grammatical gender. + * + * Generated from protobuf field .google.cloud.language.v1.PartOfSpeech.Gender gender = 5; + * @param int $var + * @return $this + */ + public function setGender($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Language\V1\PartOfSpeech\Gender::class); + $this->gender = $var; + + return $this; + } + + /** + * The grammatical mood. + * + * Generated from protobuf field .google.cloud.language.v1.PartOfSpeech.Mood mood = 6; + * @return int + */ + public function getMood() + { + return $this->mood; + } + + /** + * The grammatical mood. + * + * Generated from protobuf field .google.cloud.language.v1.PartOfSpeech.Mood mood = 6; + * @param int $var + * @return $this + */ + public function setMood($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Language\V1\PartOfSpeech\Mood::class); + $this->mood = $var; + + return $this; + } + + /** + * The grammatical number. + * + * Generated from protobuf field .google.cloud.language.v1.PartOfSpeech.Number number = 7; + * @return int + */ + public function getNumber() + { + return $this->number; + } + + /** + * The grammatical number. + * + * Generated from protobuf field .google.cloud.language.v1.PartOfSpeech.Number number = 7; + * @param int $var + * @return $this + */ + public function setNumber($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Language\V1\PartOfSpeech\Number::class); + $this->number = $var; + + return $this; + } + + /** + * The grammatical person. + * + * Generated from protobuf field .google.cloud.language.v1.PartOfSpeech.Person person = 8; + * @return int + */ + public function getPerson() + { + return $this->person; + } + + /** + * The grammatical person. + * + * Generated from protobuf field .google.cloud.language.v1.PartOfSpeech.Person person = 8; + * @param int $var + * @return $this + */ + public function setPerson($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Language\V1\PartOfSpeech\Person::class); + $this->person = $var; + + return $this; + } + + /** + * The grammatical properness. + * + * Generated from protobuf field .google.cloud.language.v1.PartOfSpeech.Proper proper = 9; + * @return int + */ + public function getProper() + { + return $this->proper; + } + + /** + * The grammatical properness. + * + * Generated from protobuf field .google.cloud.language.v1.PartOfSpeech.Proper proper = 9; + * @param int $var + * @return $this + */ + public function setProper($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Language\V1\PartOfSpeech\Proper::class); + $this->proper = $var; + + return $this; + } + + /** + * The grammatical reciprocity. + * + * Generated from protobuf field .google.cloud.language.v1.PartOfSpeech.Reciprocity reciprocity = 10; + * @return int + */ + public function getReciprocity() + { + return $this->reciprocity; + } + + /** + * The grammatical reciprocity. + * + * Generated from protobuf field .google.cloud.language.v1.PartOfSpeech.Reciprocity reciprocity = 10; + * @param int $var + * @return $this + */ + public function setReciprocity($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Language\V1\PartOfSpeech\Reciprocity::class); + $this->reciprocity = $var; + + return $this; + } + + /** + * The grammatical tense. + * + * Generated from protobuf field .google.cloud.language.v1.PartOfSpeech.Tense tense = 11; + * @return int + */ + public function getTense() + { + return $this->tense; + } + + /** + * The grammatical tense. + * + * Generated from protobuf field .google.cloud.language.v1.PartOfSpeech.Tense tense = 11; + * @param int $var + * @return $this + */ + public function setTense($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Language\V1\PartOfSpeech\Tense::class); + $this->tense = $var; + + return $this; + } + + /** + * The grammatical voice. + * + * Generated from protobuf field .google.cloud.language.v1.PartOfSpeech.Voice voice = 12; + * @return int + */ + public function getVoice() + { + return $this->voice; + } + + /** + * The grammatical voice. + * + * Generated from protobuf field .google.cloud.language.v1.PartOfSpeech.Voice voice = 12; + * @param int $var + * @return $this + */ + public function setVoice($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Language\V1\PartOfSpeech\Voice::class); + $this->voice = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/PartOfSpeech/Aspect.php b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/PartOfSpeech/Aspect.php new file mode 100644 index 000000000000..95abc9c0df68 --- /dev/null +++ b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/PartOfSpeech/Aspect.php @@ -0,0 +1,71 @@ +google.cloud.language.v1.PartOfSpeech.Aspect + */ +class Aspect +{ + /** + * Aspect is not applicable in the analyzed language or is not predicted. + * + * Generated from protobuf enum ASPECT_UNKNOWN = 0; + */ + const ASPECT_UNKNOWN = 0; + /** + * Perfective + * + * Generated from protobuf enum PERFECTIVE = 1; + */ + const PERFECTIVE = 1; + /** + * Imperfective + * + * Generated from protobuf enum IMPERFECTIVE = 2; + */ + const IMPERFECTIVE = 2; + /** + * Progressive + * + * Generated from protobuf enum PROGRESSIVE = 3; + */ + const PROGRESSIVE = 3; + + private static $valueToName = [ + self::ASPECT_UNKNOWN => 'ASPECT_UNKNOWN', + self::PERFECTIVE => 'PERFECTIVE', + self::IMPERFECTIVE => 'IMPERFECTIVE', + self::PROGRESSIVE => 'PROGRESSIVE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Aspect::class, \Google\Cloud\Language\V1\PartOfSpeech_Aspect::class); + diff --git a/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/PartOfSpeech/Form.php b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/PartOfSpeech/Form.php new file mode 100644 index 000000000000..0d3977bbd54a --- /dev/null +++ b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/PartOfSpeech/Form.php @@ -0,0 +1,130 @@ +google.cloud.language.v1.PartOfSpeech.Form + */ +class Form +{ + /** + * Form is not applicable in the analyzed language or is not predicted. + * + * Generated from protobuf enum FORM_UNKNOWN = 0; + */ + const FORM_UNKNOWN = 0; + /** + * Adnomial + * + * Generated from protobuf enum ADNOMIAL = 1; + */ + const ADNOMIAL = 1; + /** + * Auxiliary + * + * Generated from protobuf enum AUXILIARY = 2; + */ + const AUXILIARY = 2; + /** + * Complementizer + * + * Generated from protobuf enum COMPLEMENTIZER = 3; + */ + const COMPLEMENTIZER = 3; + /** + * Final ending + * + * Generated from protobuf enum FINAL_ENDING = 4; + */ + const FINAL_ENDING = 4; + /** + * Gerund + * + * Generated from protobuf enum GERUND = 5; + */ + const GERUND = 5; + /** + * Realis + * + * Generated from protobuf enum REALIS = 6; + */ + const REALIS = 6; + /** + * Irrealis + * + * Generated from protobuf enum IRREALIS = 7; + */ + const IRREALIS = 7; + /** + * Short form + * + * Generated from protobuf enum SHORT = 8; + */ + const SHORT = 8; + /** + * Long form + * + * Generated from protobuf enum LONG = 9; + */ + const LONG = 9; + /** + * Order form + * + * Generated from protobuf enum ORDER = 10; + */ + const ORDER = 10; + /** + * Specific form + * + * Generated from protobuf enum SPECIFIC = 11; + */ + const SPECIFIC = 11; + + private static $valueToName = [ + self::FORM_UNKNOWN => 'FORM_UNKNOWN', + self::ADNOMIAL => 'ADNOMIAL', + self::AUXILIARY => 'AUXILIARY', + self::COMPLEMENTIZER => 'COMPLEMENTIZER', + self::FINAL_ENDING => 'FINAL_ENDING', + self::GERUND => 'GERUND', + self::REALIS => 'REALIS', + self::IRREALIS => 'IRREALIS', + self::SHORT => 'SHORT', + self::LONG => 'LONG', + self::ORDER => 'ORDER', + self::SPECIFIC => 'SPECIFIC', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Form::class, \Google\Cloud\Language\V1\PartOfSpeech_Form::class); + diff --git a/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/PartOfSpeech/Gender.php b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/PartOfSpeech/Gender.php new file mode 100644 index 000000000000..510fead88faf --- /dev/null +++ b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/PartOfSpeech/Gender.php @@ -0,0 +1,71 @@ +google.cloud.language.v1.PartOfSpeech.Gender + */ +class Gender +{ + /** + * Gender is not applicable in the analyzed language or is not predicted. + * + * Generated from protobuf enum GENDER_UNKNOWN = 0; + */ + const GENDER_UNKNOWN = 0; + /** + * Feminine + * + * Generated from protobuf enum FEMININE = 1; + */ + const FEMININE = 1; + /** + * Masculine + * + * Generated from protobuf enum MASCULINE = 2; + */ + const MASCULINE = 2; + /** + * Neuter + * + * Generated from protobuf enum NEUTER = 3; + */ + const NEUTER = 3; + + private static $valueToName = [ + self::GENDER_UNKNOWN => 'GENDER_UNKNOWN', + self::FEMININE => 'FEMININE', + self::MASCULINE => 'MASCULINE', + self::NEUTER => 'NEUTER', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Gender::class, \Google\Cloud\Language\V1\PartOfSpeech_Gender::class); + diff --git a/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/PartOfSpeech/Mood.php b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/PartOfSpeech/Mood.php new file mode 100644 index 000000000000..3b0c97066083 --- /dev/null +++ b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/PartOfSpeech/Mood.php @@ -0,0 +1,92 @@ +google.cloud.language.v1.PartOfSpeech.Mood + */ +class Mood +{ + /** + * Mood is not applicable in the analyzed language or is not predicted. + * + * Generated from protobuf enum MOOD_UNKNOWN = 0; + */ + const MOOD_UNKNOWN = 0; + /** + * Conditional + * + * Generated from protobuf enum CONDITIONAL_MOOD = 1; + */ + const CONDITIONAL_MOOD = 1; + /** + * Imperative + * + * Generated from protobuf enum IMPERATIVE = 2; + */ + const IMPERATIVE = 2; + /** + * Indicative + * + * Generated from protobuf enum INDICATIVE = 3; + */ + const INDICATIVE = 3; + /** + * Interrogative + * + * Generated from protobuf enum INTERROGATIVE = 4; + */ + const INTERROGATIVE = 4; + /** + * Jussive + * + * Generated from protobuf enum JUSSIVE = 5; + */ + const JUSSIVE = 5; + /** + * Subjunctive + * + * Generated from protobuf enum SUBJUNCTIVE = 6; + */ + const SUBJUNCTIVE = 6; + + private static $valueToName = [ + self::MOOD_UNKNOWN => 'MOOD_UNKNOWN', + self::CONDITIONAL_MOOD => 'CONDITIONAL_MOOD', + self::IMPERATIVE => 'IMPERATIVE', + self::INDICATIVE => 'INDICATIVE', + self::INTERROGATIVE => 'INTERROGATIVE', + self::JUSSIVE => 'JUSSIVE', + self::SUBJUNCTIVE => 'SUBJUNCTIVE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Mood::class, \Google\Cloud\Language\V1\PartOfSpeech_Mood::class); + diff --git a/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/PartOfSpeech/Number.php b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/PartOfSpeech/Number.php new file mode 100644 index 000000000000..1663eed86eb7 --- /dev/null +++ b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/PartOfSpeech/Number.php @@ -0,0 +1,71 @@ +google.cloud.language.v1.PartOfSpeech.Number + */ +class Number +{ + /** + * Number is not applicable in the analyzed language or is not predicted. + * + * Generated from protobuf enum NUMBER_UNKNOWN = 0; + */ + const NUMBER_UNKNOWN = 0; + /** + * Singular + * + * Generated from protobuf enum SINGULAR = 1; + */ + const SINGULAR = 1; + /** + * Plural + * + * Generated from protobuf enum PLURAL = 2; + */ + const PLURAL = 2; + /** + * Dual + * + * Generated from protobuf enum DUAL = 3; + */ + const DUAL = 3; + + private static $valueToName = [ + self::NUMBER_UNKNOWN => 'NUMBER_UNKNOWN', + self::SINGULAR => 'SINGULAR', + self::PLURAL => 'PLURAL', + self::DUAL => 'DUAL', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Number::class, \Google\Cloud\Language\V1\PartOfSpeech_Number::class); + diff --git a/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/PartOfSpeech/PBCase.php b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/PartOfSpeech/PBCase.php new file mode 100644 index 000000000000..156b6963e012 --- /dev/null +++ b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/PartOfSpeech/PBCase.php @@ -0,0 +1,150 @@ +google.cloud.language.v1.PartOfSpeech.Case + */ +class PBCase +{ + /** + * Case is not applicable in the analyzed language or is not predicted. + * + * Generated from protobuf enum CASE_UNKNOWN = 0; + */ + const CASE_UNKNOWN = 0; + /** + * Accusative + * + * Generated from protobuf enum ACCUSATIVE = 1; + */ + const ACCUSATIVE = 1; + /** + * Adverbial + * + * Generated from protobuf enum ADVERBIAL = 2; + */ + const ADVERBIAL = 2; + /** + * Complementive + * + * Generated from protobuf enum COMPLEMENTIVE = 3; + */ + const COMPLEMENTIVE = 3; + /** + * Dative + * + * Generated from protobuf enum DATIVE = 4; + */ + const DATIVE = 4; + /** + * Genitive + * + * Generated from protobuf enum GENITIVE = 5; + */ + const GENITIVE = 5; + /** + * Instrumental + * + * Generated from protobuf enum INSTRUMENTAL = 6; + */ + const INSTRUMENTAL = 6; + /** + * Locative + * + * Generated from protobuf enum LOCATIVE = 7; + */ + const LOCATIVE = 7; + /** + * Nominative + * + * Generated from protobuf enum NOMINATIVE = 8; + */ + const NOMINATIVE = 8; + /** + * Oblique + * + * Generated from protobuf enum OBLIQUE = 9; + */ + const OBLIQUE = 9; + /** + * Partitive + * + * Generated from protobuf enum PARTITIVE = 10; + */ + const PARTITIVE = 10; + /** + * Prepositional + * + * Generated from protobuf enum PREPOSITIONAL = 11; + */ + const PREPOSITIONAL = 11; + /** + * Reflexive + * + * Generated from protobuf enum REFLEXIVE_CASE = 12; + */ + const REFLEXIVE_CASE = 12; + /** + * Relative + * + * Generated from protobuf enum RELATIVE_CASE = 13; + */ + const RELATIVE_CASE = 13; + /** + * Vocative + * + * Generated from protobuf enum VOCATIVE = 14; + */ + const VOCATIVE = 14; + + private static $valueToName = [ + self::CASE_UNKNOWN => 'CASE_UNKNOWN', + self::ACCUSATIVE => 'ACCUSATIVE', + self::ADVERBIAL => 'ADVERBIAL', + self::COMPLEMENTIVE => 'COMPLEMENTIVE', + self::DATIVE => 'DATIVE', + self::GENITIVE => 'GENITIVE', + self::INSTRUMENTAL => 'INSTRUMENTAL', + self::LOCATIVE => 'LOCATIVE', + self::NOMINATIVE => 'NOMINATIVE', + self::OBLIQUE => 'OBLIQUE', + self::PARTITIVE => 'PARTITIVE', + self::PREPOSITIONAL => 'PREPOSITIONAL', + self::REFLEXIVE_CASE => 'REFLEXIVE_CASE', + self::RELATIVE_CASE => 'RELATIVE_CASE', + self::VOCATIVE => 'VOCATIVE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(PBCase::class, \Google\Cloud\Language\V1\PartOfSpeech_Case::class); + diff --git a/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/PartOfSpeech/Person.php b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/PartOfSpeech/Person.php new file mode 100644 index 000000000000..ba1a5a463fed --- /dev/null +++ b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/PartOfSpeech/Person.php @@ -0,0 +1,78 @@ +google.cloud.language.v1.PartOfSpeech.Person + */ +class Person +{ + /** + * Person is not applicable in the analyzed language or is not predicted. + * + * Generated from protobuf enum PERSON_UNKNOWN = 0; + */ + const PERSON_UNKNOWN = 0; + /** + * First + * + * Generated from protobuf enum FIRST = 1; + */ + const FIRST = 1; + /** + * Second + * + * Generated from protobuf enum SECOND = 2; + */ + const SECOND = 2; + /** + * Third + * + * Generated from protobuf enum THIRD = 3; + */ + const THIRD = 3; + /** + * Reflexive + * + * Generated from protobuf enum REFLEXIVE_PERSON = 4; + */ + const REFLEXIVE_PERSON = 4; + + private static $valueToName = [ + self::PERSON_UNKNOWN => 'PERSON_UNKNOWN', + self::FIRST => 'FIRST', + self::SECOND => 'SECOND', + self::THIRD => 'THIRD', + self::REFLEXIVE_PERSON => 'REFLEXIVE_PERSON', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Person::class, \Google\Cloud\Language\V1\PartOfSpeech_Person::class); + diff --git a/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/PartOfSpeech/Proper.php b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/PartOfSpeech/Proper.php new file mode 100644 index 000000000000..694ba0a32b40 --- /dev/null +++ b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/PartOfSpeech/Proper.php @@ -0,0 +1,64 @@ +google.cloud.language.v1.PartOfSpeech.Proper + */ +class Proper +{ + /** + * Proper is not applicable in the analyzed language or is not predicted. + * + * Generated from protobuf enum PROPER_UNKNOWN = 0; + */ + const PROPER_UNKNOWN = 0; + /** + * Proper + * + * Generated from protobuf enum PROPER = 1; + */ + const PROPER = 1; + /** + * Not proper + * + * Generated from protobuf enum NOT_PROPER = 2; + */ + const NOT_PROPER = 2; + + private static $valueToName = [ + self::PROPER_UNKNOWN => 'PROPER_UNKNOWN', + self::PROPER => 'PROPER', + self::NOT_PROPER => 'NOT_PROPER', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Proper::class, \Google\Cloud\Language\V1\PartOfSpeech_Proper::class); + diff --git a/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/PartOfSpeech/Reciprocity.php b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/PartOfSpeech/Reciprocity.php new file mode 100644 index 000000000000..c849d6e3463c --- /dev/null +++ b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/PartOfSpeech/Reciprocity.php @@ -0,0 +1,65 @@ +google.cloud.language.v1.PartOfSpeech.Reciprocity + */ +class Reciprocity +{ + /** + * Reciprocity is not applicable in the analyzed language or is not + * predicted. + * + * Generated from protobuf enum RECIPROCITY_UNKNOWN = 0; + */ + const RECIPROCITY_UNKNOWN = 0; + /** + * Reciprocal + * + * Generated from protobuf enum RECIPROCAL = 1; + */ + const RECIPROCAL = 1; + /** + * Non-reciprocal + * + * Generated from protobuf enum NON_RECIPROCAL = 2; + */ + const NON_RECIPROCAL = 2; + + private static $valueToName = [ + self::RECIPROCITY_UNKNOWN => 'RECIPROCITY_UNKNOWN', + self::RECIPROCAL => 'RECIPROCAL', + self::NON_RECIPROCAL => 'NON_RECIPROCAL', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Reciprocity::class, \Google\Cloud\Language\V1\PartOfSpeech_Reciprocity::class); + diff --git a/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/PartOfSpeech/Tag.php b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/PartOfSpeech/Tag.php new file mode 100644 index 000000000000..3e67b7be11ae --- /dev/null +++ b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/PartOfSpeech/Tag.php @@ -0,0 +1,141 @@ +google.cloud.language.v1.PartOfSpeech.Tag + */ +class Tag +{ + /** + * Unknown + * + * Generated from protobuf enum UNKNOWN = 0; + */ + const UNKNOWN = 0; + /** + * Adjective + * + * Generated from protobuf enum ADJ = 1; + */ + const ADJ = 1; + /** + * Adposition (preposition and postposition) + * + * Generated from protobuf enum ADP = 2; + */ + const ADP = 2; + /** + * Adverb + * + * Generated from protobuf enum ADV = 3; + */ + const ADV = 3; + /** + * Conjunction + * + * Generated from protobuf enum CONJ = 4; + */ + const CONJ = 4; + /** + * Determiner + * + * Generated from protobuf enum DET = 5; + */ + const DET = 5; + /** + * Noun (common and proper) + * + * Generated from protobuf enum NOUN = 6; + */ + const NOUN = 6; + /** + * Cardinal number + * + * Generated from protobuf enum NUM = 7; + */ + const NUM = 7; + /** + * Pronoun + * + * Generated from protobuf enum PRON = 8; + */ + const PRON = 8; + /** + * Particle or other function word + * + * Generated from protobuf enum PRT = 9; + */ + const PRT = 9; + /** + * Punctuation + * + * Generated from protobuf enum PUNCT = 10; + */ + const PUNCT = 10; + /** + * Verb (all tenses and modes) + * + * Generated from protobuf enum VERB = 11; + */ + const VERB = 11; + /** + * Other: foreign words, typos, abbreviations + * + * Generated from protobuf enum X = 12; + */ + const X = 12; + /** + * Affix + * + * Generated from protobuf enum AFFIX = 13; + */ + const AFFIX = 13; + + private static $valueToName = [ + self::UNKNOWN => 'UNKNOWN', + self::ADJ => 'ADJ', + self::ADP => 'ADP', + self::ADV => 'ADV', + self::CONJ => 'CONJ', + self::DET => 'DET', + self::NOUN => 'NOUN', + self::NUM => 'NUM', + self::PRON => 'PRON', + self::PRT => 'PRT', + self::PUNCT => 'PUNCT', + self::VERB => 'VERB', + self::X => 'X', + self::AFFIX => 'AFFIX', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Tag::class, \Google\Cloud\Language\V1\PartOfSpeech_Tag::class); + diff --git a/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/PartOfSpeech/Tense.php b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/PartOfSpeech/Tense.php new file mode 100644 index 000000000000..3d0e65618a04 --- /dev/null +++ b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/PartOfSpeech/Tense.php @@ -0,0 +1,92 @@ +google.cloud.language.v1.PartOfSpeech.Tense + */ +class Tense +{ + /** + * Tense is not applicable in the analyzed language or is not predicted. + * + * Generated from protobuf enum TENSE_UNKNOWN = 0; + */ + const TENSE_UNKNOWN = 0; + /** + * Conditional + * + * Generated from protobuf enum CONDITIONAL_TENSE = 1; + */ + const CONDITIONAL_TENSE = 1; + /** + * Future + * + * Generated from protobuf enum FUTURE = 2; + */ + const FUTURE = 2; + /** + * Past + * + * Generated from protobuf enum PAST = 3; + */ + const PAST = 3; + /** + * Present + * + * Generated from protobuf enum PRESENT = 4; + */ + const PRESENT = 4; + /** + * Imperfect + * + * Generated from protobuf enum IMPERFECT = 5; + */ + const IMPERFECT = 5; + /** + * Pluperfect + * + * Generated from protobuf enum PLUPERFECT = 6; + */ + const PLUPERFECT = 6; + + private static $valueToName = [ + self::TENSE_UNKNOWN => 'TENSE_UNKNOWN', + self::CONDITIONAL_TENSE => 'CONDITIONAL_TENSE', + self::FUTURE => 'FUTURE', + self::PAST => 'PAST', + self::PRESENT => 'PRESENT', + self::IMPERFECT => 'IMPERFECT', + self::PLUPERFECT => 'PLUPERFECT', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Tense::class, \Google\Cloud\Language\V1\PartOfSpeech_Tense::class); + diff --git a/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/PartOfSpeech/Voice.php b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/PartOfSpeech/Voice.php new file mode 100644 index 000000000000..ea5996d4fe4d --- /dev/null +++ b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/PartOfSpeech/Voice.php @@ -0,0 +1,72 @@ +google.cloud.language.v1.PartOfSpeech.Voice + */ +class Voice +{ + /** + * Voice is not applicable in the analyzed language or is not predicted. + * + * Generated from protobuf enum VOICE_UNKNOWN = 0; + */ + const VOICE_UNKNOWN = 0; + /** + * Active + * + * Generated from protobuf enum ACTIVE = 1; + */ + const ACTIVE = 1; + /** + * Causative + * + * Generated from protobuf enum CAUSATIVE = 2; + */ + const CAUSATIVE = 2; + /** + * Passive + * + * Generated from protobuf enum PASSIVE = 3; + */ + const PASSIVE = 3; + + private static $valueToName = [ + self::VOICE_UNKNOWN => 'VOICE_UNKNOWN', + self::ACTIVE => 'ACTIVE', + self::CAUSATIVE => 'CAUSATIVE', + self::PASSIVE => 'PASSIVE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Voice::class, \Google\Cloud\Language\V1\PartOfSpeech_Voice::class); + diff --git a/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/PartOfSpeech_Aspect.php b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/PartOfSpeech_Aspect.php new file mode 100644 index 000000000000..87d4732dd0ef --- /dev/null +++ b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/PartOfSpeech_Aspect.php @@ -0,0 +1,16 @@ +google.cloud.language.v1.Sentence + */ +class Sentence extends \Google\Protobuf\Internal\Message +{ + /** + * The sentence text. + * + * Generated from protobuf field .google.cloud.language.v1.TextSpan text = 1; + */ + protected $text = null; + /** + * For calls to [AnalyzeSentiment][] or if + * [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_document_sentiment] + * is set to true, this field will contain the sentiment for the sentence. + * + * Generated from protobuf field .google.cloud.language.v1.Sentiment sentiment = 2; + */ + protected $sentiment = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Language\V1\TextSpan $text + * The sentence text. + * @type \Google\Cloud\Language\V1\Sentiment $sentiment + * For calls to [AnalyzeSentiment][] or if + * [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_document_sentiment] + * is set to true, this field will contain the sentiment for the sentence. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Language\V1\LanguageService::initOnce(); + parent::__construct($data); + } + + /** + * The sentence text. + * + * Generated from protobuf field .google.cloud.language.v1.TextSpan text = 1; + * @return \Google\Cloud\Language\V1\TextSpan|null + */ + public function getText() + { + return $this->text; + } + + public function hasText() + { + return isset($this->text); + } + + public function clearText() + { + unset($this->text); + } + + /** + * The sentence text. + * + * Generated from protobuf field .google.cloud.language.v1.TextSpan text = 1; + * @param \Google\Cloud\Language\V1\TextSpan $var + * @return $this + */ + public function setText($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Language\V1\TextSpan::class); + $this->text = $var; + + return $this; + } + + /** + * For calls to [AnalyzeSentiment][] or if + * [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_document_sentiment] + * is set to true, this field will contain the sentiment for the sentence. + * + * Generated from protobuf field .google.cloud.language.v1.Sentiment sentiment = 2; + * @return \Google\Cloud\Language\V1\Sentiment|null + */ + public function getSentiment() + { + return $this->sentiment; + } + + public function hasSentiment() + { + return isset($this->sentiment); + } + + public function clearSentiment() + { + unset($this->sentiment); + } + + /** + * For calls to [AnalyzeSentiment][] or if + * [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_document_sentiment] + * is set to true, this field will contain the sentiment for the sentence. + * + * Generated from protobuf field .google.cloud.language.v1.Sentiment sentiment = 2; + * @param \Google\Cloud\Language\V1\Sentiment $var + * @return $this + */ + public function setSentiment($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Language\V1\Sentiment::class); + $this->sentiment = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/Sentiment.php b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/Sentiment.php new file mode 100644 index 000000000000..f58d7d6a31be --- /dev/null +++ b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/Sentiment.php @@ -0,0 +1,114 @@ +google.cloud.language.v1.Sentiment + */ +class Sentiment extends \Google\Protobuf\Internal\Message +{ + /** + * A non-negative number in the [0, +inf) range, which represents + * the absolute magnitude of sentiment regardless of score (positive or + * negative). + * + * Generated from protobuf field float magnitude = 2; + */ + protected $magnitude = 0.0; + /** + * Sentiment score between -1.0 (negative sentiment) and 1.0 + * (positive sentiment). + * + * Generated from protobuf field float score = 3; + */ + protected $score = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type float $magnitude + * A non-negative number in the [0, +inf) range, which represents + * the absolute magnitude of sentiment regardless of score (positive or + * negative). + * @type float $score + * Sentiment score between -1.0 (negative sentiment) and 1.0 + * (positive sentiment). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Language\V1\LanguageService::initOnce(); + parent::__construct($data); + } + + /** + * A non-negative number in the [0, +inf) range, which represents + * the absolute magnitude of sentiment regardless of score (positive or + * negative). + * + * Generated from protobuf field float magnitude = 2; + * @return float + */ + public function getMagnitude() + { + return $this->magnitude; + } + + /** + * A non-negative number in the [0, +inf) range, which represents + * the absolute magnitude of sentiment regardless of score (positive or + * negative). + * + * Generated from protobuf field float magnitude = 2; + * @param float $var + * @return $this + */ + public function setMagnitude($var) + { + GPBUtil::checkFloat($var); + $this->magnitude = $var; + + return $this; + } + + /** + * Sentiment score between -1.0 (negative sentiment) and 1.0 + * (positive sentiment). + * + * Generated from protobuf field float score = 3; + * @return float + */ + public function getScore() + { + return $this->score; + } + + /** + * Sentiment score between -1.0 (negative sentiment) and 1.0 + * (positive sentiment). + * + * Generated from protobuf field float score = 3; + * @param float $var + * @return $this + */ + public function setScore($var) + { + GPBUtil::checkFloat($var); + $this->score = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/TextSpan.php b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/TextSpan.php new file mode 100644 index 000000000000..0f4018a1b30f --- /dev/null +++ b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/TextSpan.php @@ -0,0 +1,113 @@ +google.cloud.language.v1.TextSpan + */ +class TextSpan extends \Google\Protobuf\Internal\Message +{ + /** + * The content of the output text. + * + * Generated from protobuf field string content = 1; + */ + protected $content = ''; + /** + * The API calculates the beginning offset of the content in the original + * document according to the + * [EncodingType][google.cloud.language.v1.EncodingType] specified in the API + * request. + * + * Generated from protobuf field int32 begin_offset = 2; + */ + protected $begin_offset = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $content + * The content of the output text. + * @type int $begin_offset + * The API calculates the beginning offset of the content in the original + * document according to the + * [EncodingType][google.cloud.language.v1.EncodingType] specified in the API + * request. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Language\V1\LanguageService::initOnce(); + parent::__construct($data); + } + + /** + * The content of the output text. + * + * Generated from protobuf field string content = 1; + * @return string + */ + public function getContent() + { + return $this->content; + } + + /** + * The content of the output text. + * + * Generated from protobuf field string content = 1; + * @param string $var + * @return $this + */ + public function setContent($var) + { + GPBUtil::checkString($var, True); + $this->content = $var; + + return $this; + } + + /** + * The API calculates the beginning offset of the content in the original + * document according to the + * [EncodingType][google.cloud.language.v1.EncodingType] specified in the API + * request. + * + * Generated from protobuf field int32 begin_offset = 2; + * @return int + */ + public function getBeginOffset() + { + return $this->begin_offset; + } + + /** + * The API calculates the beginning offset of the content in the original + * document according to the + * [EncodingType][google.cloud.language.v1.EncodingType] specified in the API + * request. + * + * Generated from protobuf field int32 begin_offset = 2; + * @param int $var + * @return $this + */ + public function setBeginOffset($var) + { + GPBUtil::checkInt32($var); + $this->begin_offset = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/Token.php b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/Token.php new file mode 100644 index 000000000000..f01477f0c5d6 --- /dev/null +++ b/owl-bot-staging/Language/v1/proto/src/Google/Cloud/Language/V1/Token.php @@ -0,0 +1,199 @@ +google.cloud.language.v1.Token + */ +class Token extends \Google\Protobuf\Internal\Message +{ + /** + * The token text. + * + * Generated from protobuf field .google.cloud.language.v1.TextSpan text = 1; + */ + protected $text = null; + /** + * Parts of speech tag for this token. + * + * Generated from protobuf field .google.cloud.language.v1.PartOfSpeech part_of_speech = 2; + */ + protected $part_of_speech = null; + /** + * Dependency tree parse for this token. + * + * Generated from protobuf field .google.cloud.language.v1.DependencyEdge dependency_edge = 3; + */ + protected $dependency_edge = null; + /** + * [Lemma](https://en.wikipedia.org/wiki/Lemma_%28morphology%29) of the token. + * + * Generated from protobuf field string lemma = 4; + */ + protected $lemma = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Language\V1\TextSpan $text + * The token text. + * @type \Google\Cloud\Language\V1\PartOfSpeech $part_of_speech + * Parts of speech tag for this token. + * @type \Google\Cloud\Language\V1\DependencyEdge $dependency_edge + * Dependency tree parse for this token. + * @type string $lemma + * [Lemma](https://en.wikipedia.org/wiki/Lemma_%28morphology%29) of the token. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Language\V1\LanguageService::initOnce(); + parent::__construct($data); + } + + /** + * The token text. + * + * Generated from protobuf field .google.cloud.language.v1.TextSpan text = 1; + * @return \Google\Cloud\Language\V1\TextSpan|null + */ + public function getText() + { + return $this->text; + } + + public function hasText() + { + return isset($this->text); + } + + public function clearText() + { + unset($this->text); + } + + /** + * The token text. + * + * Generated from protobuf field .google.cloud.language.v1.TextSpan text = 1; + * @param \Google\Cloud\Language\V1\TextSpan $var + * @return $this + */ + public function setText($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Language\V1\TextSpan::class); + $this->text = $var; + + return $this; + } + + /** + * Parts of speech tag for this token. + * + * Generated from protobuf field .google.cloud.language.v1.PartOfSpeech part_of_speech = 2; + * @return \Google\Cloud\Language\V1\PartOfSpeech|null + */ + public function getPartOfSpeech() + { + return $this->part_of_speech; + } + + public function hasPartOfSpeech() + { + return isset($this->part_of_speech); + } + + public function clearPartOfSpeech() + { + unset($this->part_of_speech); + } + + /** + * Parts of speech tag for this token. + * + * Generated from protobuf field .google.cloud.language.v1.PartOfSpeech part_of_speech = 2; + * @param \Google\Cloud\Language\V1\PartOfSpeech $var + * @return $this + */ + public function setPartOfSpeech($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Language\V1\PartOfSpeech::class); + $this->part_of_speech = $var; + + return $this; + } + + /** + * Dependency tree parse for this token. + * + * Generated from protobuf field .google.cloud.language.v1.DependencyEdge dependency_edge = 3; + * @return \Google\Cloud\Language\V1\DependencyEdge|null + */ + public function getDependencyEdge() + { + return $this->dependency_edge; + } + + public function hasDependencyEdge() + { + return isset($this->dependency_edge); + } + + public function clearDependencyEdge() + { + unset($this->dependency_edge); + } + + /** + * Dependency tree parse for this token. + * + * Generated from protobuf field .google.cloud.language.v1.DependencyEdge dependency_edge = 3; + * @param \Google\Cloud\Language\V1\DependencyEdge $var + * @return $this + */ + public function setDependencyEdge($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Language\V1\DependencyEdge::class); + $this->dependency_edge = $var; + + return $this; + } + + /** + * [Lemma](https://en.wikipedia.org/wiki/Lemma_%28morphology%29) of the token. + * + * Generated from protobuf field string lemma = 4; + * @return string + */ + public function getLemma() + { + return $this->lemma; + } + + /** + * [Lemma](https://en.wikipedia.org/wiki/Lemma_%28morphology%29) of the token. + * + * Generated from protobuf field string lemma = 4; + * @param string $var + * @return $this + */ + public function setLemma($var) + { + GPBUtil::checkString($var, True); + $this->lemma = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Language/v1/samples/V1/LanguageServiceClient/analyze_entities.php b/owl-bot-staging/Language/v1/samples/V1/LanguageServiceClient/analyze_entities.php new file mode 100644 index 000000000000..819459ffb848 --- /dev/null +++ b/owl-bot-staging/Language/v1/samples/V1/LanguageServiceClient/analyze_entities.php @@ -0,0 +1,62 @@ +setDocument($document); + + // Call the API and handle any network failures. + try { + /** @var AnalyzeEntitiesResponse $response */ + $response = $languageServiceClient->analyzeEntities($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END language_v1_generated_LanguageService_AnalyzeEntities_sync] diff --git a/owl-bot-staging/Language/v1/samples/V1/LanguageServiceClient/analyze_entity_sentiment.php b/owl-bot-staging/Language/v1/samples/V1/LanguageServiceClient/analyze_entity_sentiment.php new file mode 100644 index 000000000000..3c44985c6de7 --- /dev/null +++ b/owl-bot-staging/Language/v1/samples/V1/LanguageServiceClient/analyze_entity_sentiment.php @@ -0,0 +1,63 @@ +setDocument($document); + + // Call the API and handle any network failures. + try { + /** @var AnalyzeEntitySentimentResponse $response */ + $response = $languageServiceClient->analyzeEntitySentiment($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END language_v1_generated_LanguageService_AnalyzeEntitySentiment_sync] diff --git a/owl-bot-staging/Language/v1/samples/V1/LanguageServiceClient/analyze_sentiment.php b/owl-bot-staging/Language/v1/samples/V1/LanguageServiceClient/analyze_sentiment.php new file mode 100644 index 000000000000..626200ac9017 --- /dev/null +++ b/owl-bot-staging/Language/v1/samples/V1/LanguageServiceClient/analyze_sentiment.php @@ -0,0 +1,60 @@ +setDocument($document); + + // Call the API and handle any network failures. + try { + /** @var AnalyzeSentimentResponse $response */ + $response = $languageServiceClient->analyzeSentiment($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END language_v1_generated_LanguageService_AnalyzeSentiment_sync] diff --git a/owl-bot-staging/Language/v1/samples/V1/LanguageServiceClient/analyze_syntax.php b/owl-bot-staging/Language/v1/samples/V1/LanguageServiceClient/analyze_syntax.php new file mode 100644 index 000000000000..4a8547df4c76 --- /dev/null +++ b/owl-bot-staging/Language/v1/samples/V1/LanguageServiceClient/analyze_syntax.php @@ -0,0 +1,62 @@ +setDocument($document); + + // Call the API and handle any network failures. + try { + /** @var AnalyzeSyntaxResponse $response */ + $response = $languageServiceClient->analyzeSyntax($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END language_v1_generated_LanguageService_AnalyzeSyntax_sync] diff --git a/owl-bot-staging/Language/v1/samples/V1/LanguageServiceClient/annotate_text.php b/owl-bot-staging/Language/v1/samples/V1/LanguageServiceClient/annotate_text.php new file mode 100644 index 000000000000..ba5235cfeb56 --- /dev/null +++ b/owl-bot-staging/Language/v1/samples/V1/LanguageServiceClient/annotate_text.php @@ -0,0 +1,64 @@ +setDocument($document) + ->setFeatures($features); + + // Call the API and handle any network failures. + try { + /** @var AnnotateTextResponse $response */ + $response = $languageServiceClient->annotateText($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END language_v1_generated_LanguageService_AnnotateText_sync] diff --git a/owl-bot-staging/Language/v1/samples/V1/LanguageServiceClient/classify_text.php b/owl-bot-staging/Language/v1/samples/V1/LanguageServiceClient/classify_text.php new file mode 100644 index 000000000000..358d689c8b6d --- /dev/null +++ b/owl-bot-staging/Language/v1/samples/V1/LanguageServiceClient/classify_text.php @@ -0,0 +1,60 @@ +setDocument($document); + + // Call the API and handle any network failures. + try { + /** @var ClassifyTextResponse $response */ + $response = $languageServiceClient->classifyText($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END language_v1_generated_LanguageService_ClassifyText_sync] diff --git a/owl-bot-staging/Language/v1/src/V1/Client/BaseClient/LanguageServiceBaseClient.php b/owl-bot-staging/Language/v1/src/V1/Client/BaseClient/LanguageServiceBaseClient.php new file mode 100644 index 000000000000..e3eaabbe8f9a --- /dev/null +++ b/owl-bot-staging/Language/v1/src/V1/Client/BaseClient/LanguageServiceBaseClient.php @@ -0,0 +1,331 @@ + self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../../resources/language_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../../resources/language_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../../resources/language_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../../resources/language_service_rest_client_config.php', + ], + ], + ]; + } + + /** + * 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 'language.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. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *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' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods 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); + } + + /** 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); + } + + /** + * Finds named entities (currently proper names and common nouns) in the text + * along with entity types, salience, mentions for each entity, and + * other properties. + * + * The async variant is {@see self::analyzeEntitiesAsync()} . + * + * @param AnalyzeEntitiesRequest $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 AnalyzeEntitiesResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function analyzeEntities(AnalyzeEntitiesRequest $request, array $callOptions = []): AnalyzeEntitiesResponse + { + return $this->startApiCall('AnalyzeEntities', $request, $callOptions)->wait(); + } + + /** + * Finds entities, similar to + * [AnalyzeEntities][google.cloud.language.v1.LanguageService.AnalyzeEntities] + * in the text and analyzes sentiment associated with each entity and its + * mentions. + * + * The async variant is {@see self::analyzeEntitySentimentAsync()} . + * + * @param AnalyzeEntitySentimentRequest $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 AnalyzeEntitySentimentResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function analyzeEntitySentiment(AnalyzeEntitySentimentRequest $request, array $callOptions = []): AnalyzeEntitySentimentResponse + { + return $this->startApiCall('AnalyzeEntitySentiment', $request, $callOptions)->wait(); + } + + /** + * Analyzes the sentiment of the provided text. + * + * The async variant is {@see self::analyzeSentimentAsync()} . + * + * @param AnalyzeSentimentRequest $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 AnalyzeSentimentResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function analyzeSentiment(AnalyzeSentimentRequest $request, array $callOptions = []): AnalyzeSentimentResponse + { + return $this->startApiCall('AnalyzeSentiment', $request, $callOptions)->wait(); + } + + /** + * Analyzes the syntax of the text and provides sentence boundaries and + * tokenization along with part of speech tags, dependency trees, and other + * properties. + * + * The async variant is {@see self::analyzeSyntaxAsync()} . + * + * @param AnalyzeSyntaxRequest $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 AnalyzeSyntaxResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function analyzeSyntax(AnalyzeSyntaxRequest $request, array $callOptions = []): AnalyzeSyntaxResponse + { + return $this->startApiCall('AnalyzeSyntax', $request, $callOptions)->wait(); + } + + /** + * A convenience method that provides all the features that analyzeSentiment, + * analyzeEntities, and analyzeSyntax provide in one call. + * + * The async variant is {@see self::annotateTextAsync()} . + * + * @param AnnotateTextRequest $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 AnnotateTextResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function annotateText(AnnotateTextRequest $request, array $callOptions = []): AnnotateTextResponse + { + return $this->startApiCall('AnnotateText', $request, $callOptions)->wait(); + } + + /** + * Classifies a document into categories. + * + * The async variant is {@see self::classifyTextAsync()} . + * + * @param ClassifyTextRequest $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 ClassifyTextResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function classifyText(ClassifyTextRequest $request, array $callOptions = []): ClassifyTextResponse + { + return $this->startApiCall('ClassifyText', $request, $callOptions)->wait(); + } +} diff --git a/owl-bot-staging/Language/v1/src/V1/Client/LanguageServiceClient.php b/owl-bot-staging/Language/v1/src/V1/Client/LanguageServiceClient.php new file mode 100644 index 000000000000..ea36ac6cff22 --- /dev/null +++ b/owl-bot-staging/Language/v1/src/V1/Client/LanguageServiceClient.php @@ -0,0 +1,40 @@ +analyzeEntities($document); + * } finally { + * $languageServiceClient->close(); + * } + * ``` + */ +class LanguageServiceGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.language.v1.LanguageService'; + + /** The default address of the service. */ + const SERVICE_ADDRESS = 'language.googleapis.com'; + + /** The default port of the service. */ + const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-language', + 'https://www.googleapis.com/auth/cloud-platform', + ]; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/language_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/language_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/language_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/language_service_rest_client_config.php', + ], + ], + ]; + } + + /** + * 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 'language.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. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *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' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods 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); + } + + /** + * Finds named entities (currently proper names and common nouns) in the text + * along with entity types, salience, mentions for each entity, and + * other properties. + * + * Sample code: + * ``` + * $languageServiceClient = new LanguageServiceClient(); + * try { + * $document = new Document(); + * $response = $languageServiceClient->analyzeEntities($document); + * } finally { + * $languageServiceClient->close(); + * } + * ``` + * + * @param Document $document Required. Input document. + * @param array $optionalArgs { + * Optional. + * + * @type int $encodingType + * The encoding type used by the API to calculate offsets. + * For allowed values, use constants defined on {@see \Google\Cloud\Language\V1\EncodingType} + * @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 \Google\Cloud\Language\V1\AnalyzeEntitiesResponse + * + * @throws ApiException if the remote call fails + */ + public function analyzeEntities($document, array $optionalArgs = []) + { + $request = new AnalyzeEntitiesRequest(); + $request->setDocument($document); + if (isset($optionalArgs['encodingType'])) { + $request->setEncodingType($optionalArgs['encodingType']); + } + + return $this->startCall('AnalyzeEntities', AnalyzeEntitiesResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Finds entities, similar to + * [AnalyzeEntities][google.cloud.language.v1.LanguageService.AnalyzeEntities] + * in the text and analyzes sentiment associated with each entity and its + * mentions. + * + * Sample code: + * ``` + * $languageServiceClient = new LanguageServiceClient(); + * try { + * $document = new Document(); + * $response = $languageServiceClient->analyzeEntitySentiment($document); + * } finally { + * $languageServiceClient->close(); + * } + * ``` + * + * @param Document $document Required. Input document. + * @param array $optionalArgs { + * Optional. + * + * @type int $encodingType + * The encoding type used by the API to calculate offsets. + * For allowed values, use constants defined on {@see \Google\Cloud\Language\V1\EncodingType} + * @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 \Google\Cloud\Language\V1\AnalyzeEntitySentimentResponse + * + * @throws ApiException if the remote call fails + */ + public function analyzeEntitySentiment($document, array $optionalArgs = []) + { + $request = new AnalyzeEntitySentimentRequest(); + $request->setDocument($document); + if (isset($optionalArgs['encodingType'])) { + $request->setEncodingType($optionalArgs['encodingType']); + } + + return $this->startCall('AnalyzeEntitySentiment', AnalyzeEntitySentimentResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Analyzes the sentiment of the provided text. + * + * Sample code: + * ``` + * $languageServiceClient = new LanguageServiceClient(); + * try { + * $document = new Document(); + * $response = $languageServiceClient->analyzeSentiment($document); + * } finally { + * $languageServiceClient->close(); + * } + * ``` + * + * @param Document $document Required. Input document. + * @param array $optionalArgs { + * Optional. + * + * @type int $encodingType + * The encoding type used by the API to calculate sentence offsets. + * For allowed values, use constants defined on {@see \Google\Cloud\Language\V1\EncodingType} + * @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 \Google\Cloud\Language\V1\AnalyzeSentimentResponse + * + * @throws ApiException if the remote call fails + */ + public function analyzeSentiment($document, array $optionalArgs = []) + { + $request = new AnalyzeSentimentRequest(); + $request->setDocument($document); + if (isset($optionalArgs['encodingType'])) { + $request->setEncodingType($optionalArgs['encodingType']); + } + + return $this->startCall('AnalyzeSentiment', AnalyzeSentimentResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Analyzes the syntax of the text and provides sentence boundaries and + * tokenization along with part of speech tags, dependency trees, and other + * properties. + * + * Sample code: + * ``` + * $languageServiceClient = new LanguageServiceClient(); + * try { + * $document = new Document(); + * $response = $languageServiceClient->analyzeSyntax($document); + * } finally { + * $languageServiceClient->close(); + * } + * ``` + * + * @param Document $document Required. Input document. + * @param array $optionalArgs { + * Optional. + * + * @type int $encodingType + * The encoding type used by the API to calculate offsets. + * For allowed values, use constants defined on {@see \Google\Cloud\Language\V1\EncodingType} + * @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 \Google\Cloud\Language\V1\AnalyzeSyntaxResponse + * + * @throws ApiException if the remote call fails + */ + public function analyzeSyntax($document, array $optionalArgs = []) + { + $request = new AnalyzeSyntaxRequest(); + $request->setDocument($document); + if (isset($optionalArgs['encodingType'])) { + $request->setEncodingType($optionalArgs['encodingType']); + } + + return $this->startCall('AnalyzeSyntax', AnalyzeSyntaxResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * A convenience method that provides all the features that analyzeSentiment, + * analyzeEntities, and analyzeSyntax provide in one call. + * + * Sample code: + * ``` + * $languageServiceClient = new LanguageServiceClient(); + * try { + * $document = new Document(); + * $features = new Features(); + * $response = $languageServiceClient->annotateText($document, $features); + * } finally { + * $languageServiceClient->close(); + * } + * ``` + * + * @param Document $document Required. Input document. + * @param Features $features Required. The enabled features. + * @param array $optionalArgs { + * Optional. + * + * @type int $encodingType + * The encoding type used by the API to calculate offsets. + * For allowed values, use constants defined on {@see \Google\Cloud\Language\V1\EncodingType} + * @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 \Google\Cloud\Language\V1\AnnotateTextResponse + * + * @throws ApiException if the remote call fails + */ + public function annotateText($document, $features, array $optionalArgs = []) + { + $request = new AnnotateTextRequest(); + $request->setDocument($document); + $request->setFeatures($features); + if (isset($optionalArgs['encodingType'])) { + $request->setEncodingType($optionalArgs['encodingType']); + } + + return $this->startCall('AnnotateText', AnnotateTextResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Classifies a document into categories. + * + * Sample code: + * ``` + * $languageServiceClient = new LanguageServiceClient(); + * try { + * $document = new Document(); + * $response = $languageServiceClient->classifyText($document); + * } finally { + * $languageServiceClient->close(); + * } + * ``` + * + * @param Document $document Required. Input document. + * @param array $optionalArgs { + * Optional. + * + * @type ClassificationModelOptions $classificationModelOptions + * Model options to use for classification. Defaults to v1 options if not + * specified. + * @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 \Google\Cloud\Language\V1\ClassifyTextResponse + * + * @throws ApiException if the remote call fails + */ + public function classifyText($document, array $optionalArgs = []) + { + $request = new ClassifyTextRequest(); + $request->setDocument($document); + if (isset($optionalArgs['classificationModelOptions'])) { + $request->setClassificationModelOptions($optionalArgs['classificationModelOptions']); + } + + return $this->startCall('ClassifyText', ClassifyTextResponse::class, $optionalArgs, $request)->wait(); + } +} diff --git a/owl-bot-staging/Language/v1/src/V1/LanguageServiceClient.php b/owl-bot-staging/Language/v1/src/V1/LanguageServiceClient.php new file mode 100644 index 000000000000..09380dea0630 --- /dev/null +++ b/owl-bot-staging/Language/v1/src/V1/LanguageServiceClient.php @@ -0,0 +1,34 @@ + [ + 'google.cloud.language.v1.LanguageService' => [ + 'AnalyzeEntities' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Language\V1\AnalyzeEntitiesResponse', + ], + 'AnalyzeEntitySentiment' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Language\V1\AnalyzeEntitySentimentResponse', + ], + 'AnalyzeSentiment' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Language\V1\AnalyzeSentimentResponse', + ], + 'AnalyzeSyntax' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Language\V1\AnalyzeSyntaxResponse', + ], + 'AnnotateText' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Language\V1\AnnotateTextResponse', + ], + 'ClassifyText' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Language\V1\ClassifyTextResponse', + ], + ], + ], +]; diff --git a/owl-bot-staging/Language/v1/src/V1/resources/language_service_rest_client_config.php b/owl-bot-staging/Language/v1/src/V1/resources/language_service_rest_client_config.php new file mode 100644 index 000000000000..3713de7e1366 --- /dev/null +++ b/owl-bot-staging/Language/v1/src/V1/resources/language_service_rest_client_config.php @@ -0,0 +1,39 @@ + [ + 'google.cloud.language.v1.LanguageService' => [ + 'AnalyzeEntities' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/documents:analyzeEntities', + 'body' => '*', + ], + 'AnalyzeEntitySentiment' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/documents:analyzeEntitySentiment', + 'body' => '*', + ], + 'AnalyzeSentiment' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/documents:analyzeSentiment', + 'body' => '*', + ], + 'AnalyzeSyntax' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/documents:analyzeSyntax', + 'body' => '*', + ], + 'AnnotateText' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/documents:annotateText', + 'body' => '*', + ], + 'ClassifyText' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/documents:classifyText', + 'body' => '*', + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/Language/v1/tests/Unit/V1/Client/LanguageServiceClientTest.php b/owl-bot-staging/Language/v1/tests/Unit/V1/Client/LanguageServiceClientTest.php new file mode 100644 index 000000000000..07424c1372b4 --- /dev/null +++ b/owl-bot-staging/Language/v1/tests/Unit/V1/Client/LanguageServiceClientTest.php @@ -0,0 +1,491 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return LanguageServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new LanguageServiceClient($options); + } + + /** @test */ + public function analyzeEntitiesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $language = 'language-1613589672'; + $expectedResponse = new AnalyzeEntitiesResponse(); + $expectedResponse->setLanguage($language); + $transport->addResponse($expectedResponse); + // Mock request + $document = new Document(); + $request = (new AnalyzeEntitiesRequest()) + ->setDocument($document); + $response = $gapicClient->analyzeEntities($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.language.v1.LanguageService/AnalyzeEntities', $actualFuncCall); + $actualValue = $actualRequestObject->getDocument(); + $this->assertProtobufEquals($document, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function analyzeEntitiesExceptionTest() + { + $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 + $document = new Document(); + $request = (new AnalyzeEntitiesRequest()) + ->setDocument($document); + try { + $gapicClient->analyzeEntities($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 analyzeEntitySentimentTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $language = 'language-1613589672'; + $expectedResponse = new AnalyzeEntitySentimentResponse(); + $expectedResponse->setLanguage($language); + $transport->addResponse($expectedResponse); + // Mock request + $document = new Document(); + $request = (new AnalyzeEntitySentimentRequest()) + ->setDocument($document); + $response = $gapicClient->analyzeEntitySentiment($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.language.v1.LanguageService/AnalyzeEntitySentiment', $actualFuncCall); + $actualValue = $actualRequestObject->getDocument(); + $this->assertProtobufEquals($document, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function analyzeEntitySentimentExceptionTest() + { + $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 + $document = new Document(); + $request = (new AnalyzeEntitySentimentRequest()) + ->setDocument($document); + try { + $gapicClient->analyzeEntitySentiment($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 analyzeSentimentTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $language = 'language-1613589672'; + $expectedResponse = new AnalyzeSentimentResponse(); + $expectedResponse->setLanguage($language); + $transport->addResponse($expectedResponse); + // Mock request + $document = new Document(); + $request = (new AnalyzeSentimentRequest()) + ->setDocument($document); + $response = $gapicClient->analyzeSentiment($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.language.v1.LanguageService/AnalyzeSentiment', $actualFuncCall); + $actualValue = $actualRequestObject->getDocument(); + $this->assertProtobufEquals($document, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function analyzeSentimentExceptionTest() + { + $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 + $document = new Document(); + $request = (new AnalyzeSentimentRequest()) + ->setDocument($document); + try { + $gapicClient->analyzeSentiment($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 analyzeSyntaxTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $language = 'language-1613589672'; + $expectedResponse = new AnalyzeSyntaxResponse(); + $expectedResponse->setLanguage($language); + $transport->addResponse($expectedResponse); + // Mock request + $document = new Document(); + $request = (new AnalyzeSyntaxRequest()) + ->setDocument($document); + $response = $gapicClient->analyzeSyntax($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.language.v1.LanguageService/AnalyzeSyntax', $actualFuncCall); + $actualValue = $actualRequestObject->getDocument(); + $this->assertProtobufEquals($document, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function analyzeSyntaxExceptionTest() + { + $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 + $document = new Document(); + $request = (new AnalyzeSyntaxRequest()) + ->setDocument($document); + try { + $gapicClient->analyzeSyntax($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 annotateTextTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $language = 'language-1613589672'; + $expectedResponse = new AnnotateTextResponse(); + $expectedResponse->setLanguage($language); + $transport->addResponse($expectedResponse); + // Mock request + $document = new Document(); + $features = new Features(); + $request = (new AnnotateTextRequest()) + ->setDocument($document) + ->setFeatures($features); + $response = $gapicClient->annotateText($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.language.v1.LanguageService/AnnotateText', $actualFuncCall); + $actualValue = $actualRequestObject->getDocument(); + $this->assertProtobufEquals($document, $actualValue); + $actualValue = $actualRequestObject->getFeatures(); + $this->assertProtobufEquals($features, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function annotateTextExceptionTest() + { + $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 + $document = new Document(); + $features = new Features(); + $request = (new AnnotateTextRequest()) + ->setDocument($document) + ->setFeatures($features); + try { + $gapicClient->annotateText($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 classifyTextTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new ClassifyTextResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $document = new Document(); + $request = (new ClassifyTextRequest()) + ->setDocument($document); + $response = $gapicClient->classifyText($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.language.v1.LanguageService/ClassifyText', $actualFuncCall); + $actualValue = $actualRequestObject->getDocument(); + $this->assertProtobufEquals($document, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function classifyTextExceptionTest() + { + $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 + $document = new Document(); + $request = (new ClassifyTextRequest()) + ->setDocument($document); + try { + $gapicClient->classifyText($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 analyzeEntitiesAsyncTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $language = 'language-1613589672'; + $expectedResponse = new AnalyzeEntitiesResponse(); + $expectedResponse->setLanguage($language); + $transport->addResponse($expectedResponse); + // Mock request + $document = new Document(); + $request = (new AnalyzeEntitiesRequest()) + ->setDocument($document); + $response = $gapicClient->analyzeEntitiesAsync($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.cloud.language.v1.LanguageService/AnalyzeEntities', $actualFuncCall); + $actualValue = $actualRequestObject->getDocument(); + $this->assertProtobufEquals($document, $actualValue); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/owl-bot-staging/Language/v1/tests/Unit/V1/LanguageServiceClientTest.php b/owl-bot-staging/Language/v1/tests/Unit/V1/LanguageServiceClientTest.php new file mode 100644 index 000000000000..07f843489a80 --- /dev/null +++ b/owl-bot-staging/Language/v1/tests/Unit/V1/LanguageServiceClientTest.php @@ -0,0 +1,430 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return LanguageServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new LanguageServiceClient($options); + } + + /** @test */ + public function analyzeEntitiesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $language = 'language-1613589672'; + $expectedResponse = new AnalyzeEntitiesResponse(); + $expectedResponse->setLanguage($language); + $transport->addResponse($expectedResponse); + // Mock request + $document = new Document(); + $response = $gapicClient->analyzeEntities($document); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.language.v1.LanguageService/AnalyzeEntities', $actualFuncCall); + $actualValue = $actualRequestObject->getDocument(); + $this->assertProtobufEquals($document, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function analyzeEntitiesExceptionTest() + { + $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 + $document = new Document(); + try { + $gapicClient->analyzeEntities($document); + // 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 analyzeEntitySentimentTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $language = 'language-1613589672'; + $expectedResponse = new AnalyzeEntitySentimentResponse(); + $expectedResponse->setLanguage($language); + $transport->addResponse($expectedResponse); + // Mock request + $document = new Document(); + $response = $gapicClient->analyzeEntitySentiment($document); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.language.v1.LanguageService/AnalyzeEntitySentiment', $actualFuncCall); + $actualValue = $actualRequestObject->getDocument(); + $this->assertProtobufEquals($document, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function analyzeEntitySentimentExceptionTest() + { + $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 + $document = new Document(); + try { + $gapicClient->analyzeEntitySentiment($document); + // 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 analyzeSentimentTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $language = 'language-1613589672'; + $expectedResponse = new AnalyzeSentimentResponse(); + $expectedResponse->setLanguage($language); + $transport->addResponse($expectedResponse); + // Mock request + $document = new Document(); + $response = $gapicClient->analyzeSentiment($document); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.language.v1.LanguageService/AnalyzeSentiment', $actualFuncCall); + $actualValue = $actualRequestObject->getDocument(); + $this->assertProtobufEquals($document, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function analyzeSentimentExceptionTest() + { + $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 + $document = new Document(); + try { + $gapicClient->analyzeSentiment($document); + // 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 analyzeSyntaxTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $language = 'language-1613589672'; + $expectedResponse = new AnalyzeSyntaxResponse(); + $expectedResponse->setLanguage($language); + $transport->addResponse($expectedResponse); + // Mock request + $document = new Document(); + $response = $gapicClient->analyzeSyntax($document); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.language.v1.LanguageService/AnalyzeSyntax', $actualFuncCall); + $actualValue = $actualRequestObject->getDocument(); + $this->assertProtobufEquals($document, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function analyzeSyntaxExceptionTest() + { + $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 + $document = new Document(); + try { + $gapicClient->analyzeSyntax($document); + // 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 annotateTextTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $language = 'language-1613589672'; + $expectedResponse = new AnnotateTextResponse(); + $expectedResponse->setLanguage($language); + $transport->addResponse($expectedResponse); + // Mock request + $document = new Document(); + $features = new Features(); + $response = $gapicClient->annotateText($document, $features); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.language.v1.LanguageService/AnnotateText', $actualFuncCall); + $actualValue = $actualRequestObject->getDocument(); + $this->assertProtobufEquals($document, $actualValue); + $actualValue = $actualRequestObject->getFeatures(); + $this->assertProtobufEquals($features, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function annotateTextExceptionTest() + { + $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 + $document = new Document(); + $features = new Features(); + try { + $gapicClient->annotateText($document, $features); + // 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 classifyTextTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new ClassifyTextResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $document = new Document(); + $response = $gapicClient->classifyText($document); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.language.v1.LanguageService/ClassifyText', $actualFuncCall); + $actualValue = $actualRequestObject->getDocument(); + $this->assertProtobufEquals($document, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function classifyTextExceptionTest() + { + $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 + $document = new Document(); + try { + $gapicClient->classifyText($document); + // 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()); + } +} diff --git a/owl-bot-staging/Language/v1beta2/proto/src/GPBMetadata/Google/Cloud/Language/V1Beta2/LanguageService.php b/owl-bot-staging/Language/v1beta2/proto/src/GPBMetadata/Google/Cloud/Language/V1Beta2/LanguageService.php new file mode 100644 index 000000000000..b16590e83406 Binary files /dev/null and b/owl-bot-staging/Language/v1beta2/proto/src/GPBMetadata/Google/Cloud/Language/V1Beta2/LanguageService.php differ diff --git a/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/AnalyzeEntitiesRequest.php b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/AnalyzeEntitiesRequest.php new file mode 100644 index 000000000000..d6a55c91b009 --- /dev/null +++ b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/AnalyzeEntitiesRequest.php @@ -0,0 +1,111 @@ +google.cloud.language.v1beta2.AnalyzeEntitiesRequest + */ +class AnalyzeEntitiesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Input document. + * + * Generated from protobuf field .google.cloud.language.v1beta2.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $document = null; + /** + * The encoding type used by the API to calculate offsets. + * + * Generated from protobuf field .google.cloud.language.v1beta2.EncodingType encoding_type = 2; + */ + protected $encoding_type = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Language\V1beta2\Document $document + * Required. Input document. + * @type int $encoding_type + * The encoding type used by the API to calculate offsets. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Language\V1Beta2\LanguageService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Input document. + * + * Generated from protobuf field .google.cloud.language.v1beta2.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Language\V1beta2\Document|null + */ + public function getDocument() + { + return $this->document; + } + + public function hasDocument() + { + return isset($this->document); + } + + public function clearDocument() + { + unset($this->document); + } + + /** + * Required. Input document. + * + * Generated from protobuf field .google.cloud.language.v1beta2.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Language\V1beta2\Document $var + * @return $this + */ + public function setDocument($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Language\V1beta2\Document::class); + $this->document = $var; + + return $this; + } + + /** + * The encoding type used by the API to calculate offsets. + * + * Generated from protobuf field .google.cloud.language.v1beta2.EncodingType encoding_type = 2; + * @return int + */ + public function getEncodingType() + { + return $this->encoding_type; + } + + /** + * The encoding type used by the API to calculate offsets. + * + * Generated from protobuf field .google.cloud.language.v1beta2.EncodingType encoding_type = 2; + * @param int $var + * @return $this + */ + public function setEncodingType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Language\V1beta2\EncodingType::class); + $this->encoding_type = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/AnalyzeEntitiesResponse.php b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/AnalyzeEntitiesResponse.php new file mode 100644 index 000000000000..d2c871818b1f --- /dev/null +++ b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/AnalyzeEntitiesResponse.php @@ -0,0 +1,109 @@ +google.cloud.language.v1beta2.AnalyzeEntitiesResponse + */ +class AnalyzeEntitiesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The recognized entities in the input document. + * + * Generated from protobuf field repeated .google.cloud.language.v1beta2.Entity entities = 1; + */ + private $entities; + /** + * The language of the text, which will be the same as the language specified + * in the request or, if not specified, the automatically-detected language. + * See [Document.language][google.cloud.language.v1beta2.Document.language] field for more details. + * + * Generated from protobuf field string language = 2; + */ + protected $language = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Language\V1beta2\Entity>|\Google\Protobuf\Internal\RepeatedField $entities + * The recognized entities in the input document. + * @type string $language + * The language of the text, which will be the same as the language specified + * in the request or, if not specified, the automatically-detected language. + * See [Document.language][google.cloud.language.v1beta2.Document.language] field for more details. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Language\V1Beta2\LanguageService::initOnce(); + parent::__construct($data); + } + + /** + * The recognized entities in the input document. + * + * Generated from protobuf field repeated .google.cloud.language.v1beta2.Entity entities = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getEntities() + { + return $this->entities; + } + + /** + * The recognized entities in the input document. + * + * Generated from protobuf field repeated .google.cloud.language.v1beta2.Entity entities = 1; + * @param array<\Google\Cloud\Language\V1beta2\Entity>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setEntities($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Language\V1beta2\Entity::class); + $this->entities = $arr; + + return $this; + } + + /** + * The language of the text, which will be the same as the language specified + * in the request or, if not specified, the automatically-detected language. + * See [Document.language][google.cloud.language.v1beta2.Document.language] field for more details. + * + * Generated from protobuf field string language = 2; + * @return string + */ + public function getLanguage() + { + return $this->language; + } + + /** + * The language of the text, which will be the same as the language specified + * in the request or, if not specified, the automatically-detected language. + * See [Document.language][google.cloud.language.v1beta2.Document.language] field for more details. + * + * Generated from protobuf field string language = 2; + * @param string $var + * @return $this + */ + public function setLanguage($var) + { + GPBUtil::checkString($var, True); + $this->language = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/AnalyzeEntitySentimentRequest.php b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/AnalyzeEntitySentimentRequest.php new file mode 100644 index 000000000000..0518237c96b6 --- /dev/null +++ b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/AnalyzeEntitySentimentRequest.php @@ -0,0 +1,111 @@ +google.cloud.language.v1beta2.AnalyzeEntitySentimentRequest + */ +class AnalyzeEntitySentimentRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Input document. + * + * Generated from protobuf field .google.cloud.language.v1beta2.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $document = null; + /** + * The encoding type used by the API to calculate offsets. + * + * Generated from protobuf field .google.cloud.language.v1beta2.EncodingType encoding_type = 2; + */ + protected $encoding_type = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Language\V1beta2\Document $document + * Required. Input document. + * @type int $encoding_type + * The encoding type used by the API to calculate offsets. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Language\V1Beta2\LanguageService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Input document. + * + * Generated from protobuf field .google.cloud.language.v1beta2.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Language\V1beta2\Document|null + */ + public function getDocument() + { + return $this->document; + } + + public function hasDocument() + { + return isset($this->document); + } + + public function clearDocument() + { + unset($this->document); + } + + /** + * Required. Input document. + * + * Generated from protobuf field .google.cloud.language.v1beta2.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Language\V1beta2\Document $var + * @return $this + */ + public function setDocument($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Language\V1beta2\Document::class); + $this->document = $var; + + return $this; + } + + /** + * The encoding type used by the API to calculate offsets. + * + * Generated from protobuf field .google.cloud.language.v1beta2.EncodingType encoding_type = 2; + * @return int + */ + public function getEncodingType() + { + return $this->encoding_type; + } + + /** + * The encoding type used by the API to calculate offsets. + * + * Generated from protobuf field .google.cloud.language.v1beta2.EncodingType encoding_type = 2; + * @param int $var + * @return $this + */ + public function setEncodingType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Language\V1beta2\EncodingType::class); + $this->encoding_type = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/AnalyzeEntitySentimentResponse.php b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/AnalyzeEntitySentimentResponse.php new file mode 100644 index 000000000000..df3732121135 --- /dev/null +++ b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/AnalyzeEntitySentimentResponse.php @@ -0,0 +1,109 @@ +google.cloud.language.v1beta2.AnalyzeEntitySentimentResponse + */ +class AnalyzeEntitySentimentResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The recognized entities in the input document with associated sentiments. + * + * Generated from protobuf field repeated .google.cloud.language.v1beta2.Entity entities = 1; + */ + private $entities; + /** + * The language of the text, which will be the same as the language specified + * in the request or, if not specified, the automatically-detected language. + * See [Document.language][google.cloud.language.v1beta2.Document.language] field for more details. + * + * Generated from protobuf field string language = 2; + */ + protected $language = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Language\V1beta2\Entity>|\Google\Protobuf\Internal\RepeatedField $entities + * The recognized entities in the input document with associated sentiments. + * @type string $language + * The language of the text, which will be the same as the language specified + * in the request or, if not specified, the automatically-detected language. + * See [Document.language][google.cloud.language.v1beta2.Document.language] field for more details. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Language\V1Beta2\LanguageService::initOnce(); + parent::__construct($data); + } + + /** + * The recognized entities in the input document with associated sentiments. + * + * Generated from protobuf field repeated .google.cloud.language.v1beta2.Entity entities = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getEntities() + { + return $this->entities; + } + + /** + * The recognized entities in the input document with associated sentiments. + * + * Generated from protobuf field repeated .google.cloud.language.v1beta2.Entity entities = 1; + * @param array<\Google\Cloud\Language\V1beta2\Entity>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setEntities($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Language\V1beta2\Entity::class); + $this->entities = $arr; + + return $this; + } + + /** + * The language of the text, which will be the same as the language specified + * in the request or, if not specified, the automatically-detected language. + * See [Document.language][google.cloud.language.v1beta2.Document.language] field for more details. + * + * Generated from protobuf field string language = 2; + * @return string + */ + public function getLanguage() + { + return $this->language; + } + + /** + * The language of the text, which will be the same as the language specified + * in the request or, if not specified, the automatically-detected language. + * See [Document.language][google.cloud.language.v1beta2.Document.language] field for more details. + * + * Generated from protobuf field string language = 2; + * @param string $var + * @return $this + */ + public function setLanguage($var) + { + GPBUtil::checkString($var, True); + $this->language = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/AnalyzeSentimentRequest.php b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/AnalyzeSentimentRequest.php new file mode 100644 index 000000000000..80c589be0ee6 --- /dev/null +++ b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/AnalyzeSentimentRequest.php @@ -0,0 +1,115 @@ +google.cloud.language.v1beta2.AnalyzeSentimentRequest + */ +class AnalyzeSentimentRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Input document. + * + * Generated from protobuf field .google.cloud.language.v1beta2.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $document = null; + /** + * The encoding type used by the API to calculate sentence offsets for the + * sentence sentiment. + * + * Generated from protobuf field .google.cloud.language.v1beta2.EncodingType encoding_type = 2; + */ + protected $encoding_type = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Language\V1beta2\Document $document + * Required. Input document. + * @type int $encoding_type + * The encoding type used by the API to calculate sentence offsets for the + * sentence sentiment. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Language\V1Beta2\LanguageService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Input document. + * + * Generated from protobuf field .google.cloud.language.v1beta2.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Language\V1beta2\Document|null + */ + public function getDocument() + { + return $this->document; + } + + public function hasDocument() + { + return isset($this->document); + } + + public function clearDocument() + { + unset($this->document); + } + + /** + * Required. Input document. + * + * Generated from protobuf field .google.cloud.language.v1beta2.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Language\V1beta2\Document $var + * @return $this + */ + public function setDocument($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Language\V1beta2\Document::class); + $this->document = $var; + + return $this; + } + + /** + * The encoding type used by the API to calculate sentence offsets for the + * sentence sentiment. + * + * Generated from protobuf field .google.cloud.language.v1beta2.EncodingType encoding_type = 2; + * @return int + */ + public function getEncodingType() + { + return $this->encoding_type; + } + + /** + * The encoding type used by the API to calculate sentence offsets for the + * sentence sentiment. + * + * Generated from protobuf field .google.cloud.language.v1beta2.EncodingType encoding_type = 2; + * @param int $var + * @return $this + */ + public function setEncodingType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Language\V1beta2\EncodingType::class); + $this->encoding_type = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/AnalyzeSentimentResponse.php b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/AnalyzeSentimentResponse.php new file mode 100644 index 000000000000..85f6940a0de1 --- /dev/null +++ b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/AnalyzeSentimentResponse.php @@ -0,0 +1,153 @@ +google.cloud.language.v1beta2.AnalyzeSentimentResponse + */ +class AnalyzeSentimentResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The overall sentiment of the input document. + * + * Generated from protobuf field .google.cloud.language.v1beta2.Sentiment document_sentiment = 1; + */ + protected $document_sentiment = null; + /** + * The language of the text, which will be the same as the language specified + * in the request or, if not specified, the automatically-detected language. + * See [Document.language][google.cloud.language.v1beta2.Document.language] field for more details. + * + * Generated from protobuf field string language = 2; + */ + protected $language = ''; + /** + * The sentiment for all the sentences in the document. + * + * Generated from protobuf field repeated .google.cloud.language.v1beta2.Sentence sentences = 3; + */ + private $sentences; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Language\V1beta2\Sentiment $document_sentiment + * The overall sentiment of the input document. + * @type string $language + * The language of the text, which will be the same as the language specified + * in the request or, if not specified, the automatically-detected language. + * See [Document.language][google.cloud.language.v1beta2.Document.language] field for more details. + * @type array<\Google\Cloud\Language\V1beta2\Sentence>|\Google\Protobuf\Internal\RepeatedField $sentences + * The sentiment for all the sentences in the document. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Language\V1Beta2\LanguageService::initOnce(); + parent::__construct($data); + } + + /** + * The overall sentiment of the input document. + * + * Generated from protobuf field .google.cloud.language.v1beta2.Sentiment document_sentiment = 1; + * @return \Google\Cloud\Language\V1beta2\Sentiment|null + */ + public function getDocumentSentiment() + { + return $this->document_sentiment; + } + + public function hasDocumentSentiment() + { + return isset($this->document_sentiment); + } + + public function clearDocumentSentiment() + { + unset($this->document_sentiment); + } + + /** + * The overall sentiment of the input document. + * + * Generated from protobuf field .google.cloud.language.v1beta2.Sentiment document_sentiment = 1; + * @param \Google\Cloud\Language\V1beta2\Sentiment $var + * @return $this + */ + public function setDocumentSentiment($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Language\V1beta2\Sentiment::class); + $this->document_sentiment = $var; + + return $this; + } + + /** + * The language of the text, which will be the same as the language specified + * in the request or, if not specified, the automatically-detected language. + * See [Document.language][google.cloud.language.v1beta2.Document.language] field for more details. + * + * Generated from protobuf field string language = 2; + * @return string + */ + public function getLanguage() + { + return $this->language; + } + + /** + * The language of the text, which will be the same as the language specified + * in the request or, if not specified, the automatically-detected language. + * See [Document.language][google.cloud.language.v1beta2.Document.language] field for more details. + * + * Generated from protobuf field string language = 2; + * @param string $var + * @return $this + */ + public function setLanguage($var) + { + GPBUtil::checkString($var, True); + $this->language = $var; + + return $this; + } + + /** + * The sentiment for all the sentences in the document. + * + * Generated from protobuf field repeated .google.cloud.language.v1beta2.Sentence sentences = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSentences() + { + return $this->sentences; + } + + /** + * The sentiment for all the sentences in the document. + * + * Generated from protobuf field repeated .google.cloud.language.v1beta2.Sentence sentences = 3; + * @param array<\Google\Cloud\Language\V1beta2\Sentence>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSentences($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Language\V1beta2\Sentence::class); + $this->sentences = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/AnalyzeSyntaxRequest.php b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/AnalyzeSyntaxRequest.php new file mode 100644 index 000000000000..4efdf49b5efc --- /dev/null +++ b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/AnalyzeSyntaxRequest.php @@ -0,0 +1,111 @@ +google.cloud.language.v1beta2.AnalyzeSyntaxRequest + */ +class AnalyzeSyntaxRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Input document. + * + * Generated from protobuf field .google.cloud.language.v1beta2.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $document = null; + /** + * The encoding type used by the API to calculate offsets. + * + * Generated from protobuf field .google.cloud.language.v1beta2.EncodingType encoding_type = 2; + */ + protected $encoding_type = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Language\V1beta2\Document $document + * Required. Input document. + * @type int $encoding_type + * The encoding type used by the API to calculate offsets. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Language\V1Beta2\LanguageService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Input document. + * + * Generated from protobuf field .google.cloud.language.v1beta2.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Language\V1beta2\Document|null + */ + public function getDocument() + { + return $this->document; + } + + public function hasDocument() + { + return isset($this->document); + } + + public function clearDocument() + { + unset($this->document); + } + + /** + * Required. Input document. + * + * Generated from protobuf field .google.cloud.language.v1beta2.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Language\V1beta2\Document $var + * @return $this + */ + public function setDocument($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Language\V1beta2\Document::class); + $this->document = $var; + + return $this; + } + + /** + * The encoding type used by the API to calculate offsets. + * + * Generated from protobuf field .google.cloud.language.v1beta2.EncodingType encoding_type = 2; + * @return int + */ + public function getEncodingType() + { + return $this->encoding_type; + } + + /** + * The encoding type used by the API to calculate offsets. + * + * Generated from protobuf field .google.cloud.language.v1beta2.EncodingType encoding_type = 2; + * @param int $var + * @return $this + */ + public function setEncodingType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Language\V1beta2\EncodingType::class); + $this->encoding_type = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/AnalyzeSyntaxResponse.php b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/AnalyzeSyntaxResponse.php new file mode 100644 index 000000000000..9ade9fd01ee7 --- /dev/null +++ b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/AnalyzeSyntaxResponse.php @@ -0,0 +1,143 @@ +google.cloud.language.v1beta2.AnalyzeSyntaxResponse + */ +class AnalyzeSyntaxResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Sentences in the input document. + * + * Generated from protobuf field repeated .google.cloud.language.v1beta2.Sentence sentences = 1; + */ + private $sentences; + /** + * Tokens, along with their syntactic information, in the input document. + * + * Generated from protobuf field repeated .google.cloud.language.v1beta2.Token tokens = 2; + */ + private $tokens; + /** + * The language of the text, which will be the same as the language specified + * in the request or, if not specified, the automatically-detected language. + * See [Document.language][google.cloud.language.v1beta2.Document.language] field for more details. + * + * Generated from protobuf field string language = 3; + */ + protected $language = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Language\V1beta2\Sentence>|\Google\Protobuf\Internal\RepeatedField $sentences + * Sentences in the input document. + * @type array<\Google\Cloud\Language\V1beta2\Token>|\Google\Protobuf\Internal\RepeatedField $tokens + * Tokens, along with their syntactic information, in the input document. + * @type string $language + * The language of the text, which will be the same as the language specified + * in the request or, if not specified, the automatically-detected language. + * See [Document.language][google.cloud.language.v1beta2.Document.language] field for more details. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Language\V1Beta2\LanguageService::initOnce(); + parent::__construct($data); + } + + /** + * Sentences in the input document. + * + * Generated from protobuf field repeated .google.cloud.language.v1beta2.Sentence sentences = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSentences() + { + return $this->sentences; + } + + /** + * Sentences in the input document. + * + * Generated from protobuf field repeated .google.cloud.language.v1beta2.Sentence sentences = 1; + * @param array<\Google\Cloud\Language\V1beta2\Sentence>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSentences($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Language\V1beta2\Sentence::class); + $this->sentences = $arr; + + return $this; + } + + /** + * Tokens, along with their syntactic information, in the input document. + * + * Generated from protobuf field repeated .google.cloud.language.v1beta2.Token tokens = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTokens() + { + return $this->tokens; + } + + /** + * Tokens, along with their syntactic information, in the input document. + * + * Generated from protobuf field repeated .google.cloud.language.v1beta2.Token tokens = 2; + * @param array<\Google\Cloud\Language\V1beta2\Token>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTokens($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Language\V1beta2\Token::class); + $this->tokens = $arr; + + return $this; + } + + /** + * The language of the text, which will be the same as the language specified + * in the request or, if not specified, the automatically-detected language. + * See [Document.language][google.cloud.language.v1beta2.Document.language] field for more details. + * + * Generated from protobuf field string language = 3; + * @return string + */ + public function getLanguage() + { + return $this->language; + } + + /** + * The language of the text, which will be the same as the language specified + * in the request or, if not specified, the automatically-detected language. + * See [Document.language][google.cloud.language.v1beta2.Document.language] field for more details. + * + * Generated from protobuf field string language = 3; + * @param string $var + * @return $this + */ + public function setLanguage($var) + { + GPBUtil::checkString($var, True); + $this->language = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/AnnotateTextRequest.php b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/AnnotateTextRequest.php new file mode 100644 index 000000000000..811df80d0e3f --- /dev/null +++ b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/AnnotateTextRequest.php @@ -0,0 +1,156 @@ +google.cloud.language.v1beta2.AnnotateTextRequest + */ +class AnnotateTextRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Input document. + * + * Generated from protobuf field .google.cloud.language.v1beta2.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $document = null; + /** + * Required. The enabled features. + * + * Generated from protobuf field .google.cloud.language.v1beta2.AnnotateTextRequest.Features features = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $features = null; + /** + * The encoding type used by the API to calculate offsets. + * + * Generated from protobuf field .google.cloud.language.v1beta2.EncodingType encoding_type = 3; + */ + protected $encoding_type = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Language\V1beta2\Document $document + * Required. Input document. + * @type \Google\Cloud\Language\V1beta2\AnnotateTextRequest\Features $features + * Required. The enabled features. + * @type int $encoding_type + * The encoding type used by the API to calculate offsets. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Language\V1Beta2\LanguageService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Input document. + * + * Generated from protobuf field .google.cloud.language.v1beta2.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Language\V1beta2\Document|null + */ + public function getDocument() + { + return $this->document; + } + + public function hasDocument() + { + return isset($this->document); + } + + public function clearDocument() + { + unset($this->document); + } + + /** + * Required. Input document. + * + * Generated from protobuf field .google.cloud.language.v1beta2.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Language\V1beta2\Document $var + * @return $this + */ + public function setDocument($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Language\V1beta2\Document::class); + $this->document = $var; + + return $this; + } + + /** + * Required. The enabled features. + * + * Generated from protobuf field .google.cloud.language.v1beta2.AnnotateTextRequest.Features features = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Language\V1beta2\AnnotateTextRequest\Features|null + */ + public function getFeatures() + { + return $this->features; + } + + public function hasFeatures() + { + return isset($this->features); + } + + public function clearFeatures() + { + unset($this->features); + } + + /** + * Required. The enabled features. + * + * Generated from protobuf field .google.cloud.language.v1beta2.AnnotateTextRequest.Features features = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Language\V1beta2\AnnotateTextRequest\Features $var + * @return $this + */ + public function setFeatures($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Language\V1beta2\AnnotateTextRequest\Features::class); + $this->features = $var; + + return $this; + } + + /** + * The encoding type used by the API to calculate offsets. + * + * Generated from protobuf field .google.cloud.language.v1beta2.EncodingType encoding_type = 3; + * @return int + */ + public function getEncodingType() + { + return $this->encoding_type; + } + + /** + * The encoding type used by the API to calculate offsets. + * + * Generated from protobuf field .google.cloud.language.v1beta2.EncodingType encoding_type = 3; + * @param int $var + * @return $this + */ + public function setEncodingType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Language\V1beta2\EncodingType::class); + $this->encoding_type = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/AnnotateTextRequest/Features.php b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/AnnotateTextRequest/Features.php new file mode 100644 index 000000000000..222c37b72e94 --- /dev/null +++ b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/AnnotateTextRequest/Features.php @@ -0,0 +1,268 @@ +google.cloud.language.v1beta2.AnnotateTextRequest.Features + */ +class Features extends \Google\Protobuf\Internal\Message +{ + /** + * Extract syntax information. + * + * Generated from protobuf field bool extract_syntax = 1; + */ + protected $extract_syntax = false; + /** + * Extract entities. + * + * Generated from protobuf field bool extract_entities = 2; + */ + protected $extract_entities = false; + /** + * Extract document-level sentiment. + * + * Generated from protobuf field bool extract_document_sentiment = 3; + */ + protected $extract_document_sentiment = false; + /** + * Extract entities and their associated sentiment. + * + * Generated from protobuf field bool extract_entity_sentiment = 4; + */ + protected $extract_entity_sentiment = false; + /** + * Classify the full document into categories. If this is true, + * the API will use the default model which classifies into a + * [predefined + * taxonomy](https://cloud.google.com/natural-language/docs/categories). + * + * Generated from protobuf field bool classify_text = 6; + */ + protected $classify_text = false; + /** + * The model options to use for classification. Defaults to v1 options + * if not specified. Only used if `classify_text` is set to true. + * + * Generated from protobuf field .google.cloud.language.v1beta2.ClassificationModelOptions classification_model_options = 10; + */ + protected $classification_model_options = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $extract_syntax + * Extract syntax information. + * @type bool $extract_entities + * Extract entities. + * @type bool $extract_document_sentiment + * Extract document-level sentiment. + * @type bool $extract_entity_sentiment + * Extract entities and their associated sentiment. + * @type bool $classify_text + * Classify the full document into categories. If this is true, + * the API will use the default model which classifies into a + * [predefined + * taxonomy](https://cloud.google.com/natural-language/docs/categories). + * @type \Google\Cloud\Language\V1beta2\ClassificationModelOptions $classification_model_options + * The model options to use for classification. Defaults to v1 options + * if not specified. Only used if `classify_text` is set to true. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Language\V1Beta2\LanguageService::initOnce(); + parent::__construct($data); + } + + /** + * Extract syntax information. + * + * Generated from protobuf field bool extract_syntax = 1; + * @return bool + */ + public function getExtractSyntax() + { + return $this->extract_syntax; + } + + /** + * Extract syntax information. + * + * Generated from protobuf field bool extract_syntax = 1; + * @param bool $var + * @return $this + */ + public function setExtractSyntax($var) + { + GPBUtil::checkBool($var); + $this->extract_syntax = $var; + + return $this; + } + + /** + * Extract entities. + * + * Generated from protobuf field bool extract_entities = 2; + * @return bool + */ + public function getExtractEntities() + { + return $this->extract_entities; + } + + /** + * Extract entities. + * + * Generated from protobuf field bool extract_entities = 2; + * @param bool $var + * @return $this + */ + public function setExtractEntities($var) + { + GPBUtil::checkBool($var); + $this->extract_entities = $var; + + return $this; + } + + /** + * Extract document-level sentiment. + * + * Generated from protobuf field bool extract_document_sentiment = 3; + * @return bool + */ + public function getExtractDocumentSentiment() + { + return $this->extract_document_sentiment; + } + + /** + * Extract document-level sentiment. + * + * Generated from protobuf field bool extract_document_sentiment = 3; + * @param bool $var + * @return $this + */ + public function setExtractDocumentSentiment($var) + { + GPBUtil::checkBool($var); + $this->extract_document_sentiment = $var; + + return $this; + } + + /** + * Extract entities and their associated sentiment. + * + * Generated from protobuf field bool extract_entity_sentiment = 4; + * @return bool + */ + public function getExtractEntitySentiment() + { + return $this->extract_entity_sentiment; + } + + /** + * Extract entities and their associated sentiment. + * + * Generated from protobuf field bool extract_entity_sentiment = 4; + * @param bool $var + * @return $this + */ + public function setExtractEntitySentiment($var) + { + GPBUtil::checkBool($var); + $this->extract_entity_sentiment = $var; + + return $this; + } + + /** + * Classify the full document into categories. If this is true, + * the API will use the default model which classifies into a + * [predefined + * taxonomy](https://cloud.google.com/natural-language/docs/categories). + * + * Generated from protobuf field bool classify_text = 6; + * @return bool + */ + public function getClassifyText() + { + return $this->classify_text; + } + + /** + * Classify the full document into categories. If this is true, + * the API will use the default model which classifies into a + * [predefined + * taxonomy](https://cloud.google.com/natural-language/docs/categories). + * + * Generated from protobuf field bool classify_text = 6; + * @param bool $var + * @return $this + */ + public function setClassifyText($var) + { + GPBUtil::checkBool($var); + $this->classify_text = $var; + + return $this; + } + + /** + * The model options to use for classification. Defaults to v1 options + * if not specified. Only used if `classify_text` is set to true. + * + * Generated from protobuf field .google.cloud.language.v1beta2.ClassificationModelOptions classification_model_options = 10; + * @return \Google\Cloud\Language\V1beta2\ClassificationModelOptions|null + */ + public function getClassificationModelOptions() + { + return $this->classification_model_options; + } + + public function hasClassificationModelOptions() + { + return isset($this->classification_model_options); + } + + public function clearClassificationModelOptions() + { + unset($this->classification_model_options); + } + + /** + * The model options to use for classification. Defaults to v1 options + * if not specified. Only used if `classify_text` is set to true. + * + * Generated from protobuf field .google.cloud.language.v1beta2.ClassificationModelOptions classification_model_options = 10; + * @param \Google\Cloud\Language\V1beta2\ClassificationModelOptions $var + * @return $this + */ + public function setClassificationModelOptions($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Language\V1beta2\ClassificationModelOptions::class); + $this->classification_model_options = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Features::class, \Google\Cloud\Language\V1beta2\AnnotateTextRequest_Features::class); + diff --git a/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/AnnotateTextRequest_Features.php b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/AnnotateTextRequest_Features.php new file mode 100644 index 000000000000..e1f981a34755 --- /dev/null +++ b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/AnnotateTextRequest_Features.php @@ -0,0 +1,16 @@ +google.cloud.language.v1beta2.AnnotateTextResponse + */ +class AnnotateTextResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Sentences in the input document. Populated if the user enables + * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_syntax]. + * + * Generated from protobuf field repeated .google.cloud.language.v1beta2.Sentence sentences = 1; + */ + private $sentences; + /** + * Tokens, along with their syntactic information, in the input document. + * Populated if the user enables + * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_syntax]. + * + * Generated from protobuf field repeated .google.cloud.language.v1beta2.Token tokens = 2; + */ + private $tokens; + /** + * Entities, along with their semantic information, in the input document. + * Populated if the user enables + * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_entities]. + * + * Generated from protobuf field repeated .google.cloud.language.v1beta2.Entity entities = 3; + */ + private $entities; + /** + * The overall sentiment for the document. Populated if the user enables + * [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_document_sentiment]. + * + * Generated from protobuf field .google.cloud.language.v1beta2.Sentiment document_sentiment = 4; + */ + protected $document_sentiment = null; + /** + * The language of the text, which will be the same as the language specified + * in the request or, if not specified, the automatically-detected language. + * See [Document.language][google.cloud.language.v1beta2.Document.language] field for more details. + * + * Generated from protobuf field string language = 5; + */ + protected $language = ''; + /** + * Categories identified in the input document. + * + * Generated from protobuf field repeated .google.cloud.language.v1beta2.ClassificationCategory categories = 6; + */ + private $categories; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Language\V1beta2\Sentence>|\Google\Protobuf\Internal\RepeatedField $sentences + * Sentences in the input document. Populated if the user enables + * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_syntax]. + * @type array<\Google\Cloud\Language\V1beta2\Token>|\Google\Protobuf\Internal\RepeatedField $tokens + * Tokens, along with their syntactic information, in the input document. + * Populated if the user enables + * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_syntax]. + * @type array<\Google\Cloud\Language\V1beta2\Entity>|\Google\Protobuf\Internal\RepeatedField $entities + * Entities, along with their semantic information, in the input document. + * Populated if the user enables + * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_entities]. + * @type \Google\Cloud\Language\V1beta2\Sentiment $document_sentiment + * The overall sentiment for the document. Populated if the user enables + * [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_document_sentiment]. + * @type string $language + * The language of the text, which will be the same as the language specified + * in the request or, if not specified, the automatically-detected language. + * See [Document.language][google.cloud.language.v1beta2.Document.language] field for more details. + * @type array<\Google\Cloud\Language\V1beta2\ClassificationCategory>|\Google\Protobuf\Internal\RepeatedField $categories + * Categories identified in the input document. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Language\V1Beta2\LanguageService::initOnce(); + parent::__construct($data); + } + + /** + * Sentences in the input document. Populated if the user enables + * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_syntax]. + * + * Generated from protobuf field repeated .google.cloud.language.v1beta2.Sentence sentences = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSentences() + { + return $this->sentences; + } + + /** + * Sentences in the input document. Populated if the user enables + * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_syntax]. + * + * Generated from protobuf field repeated .google.cloud.language.v1beta2.Sentence sentences = 1; + * @param array<\Google\Cloud\Language\V1beta2\Sentence>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSentences($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Language\V1beta2\Sentence::class); + $this->sentences = $arr; + + return $this; + } + + /** + * Tokens, along with their syntactic information, in the input document. + * Populated if the user enables + * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_syntax]. + * + * Generated from protobuf field repeated .google.cloud.language.v1beta2.Token tokens = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTokens() + { + return $this->tokens; + } + + /** + * Tokens, along with their syntactic information, in the input document. + * Populated if the user enables + * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_syntax]. + * + * Generated from protobuf field repeated .google.cloud.language.v1beta2.Token tokens = 2; + * @param array<\Google\Cloud\Language\V1beta2\Token>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTokens($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Language\V1beta2\Token::class); + $this->tokens = $arr; + + return $this; + } + + /** + * Entities, along with their semantic information, in the input document. + * Populated if the user enables + * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_entities]. + * + * Generated from protobuf field repeated .google.cloud.language.v1beta2.Entity entities = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getEntities() + { + return $this->entities; + } + + /** + * Entities, along with their semantic information, in the input document. + * Populated if the user enables + * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_entities]. + * + * Generated from protobuf field repeated .google.cloud.language.v1beta2.Entity entities = 3; + * @param array<\Google\Cloud\Language\V1beta2\Entity>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setEntities($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Language\V1beta2\Entity::class); + $this->entities = $arr; + + return $this; + } + + /** + * The overall sentiment for the document. Populated if the user enables + * [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_document_sentiment]. + * + * Generated from protobuf field .google.cloud.language.v1beta2.Sentiment document_sentiment = 4; + * @return \Google\Cloud\Language\V1beta2\Sentiment|null + */ + public function getDocumentSentiment() + { + return $this->document_sentiment; + } + + public function hasDocumentSentiment() + { + return isset($this->document_sentiment); + } + + public function clearDocumentSentiment() + { + unset($this->document_sentiment); + } + + /** + * The overall sentiment for the document. Populated if the user enables + * [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_document_sentiment]. + * + * Generated from protobuf field .google.cloud.language.v1beta2.Sentiment document_sentiment = 4; + * @param \Google\Cloud\Language\V1beta2\Sentiment $var + * @return $this + */ + public function setDocumentSentiment($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Language\V1beta2\Sentiment::class); + $this->document_sentiment = $var; + + return $this; + } + + /** + * The language of the text, which will be the same as the language specified + * in the request or, if not specified, the automatically-detected language. + * See [Document.language][google.cloud.language.v1beta2.Document.language] field for more details. + * + * Generated from protobuf field string language = 5; + * @return string + */ + public function getLanguage() + { + return $this->language; + } + + /** + * The language of the text, which will be the same as the language specified + * in the request or, if not specified, the automatically-detected language. + * See [Document.language][google.cloud.language.v1beta2.Document.language] field for more details. + * + * Generated from protobuf field string language = 5; + * @param string $var + * @return $this + */ + public function setLanguage($var) + { + GPBUtil::checkString($var, True); + $this->language = $var; + + return $this; + } + + /** + * Categories identified in the input document. + * + * Generated from protobuf field repeated .google.cloud.language.v1beta2.ClassificationCategory categories = 6; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getCategories() + { + return $this->categories; + } + + /** + * Categories identified in the input document. + * + * Generated from protobuf field repeated .google.cloud.language.v1beta2.ClassificationCategory categories = 6; + * @param array<\Google\Cloud\Language\V1beta2\ClassificationCategory>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setCategories($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Language\V1beta2\ClassificationCategory::class); + $this->categories = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/ClassificationCategory.php b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/ClassificationCategory.php new file mode 100644 index 000000000000..8303e14ba8f4 --- /dev/null +++ b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/ClassificationCategory.php @@ -0,0 +1,109 @@ +google.cloud.language.v1beta2.ClassificationCategory + */ +class ClassificationCategory extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the category representing the document, from the [predefined + * taxonomy](https://cloud.google.com/natural-language/docs/categories). + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * The classifier's confidence of the category. Number represents how certain + * the classifier is that this category represents the given text. + * + * Generated from protobuf field float confidence = 2; + */ + protected $confidence = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The name of the category representing the document, from the [predefined + * taxonomy](https://cloud.google.com/natural-language/docs/categories). + * @type float $confidence + * The classifier's confidence of the category. Number represents how certain + * the classifier is that this category represents the given text. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Language\V1Beta2\LanguageService::initOnce(); + parent::__construct($data); + } + + /** + * The name of the category representing the document, from the [predefined + * taxonomy](https://cloud.google.com/natural-language/docs/categories). + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The name of the category representing the document, from the [predefined + * taxonomy](https://cloud.google.com/natural-language/docs/categories). + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The classifier's confidence of the category. Number represents how certain + * the classifier is that this category represents the given text. + * + * Generated from protobuf field float confidence = 2; + * @return float + */ + public function getConfidence() + { + return $this->confidence; + } + + /** + * The classifier's confidence of the category. Number represents how certain + * the classifier is that this category represents the given text. + * + * Generated from protobuf field float confidence = 2; + * @param float $var + * @return $this + */ + public function setConfidence($var) + { + GPBUtil::checkFloat($var); + $this->confidence = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/ClassificationModelOptions.php b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/ClassificationModelOptions.php new file mode 100644 index 000000000000..75c27dd88790 --- /dev/null +++ b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/ClassificationModelOptions.php @@ -0,0 +1,117 @@ +google.cloud.language.v1beta2.ClassificationModelOptions + */ +class ClassificationModelOptions extends \Google\Protobuf\Internal\Message +{ + protected $model_type; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Language\V1beta2\ClassificationModelOptions\V1Model $v1_model + * Setting this field will use the V1 model and V1 content categories + * version. The V1 model is a legacy model; support for this will be + * discontinued in the future. + * @type \Google\Cloud\Language\V1beta2\ClassificationModelOptions\V2Model $v2_model + * Setting this field will use the V2 model with the appropriate content + * categories version. The V2 model is a better performing model. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Language\V1Beta2\LanguageService::initOnce(); + parent::__construct($data); + } + + /** + * Setting this field will use the V1 model and V1 content categories + * version. The V1 model is a legacy model; support for this will be + * discontinued in the future. + * + * Generated from protobuf field .google.cloud.language.v1beta2.ClassificationModelOptions.V1Model v1_model = 1; + * @return \Google\Cloud\Language\V1beta2\ClassificationModelOptions\V1Model|null + */ + public function getV1Model() + { + return $this->readOneof(1); + } + + public function hasV1Model() + { + return $this->hasOneof(1); + } + + /** + * Setting this field will use the V1 model and V1 content categories + * version. The V1 model is a legacy model; support for this will be + * discontinued in the future. + * + * Generated from protobuf field .google.cloud.language.v1beta2.ClassificationModelOptions.V1Model v1_model = 1; + * @param \Google\Cloud\Language\V1beta2\ClassificationModelOptions\V1Model $var + * @return $this + */ + public function setV1Model($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Language\V1beta2\ClassificationModelOptions\V1Model::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * Setting this field will use the V2 model with the appropriate content + * categories version. The V2 model is a better performing model. + * + * Generated from protobuf field .google.cloud.language.v1beta2.ClassificationModelOptions.V2Model v2_model = 2; + * @return \Google\Cloud\Language\V1beta2\ClassificationModelOptions\V2Model|null + */ + public function getV2Model() + { + return $this->readOneof(2); + } + + public function hasV2Model() + { + return $this->hasOneof(2); + } + + /** + * Setting this field will use the V2 model with the appropriate content + * categories version. The V2 model is a better performing model. + * + * Generated from protobuf field .google.cloud.language.v1beta2.ClassificationModelOptions.V2Model v2_model = 2; + * @param \Google\Cloud\Language\V1beta2\ClassificationModelOptions\V2Model $var + * @return $this + */ + public function setV2Model($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Language\V1beta2\ClassificationModelOptions\V2Model::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * @return string + */ + public function getModelType() + { + return $this->whichOneof("model_type"); + } + +} + diff --git a/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/ClassificationModelOptions/V1Model.php b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/ClassificationModelOptions/V1Model.php new file mode 100644 index 000000000000..ae781d4d3d46 --- /dev/null +++ b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/ClassificationModelOptions/V1Model.php @@ -0,0 +1,36 @@ +google.cloud.language.v1beta2.ClassificationModelOptions.V1Model + */ +class V1Model extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Language\V1Beta2\LanguageService::initOnce(); + parent::__construct($data); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(V1Model::class, \Google\Cloud\Language\V1beta2\ClassificationModelOptions_V1Model::class); + diff --git a/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/ClassificationModelOptions/V2Model.php b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/ClassificationModelOptions/V2Model.php new file mode 100644 index 000000000000..d312077d7246 --- /dev/null +++ b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/ClassificationModelOptions/V2Model.php @@ -0,0 +1,70 @@ +google.cloud.language.v1beta2.ClassificationModelOptions.V2Model + */ +class V2Model extends \Google\Protobuf\Internal\Message +{ + /** + * The content categories used for classification. + * + * Generated from protobuf field .google.cloud.language.v1beta2.ClassificationModelOptions.V2Model.ContentCategoriesVersion content_categories_version = 1; + */ + protected $content_categories_version = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $content_categories_version + * The content categories used for classification. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Language\V1Beta2\LanguageService::initOnce(); + parent::__construct($data); + } + + /** + * The content categories used for classification. + * + * Generated from protobuf field .google.cloud.language.v1beta2.ClassificationModelOptions.V2Model.ContentCategoriesVersion content_categories_version = 1; + * @return int + */ + public function getContentCategoriesVersion() + { + return $this->content_categories_version; + } + + /** + * The content categories used for classification. + * + * Generated from protobuf field .google.cloud.language.v1beta2.ClassificationModelOptions.V2Model.ContentCategoriesVersion content_categories_version = 1; + * @param int $var + * @return $this + */ + public function setContentCategoriesVersion($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Language\V1beta2\ClassificationModelOptions\V2Model\ContentCategoriesVersion::class); + $this->content_categories_version = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(V2Model::class, \Google\Cloud\Language\V1beta2\ClassificationModelOptions_V2Model::class); + diff --git a/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/ClassificationModelOptions/V2Model/ContentCategoriesVersion.php b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/ClassificationModelOptions/V2Model/ContentCategoriesVersion.php new file mode 100644 index 000000000000..7b495d2a084a --- /dev/null +++ b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/ClassificationModelOptions/V2Model/ContentCategoriesVersion.php @@ -0,0 +1,65 @@ +google.cloud.language.v1beta2.ClassificationModelOptions.V2Model.ContentCategoriesVersion + */ +class ContentCategoriesVersion +{ + /** + * If `ContentCategoriesVersion` is not specified, this option will + * default to `V1`. + * + * Generated from protobuf enum CONTENT_CATEGORIES_VERSION_UNSPECIFIED = 0; + */ + const CONTENT_CATEGORIES_VERSION_UNSPECIFIED = 0; + /** + * Legacy content categories of our initial launch in 2017. + * + * Generated from protobuf enum V1 = 1; + */ + const V1 = 1; + /** + * Updated content categories in 2022. + * + * Generated from protobuf enum V2 = 2; + */ + const V2 = 2; + + private static $valueToName = [ + self::CONTENT_CATEGORIES_VERSION_UNSPECIFIED => 'CONTENT_CATEGORIES_VERSION_UNSPECIFIED', + self::V1 => 'V1', + self::V2 => 'V2', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ContentCategoriesVersion::class, \Google\Cloud\Language\V1beta2\ClassificationModelOptions_V2Model_ContentCategoriesVersion::class); + diff --git a/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/ClassificationModelOptions_V1Model.php b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/ClassificationModelOptions_V1Model.php new file mode 100644 index 000000000000..8d869319c8e1 --- /dev/null +++ b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/ClassificationModelOptions_V1Model.php @@ -0,0 +1,16 @@ +google.cloud.language.v1beta2.ClassifyTextRequest + */ +class ClassifyTextRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Input document. + * + * Generated from protobuf field .google.cloud.language.v1beta2.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $document = null; + /** + * Model options to use for classification. Defaults to v1 options if not + * specified. + * + * Generated from protobuf field .google.cloud.language.v1beta2.ClassificationModelOptions classification_model_options = 3; + */ + protected $classification_model_options = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Language\V1beta2\Document $document + * Required. Input document. + * @type \Google\Cloud\Language\V1beta2\ClassificationModelOptions $classification_model_options + * Model options to use for classification. Defaults to v1 options if not + * specified. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Language\V1Beta2\LanguageService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Input document. + * + * Generated from protobuf field .google.cloud.language.v1beta2.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Language\V1beta2\Document|null + */ + public function getDocument() + { + return $this->document; + } + + public function hasDocument() + { + return isset($this->document); + } + + public function clearDocument() + { + unset($this->document); + } + + /** + * Required. Input document. + * + * Generated from protobuf field .google.cloud.language.v1beta2.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Language\V1beta2\Document $var + * @return $this + */ + public function setDocument($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Language\V1beta2\Document::class); + $this->document = $var; + + return $this; + } + + /** + * Model options to use for classification. Defaults to v1 options if not + * specified. + * + * Generated from protobuf field .google.cloud.language.v1beta2.ClassificationModelOptions classification_model_options = 3; + * @return \Google\Cloud\Language\V1beta2\ClassificationModelOptions|null + */ + public function getClassificationModelOptions() + { + return $this->classification_model_options; + } + + public function hasClassificationModelOptions() + { + return isset($this->classification_model_options); + } + + public function clearClassificationModelOptions() + { + unset($this->classification_model_options); + } + + /** + * Model options to use for classification. Defaults to v1 options if not + * specified. + * + * Generated from protobuf field .google.cloud.language.v1beta2.ClassificationModelOptions classification_model_options = 3; + * @param \Google\Cloud\Language\V1beta2\ClassificationModelOptions $var + * @return $this + */ + public function setClassificationModelOptions($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Language\V1beta2\ClassificationModelOptions::class); + $this->classification_model_options = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/ClassifyTextResponse.php b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/ClassifyTextResponse.php new file mode 100644 index 000000000000..a919aba1e73f --- /dev/null +++ b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/ClassifyTextResponse.php @@ -0,0 +1,67 @@ +google.cloud.language.v1beta2.ClassifyTextResponse + */ +class ClassifyTextResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Categories representing the input document. + * + * Generated from protobuf field repeated .google.cloud.language.v1beta2.ClassificationCategory categories = 1; + */ + private $categories; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Language\V1beta2\ClassificationCategory>|\Google\Protobuf\Internal\RepeatedField $categories + * Categories representing the input document. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Language\V1Beta2\LanguageService::initOnce(); + parent::__construct($data); + } + + /** + * Categories representing the input document. + * + * Generated from protobuf field repeated .google.cloud.language.v1beta2.ClassificationCategory categories = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getCategories() + { + return $this->categories; + } + + /** + * Categories representing the input document. + * + * Generated from protobuf field repeated .google.cloud.language.v1beta2.ClassificationCategory categories = 1; + * @param array<\Google\Cloud\Language\V1beta2\ClassificationCategory>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setCategories($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Language\V1beta2\ClassificationCategory::class); + $this->categories = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/DependencyEdge.php b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/DependencyEdge.php new file mode 100644 index 000000000000..17f1fd96606c --- /dev/null +++ b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/DependencyEdge.php @@ -0,0 +1,117 @@ +google.cloud.language.v1beta2.DependencyEdge + */ +class DependencyEdge extends \Google\Protobuf\Internal\Message +{ + /** + * Represents the head of this token in the dependency tree. + * This is the index of the token which has an arc going to this token. + * The index is the position of the token in the array of tokens returned + * by the API method. If this token is a root token, then the + * `head_token_index` is its own index. + * + * Generated from protobuf field int32 head_token_index = 1; + */ + protected $head_token_index = 0; + /** + * The parse label for the token. + * + * Generated from protobuf field .google.cloud.language.v1beta2.DependencyEdge.Label label = 2; + */ + protected $label = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $head_token_index + * Represents the head of this token in the dependency tree. + * This is the index of the token which has an arc going to this token. + * The index is the position of the token in the array of tokens returned + * by the API method. If this token is a root token, then the + * `head_token_index` is its own index. + * @type int $label + * The parse label for the token. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Language\V1Beta2\LanguageService::initOnce(); + parent::__construct($data); + } + + /** + * Represents the head of this token in the dependency tree. + * This is the index of the token which has an arc going to this token. + * The index is the position of the token in the array of tokens returned + * by the API method. If this token is a root token, then the + * `head_token_index` is its own index. + * + * Generated from protobuf field int32 head_token_index = 1; + * @return int + */ + public function getHeadTokenIndex() + { + return $this->head_token_index; + } + + /** + * Represents the head of this token in the dependency tree. + * This is the index of the token which has an arc going to this token. + * The index is the position of the token in the array of tokens returned + * by the API method. If this token is a root token, then the + * `head_token_index` is its own index. + * + * Generated from protobuf field int32 head_token_index = 1; + * @param int $var + * @return $this + */ + public function setHeadTokenIndex($var) + { + GPBUtil::checkInt32($var); + $this->head_token_index = $var; + + return $this; + } + + /** + * The parse label for the token. + * + * Generated from protobuf field .google.cloud.language.v1beta2.DependencyEdge.Label label = 2; + * @return int + */ + public function getLabel() + { + return $this->label; + } + + /** + * The parse label for the token. + * + * Generated from protobuf field .google.cloud.language.v1beta2.DependencyEdge.Label label = 2; + * @param int $var + * @return $this + */ + public function setLabel($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Language\V1beta2\DependencyEdge\Label::class); + $this->label = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/DependencyEdge/Label.php b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/DependencyEdge/Label.php new file mode 100644 index 000000000000..81e822ce5295 --- /dev/null +++ b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/DependencyEdge/Label.php @@ -0,0 +1,628 @@ +google.cloud.language.v1beta2.DependencyEdge.Label + */ +class Label +{ + /** + * Unknown + * + * Generated from protobuf enum UNKNOWN = 0; + */ + const UNKNOWN = 0; + /** + * Abbreviation modifier + * + * Generated from protobuf enum ABBREV = 1; + */ + const ABBREV = 1; + /** + * Adjectival complement + * + * Generated from protobuf enum ACOMP = 2; + */ + const ACOMP = 2; + /** + * Adverbial clause modifier + * + * Generated from protobuf enum ADVCL = 3; + */ + const ADVCL = 3; + /** + * Adverbial modifier + * + * Generated from protobuf enum ADVMOD = 4; + */ + const ADVMOD = 4; + /** + * Adjectival modifier of an NP + * + * Generated from protobuf enum AMOD = 5; + */ + const AMOD = 5; + /** + * Appositional modifier of an NP + * + * Generated from protobuf enum APPOS = 6; + */ + const APPOS = 6; + /** + * Attribute dependent of a copular verb + * + * Generated from protobuf enum ATTR = 7; + */ + const ATTR = 7; + /** + * Auxiliary (non-main) verb + * + * Generated from protobuf enum AUX = 8; + */ + const AUX = 8; + /** + * Passive auxiliary + * + * Generated from protobuf enum AUXPASS = 9; + */ + const AUXPASS = 9; + /** + * Coordinating conjunction + * + * Generated from protobuf enum CC = 10; + */ + const CC = 10; + /** + * Clausal complement of a verb or adjective + * + * Generated from protobuf enum CCOMP = 11; + */ + const CCOMP = 11; + /** + * Conjunct + * + * Generated from protobuf enum CONJ = 12; + */ + const CONJ = 12; + /** + * Clausal subject + * + * Generated from protobuf enum CSUBJ = 13; + */ + const CSUBJ = 13; + /** + * Clausal passive subject + * + * Generated from protobuf enum CSUBJPASS = 14; + */ + const CSUBJPASS = 14; + /** + * Dependency (unable to determine) + * + * Generated from protobuf enum DEP = 15; + */ + const DEP = 15; + /** + * Determiner + * + * Generated from protobuf enum DET = 16; + */ + const DET = 16; + /** + * Discourse + * + * Generated from protobuf enum DISCOURSE = 17; + */ + const DISCOURSE = 17; + /** + * Direct object + * + * Generated from protobuf enum DOBJ = 18; + */ + const DOBJ = 18; + /** + * Expletive + * + * Generated from protobuf enum EXPL = 19; + */ + const EXPL = 19; + /** + * Goes with (part of a word in a text not well edited) + * + * Generated from protobuf enum GOESWITH = 20; + */ + const GOESWITH = 20; + /** + * Indirect object + * + * Generated from protobuf enum IOBJ = 21; + */ + const IOBJ = 21; + /** + * Marker (word introducing a subordinate clause) + * + * Generated from protobuf enum MARK = 22; + */ + const MARK = 22; + /** + * Multi-word expression + * + * Generated from protobuf enum MWE = 23; + */ + const MWE = 23; + /** + * Multi-word verbal expression + * + * Generated from protobuf enum MWV = 24; + */ + const MWV = 24; + /** + * Negation modifier + * + * Generated from protobuf enum NEG = 25; + */ + const NEG = 25; + /** + * Noun compound modifier + * + * Generated from protobuf enum NN = 26; + */ + const NN = 26; + /** + * Noun phrase used as an adverbial modifier + * + * Generated from protobuf enum NPADVMOD = 27; + */ + const NPADVMOD = 27; + /** + * Nominal subject + * + * Generated from protobuf enum NSUBJ = 28; + */ + const NSUBJ = 28; + /** + * Passive nominal subject + * + * Generated from protobuf enum NSUBJPASS = 29; + */ + const NSUBJPASS = 29; + /** + * Numeric modifier of a noun + * + * Generated from protobuf enum NUM = 30; + */ + const NUM = 30; + /** + * Element of compound number + * + * Generated from protobuf enum NUMBER = 31; + */ + const NUMBER = 31; + /** + * Punctuation mark + * + * Generated from protobuf enum P = 32; + */ + const P = 32; + /** + * Parataxis relation + * + * Generated from protobuf enum PARATAXIS = 33; + */ + const PARATAXIS = 33; + /** + * Participial modifier + * + * Generated from protobuf enum PARTMOD = 34; + */ + const PARTMOD = 34; + /** + * The complement of a preposition is a clause + * + * Generated from protobuf enum PCOMP = 35; + */ + const PCOMP = 35; + /** + * Object of a preposition + * + * Generated from protobuf enum POBJ = 36; + */ + const POBJ = 36; + /** + * Possession modifier + * + * Generated from protobuf enum POSS = 37; + */ + const POSS = 37; + /** + * Postverbal negative particle + * + * Generated from protobuf enum POSTNEG = 38; + */ + const POSTNEG = 38; + /** + * Predicate complement + * + * Generated from protobuf enum PRECOMP = 39; + */ + const PRECOMP = 39; + /** + * Preconjunt + * + * Generated from protobuf enum PRECONJ = 40; + */ + const PRECONJ = 40; + /** + * Predeterminer + * + * Generated from protobuf enum PREDET = 41; + */ + const PREDET = 41; + /** + * Prefix + * + * Generated from protobuf enum PREF = 42; + */ + const PREF = 42; + /** + * Prepositional modifier + * + * Generated from protobuf enum PREP = 43; + */ + const PREP = 43; + /** + * The relationship between a verb and verbal morpheme + * + * Generated from protobuf enum PRONL = 44; + */ + const PRONL = 44; + /** + * Particle + * + * Generated from protobuf enum PRT = 45; + */ + const PRT = 45; + /** + * Associative or possessive marker + * + * Generated from protobuf enum PS = 46; + */ + const PS = 46; + /** + * Quantifier phrase modifier + * + * Generated from protobuf enum QUANTMOD = 47; + */ + const QUANTMOD = 47; + /** + * Relative clause modifier + * + * Generated from protobuf enum RCMOD = 48; + */ + const RCMOD = 48; + /** + * Complementizer in relative clause + * + * Generated from protobuf enum RCMODREL = 49; + */ + const RCMODREL = 49; + /** + * Ellipsis without a preceding predicate + * + * Generated from protobuf enum RDROP = 50; + */ + const RDROP = 50; + /** + * Referent + * + * Generated from protobuf enum REF = 51; + */ + const REF = 51; + /** + * Remnant + * + * Generated from protobuf enum REMNANT = 52; + */ + const REMNANT = 52; + /** + * Reparandum + * + * Generated from protobuf enum REPARANDUM = 53; + */ + const REPARANDUM = 53; + /** + * Root + * + * Generated from protobuf enum ROOT = 54; + */ + const ROOT = 54; + /** + * Suffix specifying a unit of number + * + * Generated from protobuf enum SNUM = 55; + */ + const SNUM = 55; + /** + * Suffix + * + * Generated from protobuf enum SUFF = 56; + */ + const SUFF = 56; + /** + * Temporal modifier + * + * Generated from protobuf enum TMOD = 57; + */ + const TMOD = 57; + /** + * Topic marker + * + * Generated from protobuf enum TOPIC = 58; + */ + const TOPIC = 58; + /** + * Clause headed by an infinite form of the verb that modifies a noun + * + * Generated from protobuf enum VMOD = 59; + */ + const VMOD = 59; + /** + * Vocative + * + * Generated from protobuf enum VOCATIVE = 60; + */ + const VOCATIVE = 60; + /** + * Open clausal complement + * + * Generated from protobuf enum XCOMP = 61; + */ + const XCOMP = 61; + /** + * Name suffix + * + * Generated from protobuf enum SUFFIX = 62; + */ + const SUFFIX = 62; + /** + * Name title + * + * Generated from protobuf enum TITLE = 63; + */ + const TITLE = 63; + /** + * Adverbial phrase modifier + * + * Generated from protobuf enum ADVPHMOD = 64; + */ + const ADVPHMOD = 64; + /** + * Causative auxiliary + * + * Generated from protobuf enum AUXCAUS = 65; + */ + const AUXCAUS = 65; + /** + * Helper auxiliary + * + * Generated from protobuf enum AUXVV = 66; + */ + const AUXVV = 66; + /** + * Rentaishi (Prenominal modifier) + * + * Generated from protobuf enum DTMOD = 67; + */ + const DTMOD = 67; + /** + * Foreign words + * + * Generated from protobuf enum FOREIGN = 68; + */ + const FOREIGN = 68; + /** + * Keyword + * + * Generated from protobuf enum KW = 69; + */ + const KW = 69; + /** + * List for chains of comparable items + * + * Generated from protobuf enum LIST = 70; + */ + const PBLIST = 70; + /** + * Nominalized clause + * + * Generated from protobuf enum NOMC = 71; + */ + const NOMC = 71; + /** + * Nominalized clausal subject + * + * Generated from protobuf enum NOMCSUBJ = 72; + */ + const NOMCSUBJ = 72; + /** + * Nominalized clausal passive + * + * Generated from protobuf enum NOMCSUBJPASS = 73; + */ + const NOMCSUBJPASS = 73; + /** + * Compound of numeric modifier + * + * Generated from protobuf enum NUMC = 74; + */ + const NUMC = 74; + /** + * Copula + * + * Generated from protobuf enum COP = 75; + */ + const COP = 75; + /** + * Dislocated relation (for fronted/topicalized elements) + * + * Generated from protobuf enum DISLOCATED = 76; + */ + const DISLOCATED = 76; + /** + * Aspect marker + * + * Generated from protobuf enum ASP = 77; + */ + const ASP = 77; + /** + * Genitive modifier + * + * Generated from protobuf enum GMOD = 78; + */ + const GMOD = 78; + /** + * Genitive object + * + * Generated from protobuf enum GOBJ = 79; + */ + const GOBJ = 79; + /** + * Infinitival modifier + * + * Generated from protobuf enum INFMOD = 80; + */ + const INFMOD = 80; + /** + * Measure + * + * Generated from protobuf enum MES = 81; + */ + const MES = 81; + /** + * Nominal complement of a noun + * + * Generated from protobuf enum NCOMP = 82; + */ + const NCOMP = 82; + + private static $valueToName = [ + self::UNKNOWN => 'UNKNOWN', + self::ABBREV => 'ABBREV', + self::ACOMP => 'ACOMP', + self::ADVCL => 'ADVCL', + self::ADVMOD => 'ADVMOD', + self::AMOD => 'AMOD', + self::APPOS => 'APPOS', + self::ATTR => 'ATTR', + self::AUX => 'AUX', + self::AUXPASS => 'AUXPASS', + self::CC => 'CC', + self::CCOMP => 'CCOMP', + self::CONJ => 'CONJ', + self::CSUBJ => 'CSUBJ', + self::CSUBJPASS => 'CSUBJPASS', + self::DEP => 'DEP', + self::DET => 'DET', + self::DISCOURSE => 'DISCOURSE', + self::DOBJ => 'DOBJ', + self::EXPL => 'EXPL', + self::GOESWITH => 'GOESWITH', + self::IOBJ => 'IOBJ', + self::MARK => 'MARK', + self::MWE => 'MWE', + self::MWV => 'MWV', + self::NEG => 'NEG', + self::NN => 'NN', + self::NPADVMOD => 'NPADVMOD', + self::NSUBJ => 'NSUBJ', + self::NSUBJPASS => 'NSUBJPASS', + self::NUM => 'NUM', + self::NUMBER => 'NUMBER', + self::P => 'P', + self::PARATAXIS => 'PARATAXIS', + self::PARTMOD => 'PARTMOD', + self::PCOMP => 'PCOMP', + self::POBJ => 'POBJ', + self::POSS => 'POSS', + self::POSTNEG => 'POSTNEG', + self::PRECOMP => 'PRECOMP', + self::PRECONJ => 'PRECONJ', + self::PREDET => 'PREDET', + self::PREF => 'PREF', + self::PREP => 'PREP', + self::PRONL => 'PRONL', + self::PRT => 'PRT', + self::PS => 'PS', + self::QUANTMOD => 'QUANTMOD', + self::RCMOD => 'RCMOD', + self::RCMODREL => 'RCMODREL', + self::RDROP => 'RDROP', + self::REF => 'REF', + self::REMNANT => 'REMNANT', + self::REPARANDUM => 'REPARANDUM', + self::ROOT => 'ROOT', + self::SNUM => 'SNUM', + self::SUFF => 'SUFF', + self::TMOD => 'TMOD', + self::TOPIC => 'TOPIC', + self::VMOD => 'VMOD', + self::VOCATIVE => 'VOCATIVE', + self::XCOMP => 'XCOMP', + self::SUFFIX => 'SUFFIX', + self::TITLE => 'TITLE', + self::ADVPHMOD => 'ADVPHMOD', + self::AUXCAUS => 'AUXCAUS', + self::AUXVV => 'AUXVV', + self::DTMOD => 'DTMOD', + self::FOREIGN => 'FOREIGN', + self::KW => 'KW', + self::PBLIST => 'LIST', + self::NOMC => 'NOMC', + self::NOMCSUBJ => 'NOMCSUBJ', + self::NOMCSUBJPASS => 'NOMCSUBJPASS', + self::NUMC => 'NUMC', + self::COP => 'COP', + self::DISLOCATED => 'DISLOCATED', + self::ASP => 'ASP', + self::GMOD => 'GMOD', + self::GOBJ => 'GOBJ', + self::INFMOD => 'INFMOD', + self::MES => 'MES', + self::NCOMP => 'NCOMP', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + $pbconst = __CLASS__. '::PB' . strtoupper($name); + if (!defined($pbconst)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($pbconst); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Label::class, \Google\Cloud\Language\V1beta2\DependencyEdge_Label::class); + diff --git a/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/DependencyEdge_Label.php b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/DependencyEdge_Label.php new file mode 100644 index 000000000000..ec8b85fdba85 --- /dev/null +++ b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/DependencyEdge_Label.php @@ -0,0 +1,16 @@ +google.cloud.language.v1beta2.Document + */ +class Document extends \Google\Protobuf\Internal\Message +{ + /** + * Required. If the type is not set or is `TYPE_UNSPECIFIED`, + * returns an `INVALID_ARGUMENT` error. + * + * Generated from protobuf field .google.cloud.language.v1beta2.Document.Type type = 1; + */ + protected $type = 0; + /** + * The language of the document (if not specified, the language is + * automatically detected). Both ISO and BCP-47 language codes are + * accepted.
+ * [Language + * Support](https://cloud.google.com/natural-language/docs/languages) lists + * currently supported languages for each API method. If the language (either + * specified by the caller or automatically detected) is not supported by the + * called API method, an `INVALID_ARGUMENT` error is returned. + * + * Generated from protobuf field string language = 4; + */ + protected $language = ''; + /** + * The web URI where the document comes from. This URI is not used for + * fetching the content, but as a hint for analyzing the document. + * + * Generated from protobuf field string reference_web_uri = 5; + */ + protected $reference_web_uri = ''; + /** + * Indicates how detected boilerplate(e.g. advertisements, copyright + * declarations, banners) should be handled for this document. If not + * specified, boilerplate will be treated the same as content. + * + * Generated from protobuf field .google.cloud.language.v1beta2.Document.BoilerplateHandling boilerplate_handling = 6; + */ + protected $boilerplate_handling = 0; + protected $source; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $type + * Required. If the type is not set or is `TYPE_UNSPECIFIED`, + * returns an `INVALID_ARGUMENT` error. + * @type string $content + * The content of the input in string format. + * Cloud audit logging exempt since it is based on user data. + * @type string $gcs_content_uri + * The Google Cloud Storage URI where the file content is located. + * This URI must be of the form: gs://bucket_name/object_name. For more + * details, see https://cloud.google.com/storage/docs/reference-uris. + * NOTE: Cloud Storage object versioning is not supported. + * @type string $language + * The language of the document (if not specified, the language is + * automatically detected). Both ISO and BCP-47 language codes are + * accepted.
+ * [Language + * Support](https://cloud.google.com/natural-language/docs/languages) lists + * currently supported languages for each API method. If the language (either + * specified by the caller or automatically detected) is not supported by the + * called API method, an `INVALID_ARGUMENT` error is returned. + * @type string $reference_web_uri + * The web URI where the document comes from. This URI is not used for + * fetching the content, but as a hint for analyzing the document. + * @type int $boilerplate_handling + * Indicates how detected boilerplate(e.g. advertisements, copyright + * declarations, banners) should be handled for this document. If not + * specified, boilerplate will be treated the same as content. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Language\V1Beta2\LanguageService::initOnce(); + parent::__construct($data); + } + + /** + * Required. If the type is not set or is `TYPE_UNSPECIFIED`, + * returns an `INVALID_ARGUMENT` error. + * + * Generated from protobuf field .google.cloud.language.v1beta2.Document.Type type = 1; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * Required. If the type is not set or is `TYPE_UNSPECIFIED`, + * returns an `INVALID_ARGUMENT` error. + * + * Generated from protobuf field .google.cloud.language.v1beta2.Document.Type type = 1; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Language\V1beta2\Document\Type::class); + $this->type = $var; + + return $this; + } + + /** + * The content of the input in string format. + * Cloud audit logging exempt since it is based on user data. + * + * Generated from protobuf field string content = 2; + * @return string + */ + public function getContent() + { + return $this->readOneof(2); + } + + public function hasContent() + { + return $this->hasOneof(2); + } + + /** + * The content of the input in string format. + * Cloud audit logging exempt since it is based on user data. + * + * Generated from protobuf field string content = 2; + * @param string $var + * @return $this + */ + public function setContent($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * The Google Cloud Storage URI where the file content is located. + * This URI must be of the form: gs://bucket_name/object_name. For more + * details, see https://cloud.google.com/storage/docs/reference-uris. + * NOTE: Cloud Storage object versioning is not supported. + * + * Generated from protobuf field string gcs_content_uri = 3; + * @return string + */ + public function getGcsContentUri() + { + return $this->readOneof(3); + } + + public function hasGcsContentUri() + { + return $this->hasOneof(3); + } + + /** + * The Google Cloud Storage URI where the file content is located. + * This URI must be of the form: gs://bucket_name/object_name. For more + * details, see https://cloud.google.com/storage/docs/reference-uris. + * NOTE: Cloud Storage object versioning is not supported. + * + * Generated from protobuf field string gcs_content_uri = 3; + * @param string $var + * @return $this + */ + public function setGcsContentUri($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * The language of the document (if not specified, the language is + * automatically detected). Both ISO and BCP-47 language codes are + * accepted.
+ * [Language + * Support](https://cloud.google.com/natural-language/docs/languages) lists + * currently supported languages for each API method. If the language (either + * specified by the caller or automatically detected) is not supported by the + * called API method, an `INVALID_ARGUMENT` error is returned. + * + * Generated from protobuf field string language = 4; + * @return string + */ + public function getLanguage() + { + return $this->language; + } + + /** + * The language of the document (if not specified, the language is + * automatically detected). Both ISO and BCP-47 language codes are + * accepted.
+ * [Language + * Support](https://cloud.google.com/natural-language/docs/languages) lists + * currently supported languages for each API method. If the language (either + * specified by the caller or automatically detected) is not supported by the + * called API method, an `INVALID_ARGUMENT` error is returned. + * + * Generated from protobuf field string language = 4; + * @param string $var + * @return $this + */ + public function setLanguage($var) + { + GPBUtil::checkString($var, True); + $this->language = $var; + + return $this; + } + + /** + * The web URI where the document comes from. This URI is not used for + * fetching the content, but as a hint for analyzing the document. + * + * Generated from protobuf field string reference_web_uri = 5; + * @return string + */ + public function getReferenceWebUri() + { + return $this->reference_web_uri; + } + + /** + * The web URI where the document comes from. This URI is not used for + * fetching the content, but as a hint for analyzing the document. + * + * Generated from protobuf field string reference_web_uri = 5; + * @param string $var + * @return $this + */ + public function setReferenceWebUri($var) + { + GPBUtil::checkString($var, True); + $this->reference_web_uri = $var; + + return $this; + } + + /** + * Indicates how detected boilerplate(e.g. advertisements, copyright + * declarations, banners) should be handled for this document. If not + * specified, boilerplate will be treated the same as content. + * + * Generated from protobuf field .google.cloud.language.v1beta2.Document.BoilerplateHandling boilerplate_handling = 6; + * @return int + */ + public function getBoilerplateHandling() + { + return $this->boilerplate_handling; + } + + /** + * Indicates how detected boilerplate(e.g. advertisements, copyright + * declarations, banners) should be handled for this document. If not + * specified, boilerplate will be treated the same as content. + * + * Generated from protobuf field .google.cloud.language.v1beta2.Document.BoilerplateHandling boilerplate_handling = 6; + * @param int $var + * @return $this + */ + public function setBoilerplateHandling($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Language\V1beta2\Document\BoilerplateHandling::class); + $this->boilerplate_handling = $var; + + return $this; + } + + /** + * @return string + */ + public function getSource() + { + return $this->whichOneof("source"); + } + +} + diff --git a/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/Document/BoilerplateHandling.php b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/Document/BoilerplateHandling.php new file mode 100644 index 000000000000..0b2e8a4c21c7 --- /dev/null +++ b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/Document/BoilerplateHandling.php @@ -0,0 +1,65 @@ +google.cloud.language.v1beta2.Document.BoilerplateHandling + */ +class BoilerplateHandling +{ + /** + * The boilerplate handling is not specified. + * + * Generated from protobuf enum BOILERPLATE_HANDLING_UNSPECIFIED = 0; + */ + const BOILERPLATE_HANDLING_UNSPECIFIED = 0; + /** + * Do not analyze detected boilerplate. Reference web URI is required for + * detecting boilerplate. + * + * Generated from protobuf enum SKIP_BOILERPLATE = 1; + */ + const SKIP_BOILERPLATE = 1; + /** + * Treat boilerplate the same as content. + * + * Generated from protobuf enum KEEP_BOILERPLATE = 2; + */ + const KEEP_BOILERPLATE = 2; + + private static $valueToName = [ + self::BOILERPLATE_HANDLING_UNSPECIFIED => 'BOILERPLATE_HANDLING_UNSPECIFIED', + self::SKIP_BOILERPLATE => 'SKIP_BOILERPLATE', + self::KEEP_BOILERPLATE => 'KEEP_BOILERPLATE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(BoilerplateHandling::class, \Google\Cloud\Language\V1beta2\Document_BoilerplateHandling::class); + diff --git a/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/Document/Type.php b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/Document/Type.php new file mode 100644 index 000000000000..382148db46a1 --- /dev/null +++ b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/Document/Type.php @@ -0,0 +1,64 @@ +google.cloud.language.v1beta2.Document.Type + */ +class Type +{ + /** + * The content type is not specified. + * + * Generated from protobuf enum TYPE_UNSPECIFIED = 0; + */ + const TYPE_UNSPECIFIED = 0; + /** + * Plain text + * + * Generated from protobuf enum PLAIN_TEXT = 1; + */ + const PLAIN_TEXT = 1; + /** + * HTML + * + * Generated from protobuf enum HTML = 2; + */ + const HTML = 2; + + private static $valueToName = [ + self::TYPE_UNSPECIFIED => 'TYPE_UNSPECIFIED', + self::PLAIN_TEXT => 'PLAIN_TEXT', + self::HTML => 'HTML', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Type::class, \Google\Cloud\Language\V1beta2\Document_Type::class); + diff --git a/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/Document_BoilerplateHandling.php b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/Document_BoilerplateHandling.php new file mode 100644 index 000000000000..780023885950 --- /dev/null +++ b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/Document_BoilerplateHandling.php @@ -0,0 +1,16 @@ +google.cloud.language.v1beta2.EncodingType + */ +class EncodingType +{ + /** + * If `EncodingType` is not specified, encoding-dependent information (such as + * `begin_offset`) will be set at `-1`. + * + * Generated from protobuf enum NONE = 0; + */ + const NONE = 0; + /** + * Encoding-dependent information (such as `begin_offset`) is calculated based + * on the UTF-8 encoding of the input. C++ and Go are examples of languages + * that use this encoding natively. + * + * Generated from protobuf enum UTF8 = 1; + */ + const UTF8 = 1; + /** + * Encoding-dependent information (such as `begin_offset`) is calculated based + * on the UTF-16 encoding of the input. Java and JavaScript are examples of + * languages that use this encoding natively. + * + * Generated from protobuf enum UTF16 = 2; + */ + const UTF16 = 2; + /** + * Encoding-dependent information (such as `begin_offset`) is calculated based + * on the UTF-32 encoding of the input. Python is an example of a language + * that uses this encoding natively. + * + * Generated from protobuf enum UTF32 = 3; + */ + const UTF32 = 3; + + private static $valueToName = [ + self::NONE => 'NONE', + self::UTF8 => 'UTF8', + self::UTF16 => 'UTF16', + self::UTF32 => 'UTF32', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/Entity.php b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/Entity.php new file mode 100644 index 000000000000..846e4fa93d5b --- /dev/null +++ b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/Entity.php @@ -0,0 +1,293 @@ +google.cloud.language.v1beta2.Entity + */ +class Entity extends \Google\Protobuf\Internal\Message +{ + /** + * The representative name for the entity. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * The entity type. + * + * Generated from protobuf field .google.cloud.language.v1beta2.Entity.Type type = 2; + */ + protected $type = 0; + /** + * Metadata associated with the entity. + * For most entity types, the metadata is a Wikipedia URL (`wikipedia_url`) + * and Knowledge Graph MID (`mid`), if they are available. For the metadata + * associated with other entity types, see the Type table below. + * + * Generated from protobuf field map metadata = 3; + */ + private $metadata; + /** + * The salience score associated with the entity in the [0, 1.0] range. + * The salience score for an entity provides information about the + * importance or centrality of that entity to the entire document text. + * Scores closer to 0 are less salient, while scores closer to 1.0 are highly + * salient. + * + * Generated from protobuf field float salience = 4; + */ + protected $salience = 0.0; + /** + * The mentions of this entity in the input document. The API currently + * supports proper noun mentions. + * + * Generated from protobuf field repeated .google.cloud.language.v1beta2.EntityMention mentions = 5; + */ + private $mentions; + /** + * For calls to [AnalyzeEntitySentiment][] or if + * [AnnotateTextRequest.Features.extract_entity_sentiment][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_entity_sentiment] is set to + * true, this field will contain the aggregate sentiment expressed for this + * entity in the provided document. + * + * Generated from protobuf field .google.cloud.language.v1beta2.Sentiment sentiment = 6; + */ + protected $sentiment = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The representative name for the entity. + * @type int $type + * The entity type. + * @type array|\Google\Protobuf\Internal\MapField $metadata + * Metadata associated with the entity. + * For most entity types, the metadata is a Wikipedia URL (`wikipedia_url`) + * and Knowledge Graph MID (`mid`), if they are available. For the metadata + * associated with other entity types, see the Type table below. + * @type float $salience + * The salience score associated with the entity in the [0, 1.0] range. + * The salience score for an entity provides information about the + * importance or centrality of that entity to the entire document text. + * Scores closer to 0 are less salient, while scores closer to 1.0 are highly + * salient. + * @type array<\Google\Cloud\Language\V1beta2\EntityMention>|\Google\Protobuf\Internal\RepeatedField $mentions + * The mentions of this entity in the input document. The API currently + * supports proper noun mentions. + * @type \Google\Cloud\Language\V1beta2\Sentiment $sentiment + * For calls to [AnalyzeEntitySentiment][] or if + * [AnnotateTextRequest.Features.extract_entity_sentiment][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_entity_sentiment] is set to + * true, this field will contain the aggregate sentiment expressed for this + * entity in the provided document. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Language\V1Beta2\LanguageService::initOnce(); + parent::__construct($data); + } + + /** + * The representative name for the entity. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The representative name for the entity. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The entity type. + * + * Generated from protobuf field .google.cloud.language.v1beta2.Entity.Type type = 2; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * The entity type. + * + * Generated from protobuf field .google.cloud.language.v1beta2.Entity.Type type = 2; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Language\V1beta2\Entity\Type::class); + $this->type = $var; + + return $this; + } + + /** + * Metadata associated with the entity. + * For most entity types, the metadata is a Wikipedia URL (`wikipedia_url`) + * and Knowledge Graph MID (`mid`), if they are available. For the metadata + * associated with other entity types, see the Type table below. + * + * Generated from protobuf field map metadata = 3; + * @return \Google\Protobuf\Internal\MapField + */ + public function getMetadata() + { + return $this->metadata; + } + + /** + * Metadata associated with the entity. + * For most entity types, the metadata is a Wikipedia URL (`wikipedia_url`) + * and Knowledge Graph MID (`mid`), if they are available. For the metadata + * associated with other entity types, see the Type table below. + * + * Generated from protobuf field map metadata = 3; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setMetadata($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->metadata = $arr; + + return $this; + } + + /** + * The salience score associated with the entity in the [0, 1.0] range. + * The salience score for an entity provides information about the + * importance or centrality of that entity to the entire document text. + * Scores closer to 0 are less salient, while scores closer to 1.0 are highly + * salient. + * + * Generated from protobuf field float salience = 4; + * @return float + */ + public function getSalience() + { + return $this->salience; + } + + /** + * The salience score associated with the entity in the [0, 1.0] range. + * The salience score for an entity provides information about the + * importance or centrality of that entity to the entire document text. + * Scores closer to 0 are less salient, while scores closer to 1.0 are highly + * salient. + * + * Generated from protobuf field float salience = 4; + * @param float $var + * @return $this + */ + public function setSalience($var) + { + GPBUtil::checkFloat($var); + $this->salience = $var; + + return $this; + } + + /** + * The mentions of this entity in the input document. The API currently + * supports proper noun mentions. + * + * Generated from protobuf field repeated .google.cloud.language.v1beta2.EntityMention mentions = 5; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getMentions() + { + return $this->mentions; + } + + /** + * The mentions of this entity in the input document. The API currently + * supports proper noun mentions. + * + * Generated from protobuf field repeated .google.cloud.language.v1beta2.EntityMention mentions = 5; + * @param array<\Google\Cloud\Language\V1beta2\EntityMention>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setMentions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Language\V1beta2\EntityMention::class); + $this->mentions = $arr; + + return $this; + } + + /** + * For calls to [AnalyzeEntitySentiment][] or if + * [AnnotateTextRequest.Features.extract_entity_sentiment][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_entity_sentiment] is set to + * true, this field will contain the aggregate sentiment expressed for this + * entity in the provided document. + * + * Generated from protobuf field .google.cloud.language.v1beta2.Sentiment sentiment = 6; + * @return \Google\Cloud\Language\V1beta2\Sentiment|null + */ + public function getSentiment() + { + return $this->sentiment; + } + + public function hasSentiment() + { + return isset($this->sentiment); + } + + public function clearSentiment() + { + unset($this->sentiment); + } + + /** + * For calls to [AnalyzeEntitySentiment][] or if + * [AnnotateTextRequest.Features.extract_entity_sentiment][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_entity_sentiment] is set to + * true, this field will contain the aggregate sentiment expressed for this + * entity in the provided document. + * + * Generated from protobuf field .google.cloud.language.v1beta2.Sentiment sentiment = 6; + * @param \Google\Cloud\Language\V1beta2\Sentiment $var + * @return $this + */ + public function setSentiment($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Language\V1beta2\Sentiment::class); + $this->sentiment = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/Entity/Type.php b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/Entity/Type.php new file mode 100644 index 000000000000..128bbb2c7e0b --- /dev/null +++ b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/Entity/Type.php @@ -0,0 +1,163 @@ +google.cloud.language.v1beta2.Entity.Type + */ +class Type +{ + /** + * Unknown + * + * Generated from protobuf enum UNKNOWN = 0; + */ + const UNKNOWN = 0; + /** + * Person + * + * Generated from protobuf enum PERSON = 1; + */ + const PERSON = 1; + /** + * Location + * + * Generated from protobuf enum LOCATION = 2; + */ + const LOCATION = 2; + /** + * Organization + * + * Generated from protobuf enum ORGANIZATION = 3; + */ + const ORGANIZATION = 3; + /** + * Event + * + * Generated from protobuf enum EVENT = 4; + */ + const EVENT = 4; + /** + * Artwork + * + * Generated from protobuf enum WORK_OF_ART = 5; + */ + const WORK_OF_ART = 5; + /** + * Consumer product + * + * Generated from protobuf enum CONSUMER_GOOD = 6; + */ + const CONSUMER_GOOD = 6; + /** + * Other types of entities + * + * Generated from protobuf enum OTHER = 7; + */ + const OTHER = 7; + /** + * Phone number + * The metadata lists the phone number, formatted according to local + * convention, plus whichever additional elements appear in the text: + * * `number` - the actual number, broken down into sections as per local + * convention + * * `national_prefix` - country code, if detected + * * `area_code` - region or area code, if detected + * * `extension` - phone extension (to be dialed after connection), if + * detected + * + * Generated from protobuf enum PHONE_NUMBER = 9; + */ + const PHONE_NUMBER = 9; + /** + * Address + * The metadata identifies the street number and locality plus whichever + * additional elements appear in the text: + * * `street_number` - street number + * * `locality` - city or town + * * `street_name` - street/route name, if detected + * * `postal_code` - postal code, if detected + * * `country` - country, if detected< + * * `broad_region` - administrative area, such as the state, if detected + * * `narrow_region` - smaller administrative area, such as county, if + * detected + * * `sublocality` - used in Asian addresses to demark a district within a + * city, if detected + * + * Generated from protobuf enum ADDRESS = 10; + */ + const ADDRESS = 10; + /** + * Date + * The metadata identifies the components of the date: + * * `year` - four digit year, if detected + * * `month` - two digit month number, if detected + * * `day` - two digit day number, if detected + * + * Generated from protobuf enum DATE = 11; + */ + const DATE = 11; + /** + * Number + * The metadata is the number itself. + * + * Generated from protobuf enum NUMBER = 12; + */ + const NUMBER = 12; + /** + * Price + * The metadata identifies the `value` and `currency`. + * + * Generated from protobuf enum PRICE = 13; + */ + const PRICE = 13; + + private static $valueToName = [ + self::UNKNOWN => 'UNKNOWN', + self::PERSON => 'PERSON', + self::LOCATION => 'LOCATION', + self::ORGANIZATION => 'ORGANIZATION', + self::EVENT => 'EVENT', + self::WORK_OF_ART => 'WORK_OF_ART', + self::CONSUMER_GOOD => 'CONSUMER_GOOD', + self::OTHER => 'OTHER', + self::PHONE_NUMBER => 'PHONE_NUMBER', + self::ADDRESS => 'ADDRESS', + self::DATE => 'DATE', + self::NUMBER => 'NUMBER', + self::PRICE => 'PRICE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Type::class, \Google\Cloud\Language\V1beta2\Entity_Type::class); + diff --git a/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/EntityMention.php b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/EntityMention.php new file mode 100644 index 000000000000..9f3769212df5 --- /dev/null +++ b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/EntityMention.php @@ -0,0 +1,168 @@ +google.cloud.language.v1beta2.EntityMention + */ +class EntityMention extends \Google\Protobuf\Internal\Message +{ + /** + * The mention text. + * + * Generated from protobuf field .google.cloud.language.v1beta2.TextSpan text = 1; + */ + protected $text = null; + /** + * The type of the entity mention. + * + * Generated from protobuf field .google.cloud.language.v1beta2.EntityMention.Type type = 2; + */ + protected $type = 0; + /** + * For calls to [AnalyzeEntitySentiment][] or if + * [AnnotateTextRequest.Features.extract_entity_sentiment][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_entity_sentiment] is set to + * true, this field will contain the sentiment expressed for this mention of + * the entity in the provided document. + * + * Generated from protobuf field .google.cloud.language.v1beta2.Sentiment sentiment = 3; + */ + protected $sentiment = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Language\V1beta2\TextSpan $text + * The mention text. + * @type int $type + * The type of the entity mention. + * @type \Google\Cloud\Language\V1beta2\Sentiment $sentiment + * For calls to [AnalyzeEntitySentiment][] or if + * [AnnotateTextRequest.Features.extract_entity_sentiment][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_entity_sentiment] is set to + * true, this field will contain the sentiment expressed for this mention of + * the entity in the provided document. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Language\V1Beta2\LanguageService::initOnce(); + parent::__construct($data); + } + + /** + * The mention text. + * + * Generated from protobuf field .google.cloud.language.v1beta2.TextSpan text = 1; + * @return \Google\Cloud\Language\V1beta2\TextSpan|null + */ + public function getText() + { + return $this->text; + } + + public function hasText() + { + return isset($this->text); + } + + public function clearText() + { + unset($this->text); + } + + /** + * The mention text. + * + * Generated from protobuf field .google.cloud.language.v1beta2.TextSpan text = 1; + * @param \Google\Cloud\Language\V1beta2\TextSpan $var + * @return $this + */ + public function setText($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Language\V1beta2\TextSpan::class); + $this->text = $var; + + return $this; + } + + /** + * The type of the entity mention. + * + * Generated from protobuf field .google.cloud.language.v1beta2.EntityMention.Type type = 2; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * The type of the entity mention. + * + * Generated from protobuf field .google.cloud.language.v1beta2.EntityMention.Type type = 2; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Language\V1beta2\EntityMention\Type::class); + $this->type = $var; + + return $this; + } + + /** + * For calls to [AnalyzeEntitySentiment][] or if + * [AnnotateTextRequest.Features.extract_entity_sentiment][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_entity_sentiment] is set to + * true, this field will contain the sentiment expressed for this mention of + * the entity in the provided document. + * + * Generated from protobuf field .google.cloud.language.v1beta2.Sentiment sentiment = 3; + * @return \Google\Cloud\Language\V1beta2\Sentiment|null + */ + public function getSentiment() + { + return $this->sentiment; + } + + public function hasSentiment() + { + return isset($this->sentiment); + } + + public function clearSentiment() + { + unset($this->sentiment); + } + + /** + * For calls to [AnalyzeEntitySentiment][] or if + * [AnnotateTextRequest.Features.extract_entity_sentiment][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_entity_sentiment] is set to + * true, this field will contain the sentiment expressed for this mention of + * the entity in the provided document. + * + * Generated from protobuf field .google.cloud.language.v1beta2.Sentiment sentiment = 3; + * @param \Google\Cloud\Language\V1beta2\Sentiment $var + * @return $this + */ + public function setSentiment($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Language\V1beta2\Sentiment::class); + $this->sentiment = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/EntityMention/Type.php b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/EntityMention/Type.php new file mode 100644 index 000000000000..75131e71c1d9 --- /dev/null +++ b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/EntityMention/Type.php @@ -0,0 +1,64 @@ +google.cloud.language.v1beta2.EntityMention.Type + */ +class Type +{ + /** + * Unknown + * + * Generated from protobuf enum TYPE_UNKNOWN = 0; + */ + const TYPE_UNKNOWN = 0; + /** + * Proper name + * + * Generated from protobuf enum PROPER = 1; + */ + const PROPER = 1; + /** + * Common noun (or noun compound) + * + * Generated from protobuf enum COMMON = 2; + */ + const COMMON = 2; + + private static $valueToName = [ + self::TYPE_UNKNOWN => 'TYPE_UNKNOWN', + self::PROPER => 'PROPER', + self::COMMON => 'COMMON', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Type::class, \Google\Cloud\Language\V1beta2\EntityMention_Type::class); + diff --git a/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/EntityMention_Type.php b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/EntityMention_Type.php new file mode 100644 index 000000000000..1202dcaa1ec0 --- /dev/null +++ b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/EntityMention_Type.php @@ -0,0 +1,16 @@ +_simpleRequest('/google.cloud.language.v1beta2.LanguageService/AnalyzeSentiment', + $argument, + ['\Google\Cloud\Language\V1beta2\AnalyzeSentimentResponse', 'decode'], + $metadata, $options); + } + + /** + * Finds named entities (currently proper names and common nouns) in the text + * along with entity types, salience, mentions for each entity, and + * other properties. + * @param \Google\Cloud\Language\V1beta2\AnalyzeEntitiesRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function AnalyzeEntities(\Google\Cloud\Language\V1beta2\AnalyzeEntitiesRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.language.v1beta2.LanguageService/AnalyzeEntities', + $argument, + ['\Google\Cloud\Language\V1beta2\AnalyzeEntitiesResponse', 'decode'], + $metadata, $options); + } + + /** + * Finds entities, similar to [AnalyzeEntities][google.cloud.language.v1beta2.LanguageService.AnalyzeEntities] in the text and analyzes + * sentiment associated with each entity and its mentions. + * @param \Google\Cloud\Language\V1beta2\AnalyzeEntitySentimentRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function AnalyzeEntitySentiment(\Google\Cloud\Language\V1beta2\AnalyzeEntitySentimentRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.language.v1beta2.LanguageService/AnalyzeEntitySentiment', + $argument, + ['\Google\Cloud\Language\V1beta2\AnalyzeEntitySentimentResponse', 'decode'], + $metadata, $options); + } + + /** + * Analyzes the syntax of the text and provides sentence boundaries and + * tokenization along with part of speech tags, dependency trees, and other + * properties. + * @param \Google\Cloud\Language\V1beta2\AnalyzeSyntaxRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function AnalyzeSyntax(\Google\Cloud\Language\V1beta2\AnalyzeSyntaxRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.language.v1beta2.LanguageService/AnalyzeSyntax', + $argument, + ['\Google\Cloud\Language\V1beta2\AnalyzeSyntaxResponse', 'decode'], + $metadata, $options); + } + + /** + * Classifies a document into categories. + * @param \Google\Cloud\Language\V1beta2\ClassifyTextRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function ClassifyText(\Google\Cloud\Language\V1beta2\ClassifyTextRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.language.v1beta2.LanguageService/ClassifyText', + $argument, + ['\Google\Cloud\Language\V1beta2\ClassifyTextResponse', 'decode'], + $metadata, $options); + } + + /** + * A convenience method that provides all syntax, sentiment, entity, and + * classification features in one call. + * @param \Google\Cloud\Language\V1beta2\AnnotateTextRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function AnnotateText(\Google\Cloud\Language\V1beta2\AnnotateTextRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.language.v1beta2.LanguageService/AnnotateText', + $argument, + ['\Google\Cloud\Language\V1beta2\AnnotateTextResponse', 'decode'], + $metadata, $options); + } + +} diff --git a/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/PartOfSpeech.php b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/PartOfSpeech.php new file mode 100644 index 000000000000..5c739918469e --- /dev/null +++ b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/PartOfSpeech.php @@ -0,0 +1,441 @@ +google.cloud.language.v1beta2.PartOfSpeech + */ +class PartOfSpeech extends \Google\Protobuf\Internal\Message +{ + /** + * The part of speech tag. + * + * Generated from protobuf field .google.cloud.language.v1beta2.PartOfSpeech.Tag tag = 1; + */ + protected $tag = 0; + /** + * The grammatical aspect. + * + * Generated from protobuf field .google.cloud.language.v1beta2.PartOfSpeech.Aspect aspect = 2; + */ + protected $aspect = 0; + /** + * The grammatical case. + * + * Generated from protobuf field .google.cloud.language.v1beta2.PartOfSpeech.Case case = 3; + */ + protected $case = 0; + /** + * The grammatical form. + * + * Generated from protobuf field .google.cloud.language.v1beta2.PartOfSpeech.Form form = 4; + */ + protected $form = 0; + /** + * The grammatical gender. + * + * Generated from protobuf field .google.cloud.language.v1beta2.PartOfSpeech.Gender gender = 5; + */ + protected $gender = 0; + /** + * The grammatical mood. + * + * Generated from protobuf field .google.cloud.language.v1beta2.PartOfSpeech.Mood mood = 6; + */ + protected $mood = 0; + /** + * The grammatical number. + * + * Generated from protobuf field .google.cloud.language.v1beta2.PartOfSpeech.Number number = 7; + */ + protected $number = 0; + /** + * The grammatical person. + * + * Generated from protobuf field .google.cloud.language.v1beta2.PartOfSpeech.Person person = 8; + */ + protected $person = 0; + /** + * The grammatical properness. + * + * Generated from protobuf field .google.cloud.language.v1beta2.PartOfSpeech.Proper proper = 9; + */ + protected $proper = 0; + /** + * The grammatical reciprocity. + * + * Generated from protobuf field .google.cloud.language.v1beta2.PartOfSpeech.Reciprocity reciprocity = 10; + */ + protected $reciprocity = 0; + /** + * The grammatical tense. + * + * Generated from protobuf field .google.cloud.language.v1beta2.PartOfSpeech.Tense tense = 11; + */ + protected $tense = 0; + /** + * The grammatical voice. + * + * Generated from protobuf field .google.cloud.language.v1beta2.PartOfSpeech.Voice voice = 12; + */ + protected $voice = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $tag + * The part of speech tag. + * @type int $aspect + * The grammatical aspect. + * @type int $case + * The grammatical case. + * @type int $form + * The grammatical form. + * @type int $gender + * The grammatical gender. + * @type int $mood + * The grammatical mood. + * @type int $number + * The grammatical number. + * @type int $person + * The grammatical person. + * @type int $proper + * The grammatical properness. + * @type int $reciprocity + * The grammatical reciprocity. + * @type int $tense + * The grammatical tense. + * @type int $voice + * The grammatical voice. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Language\V1Beta2\LanguageService::initOnce(); + parent::__construct($data); + } + + /** + * The part of speech tag. + * + * Generated from protobuf field .google.cloud.language.v1beta2.PartOfSpeech.Tag tag = 1; + * @return int + */ + public function getTag() + { + return $this->tag; + } + + /** + * The part of speech tag. + * + * Generated from protobuf field .google.cloud.language.v1beta2.PartOfSpeech.Tag tag = 1; + * @param int $var + * @return $this + */ + public function setTag($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Language\V1beta2\PartOfSpeech\Tag::class); + $this->tag = $var; + + return $this; + } + + /** + * The grammatical aspect. + * + * Generated from protobuf field .google.cloud.language.v1beta2.PartOfSpeech.Aspect aspect = 2; + * @return int + */ + public function getAspect() + { + return $this->aspect; + } + + /** + * The grammatical aspect. + * + * Generated from protobuf field .google.cloud.language.v1beta2.PartOfSpeech.Aspect aspect = 2; + * @param int $var + * @return $this + */ + public function setAspect($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Language\V1beta2\PartOfSpeech\Aspect::class); + $this->aspect = $var; + + return $this; + } + + /** + * The grammatical case. + * + * Generated from protobuf field .google.cloud.language.v1beta2.PartOfSpeech.Case case = 3; + * @return int + */ + public function getCase() + { + return $this->case; + } + + /** + * The grammatical case. + * + * Generated from protobuf field .google.cloud.language.v1beta2.PartOfSpeech.Case case = 3; + * @param int $var + * @return $this + */ + public function setCase($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Language\V1beta2\PartOfSpeech\PBCase::class); + $this->case = $var; + + return $this; + } + + /** + * The grammatical form. + * + * Generated from protobuf field .google.cloud.language.v1beta2.PartOfSpeech.Form form = 4; + * @return int + */ + public function getForm() + { + return $this->form; + } + + /** + * The grammatical form. + * + * Generated from protobuf field .google.cloud.language.v1beta2.PartOfSpeech.Form form = 4; + * @param int $var + * @return $this + */ + public function setForm($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Language\V1beta2\PartOfSpeech\Form::class); + $this->form = $var; + + return $this; + } + + /** + * The grammatical gender. + * + * Generated from protobuf field .google.cloud.language.v1beta2.PartOfSpeech.Gender gender = 5; + * @return int + */ + public function getGender() + { + return $this->gender; + } + + /** + * The grammatical gender. + * + * Generated from protobuf field .google.cloud.language.v1beta2.PartOfSpeech.Gender gender = 5; + * @param int $var + * @return $this + */ + public function setGender($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Language\V1beta2\PartOfSpeech\Gender::class); + $this->gender = $var; + + return $this; + } + + /** + * The grammatical mood. + * + * Generated from protobuf field .google.cloud.language.v1beta2.PartOfSpeech.Mood mood = 6; + * @return int + */ + public function getMood() + { + return $this->mood; + } + + /** + * The grammatical mood. + * + * Generated from protobuf field .google.cloud.language.v1beta2.PartOfSpeech.Mood mood = 6; + * @param int $var + * @return $this + */ + public function setMood($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Language\V1beta2\PartOfSpeech\Mood::class); + $this->mood = $var; + + return $this; + } + + /** + * The grammatical number. + * + * Generated from protobuf field .google.cloud.language.v1beta2.PartOfSpeech.Number number = 7; + * @return int + */ + public function getNumber() + { + return $this->number; + } + + /** + * The grammatical number. + * + * Generated from protobuf field .google.cloud.language.v1beta2.PartOfSpeech.Number number = 7; + * @param int $var + * @return $this + */ + public function setNumber($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Language\V1beta2\PartOfSpeech\Number::class); + $this->number = $var; + + return $this; + } + + /** + * The grammatical person. + * + * Generated from protobuf field .google.cloud.language.v1beta2.PartOfSpeech.Person person = 8; + * @return int + */ + public function getPerson() + { + return $this->person; + } + + /** + * The grammatical person. + * + * Generated from protobuf field .google.cloud.language.v1beta2.PartOfSpeech.Person person = 8; + * @param int $var + * @return $this + */ + public function setPerson($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Language\V1beta2\PartOfSpeech\Person::class); + $this->person = $var; + + return $this; + } + + /** + * The grammatical properness. + * + * Generated from protobuf field .google.cloud.language.v1beta2.PartOfSpeech.Proper proper = 9; + * @return int + */ + public function getProper() + { + return $this->proper; + } + + /** + * The grammatical properness. + * + * Generated from protobuf field .google.cloud.language.v1beta2.PartOfSpeech.Proper proper = 9; + * @param int $var + * @return $this + */ + public function setProper($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Language\V1beta2\PartOfSpeech\Proper::class); + $this->proper = $var; + + return $this; + } + + /** + * The grammatical reciprocity. + * + * Generated from protobuf field .google.cloud.language.v1beta2.PartOfSpeech.Reciprocity reciprocity = 10; + * @return int + */ + public function getReciprocity() + { + return $this->reciprocity; + } + + /** + * The grammatical reciprocity. + * + * Generated from protobuf field .google.cloud.language.v1beta2.PartOfSpeech.Reciprocity reciprocity = 10; + * @param int $var + * @return $this + */ + public function setReciprocity($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Language\V1beta2\PartOfSpeech\Reciprocity::class); + $this->reciprocity = $var; + + return $this; + } + + /** + * The grammatical tense. + * + * Generated from protobuf field .google.cloud.language.v1beta2.PartOfSpeech.Tense tense = 11; + * @return int + */ + public function getTense() + { + return $this->tense; + } + + /** + * The grammatical tense. + * + * Generated from protobuf field .google.cloud.language.v1beta2.PartOfSpeech.Tense tense = 11; + * @param int $var + * @return $this + */ + public function setTense($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Language\V1beta2\PartOfSpeech\Tense::class); + $this->tense = $var; + + return $this; + } + + /** + * The grammatical voice. + * + * Generated from protobuf field .google.cloud.language.v1beta2.PartOfSpeech.Voice voice = 12; + * @return int + */ + public function getVoice() + { + return $this->voice; + } + + /** + * The grammatical voice. + * + * Generated from protobuf field .google.cloud.language.v1beta2.PartOfSpeech.Voice voice = 12; + * @param int $var + * @return $this + */ + public function setVoice($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Language\V1beta2\PartOfSpeech\Voice::class); + $this->voice = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/PartOfSpeech/Aspect.php b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/PartOfSpeech/Aspect.php new file mode 100644 index 000000000000..48882ba09ced --- /dev/null +++ b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/PartOfSpeech/Aspect.php @@ -0,0 +1,71 @@ +google.cloud.language.v1beta2.PartOfSpeech.Aspect + */ +class Aspect +{ + /** + * Aspect is not applicable in the analyzed language or is not predicted. + * + * Generated from protobuf enum ASPECT_UNKNOWN = 0; + */ + const ASPECT_UNKNOWN = 0; + /** + * Perfective + * + * Generated from protobuf enum PERFECTIVE = 1; + */ + const PERFECTIVE = 1; + /** + * Imperfective + * + * Generated from protobuf enum IMPERFECTIVE = 2; + */ + const IMPERFECTIVE = 2; + /** + * Progressive + * + * Generated from protobuf enum PROGRESSIVE = 3; + */ + const PROGRESSIVE = 3; + + private static $valueToName = [ + self::ASPECT_UNKNOWN => 'ASPECT_UNKNOWN', + self::PERFECTIVE => 'PERFECTIVE', + self::IMPERFECTIVE => 'IMPERFECTIVE', + self::PROGRESSIVE => 'PROGRESSIVE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Aspect::class, \Google\Cloud\Language\V1beta2\PartOfSpeech_Aspect::class); + diff --git a/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/PartOfSpeech/Form.php b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/PartOfSpeech/Form.php new file mode 100644 index 000000000000..b3c1847352d3 --- /dev/null +++ b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/PartOfSpeech/Form.php @@ -0,0 +1,130 @@ +google.cloud.language.v1beta2.PartOfSpeech.Form + */ +class Form +{ + /** + * Form is not applicable in the analyzed language or is not predicted. + * + * Generated from protobuf enum FORM_UNKNOWN = 0; + */ + const FORM_UNKNOWN = 0; + /** + * Adnomial + * + * Generated from protobuf enum ADNOMIAL = 1; + */ + const ADNOMIAL = 1; + /** + * Auxiliary + * + * Generated from protobuf enum AUXILIARY = 2; + */ + const AUXILIARY = 2; + /** + * Complementizer + * + * Generated from protobuf enum COMPLEMENTIZER = 3; + */ + const COMPLEMENTIZER = 3; + /** + * Final ending + * + * Generated from protobuf enum FINAL_ENDING = 4; + */ + const FINAL_ENDING = 4; + /** + * Gerund + * + * Generated from protobuf enum GERUND = 5; + */ + const GERUND = 5; + /** + * Realis + * + * Generated from protobuf enum REALIS = 6; + */ + const REALIS = 6; + /** + * Irrealis + * + * Generated from protobuf enum IRREALIS = 7; + */ + const IRREALIS = 7; + /** + * Short form + * + * Generated from protobuf enum SHORT = 8; + */ + const SHORT = 8; + /** + * Long form + * + * Generated from protobuf enum LONG = 9; + */ + const LONG = 9; + /** + * Order form + * + * Generated from protobuf enum ORDER = 10; + */ + const ORDER = 10; + /** + * Specific form + * + * Generated from protobuf enum SPECIFIC = 11; + */ + const SPECIFIC = 11; + + private static $valueToName = [ + self::FORM_UNKNOWN => 'FORM_UNKNOWN', + self::ADNOMIAL => 'ADNOMIAL', + self::AUXILIARY => 'AUXILIARY', + self::COMPLEMENTIZER => 'COMPLEMENTIZER', + self::FINAL_ENDING => 'FINAL_ENDING', + self::GERUND => 'GERUND', + self::REALIS => 'REALIS', + self::IRREALIS => 'IRREALIS', + self::SHORT => 'SHORT', + self::LONG => 'LONG', + self::ORDER => 'ORDER', + self::SPECIFIC => 'SPECIFIC', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Form::class, \Google\Cloud\Language\V1beta2\PartOfSpeech_Form::class); + diff --git a/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/PartOfSpeech/Gender.php b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/PartOfSpeech/Gender.php new file mode 100644 index 000000000000..8481abbc6b93 --- /dev/null +++ b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/PartOfSpeech/Gender.php @@ -0,0 +1,71 @@ +google.cloud.language.v1beta2.PartOfSpeech.Gender + */ +class Gender +{ + /** + * Gender is not applicable in the analyzed language or is not predicted. + * + * Generated from protobuf enum GENDER_UNKNOWN = 0; + */ + const GENDER_UNKNOWN = 0; + /** + * Feminine + * + * Generated from protobuf enum FEMININE = 1; + */ + const FEMININE = 1; + /** + * Masculine + * + * Generated from protobuf enum MASCULINE = 2; + */ + const MASCULINE = 2; + /** + * Neuter + * + * Generated from protobuf enum NEUTER = 3; + */ + const NEUTER = 3; + + private static $valueToName = [ + self::GENDER_UNKNOWN => 'GENDER_UNKNOWN', + self::FEMININE => 'FEMININE', + self::MASCULINE => 'MASCULINE', + self::NEUTER => 'NEUTER', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Gender::class, \Google\Cloud\Language\V1beta2\PartOfSpeech_Gender::class); + diff --git a/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/PartOfSpeech/Mood.php b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/PartOfSpeech/Mood.php new file mode 100644 index 000000000000..8857bc7dcd44 --- /dev/null +++ b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/PartOfSpeech/Mood.php @@ -0,0 +1,92 @@ +google.cloud.language.v1beta2.PartOfSpeech.Mood + */ +class Mood +{ + /** + * Mood is not applicable in the analyzed language or is not predicted. + * + * Generated from protobuf enum MOOD_UNKNOWN = 0; + */ + const MOOD_UNKNOWN = 0; + /** + * Conditional + * + * Generated from protobuf enum CONDITIONAL_MOOD = 1; + */ + const CONDITIONAL_MOOD = 1; + /** + * Imperative + * + * Generated from protobuf enum IMPERATIVE = 2; + */ + const IMPERATIVE = 2; + /** + * Indicative + * + * Generated from protobuf enum INDICATIVE = 3; + */ + const INDICATIVE = 3; + /** + * Interrogative + * + * Generated from protobuf enum INTERROGATIVE = 4; + */ + const INTERROGATIVE = 4; + /** + * Jussive + * + * Generated from protobuf enum JUSSIVE = 5; + */ + const JUSSIVE = 5; + /** + * Subjunctive + * + * Generated from protobuf enum SUBJUNCTIVE = 6; + */ + const SUBJUNCTIVE = 6; + + private static $valueToName = [ + self::MOOD_UNKNOWN => 'MOOD_UNKNOWN', + self::CONDITIONAL_MOOD => 'CONDITIONAL_MOOD', + self::IMPERATIVE => 'IMPERATIVE', + self::INDICATIVE => 'INDICATIVE', + self::INTERROGATIVE => 'INTERROGATIVE', + self::JUSSIVE => 'JUSSIVE', + self::SUBJUNCTIVE => 'SUBJUNCTIVE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Mood::class, \Google\Cloud\Language\V1beta2\PartOfSpeech_Mood::class); + diff --git a/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/PartOfSpeech/Number.php b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/PartOfSpeech/Number.php new file mode 100644 index 000000000000..f3c9eddeaf95 --- /dev/null +++ b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/PartOfSpeech/Number.php @@ -0,0 +1,71 @@ +google.cloud.language.v1beta2.PartOfSpeech.Number + */ +class Number +{ + /** + * Number is not applicable in the analyzed language or is not predicted. + * + * Generated from protobuf enum NUMBER_UNKNOWN = 0; + */ + const NUMBER_UNKNOWN = 0; + /** + * Singular + * + * Generated from protobuf enum SINGULAR = 1; + */ + const SINGULAR = 1; + /** + * Plural + * + * Generated from protobuf enum PLURAL = 2; + */ + const PLURAL = 2; + /** + * Dual + * + * Generated from protobuf enum DUAL = 3; + */ + const DUAL = 3; + + private static $valueToName = [ + self::NUMBER_UNKNOWN => 'NUMBER_UNKNOWN', + self::SINGULAR => 'SINGULAR', + self::PLURAL => 'PLURAL', + self::DUAL => 'DUAL', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Number::class, \Google\Cloud\Language\V1beta2\PartOfSpeech_Number::class); + diff --git a/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/PartOfSpeech/PBCase.php b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/PartOfSpeech/PBCase.php new file mode 100644 index 000000000000..f110d8846a1a --- /dev/null +++ b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/PartOfSpeech/PBCase.php @@ -0,0 +1,150 @@ +google.cloud.language.v1beta2.PartOfSpeech.Case + */ +class PBCase +{ + /** + * Case is not applicable in the analyzed language or is not predicted. + * + * Generated from protobuf enum CASE_UNKNOWN = 0; + */ + const CASE_UNKNOWN = 0; + /** + * Accusative + * + * Generated from protobuf enum ACCUSATIVE = 1; + */ + const ACCUSATIVE = 1; + /** + * Adverbial + * + * Generated from protobuf enum ADVERBIAL = 2; + */ + const ADVERBIAL = 2; + /** + * Complementive + * + * Generated from protobuf enum COMPLEMENTIVE = 3; + */ + const COMPLEMENTIVE = 3; + /** + * Dative + * + * Generated from protobuf enum DATIVE = 4; + */ + const DATIVE = 4; + /** + * Genitive + * + * Generated from protobuf enum GENITIVE = 5; + */ + const GENITIVE = 5; + /** + * Instrumental + * + * Generated from protobuf enum INSTRUMENTAL = 6; + */ + const INSTRUMENTAL = 6; + /** + * Locative + * + * Generated from protobuf enum LOCATIVE = 7; + */ + const LOCATIVE = 7; + /** + * Nominative + * + * Generated from protobuf enum NOMINATIVE = 8; + */ + const NOMINATIVE = 8; + /** + * Oblique + * + * Generated from protobuf enum OBLIQUE = 9; + */ + const OBLIQUE = 9; + /** + * Partitive + * + * Generated from protobuf enum PARTITIVE = 10; + */ + const PARTITIVE = 10; + /** + * Prepositional + * + * Generated from protobuf enum PREPOSITIONAL = 11; + */ + const PREPOSITIONAL = 11; + /** + * Reflexive + * + * Generated from protobuf enum REFLEXIVE_CASE = 12; + */ + const REFLEXIVE_CASE = 12; + /** + * Relative + * + * Generated from protobuf enum RELATIVE_CASE = 13; + */ + const RELATIVE_CASE = 13; + /** + * Vocative + * + * Generated from protobuf enum VOCATIVE = 14; + */ + const VOCATIVE = 14; + + private static $valueToName = [ + self::CASE_UNKNOWN => 'CASE_UNKNOWN', + self::ACCUSATIVE => 'ACCUSATIVE', + self::ADVERBIAL => 'ADVERBIAL', + self::COMPLEMENTIVE => 'COMPLEMENTIVE', + self::DATIVE => 'DATIVE', + self::GENITIVE => 'GENITIVE', + self::INSTRUMENTAL => 'INSTRUMENTAL', + self::LOCATIVE => 'LOCATIVE', + self::NOMINATIVE => 'NOMINATIVE', + self::OBLIQUE => 'OBLIQUE', + self::PARTITIVE => 'PARTITIVE', + self::PREPOSITIONAL => 'PREPOSITIONAL', + self::REFLEXIVE_CASE => 'REFLEXIVE_CASE', + self::RELATIVE_CASE => 'RELATIVE_CASE', + self::VOCATIVE => 'VOCATIVE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(PBCase::class, \Google\Cloud\Language\V1beta2\PartOfSpeech_Case::class); + diff --git a/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/PartOfSpeech/Person.php b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/PartOfSpeech/Person.php new file mode 100644 index 000000000000..9584fd35c7ca --- /dev/null +++ b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/PartOfSpeech/Person.php @@ -0,0 +1,78 @@ +google.cloud.language.v1beta2.PartOfSpeech.Person + */ +class Person +{ + /** + * Person is not applicable in the analyzed language or is not predicted. + * + * Generated from protobuf enum PERSON_UNKNOWN = 0; + */ + const PERSON_UNKNOWN = 0; + /** + * First + * + * Generated from protobuf enum FIRST = 1; + */ + const FIRST = 1; + /** + * Second + * + * Generated from protobuf enum SECOND = 2; + */ + const SECOND = 2; + /** + * Third + * + * Generated from protobuf enum THIRD = 3; + */ + const THIRD = 3; + /** + * Reflexive + * + * Generated from protobuf enum REFLEXIVE_PERSON = 4; + */ + const REFLEXIVE_PERSON = 4; + + private static $valueToName = [ + self::PERSON_UNKNOWN => 'PERSON_UNKNOWN', + self::FIRST => 'FIRST', + self::SECOND => 'SECOND', + self::THIRD => 'THIRD', + self::REFLEXIVE_PERSON => 'REFLEXIVE_PERSON', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Person::class, \Google\Cloud\Language\V1beta2\PartOfSpeech_Person::class); + diff --git a/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/PartOfSpeech/Proper.php b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/PartOfSpeech/Proper.php new file mode 100644 index 000000000000..d71aded410d6 --- /dev/null +++ b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/PartOfSpeech/Proper.php @@ -0,0 +1,64 @@ +google.cloud.language.v1beta2.PartOfSpeech.Proper + */ +class Proper +{ + /** + * Proper is not applicable in the analyzed language or is not predicted. + * + * Generated from protobuf enum PROPER_UNKNOWN = 0; + */ + const PROPER_UNKNOWN = 0; + /** + * Proper + * + * Generated from protobuf enum PROPER = 1; + */ + const PROPER = 1; + /** + * Not proper + * + * Generated from protobuf enum NOT_PROPER = 2; + */ + const NOT_PROPER = 2; + + private static $valueToName = [ + self::PROPER_UNKNOWN => 'PROPER_UNKNOWN', + self::PROPER => 'PROPER', + self::NOT_PROPER => 'NOT_PROPER', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Proper::class, \Google\Cloud\Language\V1beta2\PartOfSpeech_Proper::class); + diff --git a/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/PartOfSpeech/Reciprocity.php b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/PartOfSpeech/Reciprocity.php new file mode 100644 index 000000000000..aae22e4dd765 --- /dev/null +++ b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/PartOfSpeech/Reciprocity.php @@ -0,0 +1,65 @@ +google.cloud.language.v1beta2.PartOfSpeech.Reciprocity + */ +class Reciprocity +{ + /** + * Reciprocity is not applicable in the analyzed language or is not + * predicted. + * + * Generated from protobuf enum RECIPROCITY_UNKNOWN = 0; + */ + const RECIPROCITY_UNKNOWN = 0; + /** + * Reciprocal + * + * Generated from protobuf enum RECIPROCAL = 1; + */ + const RECIPROCAL = 1; + /** + * Non-reciprocal + * + * Generated from protobuf enum NON_RECIPROCAL = 2; + */ + const NON_RECIPROCAL = 2; + + private static $valueToName = [ + self::RECIPROCITY_UNKNOWN => 'RECIPROCITY_UNKNOWN', + self::RECIPROCAL => 'RECIPROCAL', + self::NON_RECIPROCAL => 'NON_RECIPROCAL', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Reciprocity::class, \Google\Cloud\Language\V1beta2\PartOfSpeech_Reciprocity::class); + diff --git a/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/PartOfSpeech/Tag.php b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/PartOfSpeech/Tag.php new file mode 100644 index 000000000000..0fb0d7e7e813 --- /dev/null +++ b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/PartOfSpeech/Tag.php @@ -0,0 +1,141 @@ +google.cloud.language.v1beta2.PartOfSpeech.Tag + */ +class Tag +{ + /** + * Unknown + * + * Generated from protobuf enum UNKNOWN = 0; + */ + const UNKNOWN = 0; + /** + * Adjective + * + * Generated from protobuf enum ADJ = 1; + */ + const ADJ = 1; + /** + * Adposition (preposition and postposition) + * + * Generated from protobuf enum ADP = 2; + */ + const ADP = 2; + /** + * Adverb + * + * Generated from protobuf enum ADV = 3; + */ + const ADV = 3; + /** + * Conjunction + * + * Generated from protobuf enum CONJ = 4; + */ + const CONJ = 4; + /** + * Determiner + * + * Generated from protobuf enum DET = 5; + */ + const DET = 5; + /** + * Noun (common and proper) + * + * Generated from protobuf enum NOUN = 6; + */ + const NOUN = 6; + /** + * Cardinal number + * + * Generated from protobuf enum NUM = 7; + */ + const NUM = 7; + /** + * Pronoun + * + * Generated from protobuf enum PRON = 8; + */ + const PRON = 8; + /** + * Particle or other function word + * + * Generated from protobuf enum PRT = 9; + */ + const PRT = 9; + /** + * Punctuation + * + * Generated from protobuf enum PUNCT = 10; + */ + const PUNCT = 10; + /** + * Verb (all tenses and modes) + * + * Generated from protobuf enum VERB = 11; + */ + const VERB = 11; + /** + * Other: foreign words, typos, abbreviations + * + * Generated from protobuf enum X = 12; + */ + const X = 12; + /** + * Affix + * + * Generated from protobuf enum AFFIX = 13; + */ + const AFFIX = 13; + + private static $valueToName = [ + self::UNKNOWN => 'UNKNOWN', + self::ADJ => 'ADJ', + self::ADP => 'ADP', + self::ADV => 'ADV', + self::CONJ => 'CONJ', + self::DET => 'DET', + self::NOUN => 'NOUN', + self::NUM => 'NUM', + self::PRON => 'PRON', + self::PRT => 'PRT', + self::PUNCT => 'PUNCT', + self::VERB => 'VERB', + self::X => 'X', + self::AFFIX => 'AFFIX', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Tag::class, \Google\Cloud\Language\V1beta2\PartOfSpeech_Tag::class); + diff --git a/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/PartOfSpeech/Tense.php b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/PartOfSpeech/Tense.php new file mode 100644 index 000000000000..e9e4e2000ad0 --- /dev/null +++ b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/PartOfSpeech/Tense.php @@ -0,0 +1,92 @@ +google.cloud.language.v1beta2.PartOfSpeech.Tense + */ +class Tense +{ + /** + * Tense is not applicable in the analyzed language or is not predicted. + * + * Generated from protobuf enum TENSE_UNKNOWN = 0; + */ + const TENSE_UNKNOWN = 0; + /** + * Conditional + * + * Generated from protobuf enum CONDITIONAL_TENSE = 1; + */ + const CONDITIONAL_TENSE = 1; + /** + * Future + * + * Generated from protobuf enum FUTURE = 2; + */ + const FUTURE = 2; + /** + * Past + * + * Generated from protobuf enum PAST = 3; + */ + const PAST = 3; + /** + * Present + * + * Generated from protobuf enum PRESENT = 4; + */ + const PRESENT = 4; + /** + * Imperfect + * + * Generated from protobuf enum IMPERFECT = 5; + */ + const IMPERFECT = 5; + /** + * Pluperfect + * + * Generated from protobuf enum PLUPERFECT = 6; + */ + const PLUPERFECT = 6; + + private static $valueToName = [ + self::TENSE_UNKNOWN => 'TENSE_UNKNOWN', + self::CONDITIONAL_TENSE => 'CONDITIONAL_TENSE', + self::FUTURE => 'FUTURE', + self::PAST => 'PAST', + self::PRESENT => 'PRESENT', + self::IMPERFECT => 'IMPERFECT', + self::PLUPERFECT => 'PLUPERFECT', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Tense::class, \Google\Cloud\Language\V1beta2\PartOfSpeech_Tense::class); + diff --git a/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/PartOfSpeech/Voice.php b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/PartOfSpeech/Voice.php new file mode 100644 index 000000000000..b1cfd65aeaa9 --- /dev/null +++ b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/PartOfSpeech/Voice.php @@ -0,0 +1,72 @@ +google.cloud.language.v1beta2.PartOfSpeech.Voice + */ +class Voice +{ + /** + * Voice is not applicable in the analyzed language or is not predicted. + * + * Generated from protobuf enum VOICE_UNKNOWN = 0; + */ + const VOICE_UNKNOWN = 0; + /** + * Active + * + * Generated from protobuf enum ACTIVE = 1; + */ + const ACTIVE = 1; + /** + * Causative + * + * Generated from protobuf enum CAUSATIVE = 2; + */ + const CAUSATIVE = 2; + /** + * Passive + * + * Generated from protobuf enum PASSIVE = 3; + */ + const PASSIVE = 3; + + private static $valueToName = [ + self::VOICE_UNKNOWN => 'VOICE_UNKNOWN', + self::ACTIVE => 'ACTIVE', + self::CAUSATIVE => 'CAUSATIVE', + self::PASSIVE => 'PASSIVE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Voice::class, \Google\Cloud\Language\V1beta2\PartOfSpeech_Voice::class); + diff --git a/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/PartOfSpeech_Aspect.php b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/PartOfSpeech_Aspect.php new file mode 100644 index 000000000000..15059e3520b9 --- /dev/null +++ b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/PartOfSpeech_Aspect.php @@ -0,0 +1,16 @@ +google.cloud.language.v1beta2.Sentence + */ +class Sentence extends \Google\Protobuf\Internal\Message +{ + /** + * The sentence text. + * + * Generated from protobuf field .google.cloud.language.v1beta2.TextSpan text = 1; + */ + protected $text = null; + /** + * For calls to [AnalyzeSentiment][] or if + * [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_document_sentiment] is set to + * true, this field will contain the sentiment for the sentence. + * + * Generated from protobuf field .google.cloud.language.v1beta2.Sentiment sentiment = 2; + */ + protected $sentiment = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Language\V1beta2\TextSpan $text + * The sentence text. + * @type \Google\Cloud\Language\V1beta2\Sentiment $sentiment + * For calls to [AnalyzeSentiment][] or if + * [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_document_sentiment] is set to + * true, this field will contain the sentiment for the sentence. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Language\V1Beta2\LanguageService::initOnce(); + parent::__construct($data); + } + + /** + * The sentence text. + * + * Generated from protobuf field .google.cloud.language.v1beta2.TextSpan text = 1; + * @return \Google\Cloud\Language\V1beta2\TextSpan|null + */ + public function getText() + { + return $this->text; + } + + public function hasText() + { + return isset($this->text); + } + + public function clearText() + { + unset($this->text); + } + + /** + * The sentence text. + * + * Generated from protobuf field .google.cloud.language.v1beta2.TextSpan text = 1; + * @param \Google\Cloud\Language\V1beta2\TextSpan $var + * @return $this + */ + public function setText($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Language\V1beta2\TextSpan::class); + $this->text = $var; + + return $this; + } + + /** + * For calls to [AnalyzeSentiment][] or if + * [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_document_sentiment] is set to + * true, this field will contain the sentiment for the sentence. + * + * Generated from protobuf field .google.cloud.language.v1beta2.Sentiment sentiment = 2; + * @return \Google\Cloud\Language\V1beta2\Sentiment|null + */ + public function getSentiment() + { + return $this->sentiment; + } + + public function hasSentiment() + { + return isset($this->sentiment); + } + + public function clearSentiment() + { + unset($this->sentiment); + } + + /** + * For calls to [AnalyzeSentiment][] or if + * [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_document_sentiment] is set to + * true, this field will contain the sentiment for the sentence. + * + * Generated from protobuf field .google.cloud.language.v1beta2.Sentiment sentiment = 2; + * @param \Google\Cloud\Language\V1beta2\Sentiment $var + * @return $this + */ + public function setSentiment($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Language\V1beta2\Sentiment::class); + $this->sentiment = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/Sentiment.php b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/Sentiment.php new file mode 100644 index 000000000000..5dd926e6ae2d --- /dev/null +++ b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/Sentiment.php @@ -0,0 +1,115 @@ +google.cloud.language.v1beta2.Sentiment + */ +class Sentiment extends \Google\Protobuf\Internal\Message +{ + /** + * A non-negative number in the [0, +inf) range, which represents + * the absolute magnitude of sentiment regardless of score (positive or + * negative). + * + * Generated from protobuf field float magnitude = 2; + */ + protected $magnitude = 0.0; + /** + * Sentiment score between -1.0 (negative sentiment) and 1.0 + * (positive sentiment). + * + * Generated from protobuf field float score = 3; + */ + protected $score = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type float $magnitude + * A non-negative number in the [0, +inf) range, which represents + * the absolute magnitude of sentiment regardless of score (positive or + * negative). + * @type float $score + * Sentiment score between -1.0 (negative sentiment) and 1.0 + * (positive sentiment). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Language\V1Beta2\LanguageService::initOnce(); + parent::__construct($data); + } + + /** + * A non-negative number in the [0, +inf) range, which represents + * the absolute magnitude of sentiment regardless of score (positive or + * negative). + * + * Generated from protobuf field float magnitude = 2; + * @return float + */ + public function getMagnitude() + { + return $this->magnitude; + } + + /** + * A non-negative number in the [0, +inf) range, which represents + * the absolute magnitude of sentiment regardless of score (positive or + * negative). + * + * Generated from protobuf field float magnitude = 2; + * @param float $var + * @return $this + */ + public function setMagnitude($var) + { + GPBUtil::checkFloat($var); + $this->magnitude = $var; + + return $this; + } + + /** + * Sentiment score between -1.0 (negative sentiment) and 1.0 + * (positive sentiment). + * + * Generated from protobuf field float score = 3; + * @return float + */ + public function getScore() + { + return $this->score; + } + + /** + * Sentiment score between -1.0 (negative sentiment) and 1.0 + * (positive sentiment). + * + * Generated from protobuf field float score = 3; + * @param float $var + * @return $this + */ + public function setScore($var) + { + GPBUtil::checkFloat($var); + $this->score = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/TextSpan.php b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/TextSpan.php new file mode 100644 index 000000000000..6e2c1de1b691 --- /dev/null +++ b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/TextSpan.php @@ -0,0 +1,105 @@ +google.cloud.language.v1beta2.TextSpan + */ +class TextSpan extends \Google\Protobuf\Internal\Message +{ + /** + * The content of the output text. + * + * Generated from protobuf field string content = 1; + */ + protected $content = ''; + /** + * The API calculates the beginning offset of the content in the original + * document according to the [EncodingType][google.cloud.language.v1beta2.EncodingType] specified in the API request. + * + * Generated from protobuf field int32 begin_offset = 2; + */ + protected $begin_offset = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $content + * The content of the output text. + * @type int $begin_offset + * The API calculates the beginning offset of the content in the original + * document according to the [EncodingType][google.cloud.language.v1beta2.EncodingType] specified in the API request. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Language\V1Beta2\LanguageService::initOnce(); + parent::__construct($data); + } + + /** + * The content of the output text. + * + * Generated from protobuf field string content = 1; + * @return string + */ + public function getContent() + { + return $this->content; + } + + /** + * The content of the output text. + * + * Generated from protobuf field string content = 1; + * @param string $var + * @return $this + */ + public function setContent($var) + { + GPBUtil::checkString($var, True); + $this->content = $var; + + return $this; + } + + /** + * The API calculates the beginning offset of the content in the original + * document according to the [EncodingType][google.cloud.language.v1beta2.EncodingType] specified in the API request. + * + * Generated from protobuf field int32 begin_offset = 2; + * @return int + */ + public function getBeginOffset() + { + return $this->begin_offset; + } + + /** + * The API calculates the beginning offset of the content in the original + * document according to the [EncodingType][google.cloud.language.v1beta2.EncodingType] specified in the API request. + * + * Generated from protobuf field int32 begin_offset = 2; + * @param int $var + * @return $this + */ + public function setBeginOffset($var) + { + GPBUtil::checkInt32($var); + $this->begin_offset = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/Token.php b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/Token.php new file mode 100644 index 000000000000..f441782ad3a0 --- /dev/null +++ b/owl-bot-staging/Language/v1beta2/proto/src/Google/Cloud/Language/V1beta2/Token.php @@ -0,0 +1,199 @@ +google.cloud.language.v1beta2.Token + */ +class Token extends \Google\Protobuf\Internal\Message +{ + /** + * The token text. + * + * Generated from protobuf field .google.cloud.language.v1beta2.TextSpan text = 1; + */ + protected $text = null; + /** + * Parts of speech tag for this token. + * + * Generated from protobuf field .google.cloud.language.v1beta2.PartOfSpeech part_of_speech = 2; + */ + protected $part_of_speech = null; + /** + * Dependency tree parse for this token. + * + * Generated from protobuf field .google.cloud.language.v1beta2.DependencyEdge dependency_edge = 3; + */ + protected $dependency_edge = null; + /** + * [Lemma](https://en.wikipedia.org/wiki/Lemma_%28morphology%29) of the token. + * + * Generated from protobuf field string lemma = 4; + */ + protected $lemma = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Language\V1beta2\TextSpan $text + * The token text. + * @type \Google\Cloud\Language\V1beta2\PartOfSpeech $part_of_speech + * Parts of speech tag for this token. + * @type \Google\Cloud\Language\V1beta2\DependencyEdge $dependency_edge + * Dependency tree parse for this token. + * @type string $lemma + * [Lemma](https://en.wikipedia.org/wiki/Lemma_%28morphology%29) of the token. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Language\V1Beta2\LanguageService::initOnce(); + parent::__construct($data); + } + + /** + * The token text. + * + * Generated from protobuf field .google.cloud.language.v1beta2.TextSpan text = 1; + * @return \Google\Cloud\Language\V1beta2\TextSpan|null + */ + public function getText() + { + return $this->text; + } + + public function hasText() + { + return isset($this->text); + } + + public function clearText() + { + unset($this->text); + } + + /** + * The token text. + * + * Generated from protobuf field .google.cloud.language.v1beta2.TextSpan text = 1; + * @param \Google\Cloud\Language\V1beta2\TextSpan $var + * @return $this + */ + public function setText($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Language\V1beta2\TextSpan::class); + $this->text = $var; + + return $this; + } + + /** + * Parts of speech tag for this token. + * + * Generated from protobuf field .google.cloud.language.v1beta2.PartOfSpeech part_of_speech = 2; + * @return \Google\Cloud\Language\V1beta2\PartOfSpeech|null + */ + public function getPartOfSpeech() + { + return $this->part_of_speech; + } + + public function hasPartOfSpeech() + { + return isset($this->part_of_speech); + } + + public function clearPartOfSpeech() + { + unset($this->part_of_speech); + } + + /** + * Parts of speech tag for this token. + * + * Generated from protobuf field .google.cloud.language.v1beta2.PartOfSpeech part_of_speech = 2; + * @param \Google\Cloud\Language\V1beta2\PartOfSpeech $var + * @return $this + */ + public function setPartOfSpeech($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Language\V1beta2\PartOfSpeech::class); + $this->part_of_speech = $var; + + return $this; + } + + /** + * Dependency tree parse for this token. + * + * Generated from protobuf field .google.cloud.language.v1beta2.DependencyEdge dependency_edge = 3; + * @return \Google\Cloud\Language\V1beta2\DependencyEdge|null + */ + public function getDependencyEdge() + { + return $this->dependency_edge; + } + + public function hasDependencyEdge() + { + return isset($this->dependency_edge); + } + + public function clearDependencyEdge() + { + unset($this->dependency_edge); + } + + /** + * Dependency tree parse for this token. + * + * Generated from protobuf field .google.cloud.language.v1beta2.DependencyEdge dependency_edge = 3; + * @param \Google\Cloud\Language\V1beta2\DependencyEdge $var + * @return $this + */ + public function setDependencyEdge($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Language\V1beta2\DependencyEdge::class); + $this->dependency_edge = $var; + + return $this; + } + + /** + * [Lemma](https://en.wikipedia.org/wiki/Lemma_%28morphology%29) of the token. + * + * Generated from protobuf field string lemma = 4; + * @return string + */ + public function getLemma() + { + return $this->lemma; + } + + /** + * [Lemma](https://en.wikipedia.org/wiki/Lemma_%28morphology%29) of the token. + * + * Generated from protobuf field string lemma = 4; + * @param string $var + * @return $this + */ + public function setLemma($var) + { + GPBUtil::checkString($var, True); + $this->lemma = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Language/v1beta2/samples/V1beta2/LanguageServiceClient/analyze_entities.php b/owl-bot-staging/Language/v1beta2/samples/V1beta2/LanguageServiceClient/analyze_entities.php new file mode 100644 index 000000000000..f73a7447b62f --- /dev/null +++ b/owl-bot-staging/Language/v1beta2/samples/V1beta2/LanguageServiceClient/analyze_entities.php @@ -0,0 +1,59 @@ +analyzeEntities($document); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END language_v1beta2_generated_LanguageService_AnalyzeEntities_sync] diff --git a/owl-bot-staging/Language/v1beta2/samples/V1beta2/LanguageServiceClient/analyze_entity_sentiment.php b/owl-bot-staging/Language/v1beta2/samples/V1beta2/LanguageServiceClient/analyze_entity_sentiment.php new file mode 100644 index 000000000000..29b7cea16c02 --- /dev/null +++ b/owl-bot-staging/Language/v1beta2/samples/V1beta2/LanguageServiceClient/analyze_entity_sentiment.php @@ -0,0 +1,58 @@ +analyzeEntitySentiment($document); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END language_v1beta2_generated_LanguageService_AnalyzeEntitySentiment_sync] diff --git a/owl-bot-staging/Language/v1beta2/samples/V1beta2/LanguageServiceClient/analyze_sentiment.php b/owl-bot-staging/Language/v1beta2/samples/V1beta2/LanguageServiceClient/analyze_sentiment.php new file mode 100644 index 000000000000..1977653f913d --- /dev/null +++ b/owl-bot-staging/Language/v1beta2/samples/V1beta2/LanguageServiceClient/analyze_sentiment.php @@ -0,0 +1,57 @@ +analyzeSentiment($document); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END language_v1beta2_generated_LanguageService_AnalyzeSentiment_sync] diff --git a/owl-bot-staging/Language/v1beta2/samples/V1beta2/LanguageServiceClient/analyze_syntax.php b/owl-bot-staging/Language/v1beta2/samples/V1beta2/LanguageServiceClient/analyze_syntax.php new file mode 100644 index 000000000000..b4e09eace78d --- /dev/null +++ b/owl-bot-staging/Language/v1beta2/samples/V1beta2/LanguageServiceClient/analyze_syntax.php @@ -0,0 +1,59 @@ +analyzeSyntax($document); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END language_v1beta2_generated_LanguageService_AnalyzeSyntax_sync] diff --git a/owl-bot-staging/Language/v1beta2/samples/V1beta2/LanguageServiceClient/annotate_text.php b/owl-bot-staging/Language/v1beta2/samples/V1beta2/LanguageServiceClient/annotate_text.php new file mode 100644 index 000000000000..b38967b84fce --- /dev/null +++ b/owl-bot-staging/Language/v1beta2/samples/V1beta2/LanguageServiceClient/annotate_text.php @@ -0,0 +1,60 @@ +annotateText($document, $features); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END language_v1beta2_generated_LanguageService_AnnotateText_sync] diff --git a/owl-bot-staging/Language/v1beta2/samples/V1beta2/LanguageServiceClient/classify_text.php b/owl-bot-staging/Language/v1beta2/samples/V1beta2/LanguageServiceClient/classify_text.php new file mode 100644 index 000000000000..7b7b8c8957d2 --- /dev/null +++ b/owl-bot-staging/Language/v1beta2/samples/V1beta2/LanguageServiceClient/classify_text.php @@ -0,0 +1,57 @@ +classifyText($document); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END language_v1beta2_generated_LanguageService_ClassifyText_sync] diff --git a/owl-bot-staging/Language/v1beta2/src/V1beta2/Gapic/LanguageServiceGapicClient.php b/owl-bot-staging/Language/v1beta2/src/V1beta2/Gapic/LanguageServiceGapicClient.php new file mode 100644 index 000000000000..eea191f93593 --- /dev/null +++ b/owl-bot-staging/Language/v1beta2/src/V1beta2/Gapic/LanguageServiceGapicClient.php @@ -0,0 +1,447 @@ +analyzeEntities($document); + * } finally { + * $languageServiceClient->close(); + * } + * ``` + * + * @experimental + */ +class LanguageServiceGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.language.v1beta2.LanguageService'; + + /** The default address of the service. */ + const SERVICE_ADDRESS = 'language.googleapis.com'; + + /** The default port of the service. */ + const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-language', + 'https://www.googleapis.com/auth/cloud-platform', + ]; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/language_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/language_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/language_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/language_service_rest_client_config.php', + ], + ], + ]; + } + + /** + * 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 'language.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. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *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' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods 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 + * + * @experimental + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + } + + /** + * Finds named entities (currently proper names and common nouns) in the text + * along with entity types, salience, mentions for each entity, and + * other properties. + * + * Sample code: + * ``` + * $languageServiceClient = new LanguageServiceClient(); + * try { + * $document = new Document(); + * $response = $languageServiceClient->analyzeEntities($document); + * } finally { + * $languageServiceClient->close(); + * } + * ``` + * + * @param Document $document Required. Input document. + * @param array $optionalArgs { + * Optional. + * + * @type int $encodingType + * The encoding type used by the API to calculate offsets. + * For allowed values, use constants defined on {@see \Google\Cloud\Language\V1beta2\EncodingType} + * @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 \Google\Cloud\Language\V1beta2\AnalyzeEntitiesResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function analyzeEntities($document, array $optionalArgs = []) + { + $request = new AnalyzeEntitiesRequest(); + $request->setDocument($document); + if (isset($optionalArgs['encodingType'])) { + $request->setEncodingType($optionalArgs['encodingType']); + } + + return $this->startCall('AnalyzeEntities', AnalyzeEntitiesResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Finds entities, similar to [AnalyzeEntities][google.cloud.language.v1beta2.LanguageService.AnalyzeEntities] in the text and analyzes + * sentiment associated with each entity and its mentions. + * + * Sample code: + * ``` + * $languageServiceClient = new LanguageServiceClient(); + * try { + * $document = new Document(); + * $response = $languageServiceClient->analyzeEntitySentiment($document); + * } finally { + * $languageServiceClient->close(); + * } + * ``` + * + * @param Document $document Required. Input document. + * @param array $optionalArgs { + * Optional. + * + * @type int $encodingType + * The encoding type used by the API to calculate offsets. + * For allowed values, use constants defined on {@see \Google\Cloud\Language\V1beta2\EncodingType} + * @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 \Google\Cloud\Language\V1beta2\AnalyzeEntitySentimentResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function analyzeEntitySentiment($document, array $optionalArgs = []) + { + $request = new AnalyzeEntitySentimentRequest(); + $request->setDocument($document); + if (isset($optionalArgs['encodingType'])) { + $request->setEncodingType($optionalArgs['encodingType']); + } + + return $this->startCall('AnalyzeEntitySentiment', AnalyzeEntitySentimentResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Analyzes the sentiment of the provided text. + * + * Sample code: + * ``` + * $languageServiceClient = new LanguageServiceClient(); + * try { + * $document = new Document(); + * $response = $languageServiceClient->analyzeSentiment($document); + * } finally { + * $languageServiceClient->close(); + * } + * ``` + * + * @param Document $document Required. Input document. + * @param array $optionalArgs { + * Optional. + * + * @type int $encodingType + * The encoding type used by the API to calculate sentence offsets for the + * sentence sentiment. + * For allowed values, use constants defined on {@see \Google\Cloud\Language\V1beta2\EncodingType} + * @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 \Google\Cloud\Language\V1beta2\AnalyzeSentimentResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function analyzeSentiment($document, array $optionalArgs = []) + { + $request = new AnalyzeSentimentRequest(); + $request->setDocument($document); + if (isset($optionalArgs['encodingType'])) { + $request->setEncodingType($optionalArgs['encodingType']); + } + + return $this->startCall('AnalyzeSentiment', AnalyzeSentimentResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Analyzes the syntax of the text and provides sentence boundaries and + * tokenization along with part of speech tags, dependency trees, and other + * properties. + * + * Sample code: + * ``` + * $languageServiceClient = new LanguageServiceClient(); + * try { + * $document = new Document(); + * $response = $languageServiceClient->analyzeSyntax($document); + * } finally { + * $languageServiceClient->close(); + * } + * ``` + * + * @param Document $document Required. Input document. + * @param array $optionalArgs { + * Optional. + * + * @type int $encodingType + * The encoding type used by the API to calculate offsets. + * For allowed values, use constants defined on {@see \Google\Cloud\Language\V1beta2\EncodingType} + * @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 \Google\Cloud\Language\V1beta2\AnalyzeSyntaxResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function analyzeSyntax($document, array $optionalArgs = []) + { + $request = new AnalyzeSyntaxRequest(); + $request->setDocument($document); + if (isset($optionalArgs['encodingType'])) { + $request->setEncodingType($optionalArgs['encodingType']); + } + + return $this->startCall('AnalyzeSyntax', AnalyzeSyntaxResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * A convenience method that provides all syntax, sentiment, entity, and + * classification features in one call. + * + * Sample code: + * ``` + * $languageServiceClient = new LanguageServiceClient(); + * try { + * $document = new Document(); + * $features = new Features(); + * $response = $languageServiceClient->annotateText($document, $features); + * } finally { + * $languageServiceClient->close(); + * } + * ``` + * + * @param Document $document Required. Input document. + * @param Features $features Required. The enabled features. + * @param array $optionalArgs { + * Optional. + * + * @type int $encodingType + * The encoding type used by the API to calculate offsets. + * For allowed values, use constants defined on {@see \Google\Cloud\Language\V1beta2\EncodingType} + * @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 \Google\Cloud\Language\V1beta2\AnnotateTextResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function annotateText($document, $features, array $optionalArgs = []) + { + $request = new AnnotateTextRequest(); + $request->setDocument($document); + $request->setFeatures($features); + if (isset($optionalArgs['encodingType'])) { + $request->setEncodingType($optionalArgs['encodingType']); + } + + return $this->startCall('AnnotateText', AnnotateTextResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Classifies a document into categories. + * + * Sample code: + * ``` + * $languageServiceClient = new LanguageServiceClient(); + * try { + * $document = new Document(); + * $response = $languageServiceClient->classifyText($document); + * } finally { + * $languageServiceClient->close(); + * } + * ``` + * + * @param Document $document Required. Input document. + * @param array $optionalArgs { + * Optional. + * + * @type ClassificationModelOptions $classificationModelOptions + * Model options to use for classification. Defaults to v1 options if not + * specified. + * @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 \Google\Cloud\Language\V1beta2\ClassifyTextResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function classifyText($document, array $optionalArgs = []) + { + $request = new ClassifyTextRequest(); + $request->setDocument($document); + if (isset($optionalArgs['classificationModelOptions'])) { + $request->setClassificationModelOptions($optionalArgs['classificationModelOptions']); + } + + return $this->startCall('ClassifyText', ClassifyTextResponse::class, $optionalArgs, $request)->wait(); + } +} diff --git a/owl-bot-staging/Language/v1beta2/src/V1beta2/LanguageServiceClient.php b/owl-bot-staging/Language/v1beta2/src/V1beta2/LanguageServiceClient.php new file mode 100644 index 000000000000..de60107ce0f9 --- /dev/null +++ b/owl-bot-staging/Language/v1beta2/src/V1beta2/LanguageServiceClient.php @@ -0,0 +1,36 @@ + [ + 'google.cloud.language.v1beta2.LanguageService' => [], + ], +]; diff --git a/owl-bot-staging/Language/v1beta2/src/V1beta2/resources/language_service_rest_client_config.php b/owl-bot-staging/Language/v1beta2/src/V1beta2/resources/language_service_rest_client_config.php new file mode 100644 index 000000000000..dd8a7e56d036 --- /dev/null +++ b/owl-bot-staging/Language/v1beta2/src/V1beta2/resources/language_service_rest_client_config.php @@ -0,0 +1,39 @@ + [ + 'google.cloud.language.v1beta2.LanguageService' => [ + 'AnalyzeEntities' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta2/documents:analyzeEntities', + 'body' => '*', + ], + 'AnalyzeEntitySentiment' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta2/documents:analyzeEntitySentiment', + 'body' => '*', + ], + 'AnalyzeSentiment' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta2/documents:analyzeSentiment', + 'body' => '*', + ], + 'AnalyzeSyntax' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta2/documents:analyzeSyntax', + 'body' => '*', + ], + 'AnnotateText' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta2/documents:annotateText', + 'body' => '*', + ], + 'ClassifyText' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta2/documents:classifyText', + 'body' => '*', + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/Language/v1beta2/tests/Unit/V1beta2/LanguageServiceClientTest.php b/owl-bot-staging/Language/v1beta2/tests/Unit/V1beta2/LanguageServiceClientTest.php new file mode 100644 index 000000000000..9def42fac620 --- /dev/null +++ b/owl-bot-staging/Language/v1beta2/tests/Unit/V1beta2/LanguageServiceClientTest.php @@ -0,0 +1,430 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return LanguageServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new LanguageServiceClient($options); + } + + /** @test */ + public function analyzeEntitiesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $language = 'language-1613589672'; + $expectedResponse = new AnalyzeEntitiesResponse(); + $expectedResponse->setLanguage($language); + $transport->addResponse($expectedResponse); + // Mock request + $document = new Document(); + $response = $gapicClient->analyzeEntities($document); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.language.v1beta2.LanguageService/AnalyzeEntities', $actualFuncCall); + $actualValue = $actualRequestObject->getDocument(); + $this->assertProtobufEquals($document, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function analyzeEntitiesExceptionTest() + { + $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 + $document = new Document(); + try { + $gapicClient->analyzeEntities($document); + // 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 analyzeEntitySentimentTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $language = 'language-1613589672'; + $expectedResponse = new AnalyzeEntitySentimentResponse(); + $expectedResponse->setLanguage($language); + $transport->addResponse($expectedResponse); + // Mock request + $document = new Document(); + $response = $gapicClient->analyzeEntitySentiment($document); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.language.v1beta2.LanguageService/AnalyzeEntitySentiment', $actualFuncCall); + $actualValue = $actualRequestObject->getDocument(); + $this->assertProtobufEquals($document, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function analyzeEntitySentimentExceptionTest() + { + $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 + $document = new Document(); + try { + $gapicClient->analyzeEntitySentiment($document); + // 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 analyzeSentimentTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $language = 'language-1613589672'; + $expectedResponse = new AnalyzeSentimentResponse(); + $expectedResponse->setLanguage($language); + $transport->addResponse($expectedResponse); + // Mock request + $document = new Document(); + $response = $gapicClient->analyzeSentiment($document); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.language.v1beta2.LanguageService/AnalyzeSentiment', $actualFuncCall); + $actualValue = $actualRequestObject->getDocument(); + $this->assertProtobufEquals($document, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function analyzeSentimentExceptionTest() + { + $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 + $document = new Document(); + try { + $gapicClient->analyzeSentiment($document); + // 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 analyzeSyntaxTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $language = 'language-1613589672'; + $expectedResponse = new AnalyzeSyntaxResponse(); + $expectedResponse->setLanguage($language); + $transport->addResponse($expectedResponse); + // Mock request + $document = new Document(); + $response = $gapicClient->analyzeSyntax($document); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.language.v1beta2.LanguageService/AnalyzeSyntax', $actualFuncCall); + $actualValue = $actualRequestObject->getDocument(); + $this->assertProtobufEquals($document, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function analyzeSyntaxExceptionTest() + { + $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 + $document = new Document(); + try { + $gapicClient->analyzeSyntax($document); + // 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 annotateTextTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $language = 'language-1613589672'; + $expectedResponse = new AnnotateTextResponse(); + $expectedResponse->setLanguage($language); + $transport->addResponse($expectedResponse); + // Mock request + $document = new Document(); + $features = new Features(); + $response = $gapicClient->annotateText($document, $features); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.language.v1beta2.LanguageService/AnnotateText', $actualFuncCall); + $actualValue = $actualRequestObject->getDocument(); + $this->assertProtobufEquals($document, $actualValue); + $actualValue = $actualRequestObject->getFeatures(); + $this->assertProtobufEquals($features, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function annotateTextExceptionTest() + { + $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 + $document = new Document(); + $features = new Features(); + try { + $gapicClient->annotateText($document, $features); + // 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 classifyTextTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new ClassifyTextResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $document = new Document(); + $response = $gapicClient->classifyText($document); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.language.v1beta2.LanguageService/ClassifyText', $actualFuncCall); + $actualValue = $actualRequestObject->getDocument(); + $this->assertProtobufEquals($document, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function classifyTextExceptionTest() + { + $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 + $document = new Document(); + try { + $gapicClient->classifyText($document); + // 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()); + } +} diff --git a/owl-bot-staging/LifeSciences/v2beta/proto/src/GPBMetadata/Google/Cloud/Lifesciences/V2Beta/Workflows.php b/owl-bot-staging/LifeSciences/v2beta/proto/src/GPBMetadata/Google/Cloud/Lifesciences/V2Beta/Workflows.php new file mode 100644 index 000000000000..75e8b074afcc Binary files /dev/null and b/owl-bot-staging/LifeSciences/v2beta/proto/src/GPBMetadata/Google/Cloud/Lifesciences/V2Beta/Workflows.php differ diff --git a/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/Accelerator.php b/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/Accelerator.php new file mode 100644 index 000000000000..2633487cfd4b --- /dev/null +++ b/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/Accelerator.php @@ -0,0 +1,125 @@ +google.cloud.lifesciences.v2beta.Accelerator + */ +class Accelerator extends \Google\Protobuf\Internal\Message +{ + /** + * The accelerator type string (for example, "nvidia-tesla-k80"). + * Only NVIDIA GPU accelerators are currently supported. If an NVIDIA GPU is + * attached, the required runtime libraries will be made available to all + * containers under `/usr/local/nvidia`. The driver version to install must + * be specified using the NVIDIA driver version parameter on the virtual + * machine specification. Note that attaching a GPU increases the worker VM + * startup time by a few minutes. + * + * Generated from protobuf field string type = 1; + */ + protected $type = ''; + /** + * How many accelerators of this type to attach. + * + * Generated from protobuf field int64 count = 2; + */ + protected $count = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $type + * The accelerator type string (for example, "nvidia-tesla-k80"). + * Only NVIDIA GPU accelerators are currently supported. If an NVIDIA GPU is + * attached, the required runtime libraries will be made available to all + * containers under `/usr/local/nvidia`. The driver version to install must + * be specified using the NVIDIA driver version parameter on the virtual + * machine specification. Note that attaching a GPU increases the worker VM + * startup time by a few minutes. + * @type int|string $count + * How many accelerators of this type to attach. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Lifesciences\V2Beta\Workflows::initOnce(); + parent::__construct($data); + } + + /** + * The accelerator type string (for example, "nvidia-tesla-k80"). + * Only NVIDIA GPU accelerators are currently supported. If an NVIDIA GPU is + * attached, the required runtime libraries will be made available to all + * containers under `/usr/local/nvidia`. The driver version to install must + * be specified using the NVIDIA driver version parameter on the virtual + * machine specification. Note that attaching a GPU increases the worker VM + * startup time by a few minutes. + * + * Generated from protobuf field string type = 1; + * @return string + */ + public function getType() + { + return $this->type; + } + + /** + * The accelerator type string (for example, "nvidia-tesla-k80"). + * Only NVIDIA GPU accelerators are currently supported. If an NVIDIA GPU is + * attached, the required runtime libraries will be made available to all + * containers under `/usr/local/nvidia`. The driver version to install must + * be specified using the NVIDIA driver version parameter on the virtual + * machine specification. Note that attaching a GPU increases the worker VM + * startup time by a few minutes. + * + * Generated from protobuf field string type = 1; + * @param string $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkString($var, True); + $this->type = $var; + + return $this; + } + + /** + * How many accelerators of this type to attach. + * + * Generated from protobuf field int64 count = 2; + * @return int|string + */ + public function getCount() + { + return $this->count; + } + + /** + * How many accelerators of this type to attach. + * + * Generated from protobuf field int64 count = 2; + * @param int|string $var + * @return $this + */ + public function setCount($var) + { + GPBUtil::checkInt64($var); + $this->count = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/Action.php b/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/Action.php new file mode 100644 index 000000000000..60946413bcf1 --- /dev/null +++ b/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/Action.php @@ -0,0 +1,1099 @@ +google.cloud.lifesciences.v2beta.Action + */ +class Action extends \Google\Protobuf\Internal\Message +{ + /** + * An optional name for the container. The container hostname will be set to + * this name, making it useful for inter-container communication. The name + * must contain only upper and lowercase alphanumeric characters and hyphens + * and cannot start with a hyphen. + * + * Generated from protobuf field string container_name = 1; + */ + protected $container_name = ''; + /** + * Required. The URI to pull the container image from. Note that all images + * referenced by actions in the pipeline are pulled before the first action + * runs. If multiple actions reference the same image, it is only pulled once, + * ensuring that the same image is used for all actions in a single pipeline. + * The image URI can be either a complete host and image specification (e.g., + * quay.io/biocontainers/samtools), a library and image name (e.g., + * google/cloud-sdk) or a bare image name ('bash') to pull from the default + * library. No schema is required in any of these cases. + * If the specified image is not public, the service account specified for + * the Virtual Machine must have access to pull the images from GCR, or + * appropriate credentials must be specified in the + * [google.cloud.lifesciences.v2beta.Action.credentials][google.cloud.lifesciences.v2beta.Action.credentials] + * field. + * + * Generated from protobuf field string image_uri = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $image_uri = ''; + /** + * If specified, overrides the `CMD` specified in the container. If the + * container also has an `ENTRYPOINT` the values are used as entrypoint + * arguments. Otherwise, they are used as a command and arguments to run + * inside the container. + * + * Generated from protobuf field repeated string commands = 3; + */ + private $commands; + /** + * If specified, overrides the `ENTRYPOINT` specified in the container. + * + * Generated from protobuf field string entrypoint = 4; + */ + protected $entrypoint = ''; + /** + * The environment to pass into the container. This environment is merged + * with values specified in the + * [google.cloud.lifesciences.v2beta.Pipeline][google.cloud.lifesciences.v2beta.Pipeline] + * message, overwriting any duplicate values. + * In addition to the values passed here, a few other values are + * automatically injected into the environment. These cannot be hidden or + * overwritten. + * `GOOGLE_PIPELINE_FAILED` will be set to "1" if the pipeline failed + * because an action has exited with a non-zero status (and did not have the + * `IGNORE_EXIT_STATUS` flag set). This can be used to determine if additional + * debug or logging actions should execute. + * `GOOGLE_LAST_EXIT_STATUS` will be set to the exit status of the last + * non-background action that executed. This can be used by workflow engine + * authors to determine whether an individual action has succeeded or failed. + * + * Generated from protobuf field map environment = 5; + */ + private $environment; + /** + * The encrypted environment to pass into the container. This environment is + * merged with values specified in the + * [google.cloud.lifesciences.v2beta.Pipeline][google.cloud.lifesciences.v2beta.Pipeline] + * message, overwriting any duplicate values. + * The secret must decrypt to a JSON-encoded dictionary where key-value pairs + * serve as environment variable names and their values. The decoded + * environment variables can overwrite the values specified by the + * `environment` field. + * + * Generated from protobuf field .google.cloud.lifesciences.v2beta.Secret encrypted_environment = 21; + */ + protected $encrypted_environment = null; + /** + * An optional identifier for a PID namespace to run the action inside. + * Multiple actions should use the same string to share a namespace. If + * unspecified, a separate isolated namespace is used. + * + * Generated from protobuf field string pid_namespace = 6; + */ + protected $pid_namespace = ''; + /** + * A map of containers to host port mappings for this container. If the + * container already specifies exposed ports, use the + * `PUBLISH_EXPOSED_PORTS` flag instead. + * The host port number must be less than 65536. If it is zero, an unused + * random port is assigned. To determine the resulting port number, consult + * the `ContainerStartedEvent` in the operation metadata. + * + * Generated from protobuf field map port_mappings = 8; + */ + private $port_mappings; + /** + * A list of mounts to make available to the action. + * In addition to the values specified here, every action has a special + * virtual disk mounted under `/google` that contains log files and other + * operational components. + *
    + *
  • /google/logs All logs written during the pipeline + * execution.
  • + *
  • /google/logs/output The combined standard output and + * standard error of all actions run as part of the pipeline + * execution.
  • + *
  • /google/logs/action/*/stdout The complete contents of + * each individual action's standard output.
  • + *
  • /google/logs/action/*/stderr The complete contents of + * each individual action's standard error output.
  • + *
+ * + * Generated from protobuf field repeated .google.cloud.lifesciences.v2beta.Mount mounts = 9; + */ + private $mounts; + /** + * Labels to associate with the action. This field is provided to assist + * workflow engine authors in identifying actions (for example, to indicate + * what sort of action they perform, such as localization or debugging). + * They are returned in the operation metadata, but are otherwise ignored. + * + * Generated from protobuf field map labels = 10; + */ + private $labels; + /** + * If the specified image is hosted on a private registry other than Google + * Container Registry, the credentials required to pull the image must be + * specified here as an encrypted secret. + * The secret must decrypt to a JSON-encoded dictionary containing both + * `username` and `password` keys. + * + * Generated from protobuf field .google.cloud.lifesciences.v2beta.Secret credentials = 11; + */ + protected $credentials = null; + /** + * The maximum amount of time to give the action to complete. If the action + * fails to complete before the timeout, it will be terminated and the exit + * status will be non-zero. The pipeline will continue or terminate based + * on the rules defined by the `ALWAYS_RUN` and `IGNORE_EXIT_STATUS` flags. + * + * Generated from protobuf field .google.protobuf.Duration timeout = 12; + */ + protected $timeout = null; + /** + * Normally, a non-zero exit status causes the pipeline to fail. This flag + * allows execution of other actions to continue instead. + * + * Generated from protobuf field bool ignore_exit_status = 13; + */ + protected $ignore_exit_status = false; + /** + * This flag allows an action to continue running in the background while + * executing subsequent actions. This is useful to provide services to + * other actions (or to provide debugging support tools like SSH servers). + * + * Generated from protobuf field bool run_in_background = 14; + */ + protected $run_in_background = false; + /** + * By default, after an action fails, no further actions are run. This flag + * indicates that this action must be run even if the pipeline has already + * failed. This is useful for actions that copy output files off of the VM + * or for debugging. Note that no actions will be run if image prefetching + * fails. + * + * Generated from protobuf field bool always_run = 15; + */ + protected $always_run = false; + /** + * Enable access to the FUSE device for this action. Filesystems can then + * be mounted into disks shared with other actions. The other actions do + * not need the `enable_fuse` flag to access the mounted filesystem. + * This has the effect of causing the container to be executed with + * `CAP_SYS_ADMIN` and exposes `/dev/fuse` to the container, so use it only + * for containers you trust. + * + * Generated from protobuf field bool enable_fuse = 16; + */ + protected $enable_fuse = false; + /** + * Exposes all ports specified by `EXPOSE` statements in the container. To + * discover the host side port numbers, consult the `ACTION_STARTED` event + * in the operation metadata. + * + * Generated from protobuf field bool publish_exposed_ports = 17; + */ + protected $publish_exposed_ports = false; + /** + * All container images are typically downloaded before any actions are + * executed. This helps prevent typos in URIs or issues like lack of disk + * space from wasting large amounts of compute resources. + * If set, this flag prevents the worker from downloading the image until + * just before the action is executed. + * + * Generated from protobuf field bool disable_image_prefetch = 18; + */ + protected $disable_image_prefetch = false; + /** + * A small portion of the container's standard error stream is typically + * captured and returned inside the `ContainerStoppedEvent`. Setting this + * flag disables this functionality. + * + * Generated from protobuf field bool disable_standard_error_capture = 19; + */ + protected $disable_standard_error_capture = false; + /** + * Prevents the container from accessing the external network. + * + * Generated from protobuf field bool block_external_network = 20; + */ + protected $block_external_network = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $container_name + * An optional name for the container. The container hostname will be set to + * this name, making it useful for inter-container communication. The name + * must contain only upper and lowercase alphanumeric characters and hyphens + * and cannot start with a hyphen. + * @type string $image_uri + * Required. The URI to pull the container image from. Note that all images + * referenced by actions in the pipeline are pulled before the first action + * runs. If multiple actions reference the same image, it is only pulled once, + * ensuring that the same image is used for all actions in a single pipeline. + * The image URI can be either a complete host and image specification (e.g., + * quay.io/biocontainers/samtools), a library and image name (e.g., + * google/cloud-sdk) or a bare image name ('bash') to pull from the default + * library. No schema is required in any of these cases. + * If the specified image is not public, the service account specified for + * the Virtual Machine must have access to pull the images from GCR, or + * appropriate credentials must be specified in the + * [google.cloud.lifesciences.v2beta.Action.credentials][google.cloud.lifesciences.v2beta.Action.credentials] + * field. + * @type array|\Google\Protobuf\Internal\RepeatedField $commands + * If specified, overrides the `CMD` specified in the container. If the + * container also has an `ENTRYPOINT` the values are used as entrypoint + * arguments. Otherwise, they are used as a command and arguments to run + * inside the container. + * @type string $entrypoint + * If specified, overrides the `ENTRYPOINT` specified in the container. + * @type array|\Google\Protobuf\Internal\MapField $environment + * The environment to pass into the container. This environment is merged + * with values specified in the + * [google.cloud.lifesciences.v2beta.Pipeline][google.cloud.lifesciences.v2beta.Pipeline] + * message, overwriting any duplicate values. + * In addition to the values passed here, a few other values are + * automatically injected into the environment. These cannot be hidden or + * overwritten. + * `GOOGLE_PIPELINE_FAILED` will be set to "1" if the pipeline failed + * because an action has exited with a non-zero status (and did not have the + * `IGNORE_EXIT_STATUS` flag set). This can be used to determine if additional + * debug or logging actions should execute. + * `GOOGLE_LAST_EXIT_STATUS` will be set to the exit status of the last + * non-background action that executed. This can be used by workflow engine + * authors to determine whether an individual action has succeeded or failed. + * @type \Google\Cloud\LifeSciences\V2beta\Secret $encrypted_environment + * The encrypted environment to pass into the container. This environment is + * merged with values specified in the + * [google.cloud.lifesciences.v2beta.Pipeline][google.cloud.lifesciences.v2beta.Pipeline] + * message, overwriting any duplicate values. + * The secret must decrypt to a JSON-encoded dictionary where key-value pairs + * serve as environment variable names and their values. The decoded + * environment variables can overwrite the values specified by the + * `environment` field. + * @type string $pid_namespace + * An optional identifier for a PID namespace to run the action inside. + * Multiple actions should use the same string to share a namespace. If + * unspecified, a separate isolated namespace is used. + * @type array|\Google\Protobuf\Internal\MapField $port_mappings + * A map of containers to host port mappings for this container. If the + * container already specifies exposed ports, use the + * `PUBLISH_EXPOSED_PORTS` flag instead. + * The host port number must be less than 65536. If it is zero, an unused + * random port is assigned. To determine the resulting port number, consult + * the `ContainerStartedEvent` in the operation metadata. + * @type array<\Google\Cloud\LifeSciences\V2beta\Mount>|\Google\Protobuf\Internal\RepeatedField $mounts + * A list of mounts to make available to the action. + * In addition to the values specified here, every action has a special + * virtual disk mounted under `/google` that contains log files and other + * operational components. + *
    + *
  • /google/logs All logs written during the pipeline + * execution.
  • + *
  • /google/logs/output The combined standard output and + * standard error of all actions run as part of the pipeline + * execution.
  • + *
  • /google/logs/action/*/stdout The complete contents of + * each individual action's standard output.
  • + *
  • /google/logs/action/*/stderr The complete contents of + * each individual action's standard error output.
  • + *
+ * @type array|\Google\Protobuf\Internal\MapField $labels + * Labels to associate with the action. This field is provided to assist + * workflow engine authors in identifying actions (for example, to indicate + * what sort of action they perform, such as localization or debugging). + * They are returned in the operation metadata, but are otherwise ignored. + * @type \Google\Cloud\LifeSciences\V2beta\Secret $credentials + * If the specified image is hosted on a private registry other than Google + * Container Registry, the credentials required to pull the image must be + * specified here as an encrypted secret. + * The secret must decrypt to a JSON-encoded dictionary containing both + * `username` and `password` keys. + * @type \Google\Protobuf\Duration $timeout + * The maximum amount of time to give the action to complete. If the action + * fails to complete before the timeout, it will be terminated and the exit + * status will be non-zero. The pipeline will continue or terminate based + * on the rules defined by the `ALWAYS_RUN` and `IGNORE_EXIT_STATUS` flags. + * @type bool $ignore_exit_status + * Normally, a non-zero exit status causes the pipeline to fail. This flag + * allows execution of other actions to continue instead. + * @type bool $run_in_background + * This flag allows an action to continue running in the background while + * executing subsequent actions. This is useful to provide services to + * other actions (or to provide debugging support tools like SSH servers). + * @type bool $always_run + * By default, after an action fails, no further actions are run. This flag + * indicates that this action must be run even if the pipeline has already + * failed. This is useful for actions that copy output files off of the VM + * or for debugging. Note that no actions will be run if image prefetching + * fails. + * @type bool $enable_fuse + * Enable access to the FUSE device for this action. Filesystems can then + * be mounted into disks shared with other actions. The other actions do + * not need the `enable_fuse` flag to access the mounted filesystem. + * This has the effect of causing the container to be executed with + * `CAP_SYS_ADMIN` and exposes `/dev/fuse` to the container, so use it only + * for containers you trust. + * @type bool $publish_exposed_ports + * Exposes all ports specified by `EXPOSE` statements in the container. To + * discover the host side port numbers, consult the `ACTION_STARTED` event + * in the operation metadata. + * @type bool $disable_image_prefetch + * All container images are typically downloaded before any actions are + * executed. This helps prevent typos in URIs or issues like lack of disk + * space from wasting large amounts of compute resources. + * If set, this flag prevents the worker from downloading the image until + * just before the action is executed. + * @type bool $disable_standard_error_capture + * A small portion of the container's standard error stream is typically + * captured and returned inside the `ContainerStoppedEvent`. Setting this + * flag disables this functionality. + * @type bool $block_external_network + * Prevents the container from accessing the external network. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Lifesciences\V2Beta\Workflows::initOnce(); + parent::__construct($data); + } + + /** + * An optional name for the container. The container hostname will be set to + * this name, making it useful for inter-container communication. The name + * must contain only upper and lowercase alphanumeric characters and hyphens + * and cannot start with a hyphen. + * + * Generated from protobuf field string container_name = 1; + * @return string + */ + public function getContainerName() + { + return $this->container_name; + } + + /** + * An optional name for the container. The container hostname will be set to + * this name, making it useful for inter-container communication. The name + * must contain only upper and lowercase alphanumeric characters and hyphens + * and cannot start with a hyphen. + * + * Generated from protobuf field string container_name = 1; + * @param string $var + * @return $this + */ + public function setContainerName($var) + { + GPBUtil::checkString($var, True); + $this->container_name = $var; + + return $this; + } + + /** + * Required. The URI to pull the container image from. Note that all images + * referenced by actions in the pipeline are pulled before the first action + * runs. If multiple actions reference the same image, it is only pulled once, + * ensuring that the same image is used for all actions in a single pipeline. + * The image URI can be either a complete host and image specification (e.g., + * quay.io/biocontainers/samtools), a library and image name (e.g., + * google/cloud-sdk) or a bare image name ('bash') to pull from the default + * library. No schema is required in any of these cases. + * If the specified image is not public, the service account specified for + * the Virtual Machine must have access to pull the images from GCR, or + * appropriate credentials must be specified in the + * [google.cloud.lifesciences.v2beta.Action.credentials][google.cloud.lifesciences.v2beta.Action.credentials] + * field. + * + * Generated from protobuf field string image_uri = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getImageUri() + { + return $this->image_uri; + } + + /** + * Required. The URI to pull the container image from. Note that all images + * referenced by actions in the pipeline are pulled before the first action + * runs. If multiple actions reference the same image, it is only pulled once, + * ensuring that the same image is used for all actions in a single pipeline. + * The image URI can be either a complete host and image specification (e.g., + * quay.io/biocontainers/samtools), a library and image name (e.g., + * google/cloud-sdk) or a bare image name ('bash') to pull from the default + * library. No schema is required in any of these cases. + * If the specified image is not public, the service account specified for + * the Virtual Machine must have access to pull the images from GCR, or + * appropriate credentials must be specified in the + * [google.cloud.lifesciences.v2beta.Action.credentials][google.cloud.lifesciences.v2beta.Action.credentials] + * field. + * + * Generated from protobuf field string image_uri = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setImageUri($var) + { + GPBUtil::checkString($var, True); + $this->image_uri = $var; + + return $this; + } + + /** + * If specified, overrides the `CMD` specified in the container. If the + * container also has an `ENTRYPOINT` the values are used as entrypoint + * arguments. Otherwise, they are used as a command and arguments to run + * inside the container. + * + * Generated from protobuf field repeated string commands = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getCommands() + { + return $this->commands; + } + + /** + * If specified, overrides the `CMD` specified in the container. If the + * container also has an `ENTRYPOINT` the values are used as entrypoint + * arguments. Otherwise, they are used as a command and arguments to run + * inside the container. + * + * Generated from protobuf field repeated string commands = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setCommands($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->commands = $arr; + + return $this; + } + + /** + * If specified, overrides the `ENTRYPOINT` specified in the container. + * + * Generated from protobuf field string entrypoint = 4; + * @return string + */ + public function getEntrypoint() + { + return $this->entrypoint; + } + + /** + * If specified, overrides the `ENTRYPOINT` specified in the container. + * + * Generated from protobuf field string entrypoint = 4; + * @param string $var + * @return $this + */ + public function setEntrypoint($var) + { + GPBUtil::checkString($var, True); + $this->entrypoint = $var; + + return $this; + } + + /** + * The environment to pass into the container. This environment is merged + * with values specified in the + * [google.cloud.lifesciences.v2beta.Pipeline][google.cloud.lifesciences.v2beta.Pipeline] + * message, overwriting any duplicate values. + * In addition to the values passed here, a few other values are + * automatically injected into the environment. These cannot be hidden or + * overwritten. + * `GOOGLE_PIPELINE_FAILED` will be set to "1" if the pipeline failed + * because an action has exited with a non-zero status (and did not have the + * `IGNORE_EXIT_STATUS` flag set). This can be used to determine if additional + * debug or logging actions should execute. + * `GOOGLE_LAST_EXIT_STATUS` will be set to the exit status of the last + * non-background action that executed. This can be used by workflow engine + * authors to determine whether an individual action has succeeded or failed. + * + * Generated from protobuf field map environment = 5; + * @return \Google\Protobuf\Internal\MapField + */ + public function getEnvironment() + { + return $this->environment; + } + + /** + * The environment to pass into the container. This environment is merged + * with values specified in the + * [google.cloud.lifesciences.v2beta.Pipeline][google.cloud.lifesciences.v2beta.Pipeline] + * message, overwriting any duplicate values. + * In addition to the values passed here, a few other values are + * automatically injected into the environment. These cannot be hidden or + * overwritten. + * `GOOGLE_PIPELINE_FAILED` will be set to "1" if the pipeline failed + * because an action has exited with a non-zero status (and did not have the + * `IGNORE_EXIT_STATUS` flag set). This can be used to determine if additional + * debug or logging actions should execute. + * `GOOGLE_LAST_EXIT_STATUS` will be set to the exit status of the last + * non-background action that executed. This can be used by workflow engine + * authors to determine whether an individual action has succeeded or failed. + * + * Generated from protobuf field map environment = 5; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setEnvironment($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->environment = $arr; + + return $this; + } + + /** + * The encrypted environment to pass into the container. This environment is + * merged with values specified in the + * [google.cloud.lifesciences.v2beta.Pipeline][google.cloud.lifesciences.v2beta.Pipeline] + * message, overwriting any duplicate values. + * The secret must decrypt to a JSON-encoded dictionary where key-value pairs + * serve as environment variable names and their values. The decoded + * environment variables can overwrite the values specified by the + * `environment` field. + * + * Generated from protobuf field .google.cloud.lifesciences.v2beta.Secret encrypted_environment = 21; + * @return \Google\Cloud\LifeSciences\V2beta\Secret|null + */ + public function getEncryptedEnvironment() + { + return $this->encrypted_environment; + } + + public function hasEncryptedEnvironment() + { + return isset($this->encrypted_environment); + } + + public function clearEncryptedEnvironment() + { + unset($this->encrypted_environment); + } + + /** + * The encrypted environment to pass into the container. This environment is + * merged with values specified in the + * [google.cloud.lifesciences.v2beta.Pipeline][google.cloud.lifesciences.v2beta.Pipeline] + * message, overwriting any duplicate values. + * The secret must decrypt to a JSON-encoded dictionary where key-value pairs + * serve as environment variable names and their values. The decoded + * environment variables can overwrite the values specified by the + * `environment` field. + * + * Generated from protobuf field .google.cloud.lifesciences.v2beta.Secret encrypted_environment = 21; + * @param \Google\Cloud\LifeSciences\V2beta\Secret $var + * @return $this + */ + public function setEncryptedEnvironment($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\LifeSciences\V2beta\Secret::class); + $this->encrypted_environment = $var; + + return $this; + } + + /** + * An optional identifier for a PID namespace to run the action inside. + * Multiple actions should use the same string to share a namespace. If + * unspecified, a separate isolated namespace is used. + * + * Generated from protobuf field string pid_namespace = 6; + * @return string + */ + public function getPidNamespace() + { + return $this->pid_namespace; + } + + /** + * An optional identifier for a PID namespace to run the action inside. + * Multiple actions should use the same string to share a namespace. If + * unspecified, a separate isolated namespace is used. + * + * Generated from protobuf field string pid_namespace = 6; + * @param string $var + * @return $this + */ + public function setPidNamespace($var) + { + GPBUtil::checkString($var, True); + $this->pid_namespace = $var; + + return $this; + } + + /** + * A map of containers to host port mappings for this container. If the + * container already specifies exposed ports, use the + * `PUBLISH_EXPOSED_PORTS` flag instead. + * The host port number must be less than 65536. If it is zero, an unused + * random port is assigned. To determine the resulting port number, consult + * the `ContainerStartedEvent` in the operation metadata. + * + * Generated from protobuf field map port_mappings = 8; + * @return \Google\Protobuf\Internal\MapField + */ + public function getPortMappings() + { + return $this->port_mappings; + } + + /** + * A map of containers to host port mappings for this container. If the + * container already specifies exposed ports, use the + * `PUBLISH_EXPOSED_PORTS` flag instead. + * The host port number must be less than 65536. If it is zero, an unused + * random port is assigned. To determine the resulting port number, consult + * the `ContainerStartedEvent` in the operation metadata. + * + * Generated from protobuf field map port_mappings = 8; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setPortMappings($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::INT32, \Google\Protobuf\Internal\GPBType::INT32); + $this->port_mappings = $arr; + + return $this; + } + + /** + * A list of mounts to make available to the action. + * In addition to the values specified here, every action has a special + * virtual disk mounted under `/google` that contains log files and other + * operational components. + *
    + *
  • /google/logs All logs written during the pipeline + * execution.
  • + *
  • /google/logs/output The combined standard output and + * standard error of all actions run as part of the pipeline + * execution.
  • + *
  • /google/logs/action/*/stdout The complete contents of + * each individual action's standard output.
  • + *
  • /google/logs/action/*/stderr The complete contents of + * each individual action's standard error output.
  • + *
+ * + * Generated from protobuf field repeated .google.cloud.lifesciences.v2beta.Mount mounts = 9; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getMounts() + { + return $this->mounts; + } + + /** + * A list of mounts to make available to the action. + * In addition to the values specified here, every action has a special + * virtual disk mounted under `/google` that contains log files and other + * operational components. + *
    + *
  • /google/logs All logs written during the pipeline + * execution.
  • + *
  • /google/logs/output The combined standard output and + * standard error of all actions run as part of the pipeline + * execution.
  • + *
  • /google/logs/action/*/stdout The complete contents of + * each individual action's standard output.
  • + *
  • /google/logs/action/*/stderr The complete contents of + * each individual action's standard error output.
  • + *
+ * + * Generated from protobuf field repeated .google.cloud.lifesciences.v2beta.Mount mounts = 9; + * @param array<\Google\Cloud\LifeSciences\V2beta\Mount>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setMounts($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\LifeSciences\V2beta\Mount::class); + $this->mounts = $arr; + + return $this; + } + + /** + * Labels to associate with the action. This field is provided to assist + * workflow engine authors in identifying actions (for example, to indicate + * what sort of action they perform, such as localization or debugging). + * They are returned in the operation metadata, but are otherwise ignored. + * + * Generated from protobuf field map labels = 10; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * Labels to associate with the action. This field is provided to assist + * workflow engine authors in identifying actions (for example, to indicate + * what sort of action they perform, such as localization or debugging). + * They are returned in the operation metadata, but are otherwise ignored. + * + * Generated from protobuf field map labels = 10; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + + /** + * If the specified image is hosted on a private registry other than Google + * Container Registry, the credentials required to pull the image must be + * specified here as an encrypted secret. + * The secret must decrypt to a JSON-encoded dictionary containing both + * `username` and `password` keys. + * + * Generated from protobuf field .google.cloud.lifesciences.v2beta.Secret credentials = 11; + * @return \Google\Cloud\LifeSciences\V2beta\Secret|null + */ + public function getCredentials() + { + return $this->credentials; + } + + public function hasCredentials() + { + return isset($this->credentials); + } + + public function clearCredentials() + { + unset($this->credentials); + } + + /** + * If the specified image is hosted on a private registry other than Google + * Container Registry, the credentials required to pull the image must be + * specified here as an encrypted secret. + * The secret must decrypt to a JSON-encoded dictionary containing both + * `username` and `password` keys. + * + * Generated from protobuf field .google.cloud.lifesciences.v2beta.Secret credentials = 11; + * @param \Google\Cloud\LifeSciences\V2beta\Secret $var + * @return $this + */ + public function setCredentials($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\LifeSciences\V2beta\Secret::class); + $this->credentials = $var; + + return $this; + } + + /** + * The maximum amount of time to give the action to complete. If the action + * fails to complete before the timeout, it will be terminated and the exit + * status will be non-zero. The pipeline will continue or terminate based + * on the rules defined by the `ALWAYS_RUN` and `IGNORE_EXIT_STATUS` flags. + * + * Generated from protobuf field .google.protobuf.Duration timeout = 12; + * @return \Google\Protobuf\Duration|null + */ + public function getTimeout() + { + return $this->timeout; + } + + public function hasTimeout() + { + return isset($this->timeout); + } + + public function clearTimeout() + { + unset($this->timeout); + } + + /** + * The maximum amount of time to give the action to complete. If the action + * fails to complete before the timeout, it will be terminated and the exit + * status will be non-zero. The pipeline will continue or terminate based + * on the rules defined by the `ALWAYS_RUN` and `IGNORE_EXIT_STATUS` flags. + * + * Generated from protobuf field .google.protobuf.Duration timeout = 12; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setTimeout($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->timeout = $var; + + return $this; + } + + /** + * Normally, a non-zero exit status causes the pipeline to fail. This flag + * allows execution of other actions to continue instead. + * + * Generated from protobuf field bool ignore_exit_status = 13; + * @return bool + */ + public function getIgnoreExitStatus() + { + return $this->ignore_exit_status; + } + + /** + * Normally, a non-zero exit status causes the pipeline to fail. This flag + * allows execution of other actions to continue instead. + * + * Generated from protobuf field bool ignore_exit_status = 13; + * @param bool $var + * @return $this + */ + public function setIgnoreExitStatus($var) + { + GPBUtil::checkBool($var); + $this->ignore_exit_status = $var; + + return $this; + } + + /** + * This flag allows an action to continue running in the background while + * executing subsequent actions. This is useful to provide services to + * other actions (or to provide debugging support tools like SSH servers). + * + * Generated from protobuf field bool run_in_background = 14; + * @return bool + */ + public function getRunInBackground() + { + return $this->run_in_background; + } + + /** + * This flag allows an action to continue running in the background while + * executing subsequent actions. This is useful to provide services to + * other actions (or to provide debugging support tools like SSH servers). + * + * Generated from protobuf field bool run_in_background = 14; + * @param bool $var + * @return $this + */ + public function setRunInBackground($var) + { + GPBUtil::checkBool($var); + $this->run_in_background = $var; + + return $this; + } + + /** + * By default, after an action fails, no further actions are run. This flag + * indicates that this action must be run even if the pipeline has already + * failed. This is useful for actions that copy output files off of the VM + * or for debugging. Note that no actions will be run if image prefetching + * fails. + * + * Generated from protobuf field bool always_run = 15; + * @return bool + */ + public function getAlwaysRun() + { + return $this->always_run; + } + + /** + * By default, after an action fails, no further actions are run. This flag + * indicates that this action must be run even if the pipeline has already + * failed. This is useful for actions that copy output files off of the VM + * or for debugging. Note that no actions will be run if image prefetching + * fails. + * + * Generated from protobuf field bool always_run = 15; + * @param bool $var + * @return $this + */ + public function setAlwaysRun($var) + { + GPBUtil::checkBool($var); + $this->always_run = $var; + + return $this; + } + + /** + * Enable access to the FUSE device for this action. Filesystems can then + * be mounted into disks shared with other actions. The other actions do + * not need the `enable_fuse` flag to access the mounted filesystem. + * This has the effect of causing the container to be executed with + * `CAP_SYS_ADMIN` and exposes `/dev/fuse` to the container, so use it only + * for containers you trust. + * + * Generated from protobuf field bool enable_fuse = 16; + * @return bool + */ + public function getEnableFuse() + { + return $this->enable_fuse; + } + + /** + * Enable access to the FUSE device for this action. Filesystems can then + * be mounted into disks shared with other actions. The other actions do + * not need the `enable_fuse` flag to access the mounted filesystem. + * This has the effect of causing the container to be executed with + * `CAP_SYS_ADMIN` and exposes `/dev/fuse` to the container, so use it only + * for containers you trust. + * + * Generated from protobuf field bool enable_fuse = 16; + * @param bool $var + * @return $this + */ + public function setEnableFuse($var) + { + GPBUtil::checkBool($var); + $this->enable_fuse = $var; + + return $this; + } + + /** + * Exposes all ports specified by `EXPOSE` statements in the container. To + * discover the host side port numbers, consult the `ACTION_STARTED` event + * in the operation metadata. + * + * Generated from protobuf field bool publish_exposed_ports = 17; + * @return bool + */ + public function getPublishExposedPorts() + { + return $this->publish_exposed_ports; + } + + /** + * Exposes all ports specified by `EXPOSE` statements in the container. To + * discover the host side port numbers, consult the `ACTION_STARTED` event + * in the operation metadata. + * + * Generated from protobuf field bool publish_exposed_ports = 17; + * @param bool $var + * @return $this + */ + public function setPublishExposedPorts($var) + { + GPBUtil::checkBool($var); + $this->publish_exposed_ports = $var; + + return $this; + } + + /** + * All container images are typically downloaded before any actions are + * executed. This helps prevent typos in URIs or issues like lack of disk + * space from wasting large amounts of compute resources. + * If set, this flag prevents the worker from downloading the image until + * just before the action is executed. + * + * Generated from protobuf field bool disable_image_prefetch = 18; + * @return bool + */ + public function getDisableImagePrefetch() + { + return $this->disable_image_prefetch; + } + + /** + * All container images are typically downloaded before any actions are + * executed. This helps prevent typos in URIs or issues like lack of disk + * space from wasting large amounts of compute resources. + * If set, this flag prevents the worker from downloading the image until + * just before the action is executed. + * + * Generated from protobuf field bool disable_image_prefetch = 18; + * @param bool $var + * @return $this + */ + public function setDisableImagePrefetch($var) + { + GPBUtil::checkBool($var); + $this->disable_image_prefetch = $var; + + return $this; + } + + /** + * A small portion of the container's standard error stream is typically + * captured and returned inside the `ContainerStoppedEvent`. Setting this + * flag disables this functionality. + * + * Generated from protobuf field bool disable_standard_error_capture = 19; + * @return bool + */ + public function getDisableStandardErrorCapture() + { + return $this->disable_standard_error_capture; + } + + /** + * A small portion of the container's standard error stream is typically + * captured and returned inside the `ContainerStoppedEvent`. Setting this + * flag disables this functionality. + * + * Generated from protobuf field bool disable_standard_error_capture = 19; + * @param bool $var + * @return $this + */ + public function setDisableStandardErrorCapture($var) + { + GPBUtil::checkBool($var); + $this->disable_standard_error_capture = $var; + + return $this; + } + + /** + * Prevents the container from accessing the external network. + * + * Generated from protobuf field bool block_external_network = 20; + * @return bool + */ + public function getBlockExternalNetwork() + { + return $this->block_external_network; + } + + /** + * Prevents the container from accessing the external network. + * + * Generated from protobuf field bool block_external_network = 20; + * @param bool $var + * @return $this + */ + public function setBlockExternalNetwork($var) + { + GPBUtil::checkBool($var); + $this->block_external_network = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/ContainerKilledEvent.php b/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/ContainerKilledEvent.php new file mode 100644 index 000000000000..cbaa3430b815 --- /dev/null +++ b/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/ContainerKilledEvent.php @@ -0,0 +1,69 @@ +google.cloud.lifesciences.v2beta.ContainerKilledEvent + */ +class ContainerKilledEvent extends \Google\Protobuf\Internal\Message +{ + /** + * The numeric ID of the action that started the container. + * + * Generated from protobuf field int32 action_id = 1; + */ + protected $action_id = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $action_id + * The numeric ID of the action that started the container. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Lifesciences\V2Beta\Workflows::initOnce(); + parent::__construct($data); + } + + /** + * The numeric ID of the action that started the container. + * + * Generated from protobuf field int32 action_id = 1; + * @return int + */ + public function getActionId() + { + return $this->action_id; + } + + /** + * The numeric ID of the action that started the container. + * + * Generated from protobuf field int32 action_id = 1; + * @param int $var + * @return $this + */ + public function setActionId($var) + { + GPBUtil::checkInt32($var); + $this->action_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/ContainerStartedEvent.php b/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/ContainerStartedEvent.php new file mode 100644 index 000000000000..9fcce69db437 --- /dev/null +++ b/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/ContainerStartedEvent.php @@ -0,0 +1,155 @@ +google.cloud.lifesciences.v2beta.ContainerStartedEvent + */ +class ContainerStartedEvent extends \Google\Protobuf\Internal\Message +{ + /** + * The numeric ID of the action that started this container. + * + * Generated from protobuf field int32 action_id = 1; + */ + protected $action_id = 0; + /** + * The container-to-host port mappings installed for this container. This + * set will contain any ports exposed using the `PUBLISH_EXPOSED_PORTS` flag + * as well as any specified in the `Action` definition. + * + * Generated from protobuf field map port_mappings = 2; + */ + private $port_mappings; + /** + * The public IP address that can be used to connect to the container. This + * field is only populated when at least one port mapping is present. If the + * instance was created with a private address, this field will be empty even + * if port mappings exist. + * + * Generated from protobuf field string ip_address = 3; + */ + protected $ip_address = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $action_id + * The numeric ID of the action that started this container. + * @type array|\Google\Protobuf\Internal\MapField $port_mappings + * The container-to-host port mappings installed for this container. This + * set will contain any ports exposed using the `PUBLISH_EXPOSED_PORTS` flag + * as well as any specified in the `Action` definition. + * @type string $ip_address + * The public IP address that can be used to connect to the container. This + * field is only populated when at least one port mapping is present. If the + * instance was created with a private address, this field will be empty even + * if port mappings exist. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Lifesciences\V2Beta\Workflows::initOnce(); + parent::__construct($data); + } + + /** + * The numeric ID of the action that started this container. + * + * Generated from protobuf field int32 action_id = 1; + * @return int + */ + public function getActionId() + { + return $this->action_id; + } + + /** + * The numeric ID of the action that started this container. + * + * Generated from protobuf field int32 action_id = 1; + * @param int $var + * @return $this + */ + public function setActionId($var) + { + GPBUtil::checkInt32($var); + $this->action_id = $var; + + return $this; + } + + /** + * The container-to-host port mappings installed for this container. This + * set will contain any ports exposed using the `PUBLISH_EXPOSED_PORTS` flag + * as well as any specified in the `Action` definition. + * + * Generated from protobuf field map port_mappings = 2; + * @return \Google\Protobuf\Internal\MapField + */ + public function getPortMappings() + { + return $this->port_mappings; + } + + /** + * The container-to-host port mappings installed for this container. This + * set will contain any ports exposed using the `PUBLISH_EXPOSED_PORTS` flag + * as well as any specified in the `Action` definition. + * + * Generated from protobuf field map port_mappings = 2; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setPortMappings($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::INT32, \Google\Protobuf\Internal\GPBType::INT32); + $this->port_mappings = $arr; + + return $this; + } + + /** + * The public IP address that can be used to connect to the container. This + * field is only populated when at least one port mapping is present. If the + * instance was created with a private address, this field will be empty even + * if port mappings exist. + * + * Generated from protobuf field string ip_address = 3; + * @return string + */ + public function getIpAddress() + { + return $this->ip_address; + } + + /** + * The public IP address that can be used to connect to the container. This + * field is only populated when at least one port mapping is present. If the + * instance was created with a private address, this field will be empty even + * if port mappings exist. + * + * Generated from protobuf field string ip_address = 3; + * @param string $var + * @return $this + */ + public function setIpAddress($var) + { + GPBUtil::checkString($var, True); + $this->ip_address = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/ContainerStoppedEvent.php b/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/ContainerStoppedEvent.php new file mode 100644 index 000000000000..faf44a387a52 --- /dev/null +++ b/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/ContainerStoppedEvent.php @@ -0,0 +1,159 @@ +google.cloud.lifesciences.v2beta.ContainerStoppedEvent + */ +class ContainerStoppedEvent extends \Google\Protobuf\Internal\Message +{ + /** + * The numeric ID of the action that started this container. + * + * Generated from protobuf field int32 action_id = 1; + */ + protected $action_id = 0; + /** + * The exit status of the container. + * + * Generated from protobuf field int32 exit_status = 2; + */ + protected $exit_status = 0; + /** + * The tail end of any content written to standard error by the container. + * If the content emits large amounts of debugging noise or contains + * sensitive information, you can prevent the content from being printed by + * setting the `DISABLE_STANDARD_ERROR_CAPTURE` flag. + * Note that only a small amount of the end of the stream is captured here. + * The entire stream is stored in the `/google/logs` directory mounted into + * each action, and can be copied off the machine as described elsewhere. + * + * Generated from protobuf field string stderr = 3; + */ + protected $stderr = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $action_id + * The numeric ID of the action that started this container. + * @type int $exit_status + * The exit status of the container. + * @type string $stderr + * The tail end of any content written to standard error by the container. + * If the content emits large amounts of debugging noise or contains + * sensitive information, you can prevent the content from being printed by + * setting the `DISABLE_STANDARD_ERROR_CAPTURE` flag. + * Note that only a small amount of the end of the stream is captured here. + * The entire stream is stored in the `/google/logs` directory mounted into + * each action, and can be copied off the machine as described elsewhere. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Lifesciences\V2Beta\Workflows::initOnce(); + parent::__construct($data); + } + + /** + * The numeric ID of the action that started this container. + * + * Generated from protobuf field int32 action_id = 1; + * @return int + */ + public function getActionId() + { + return $this->action_id; + } + + /** + * The numeric ID of the action that started this container. + * + * Generated from protobuf field int32 action_id = 1; + * @param int $var + * @return $this + */ + public function setActionId($var) + { + GPBUtil::checkInt32($var); + $this->action_id = $var; + + return $this; + } + + /** + * The exit status of the container. + * + * Generated from protobuf field int32 exit_status = 2; + * @return int + */ + public function getExitStatus() + { + return $this->exit_status; + } + + /** + * The exit status of the container. + * + * Generated from protobuf field int32 exit_status = 2; + * @param int $var + * @return $this + */ + public function setExitStatus($var) + { + GPBUtil::checkInt32($var); + $this->exit_status = $var; + + return $this; + } + + /** + * The tail end of any content written to standard error by the container. + * If the content emits large amounts of debugging noise or contains + * sensitive information, you can prevent the content from being printed by + * setting the `DISABLE_STANDARD_ERROR_CAPTURE` flag. + * Note that only a small amount of the end of the stream is captured here. + * The entire stream is stored in the `/google/logs` directory mounted into + * each action, and can be copied off the machine as described elsewhere. + * + * Generated from protobuf field string stderr = 3; + * @return string + */ + public function getStderr() + { + return $this->stderr; + } + + /** + * The tail end of any content written to standard error by the container. + * If the content emits large amounts of debugging noise or contains + * sensitive information, you can prevent the content from being printed by + * setting the `DISABLE_STANDARD_ERROR_CAPTURE` flag. + * Note that only a small amount of the end of the stream is captured here. + * The entire stream is stored in the `/google/logs` directory mounted into + * each action, and can be copied off the machine as described elsewhere. + * + * Generated from protobuf field string stderr = 3; + * @param string $var + * @return $this + */ + public function setStderr($var) + { + GPBUtil::checkString($var, True); + $this->stderr = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/DelayedEvent.php b/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/DelayedEvent.php new file mode 100644 index 000000000000..48021f37b2c7 --- /dev/null +++ b/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/DelayedEvent.php @@ -0,0 +1,122 @@ +google.cloud.lifesciences.v2beta.DelayedEvent + */ +class DelayedEvent extends \Google\Protobuf\Internal\Message +{ + /** + * A textual description of the cause of the delay. The string can change + * without notice because it is often generated by another service (such as + * Compute Engine). + * + * Generated from protobuf field string cause = 1; + */ + protected $cause = ''; + /** + * If the delay was caused by a resource shortage, this field lists the + * Compute Engine metrics that are preventing this operation from running + * (for example, `CPUS` or `INSTANCES`). If the particular metric is not + * known, a single `UNKNOWN` metric will be present. + * + * Generated from protobuf field repeated string metrics = 2; + */ + private $metrics; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $cause + * A textual description of the cause of the delay. The string can change + * without notice because it is often generated by another service (such as + * Compute Engine). + * @type array|\Google\Protobuf\Internal\RepeatedField $metrics + * If the delay was caused by a resource shortage, this field lists the + * Compute Engine metrics that are preventing this operation from running + * (for example, `CPUS` or `INSTANCES`). If the particular metric is not + * known, a single `UNKNOWN` metric will be present. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Lifesciences\V2Beta\Workflows::initOnce(); + parent::__construct($data); + } + + /** + * A textual description of the cause of the delay. The string can change + * without notice because it is often generated by another service (such as + * Compute Engine). + * + * Generated from protobuf field string cause = 1; + * @return string + */ + public function getCause() + { + return $this->cause; + } + + /** + * A textual description of the cause of the delay. The string can change + * without notice because it is often generated by another service (such as + * Compute Engine). + * + * Generated from protobuf field string cause = 1; + * @param string $var + * @return $this + */ + public function setCause($var) + { + GPBUtil::checkString($var, True); + $this->cause = $var; + + return $this; + } + + /** + * If the delay was caused by a resource shortage, this field lists the + * Compute Engine metrics that are preventing this operation from running + * (for example, `CPUS` or `INSTANCES`). If the particular metric is not + * known, a single `UNKNOWN` metric will be present. + * + * Generated from protobuf field repeated string metrics = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getMetrics() + { + return $this->metrics; + } + + /** + * If the delay was caused by a resource shortage, this field lists the + * Compute Engine metrics that are preventing this operation from running + * (for example, `CPUS` or `INSTANCES`). If the particular metric is not + * known, a single `UNKNOWN` metric will be present. + * + * Generated from protobuf field repeated string metrics = 2; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setMetrics($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->metrics = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/Disk.php b/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/Disk.php new file mode 100644 index 000000000000..9f92bf51df25 --- /dev/null +++ b/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/Disk.php @@ -0,0 +1,201 @@ +google.cloud.lifesciences.v2beta.Disk + */ +class Disk extends \Google\Protobuf\Internal\Message +{ + /** + * A user-supplied name for the disk. Used when mounting the disk into + * actions. The name must contain only upper and lowercase alphanumeric + * characters and hyphens and cannot start with a hyphen. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * The size, in GB, of the disk to attach. If the size is not + * specified, a default is chosen to ensure reasonable I/O performance. + * If the disk type is specified as `local-ssd`, multiple local drives are + * automatically combined to provide the requested size. Note, however, that + * each physical SSD is 375GB in size, and no more than 8 drives can be + * attached to a single instance. + * + * Generated from protobuf field int32 size_gb = 2; + */ + protected $size_gb = 0; + /** + * The Compute Engine disk type. If unspecified, `pd-standard` is used. + * + * Generated from protobuf field string type = 3; + */ + protected $type = ''; + /** + * An optional image to put on the disk before attaching it to the VM. + * + * Generated from protobuf field string source_image = 4; + */ + protected $source_image = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * A user-supplied name for the disk. Used when mounting the disk into + * actions. The name must contain only upper and lowercase alphanumeric + * characters and hyphens and cannot start with a hyphen. + * @type int $size_gb + * The size, in GB, of the disk to attach. If the size is not + * specified, a default is chosen to ensure reasonable I/O performance. + * If the disk type is specified as `local-ssd`, multiple local drives are + * automatically combined to provide the requested size. Note, however, that + * each physical SSD is 375GB in size, and no more than 8 drives can be + * attached to a single instance. + * @type string $type + * The Compute Engine disk type. If unspecified, `pd-standard` is used. + * @type string $source_image + * An optional image to put on the disk before attaching it to the VM. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Lifesciences\V2Beta\Workflows::initOnce(); + parent::__construct($data); + } + + /** + * A user-supplied name for the disk. Used when mounting the disk into + * actions. The name must contain only upper and lowercase alphanumeric + * characters and hyphens and cannot start with a hyphen. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * A user-supplied name for the disk. Used when mounting the disk into + * actions. The name must contain only upper and lowercase alphanumeric + * characters and hyphens and cannot start with a hyphen. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The size, in GB, of the disk to attach. If the size is not + * specified, a default is chosen to ensure reasonable I/O performance. + * If the disk type is specified as `local-ssd`, multiple local drives are + * automatically combined to provide the requested size. Note, however, that + * each physical SSD is 375GB in size, and no more than 8 drives can be + * attached to a single instance. + * + * Generated from protobuf field int32 size_gb = 2; + * @return int + */ + public function getSizeGb() + { + return $this->size_gb; + } + + /** + * The size, in GB, of the disk to attach. If the size is not + * specified, a default is chosen to ensure reasonable I/O performance. + * If the disk type is specified as `local-ssd`, multiple local drives are + * automatically combined to provide the requested size. Note, however, that + * each physical SSD is 375GB in size, and no more than 8 drives can be + * attached to a single instance. + * + * Generated from protobuf field int32 size_gb = 2; + * @param int $var + * @return $this + */ + public function setSizeGb($var) + { + GPBUtil::checkInt32($var); + $this->size_gb = $var; + + return $this; + } + + /** + * The Compute Engine disk type. If unspecified, `pd-standard` is used. + * + * Generated from protobuf field string type = 3; + * @return string + */ + public function getType() + { + return $this->type; + } + + /** + * The Compute Engine disk type. If unspecified, `pd-standard` is used. + * + * Generated from protobuf field string type = 3; + * @param string $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkString($var, True); + $this->type = $var; + + return $this; + } + + /** + * An optional image to put on the disk before attaching it to the VM. + * + * Generated from protobuf field string source_image = 4; + * @return string + */ + public function getSourceImage() + { + return $this->source_image; + } + + /** + * An optional image to put on the disk before attaching it to the VM. + * + * Generated from protobuf field string source_image = 4; + * @param string $var + * @return $this + */ + public function setSourceImage($var) + { + GPBUtil::checkString($var, True); + $this->source_image = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/Event.php b/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/Event.php new file mode 100644 index 000000000000..3fd47e78473f --- /dev/null +++ b/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/Event.php @@ -0,0 +1,488 @@ +google.cloud.lifesciences.v2beta.Event + */ +class Event extends \Google\Protobuf\Internal\Message +{ + /** + * The time at which the event occurred. + * + * Generated from protobuf field .google.protobuf.Timestamp timestamp = 1; + */ + protected $timestamp = null; + /** + * A human-readable description of the event. Note that these strings can + * change at any time without notice. Any application logic must use the + * information in the `details` field. + * + * Generated from protobuf field string description = 2; + */ + protected $description = ''; + protected $details; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Timestamp $timestamp + * The time at which the event occurred. + * @type string $description + * A human-readable description of the event. Note that these strings can + * change at any time without notice. Any application logic must use the + * information in the `details` field. + * @type \Google\Cloud\LifeSciences\V2beta\DelayedEvent $delayed + * See + * [google.cloud.lifesciences.v2beta.DelayedEvent][google.cloud.lifesciences.v2beta.DelayedEvent]. + * @type \Google\Cloud\LifeSciences\V2beta\WorkerAssignedEvent $worker_assigned + * See + * [google.cloud.lifesciences.v2beta.WorkerAssignedEvent][google.cloud.lifesciences.v2beta.WorkerAssignedEvent]. + * @type \Google\Cloud\LifeSciences\V2beta\WorkerReleasedEvent $worker_released + * See + * [google.cloud.lifesciences.v2beta.WorkerReleasedEvent][google.cloud.lifesciences.v2beta.WorkerReleasedEvent]. + * @type \Google\Cloud\LifeSciences\V2beta\PullStartedEvent $pull_started + * See + * [google.cloud.lifesciences.v2beta.PullStartedEvent][google.cloud.lifesciences.v2beta.PullStartedEvent]. + * @type \Google\Cloud\LifeSciences\V2beta\PullStoppedEvent $pull_stopped + * See + * [google.cloud.lifesciences.v2beta.PullStoppedEvent][google.cloud.lifesciences.v2beta.PullStoppedEvent]. + * @type \Google\Cloud\LifeSciences\V2beta\ContainerStartedEvent $container_started + * See + * [google.cloud.lifesciences.v2beta.ContainerStartedEvent][google.cloud.lifesciences.v2beta.ContainerStartedEvent]. + * @type \Google\Cloud\LifeSciences\V2beta\ContainerStoppedEvent $container_stopped + * See + * [google.cloud.lifesciences.v2beta.ContainerStoppedEvent][google.cloud.lifesciences.v2beta.ContainerStoppedEvent]. + * @type \Google\Cloud\LifeSciences\V2beta\ContainerKilledEvent $container_killed + * See + * [google.cloud.lifesciences.v2beta.ContainerKilledEvent][google.cloud.lifesciences.v2beta.ContainerKilledEvent]. + * @type \Google\Cloud\LifeSciences\V2beta\UnexpectedExitStatusEvent $unexpected_exit_status + * See + * [google.cloud.lifesciences.v2beta.UnexpectedExitStatusEvent][google.cloud.lifesciences.v2beta.UnexpectedExitStatusEvent]. + * @type \Google\Cloud\LifeSciences\V2beta\FailedEvent $failed + * See + * [google.cloud.lifesciences.v2beta.FailedEvent][google.cloud.lifesciences.v2beta.FailedEvent]. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Lifesciences\V2Beta\Workflows::initOnce(); + parent::__construct($data); + } + + /** + * The time at which the event occurred. + * + * Generated from protobuf field .google.protobuf.Timestamp timestamp = 1; + * @return \Google\Protobuf\Timestamp|null + */ + public function getTimestamp() + { + return $this->timestamp; + } + + public function hasTimestamp() + { + return isset($this->timestamp); + } + + public function clearTimestamp() + { + unset($this->timestamp); + } + + /** + * The time at which the event occurred. + * + * Generated from protobuf field .google.protobuf.Timestamp timestamp = 1; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setTimestamp($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->timestamp = $var; + + return $this; + } + + /** + * A human-readable description of the event. Note that these strings can + * change at any time without notice. Any application logic must use the + * information in the `details` field. + * + * Generated from protobuf field string description = 2; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * A human-readable description of the event. Note that these strings can + * change at any time without notice. Any application logic must use the + * information in the `details` field. + * + * Generated from protobuf field string description = 2; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * See + * [google.cloud.lifesciences.v2beta.DelayedEvent][google.cloud.lifesciences.v2beta.DelayedEvent]. + * + * Generated from protobuf field .google.cloud.lifesciences.v2beta.DelayedEvent delayed = 17; + * @return \Google\Cloud\LifeSciences\V2beta\DelayedEvent|null + */ + public function getDelayed() + { + return $this->readOneof(17); + } + + public function hasDelayed() + { + return $this->hasOneof(17); + } + + /** + * See + * [google.cloud.lifesciences.v2beta.DelayedEvent][google.cloud.lifesciences.v2beta.DelayedEvent]. + * + * Generated from protobuf field .google.cloud.lifesciences.v2beta.DelayedEvent delayed = 17; + * @param \Google\Cloud\LifeSciences\V2beta\DelayedEvent $var + * @return $this + */ + public function setDelayed($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\LifeSciences\V2beta\DelayedEvent::class); + $this->writeOneof(17, $var); + + return $this; + } + + /** + * See + * [google.cloud.lifesciences.v2beta.WorkerAssignedEvent][google.cloud.lifesciences.v2beta.WorkerAssignedEvent]. + * + * Generated from protobuf field .google.cloud.lifesciences.v2beta.WorkerAssignedEvent worker_assigned = 18; + * @return \Google\Cloud\LifeSciences\V2beta\WorkerAssignedEvent|null + */ + public function getWorkerAssigned() + { + return $this->readOneof(18); + } + + public function hasWorkerAssigned() + { + return $this->hasOneof(18); + } + + /** + * See + * [google.cloud.lifesciences.v2beta.WorkerAssignedEvent][google.cloud.lifesciences.v2beta.WorkerAssignedEvent]. + * + * Generated from protobuf field .google.cloud.lifesciences.v2beta.WorkerAssignedEvent worker_assigned = 18; + * @param \Google\Cloud\LifeSciences\V2beta\WorkerAssignedEvent $var + * @return $this + */ + public function setWorkerAssigned($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\LifeSciences\V2beta\WorkerAssignedEvent::class); + $this->writeOneof(18, $var); + + return $this; + } + + /** + * See + * [google.cloud.lifesciences.v2beta.WorkerReleasedEvent][google.cloud.lifesciences.v2beta.WorkerReleasedEvent]. + * + * Generated from protobuf field .google.cloud.lifesciences.v2beta.WorkerReleasedEvent worker_released = 19; + * @return \Google\Cloud\LifeSciences\V2beta\WorkerReleasedEvent|null + */ + public function getWorkerReleased() + { + return $this->readOneof(19); + } + + public function hasWorkerReleased() + { + return $this->hasOneof(19); + } + + /** + * See + * [google.cloud.lifesciences.v2beta.WorkerReleasedEvent][google.cloud.lifesciences.v2beta.WorkerReleasedEvent]. + * + * Generated from protobuf field .google.cloud.lifesciences.v2beta.WorkerReleasedEvent worker_released = 19; + * @param \Google\Cloud\LifeSciences\V2beta\WorkerReleasedEvent $var + * @return $this + */ + public function setWorkerReleased($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\LifeSciences\V2beta\WorkerReleasedEvent::class); + $this->writeOneof(19, $var); + + return $this; + } + + /** + * See + * [google.cloud.lifesciences.v2beta.PullStartedEvent][google.cloud.lifesciences.v2beta.PullStartedEvent]. + * + * Generated from protobuf field .google.cloud.lifesciences.v2beta.PullStartedEvent pull_started = 20; + * @return \Google\Cloud\LifeSciences\V2beta\PullStartedEvent|null + */ + public function getPullStarted() + { + return $this->readOneof(20); + } + + public function hasPullStarted() + { + return $this->hasOneof(20); + } + + /** + * See + * [google.cloud.lifesciences.v2beta.PullStartedEvent][google.cloud.lifesciences.v2beta.PullStartedEvent]. + * + * Generated from protobuf field .google.cloud.lifesciences.v2beta.PullStartedEvent pull_started = 20; + * @param \Google\Cloud\LifeSciences\V2beta\PullStartedEvent $var + * @return $this + */ + public function setPullStarted($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\LifeSciences\V2beta\PullStartedEvent::class); + $this->writeOneof(20, $var); + + return $this; + } + + /** + * See + * [google.cloud.lifesciences.v2beta.PullStoppedEvent][google.cloud.lifesciences.v2beta.PullStoppedEvent]. + * + * Generated from protobuf field .google.cloud.lifesciences.v2beta.PullStoppedEvent pull_stopped = 21; + * @return \Google\Cloud\LifeSciences\V2beta\PullStoppedEvent|null + */ + public function getPullStopped() + { + return $this->readOneof(21); + } + + public function hasPullStopped() + { + return $this->hasOneof(21); + } + + /** + * See + * [google.cloud.lifesciences.v2beta.PullStoppedEvent][google.cloud.lifesciences.v2beta.PullStoppedEvent]. + * + * Generated from protobuf field .google.cloud.lifesciences.v2beta.PullStoppedEvent pull_stopped = 21; + * @param \Google\Cloud\LifeSciences\V2beta\PullStoppedEvent $var + * @return $this + */ + public function setPullStopped($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\LifeSciences\V2beta\PullStoppedEvent::class); + $this->writeOneof(21, $var); + + return $this; + } + + /** + * See + * [google.cloud.lifesciences.v2beta.ContainerStartedEvent][google.cloud.lifesciences.v2beta.ContainerStartedEvent]. + * + * Generated from protobuf field .google.cloud.lifesciences.v2beta.ContainerStartedEvent container_started = 22; + * @return \Google\Cloud\LifeSciences\V2beta\ContainerStartedEvent|null + */ + public function getContainerStarted() + { + return $this->readOneof(22); + } + + public function hasContainerStarted() + { + return $this->hasOneof(22); + } + + /** + * See + * [google.cloud.lifesciences.v2beta.ContainerStartedEvent][google.cloud.lifesciences.v2beta.ContainerStartedEvent]. + * + * Generated from protobuf field .google.cloud.lifesciences.v2beta.ContainerStartedEvent container_started = 22; + * @param \Google\Cloud\LifeSciences\V2beta\ContainerStartedEvent $var + * @return $this + */ + public function setContainerStarted($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\LifeSciences\V2beta\ContainerStartedEvent::class); + $this->writeOneof(22, $var); + + return $this; + } + + /** + * See + * [google.cloud.lifesciences.v2beta.ContainerStoppedEvent][google.cloud.lifesciences.v2beta.ContainerStoppedEvent]. + * + * Generated from protobuf field .google.cloud.lifesciences.v2beta.ContainerStoppedEvent container_stopped = 23; + * @return \Google\Cloud\LifeSciences\V2beta\ContainerStoppedEvent|null + */ + public function getContainerStopped() + { + return $this->readOneof(23); + } + + public function hasContainerStopped() + { + return $this->hasOneof(23); + } + + /** + * See + * [google.cloud.lifesciences.v2beta.ContainerStoppedEvent][google.cloud.lifesciences.v2beta.ContainerStoppedEvent]. + * + * Generated from protobuf field .google.cloud.lifesciences.v2beta.ContainerStoppedEvent container_stopped = 23; + * @param \Google\Cloud\LifeSciences\V2beta\ContainerStoppedEvent $var + * @return $this + */ + public function setContainerStopped($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\LifeSciences\V2beta\ContainerStoppedEvent::class); + $this->writeOneof(23, $var); + + return $this; + } + + /** + * See + * [google.cloud.lifesciences.v2beta.ContainerKilledEvent][google.cloud.lifesciences.v2beta.ContainerKilledEvent]. + * + * Generated from protobuf field .google.cloud.lifesciences.v2beta.ContainerKilledEvent container_killed = 24; + * @return \Google\Cloud\LifeSciences\V2beta\ContainerKilledEvent|null + */ + public function getContainerKilled() + { + return $this->readOneof(24); + } + + public function hasContainerKilled() + { + return $this->hasOneof(24); + } + + /** + * See + * [google.cloud.lifesciences.v2beta.ContainerKilledEvent][google.cloud.lifesciences.v2beta.ContainerKilledEvent]. + * + * Generated from protobuf field .google.cloud.lifesciences.v2beta.ContainerKilledEvent container_killed = 24; + * @param \Google\Cloud\LifeSciences\V2beta\ContainerKilledEvent $var + * @return $this + */ + public function setContainerKilled($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\LifeSciences\V2beta\ContainerKilledEvent::class); + $this->writeOneof(24, $var); + + return $this; + } + + /** + * See + * [google.cloud.lifesciences.v2beta.UnexpectedExitStatusEvent][google.cloud.lifesciences.v2beta.UnexpectedExitStatusEvent]. + * + * Generated from protobuf field .google.cloud.lifesciences.v2beta.UnexpectedExitStatusEvent unexpected_exit_status = 25; + * @return \Google\Cloud\LifeSciences\V2beta\UnexpectedExitStatusEvent|null + */ + public function getUnexpectedExitStatus() + { + return $this->readOneof(25); + } + + public function hasUnexpectedExitStatus() + { + return $this->hasOneof(25); + } + + /** + * See + * [google.cloud.lifesciences.v2beta.UnexpectedExitStatusEvent][google.cloud.lifesciences.v2beta.UnexpectedExitStatusEvent]. + * + * Generated from protobuf field .google.cloud.lifesciences.v2beta.UnexpectedExitStatusEvent unexpected_exit_status = 25; + * @param \Google\Cloud\LifeSciences\V2beta\UnexpectedExitStatusEvent $var + * @return $this + */ + public function setUnexpectedExitStatus($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\LifeSciences\V2beta\UnexpectedExitStatusEvent::class); + $this->writeOneof(25, $var); + + return $this; + } + + /** + * See + * [google.cloud.lifesciences.v2beta.FailedEvent][google.cloud.lifesciences.v2beta.FailedEvent]. + * + * Generated from protobuf field .google.cloud.lifesciences.v2beta.FailedEvent failed = 26; + * @return \Google\Cloud\LifeSciences\V2beta\FailedEvent|null + */ + public function getFailed() + { + return $this->readOneof(26); + } + + public function hasFailed() + { + return $this->hasOneof(26); + } + + /** + * See + * [google.cloud.lifesciences.v2beta.FailedEvent][google.cloud.lifesciences.v2beta.FailedEvent]. + * + * Generated from protobuf field .google.cloud.lifesciences.v2beta.FailedEvent failed = 26; + * @param \Google\Cloud\LifeSciences\V2beta\FailedEvent $var + * @return $this + */ + public function setFailed($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\LifeSciences\V2beta\FailedEvent::class); + $this->writeOneof(26, $var); + + return $this; + } + + /** + * @return string + */ + public function getDetails() + { + return $this->whichOneof("details"); + } + +} + diff --git a/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/ExistingDisk.php b/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/ExistingDisk.php new file mode 100644 index 000000000000..31e65479b79b --- /dev/null +++ b/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/ExistingDisk.php @@ -0,0 +1,99 @@ +google.cloud.lifesciences.v2beta.ExistingDisk + */ +class ExistingDisk extends \Google\Protobuf\Internal\Message +{ + /** + * If `disk` contains slashes, the Cloud Life Sciences API assumes that it is + * a complete URL for the disk. If `disk` does not contain slashes, the Cloud + * Life Sciences API assumes that the disk is a zonal disk and a URL will be + * generated of the form `zones//disks/`, where `` is the + * zone in which the instance is allocated. The disk must be ext4 formatted. + * If all `Mount` references to this disk have the `read_only` flag set to + * true, the disk will be attached in `read-only` mode and can be shared with + * other instances. Otherwise, the disk will be available for writing but + * cannot be shared. + * + * Generated from protobuf field string disk = 1; + */ + protected $disk = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $disk + * If `disk` contains slashes, the Cloud Life Sciences API assumes that it is + * a complete URL for the disk. If `disk` does not contain slashes, the Cloud + * Life Sciences API assumes that the disk is a zonal disk and a URL will be + * generated of the form `zones//disks/`, where `` is the + * zone in which the instance is allocated. The disk must be ext4 formatted. + * If all `Mount` references to this disk have the `read_only` flag set to + * true, the disk will be attached in `read-only` mode and can be shared with + * other instances. Otherwise, the disk will be available for writing but + * cannot be shared. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Lifesciences\V2Beta\Workflows::initOnce(); + parent::__construct($data); + } + + /** + * If `disk` contains slashes, the Cloud Life Sciences API assumes that it is + * a complete URL for the disk. If `disk` does not contain slashes, the Cloud + * Life Sciences API assumes that the disk is a zonal disk and a URL will be + * generated of the form `zones//disks/`, where `` is the + * zone in which the instance is allocated. The disk must be ext4 formatted. + * If all `Mount` references to this disk have the `read_only` flag set to + * true, the disk will be attached in `read-only` mode and can be shared with + * other instances. Otherwise, the disk will be available for writing but + * cannot be shared. + * + * Generated from protobuf field string disk = 1; + * @return string + */ + public function getDisk() + { + return $this->disk; + } + + /** + * If `disk` contains slashes, the Cloud Life Sciences API assumes that it is + * a complete URL for the disk. If `disk` does not contain slashes, the Cloud + * Life Sciences API assumes that the disk is a zonal disk and a URL will be + * generated of the form `zones//disks/`, where `` is the + * zone in which the instance is allocated. The disk must be ext4 formatted. + * If all `Mount` references to this disk have the `read_only` flag set to + * true, the disk will be attached in `read-only` mode and can be shared with + * other instances. Otherwise, the disk will be available for writing but + * cannot be shared. + * + * Generated from protobuf field string disk = 1; + * @param string $var + * @return $this + */ + public function setDisk($var) + { + GPBUtil::checkString($var, True); + $this->disk = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/FailedEvent.php b/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/FailedEvent.php new file mode 100644 index 000000000000..c92baa2e6650 --- /dev/null +++ b/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/FailedEvent.php @@ -0,0 +1,102 @@ +google.cloud.lifesciences.v2beta.FailedEvent + */ +class FailedEvent extends \Google\Protobuf\Internal\Message +{ + /** + * The Google standard error code that best describes this failure. + * + * Generated from protobuf field .google.rpc.Code code = 1; + */ + protected $code = 0; + /** + * The human-readable description of the cause of the failure. + * + * Generated from protobuf field string cause = 2; + */ + protected $cause = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $code + * The Google standard error code that best describes this failure. + * @type string $cause + * The human-readable description of the cause of the failure. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Lifesciences\V2Beta\Workflows::initOnce(); + parent::__construct($data); + } + + /** + * The Google standard error code that best describes this failure. + * + * Generated from protobuf field .google.rpc.Code code = 1; + * @return int + */ + public function getCode() + { + return $this->code; + } + + /** + * The Google standard error code that best describes this failure. + * + * Generated from protobuf field .google.rpc.Code code = 1; + * @param int $var + * @return $this + */ + public function setCode($var) + { + GPBUtil::checkEnum($var, \Google\Rpc\Code::class); + $this->code = $var; + + return $this; + } + + /** + * The human-readable description of the cause of the failure. + * + * Generated from protobuf field string cause = 2; + * @return string + */ + public function getCause() + { + return $this->cause; + } + + /** + * The human-readable description of the cause of the failure. + * + * Generated from protobuf field string cause = 2; + * @param string $var + * @return $this + */ + public function setCause($var) + { + GPBUtil::checkString($var, True); + $this->cause = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/Metadata.php b/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/Metadata.php new file mode 100644 index 000000000000..a06a77dc22d2 --- /dev/null +++ b/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/Metadata.php @@ -0,0 +1,320 @@ +google.cloud.lifesciences.v2beta.Metadata + */ +class Metadata extends \Google\Protobuf\Internal\Message +{ + /** + * The pipeline this operation represents. + * + * Generated from protobuf field .google.cloud.lifesciences.v2beta.Pipeline pipeline = 1; + */ + protected $pipeline = null; + /** + * The user-defined labels associated with this operation. + * + * Generated from protobuf field map labels = 2; + */ + private $labels; + /** + * The list of events that have happened so far during the execution of this + * operation. + * + * Generated from protobuf field repeated .google.cloud.lifesciences.v2beta.Event events = 3; + */ + private $events; + /** + * The time at which the operation was created by the API. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 4; + */ + protected $create_time = null; + /** + * The first time at which resources were allocated to execute the pipeline. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 5; + */ + protected $start_time = null; + /** + * The time at which execution was completed and resources were cleaned up. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 6; + */ + protected $end_time = null; + /** + * The name of the Cloud Pub/Sub topic where notifications of operation status + * changes are sent. + * + * Generated from protobuf field string pub_sub_topic = 7; + */ + protected $pub_sub_topic = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\LifeSciences\V2beta\Pipeline $pipeline + * The pipeline this operation represents. + * @type array|\Google\Protobuf\Internal\MapField $labels + * The user-defined labels associated with this operation. + * @type array<\Google\Cloud\LifeSciences\V2beta\Event>|\Google\Protobuf\Internal\RepeatedField $events + * The list of events that have happened so far during the execution of this + * operation. + * @type \Google\Protobuf\Timestamp $create_time + * The time at which the operation was created by the API. + * @type \Google\Protobuf\Timestamp $start_time + * The first time at which resources were allocated to execute the pipeline. + * @type \Google\Protobuf\Timestamp $end_time + * The time at which execution was completed and resources were cleaned up. + * @type string $pub_sub_topic + * The name of the Cloud Pub/Sub topic where notifications of operation status + * changes are sent. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Lifesciences\V2Beta\Workflows::initOnce(); + parent::__construct($data); + } + + /** + * The pipeline this operation represents. + * + * Generated from protobuf field .google.cloud.lifesciences.v2beta.Pipeline pipeline = 1; + * @return \Google\Cloud\LifeSciences\V2beta\Pipeline|null + */ + public function getPipeline() + { + return $this->pipeline; + } + + public function hasPipeline() + { + return isset($this->pipeline); + } + + public function clearPipeline() + { + unset($this->pipeline); + } + + /** + * The pipeline this operation represents. + * + * Generated from protobuf field .google.cloud.lifesciences.v2beta.Pipeline pipeline = 1; + * @param \Google\Cloud\LifeSciences\V2beta\Pipeline $var + * @return $this + */ + public function setPipeline($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\LifeSciences\V2beta\Pipeline::class); + $this->pipeline = $var; + + return $this; + } + + /** + * The user-defined labels associated with this operation. + * + * Generated from protobuf field map labels = 2; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * The user-defined labels associated with this operation. + * + * Generated from protobuf field map labels = 2; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + + /** + * The list of events that have happened so far during the execution of this + * operation. + * + * Generated from protobuf field repeated .google.cloud.lifesciences.v2beta.Event events = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getEvents() + { + return $this->events; + } + + /** + * The list of events that have happened so far during the execution of this + * operation. + * + * Generated from protobuf field repeated .google.cloud.lifesciences.v2beta.Event events = 3; + * @param array<\Google\Cloud\LifeSciences\V2beta\Event>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setEvents($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\LifeSciences\V2beta\Event::class); + $this->events = $arr; + + return $this; + } + + /** + * The time at which the operation was created by the API. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 4; + * @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); + } + + /** + * The time at which the operation was created by the API. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 4; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * The first time at which resources were allocated to execute the pipeline. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 5; + * @return \Google\Protobuf\Timestamp|null + */ + public function getStartTime() + { + return $this->start_time; + } + + public function hasStartTime() + { + return isset($this->start_time); + } + + public function clearStartTime() + { + unset($this->start_time); + } + + /** + * The first time at which resources were allocated to execute the pipeline. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 5; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setStartTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->start_time = $var; + + return $this; + } + + /** + * The time at which execution was completed and resources were cleaned up. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 6; + * @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); + } + + /** + * The time at which execution was completed and resources were cleaned up. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 6; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setEndTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->end_time = $var; + + return $this; + } + + /** + * The name of the Cloud Pub/Sub topic where notifications of operation status + * changes are sent. + * + * Generated from protobuf field string pub_sub_topic = 7; + * @return string + */ + public function getPubSubTopic() + { + return $this->pub_sub_topic; + } + + /** + * The name of the Cloud Pub/Sub topic where notifications of operation status + * changes are sent. + * + * Generated from protobuf field string pub_sub_topic = 7; + * @param string $var + * @return $this + */ + public function setPubSubTopic($var) + { + GPBUtil::checkString($var, True); + $this->pub_sub_topic = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/Mount.php b/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/Mount.php new file mode 100644 index 000000000000..8832f77a319a --- /dev/null +++ b/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/Mount.php @@ -0,0 +1,135 @@ +google.cloud.lifesciences.v2beta.Mount + */ +class Mount extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the disk to mount, as specified in the resources section. + * + * Generated from protobuf field string disk = 1; + */ + protected $disk = ''; + /** + * The path to mount the disk inside the container. + * + * Generated from protobuf field string path = 2; + */ + protected $path = ''; + /** + * If true, the disk is mounted read-only inside the container. + * + * Generated from protobuf field bool read_only = 3; + */ + protected $read_only = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $disk + * The name of the disk to mount, as specified in the resources section. + * @type string $path + * The path to mount the disk inside the container. + * @type bool $read_only + * If true, the disk is mounted read-only inside the container. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Lifesciences\V2Beta\Workflows::initOnce(); + parent::__construct($data); + } + + /** + * The name of the disk to mount, as specified in the resources section. + * + * Generated from protobuf field string disk = 1; + * @return string + */ + public function getDisk() + { + return $this->disk; + } + + /** + * The name of the disk to mount, as specified in the resources section. + * + * Generated from protobuf field string disk = 1; + * @param string $var + * @return $this + */ + public function setDisk($var) + { + GPBUtil::checkString($var, True); + $this->disk = $var; + + return $this; + } + + /** + * The path to mount the disk inside the container. + * + * Generated from protobuf field string path = 2; + * @return string + */ + public function getPath() + { + return $this->path; + } + + /** + * The path to mount the disk inside the container. + * + * Generated from protobuf field string path = 2; + * @param string $var + * @return $this + */ + public function setPath($var) + { + GPBUtil::checkString($var, True); + $this->path = $var; + + return $this; + } + + /** + * If true, the disk is mounted read-only inside the container. + * + * Generated from protobuf field bool read_only = 3; + * @return bool + */ + public function getReadOnly() + { + return $this->read_only; + } + + /** + * If true, the disk is mounted read-only inside the container. + * + * Generated from protobuf field bool read_only = 3; + * @param bool $var + * @return $this + */ + public function setReadOnly($var) + { + GPBUtil::checkBool($var); + $this->read_only = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/NFSMount.php b/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/NFSMount.php new file mode 100644 index 000000000000..4c3c5cd37013 --- /dev/null +++ b/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/NFSMount.php @@ -0,0 +1,67 @@ +google.cloud.lifesciences.v2beta.NFSMount + */ +class NFSMount extends \Google\Protobuf\Internal\Message +{ + /** + * A target NFS mount. The target must be specified as `address:/mount". + * + * Generated from protobuf field string target = 1; + */ + protected $target = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $target + * A target NFS mount. The target must be specified as `address:/mount". + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Lifesciences\V2Beta\Workflows::initOnce(); + parent::__construct($data); + } + + /** + * A target NFS mount. The target must be specified as `address:/mount". + * + * Generated from protobuf field string target = 1; + * @return string + */ + public function getTarget() + { + return $this->target; + } + + /** + * A target NFS mount. The target must be specified as `address:/mount". + * + * Generated from protobuf field string target = 1; + * @param string $var + * @return $this + */ + public function setTarget($var) + { + GPBUtil::checkString($var, True); + $this->target = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/Network.php b/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/Network.php new file mode 100644 index 000000000000..e0663ecc2d38 --- /dev/null +++ b/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/Network.php @@ -0,0 +1,187 @@ +google.cloud.lifesciences.v2beta.Network + */ +class Network extends \Google\Protobuf\Internal\Message +{ + /** + * The network name to attach the VM's network interface to. The value will + * be prefixed with `global/networks/` unless it contains a `/`, in which + * case it is assumed to be a fully specified network resource URL. + * If unspecified, the global default network is used. + * + * Generated from protobuf field string network = 1; + */ + protected $network = ''; + /** + * If set to true, do not attach a public IP address to the VM. Note that + * without a public IP address, additional configuration is required to + * allow the VM to access Google services. + * See https://cloud.google.com/vpc/docs/configure-private-google-access + * for more information. + * + * Generated from protobuf field bool use_private_address = 2; + */ + protected $use_private_address = false; + /** + * If the specified network is configured for custom subnet creation, the + * name of the subnetwork to attach the instance to must be specified here. + * The value is prefixed with `regions/*/subnetworks/` unless it contains a + * `/`, in which case it is assumed to be a fully specified subnetwork + * resource URL. + * If the `*` character appears in the value, it is replaced with the region + * that the virtual machine has been allocated in. + * + * Generated from protobuf field string subnetwork = 3; + */ + protected $subnetwork = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $network + * The network name to attach the VM's network interface to. The value will + * be prefixed with `global/networks/` unless it contains a `/`, in which + * case it is assumed to be a fully specified network resource URL. + * If unspecified, the global default network is used. + * @type bool $use_private_address + * If set to true, do not attach a public IP address to the VM. Note that + * without a public IP address, additional configuration is required to + * allow the VM to access Google services. + * See https://cloud.google.com/vpc/docs/configure-private-google-access + * for more information. + * @type string $subnetwork + * If the specified network is configured for custom subnet creation, the + * name of the subnetwork to attach the instance to must be specified here. + * The value is prefixed with `regions/*/subnetworks/` unless it contains a + * `/`, in which case it is assumed to be a fully specified subnetwork + * resource URL. + * If the `*` character appears in the value, it is replaced with the region + * that the virtual machine has been allocated in. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Lifesciences\V2Beta\Workflows::initOnce(); + parent::__construct($data); + } + + /** + * The network name to attach the VM's network interface to. The value will + * be prefixed with `global/networks/` unless it contains a `/`, in which + * case it is assumed to be a fully specified network resource URL. + * If unspecified, the global default network is used. + * + * Generated from protobuf field string network = 1; + * @return string + */ + public function getNetwork() + { + return $this->network; + } + + /** + * The network name to attach the VM's network interface to. The value will + * be prefixed with `global/networks/` unless it contains a `/`, in which + * case it is assumed to be a fully specified network resource URL. + * If unspecified, the global default network is used. + * + * Generated from protobuf field string network = 1; + * @param string $var + * @return $this + */ + public function setNetwork($var) + { + GPBUtil::checkString($var, True); + $this->network = $var; + + return $this; + } + + /** + * If set to true, do not attach a public IP address to the VM. Note that + * without a public IP address, additional configuration is required to + * allow the VM to access Google services. + * See https://cloud.google.com/vpc/docs/configure-private-google-access + * for more information. + * + * Generated from protobuf field bool use_private_address = 2; + * @return bool + */ + public function getUsePrivateAddress() + { + return $this->use_private_address; + } + + /** + * If set to true, do not attach a public IP address to the VM. Note that + * without a public IP address, additional configuration is required to + * allow the VM to access Google services. + * See https://cloud.google.com/vpc/docs/configure-private-google-access + * for more information. + * + * Generated from protobuf field bool use_private_address = 2; + * @param bool $var + * @return $this + */ + public function setUsePrivateAddress($var) + { + GPBUtil::checkBool($var); + $this->use_private_address = $var; + + return $this; + } + + /** + * If the specified network is configured for custom subnet creation, the + * name of the subnetwork to attach the instance to must be specified here. + * The value is prefixed with `regions/*/subnetworks/` unless it contains a + * `/`, in which case it is assumed to be a fully specified subnetwork + * resource URL. + * If the `*` character appears in the value, it is replaced with the region + * that the virtual machine has been allocated in. + * + * Generated from protobuf field string subnetwork = 3; + * @return string + */ + public function getSubnetwork() + { + return $this->subnetwork; + } + + /** + * If the specified network is configured for custom subnet creation, the + * name of the subnetwork to attach the instance to must be specified here. + * The value is prefixed with `regions/*/subnetworks/` unless it contains a + * `/`, in which case it is assumed to be a fully specified subnetwork + * resource URL. + * If the `*` character appears in the value, it is replaced with the region + * that the virtual machine has been allocated in. + * + * Generated from protobuf field string subnetwork = 3; + * @param string $var + * @return $this + */ + public function setSubnetwork($var) + { + GPBUtil::checkString($var, True); + $this->subnetwork = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/PersistentDisk.php b/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/PersistentDisk.php new file mode 100644 index 000000000000..985feaa1b929 --- /dev/null +++ b/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/PersistentDisk.php @@ -0,0 +1,157 @@ +google.cloud.lifesciences.v2beta.PersistentDisk + */ +class PersistentDisk extends \Google\Protobuf\Internal\Message +{ + /** + * The size, in GB, of the disk to attach. If the size is not + * specified, a default is chosen to ensure reasonable I/O performance. + * If the disk type is specified as `local-ssd`, multiple local drives are + * automatically combined to provide the requested size. Note, however, that + * each physical SSD is 375GB in size, and no more than 8 drives can be + * attached to a single instance. + * + * Generated from protobuf field int32 size_gb = 1; + */ + protected $size_gb = 0; + /** + * The Compute Engine disk type. If unspecified, `pd-standard` is used. + * + * Generated from protobuf field string type = 2; + */ + protected $type = ''; + /** + * An image to put on the disk before attaching it to the VM. + * + * Generated from protobuf field string source_image = 3; + */ + protected $source_image = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $size_gb + * The size, in GB, of the disk to attach. If the size is not + * specified, a default is chosen to ensure reasonable I/O performance. + * If the disk type is specified as `local-ssd`, multiple local drives are + * automatically combined to provide the requested size. Note, however, that + * each physical SSD is 375GB in size, and no more than 8 drives can be + * attached to a single instance. + * @type string $type + * The Compute Engine disk type. If unspecified, `pd-standard` is used. + * @type string $source_image + * An image to put on the disk before attaching it to the VM. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Lifesciences\V2Beta\Workflows::initOnce(); + parent::__construct($data); + } + + /** + * The size, in GB, of the disk to attach. If the size is not + * specified, a default is chosen to ensure reasonable I/O performance. + * If the disk type is specified as `local-ssd`, multiple local drives are + * automatically combined to provide the requested size. Note, however, that + * each physical SSD is 375GB in size, and no more than 8 drives can be + * attached to a single instance. + * + * Generated from protobuf field int32 size_gb = 1; + * @return int + */ + public function getSizeGb() + { + return $this->size_gb; + } + + /** + * The size, in GB, of the disk to attach. If the size is not + * specified, a default is chosen to ensure reasonable I/O performance. + * If the disk type is specified as `local-ssd`, multiple local drives are + * automatically combined to provide the requested size. Note, however, that + * each physical SSD is 375GB in size, and no more than 8 drives can be + * attached to a single instance. + * + * Generated from protobuf field int32 size_gb = 1; + * @param int $var + * @return $this + */ + public function setSizeGb($var) + { + GPBUtil::checkInt32($var); + $this->size_gb = $var; + + return $this; + } + + /** + * The Compute Engine disk type. If unspecified, `pd-standard` is used. + * + * Generated from protobuf field string type = 2; + * @return string + */ + public function getType() + { + return $this->type; + } + + /** + * The Compute Engine disk type. If unspecified, `pd-standard` is used. + * + * Generated from protobuf field string type = 2; + * @param string $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkString($var, True); + $this->type = $var; + + return $this; + } + + /** + * An image to put on the disk before attaching it to the VM. + * + * Generated from protobuf field string source_image = 3; + * @return string + */ + public function getSourceImage() + { + return $this->source_image; + } + + /** + * An image to put on the disk before attaching it to the VM. + * + * Generated from protobuf field string source_image = 3; + * @param string $var + * @return $this + */ + public function setSourceImage($var) + { + GPBUtil::checkString($var, True); + $this->source_image = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/Pipeline.php b/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/Pipeline.php new file mode 100644 index 000000000000..6351d430b2b7 --- /dev/null +++ b/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/Pipeline.php @@ -0,0 +1,277 @@ +google.cloud.lifesciences.v2beta.Pipeline + */ +class Pipeline extends \Google\Protobuf\Internal\Message +{ + /** + * The list of actions to execute, in the order they are specified. + * + * Generated from protobuf field repeated .google.cloud.lifesciences.v2beta.Action actions = 1; + */ + private $actions; + /** + * The resources required for execution. + * + * Generated from protobuf field .google.cloud.lifesciences.v2beta.Resources resources = 2; + */ + protected $resources = null; + /** + * The environment to pass into every action. Each action can also specify + * additional environment variables but cannot delete an entry from this map + * (though they can overwrite it with a different value). + * + * Generated from protobuf field map environment = 3; + */ + private $environment; + /** + * The encrypted environment to pass into every action. Each action can also + * specify its own encrypted environment. + * The secret must decrypt to a JSON-encoded dictionary where key-value pairs + * serve as environment variable names and their values. The decoded + * environment variables can overwrite the values specified by the + * `environment` field. + * + * Generated from protobuf field .google.cloud.lifesciences.v2beta.Secret encrypted_environment = 5; + */ + protected $encrypted_environment = null; + /** + * The maximum amount of time to give the pipeline to complete. This includes + * the time spent waiting for a worker to be allocated. If the pipeline fails + * to complete before the timeout, it will be cancelled and the error code + * will be set to DEADLINE_EXCEEDED. + * If unspecified, it will default to 7 days. + * + * Generated from protobuf field .google.protobuf.Duration timeout = 4; + */ + protected $timeout = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\LifeSciences\V2beta\Action>|\Google\Protobuf\Internal\RepeatedField $actions + * The list of actions to execute, in the order they are specified. + * @type \Google\Cloud\LifeSciences\V2beta\Resources $resources + * The resources required for execution. + * @type array|\Google\Protobuf\Internal\MapField $environment + * The environment to pass into every action. Each action can also specify + * additional environment variables but cannot delete an entry from this map + * (though they can overwrite it with a different value). + * @type \Google\Cloud\LifeSciences\V2beta\Secret $encrypted_environment + * The encrypted environment to pass into every action. Each action can also + * specify its own encrypted environment. + * The secret must decrypt to a JSON-encoded dictionary where key-value pairs + * serve as environment variable names and their values. The decoded + * environment variables can overwrite the values specified by the + * `environment` field. + * @type \Google\Protobuf\Duration $timeout + * The maximum amount of time to give the pipeline to complete. This includes + * the time spent waiting for a worker to be allocated. If the pipeline fails + * to complete before the timeout, it will be cancelled and the error code + * will be set to DEADLINE_EXCEEDED. + * If unspecified, it will default to 7 days. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Lifesciences\V2Beta\Workflows::initOnce(); + parent::__construct($data); + } + + /** + * The list of actions to execute, in the order they are specified. + * + * Generated from protobuf field repeated .google.cloud.lifesciences.v2beta.Action actions = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getActions() + { + return $this->actions; + } + + /** + * The list of actions to execute, in the order they are specified. + * + * Generated from protobuf field repeated .google.cloud.lifesciences.v2beta.Action actions = 1; + * @param array<\Google\Cloud\LifeSciences\V2beta\Action>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setActions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\LifeSciences\V2beta\Action::class); + $this->actions = $arr; + + return $this; + } + + /** + * The resources required for execution. + * + * Generated from protobuf field .google.cloud.lifesciences.v2beta.Resources resources = 2; + * @return \Google\Cloud\LifeSciences\V2beta\Resources|null + */ + public function getResources() + { + return $this->resources; + } + + public function hasResources() + { + return isset($this->resources); + } + + public function clearResources() + { + unset($this->resources); + } + + /** + * The resources required for execution. + * + * Generated from protobuf field .google.cloud.lifesciences.v2beta.Resources resources = 2; + * @param \Google\Cloud\LifeSciences\V2beta\Resources $var + * @return $this + */ + public function setResources($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\LifeSciences\V2beta\Resources::class); + $this->resources = $var; + + return $this; + } + + /** + * The environment to pass into every action. Each action can also specify + * additional environment variables but cannot delete an entry from this map + * (though they can overwrite it with a different value). + * + * Generated from protobuf field map environment = 3; + * @return \Google\Protobuf\Internal\MapField + */ + public function getEnvironment() + { + return $this->environment; + } + + /** + * The environment to pass into every action. Each action can also specify + * additional environment variables but cannot delete an entry from this map + * (though they can overwrite it with a different value). + * + * Generated from protobuf field map environment = 3; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setEnvironment($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->environment = $arr; + + return $this; + } + + /** + * The encrypted environment to pass into every action. Each action can also + * specify its own encrypted environment. + * The secret must decrypt to a JSON-encoded dictionary where key-value pairs + * serve as environment variable names and their values. The decoded + * environment variables can overwrite the values specified by the + * `environment` field. + * + * Generated from protobuf field .google.cloud.lifesciences.v2beta.Secret encrypted_environment = 5; + * @return \Google\Cloud\LifeSciences\V2beta\Secret|null + */ + public function getEncryptedEnvironment() + { + return $this->encrypted_environment; + } + + public function hasEncryptedEnvironment() + { + return isset($this->encrypted_environment); + } + + public function clearEncryptedEnvironment() + { + unset($this->encrypted_environment); + } + + /** + * The encrypted environment to pass into every action. Each action can also + * specify its own encrypted environment. + * The secret must decrypt to a JSON-encoded dictionary where key-value pairs + * serve as environment variable names and their values. The decoded + * environment variables can overwrite the values specified by the + * `environment` field. + * + * Generated from protobuf field .google.cloud.lifesciences.v2beta.Secret encrypted_environment = 5; + * @param \Google\Cloud\LifeSciences\V2beta\Secret $var + * @return $this + */ + public function setEncryptedEnvironment($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\LifeSciences\V2beta\Secret::class); + $this->encrypted_environment = $var; + + return $this; + } + + /** + * The maximum amount of time to give the pipeline to complete. This includes + * the time spent waiting for a worker to be allocated. If the pipeline fails + * to complete before the timeout, it will be cancelled and the error code + * will be set to DEADLINE_EXCEEDED. + * If unspecified, it will default to 7 days. + * + * Generated from protobuf field .google.protobuf.Duration timeout = 4; + * @return \Google\Protobuf\Duration|null + */ + public function getTimeout() + { + return $this->timeout; + } + + public function hasTimeout() + { + return isset($this->timeout); + } + + public function clearTimeout() + { + unset($this->timeout); + } + + /** + * The maximum amount of time to give the pipeline to complete. This includes + * the time spent waiting for a worker to be allocated. If the pipeline fails + * to complete before the timeout, it will be cancelled and the error code + * will be set to DEADLINE_EXCEEDED. + * If unspecified, it will default to 7 days. + * + * Generated from protobuf field .google.protobuf.Duration timeout = 4; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setTimeout($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->timeout = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/PullStartedEvent.php b/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/PullStartedEvent.php new file mode 100644 index 000000000000..295409c26ba0 --- /dev/null +++ b/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/PullStartedEvent.php @@ -0,0 +1,67 @@ +google.cloud.lifesciences.v2beta.PullStartedEvent + */ +class PullStartedEvent extends \Google\Protobuf\Internal\Message +{ + /** + * The URI of the image that was pulled. + * + * Generated from protobuf field string image_uri = 1; + */ + protected $image_uri = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $image_uri + * The URI of the image that was pulled. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Lifesciences\V2Beta\Workflows::initOnce(); + parent::__construct($data); + } + + /** + * The URI of the image that was pulled. + * + * Generated from protobuf field string image_uri = 1; + * @return string + */ + public function getImageUri() + { + return $this->image_uri; + } + + /** + * The URI of the image that was pulled. + * + * Generated from protobuf field string image_uri = 1; + * @param string $var + * @return $this + */ + public function setImageUri($var) + { + GPBUtil::checkString($var, True); + $this->image_uri = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/PullStoppedEvent.php b/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/PullStoppedEvent.php new file mode 100644 index 000000000000..35ce70556057 --- /dev/null +++ b/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/PullStoppedEvent.php @@ -0,0 +1,67 @@ +google.cloud.lifesciences.v2beta.PullStoppedEvent + */ +class PullStoppedEvent extends \Google\Protobuf\Internal\Message +{ + /** + * The URI of the image that was pulled. + * + * Generated from protobuf field string image_uri = 1; + */ + protected $image_uri = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $image_uri + * The URI of the image that was pulled. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Lifesciences\V2Beta\Workflows::initOnce(); + parent::__construct($data); + } + + /** + * The URI of the image that was pulled. + * + * Generated from protobuf field string image_uri = 1; + * @return string + */ + public function getImageUri() + { + return $this->image_uri; + } + + /** + * The URI of the image that was pulled. + * + * Generated from protobuf field string image_uri = 1; + * @param string $var + * @return $this + */ + public function setImageUri($var) + { + GPBUtil::checkString($var, True); + $this->image_uri = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/Resources.php b/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/Resources.php new file mode 100644 index 000000000000..df892573ebc4 --- /dev/null +++ b/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/Resources.php @@ -0,0 +1,154 @@ +google.cloud.lifesciences.v2beta.Resources + */ +class Resources extends \Google\Protobuf\Internal\Message +{ + /** + * The list of regions allowed for VM allocation. If set, the `zones` field + * must not be set. + * + * Generated from protobuf field repeated string regions = 2; + */ + private $regions; + /** + * The list of zones allowed for VM allocation. If set, the `regions` field + * must not be set. + * + * Generated from protobuf field repeated string zones = 3; + */ + private $zones; + /** + * The virtual machine specification. + * + * Generated from protobuf field .google.cloud.lifesciences.v2beta.VirtualMachine virtual_machine = 4; + */ + protected $virtual_machine = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $regions + * The list of regions allowed for VM allocation. If set, the `zones` field + * must not be set. + * @type array|\Google\Protobuf\Internal\RepeatedField $zones + * The list of zones allowed for VM allocation. If set, the `regions` field + * must not be set. + * @type \Google\Cloud\LifeSciences\V2beta\VirtualMachine $virtual_machine + * The virtual machine specification. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Lifesciences\V2Beta\Workflows::initOnce(); + parent::__construct($data); + } + + /** + * The list of regions allowed for VM allocation. If set, the `zones` field + * must not be set. + * + * Generated from protobuf field repeated string regions = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRegions() + { + return $this->regions; + } + + /** + * The list of regions allowed for VM allocation. If set, the `zones` field + * must not be set. + * + * Generated from protobuf field repeated string regions = 2; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRegions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->regions = $arr; + + return $this; + } + + /** + * The list of zones allowed for VM allocation. If set, the `regions` field + * must not be set. + * + * Generated from protobuf field repeated string zones = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getZones() + { + return $this->zones; + } + + /** + * The list of zones allowed for VM allocation. If set, the `regions` field + * must not be set. + * + * Generated from protobuf field repeated string zones = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setZones($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->zones = $arr; + + return $this; + } + + /** + * The virtual machine specification. + * + * Generated from protobuf field .google.cloud.lifesciences.v2beta.VirtualMachine virtual_machine = 4; + * @return \Google\Cloud\LifeSciences\V2beta\VirtualMachine|null + */ + public function getVirtualMachine() + { + return $this->virtual_machine; + } + + public function hasVirtualMachine() + { + return isset($this->virtual_machine); + } + + public function clearVirtualMachine() + { + unset($this->virtual_machine); + } + + /** + * The virtual machine specification. + * + * Generated from protobuf field .google.cloud.lifesciences.v2beta.VirtualMachine virtual_machine = 4; + * @param \Google\Cloud\LifeSciences\V2beta\VirtualMachine $var + * @return $this + */ + public function setVirtualMachine($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\LifeSciences\V2beta\VirtualMachine::class); + $this->virtual_machine = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/RunPipelineRequest.php b/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/RunPipelineRequest.php new file mode 100644 index 000000000000..3d7634c4f03e --- /dev/null +++ b/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/RunPipelineRequest.php @@ -0,0 +1,209 @@ +google.cloud.lifesciences.v2beta.RunPipelineRequest + */ +class RunPipelineRequest extends \Google\Protobuf\Internal\Message +{ + /** + * The project and location that this request should be executed against. + * + * Generated from protobuf field string parent = 4; + */ + protected $parent = ''; + /** + * Required. The description of the pipeline to run. + * + * Generated from protobuf field .google.cloud.lifesciences.v2beta.Pipeline pipeline = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $pipeline = null; + /** + * User-defined labels to associate with the returned operation. These + * labels are not propagated to any Google Cloud Platform resources used by + * the operation, and can be modified at any time. + * To associate labels with resources created while executing the operation, + * see the appropriate resource message (for example, `VirtualMachine`). + * + * Generated from protobuf field map labels = 2; + */ + private $labels; + /** + * The name of an existing Pub/Sub topic. The server will publish + * messages to this topic whenever the status of the operation changes. + * The Life Sciences Service Agent account must have publisher permissions to + * the specified topic or notifications will not be sent. + * + * Generated from protobuf field string pub_sub_topic = 3; + */ + protected $pub_sub_topic = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * The project and location that this request should be executed against. + * @type \Google\Cloud\LifeSciences\V2beta\Pipeline $pipeline + * Required. The description of the pipeline to run. + * @type array|\Google\Protobuf\Internal\MapField $labels + * User-defined labels to associate with the returned operation. These + * labels are not propagated to any Google Cloud Platform resources used by + * the operation, and can be modified at any time. + * To associate labels with resources created while executing the operation, + * see the appropriate resource message (for example, `VirtualMachine`). + * @type string $pub_sub_topic + * The name of an existing Pub/Sub topic. The server will publish + * messages to this topic whenever the status of the operation changes. + * The Life Sciences Service Agent account must have publisher permissions to + * the specified topic or notifications will not be sent. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Lifesciences\V2Beta\Workflows::initOnce(); + parent::__construct($data); + } + + /** + * The project and location that this request should be executed against. + * + * Generated from protobuf field string parent = 4; + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * The project and location that this request should be executed against. + * + * Generated from protobuf field string parent = 4; + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The description of the pipeline to run. + * + * Generated from protobuf field .google.cloud.lifesciences.v2beta.Pipeline pipeline = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\LifeSciences\V2beta\Pipeline|null + */ + public function getPipeline() + { + return $this->pipeline; + } + + public function hasPipeline() + { + return isset($this->pipeline); + } + + public function clearPipeline() + { + unset($this->pipeline); + } + + /** + * Required. The description of the pipeline to run. + * + * Generated from protobuf field .google.cloud.lifesciences.v2beta.Pipeline pipeline = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\LifeSciences\V2beta\Pipeline $var + * @return $this + */ + public function setPipeline($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\LifeSciences\V2beta\Pipeline::class); + $this->pipeline = $var; + + return $this; + } + + /** + * User-defined labels to associate with the returned operation. These + * labels are not propagated to any Google Cloud Platform resources used by + * the operation, and can be modified at any time. + * To associate labels with resources created while executing the operation, + * see the appropriate resource message (for example, `VirtualMachine`). + * + * Generated from protobuf field map labels = 2; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * User-defined labels to associate with the returned operation. These + * labels are not propagated to any Google Cloud Platform resources used by + * the operation, and can be modified at any time. + * To associate labels with resources created while executing the operation, + * see the appropriate resource message (for example, `VirtualMachine`). + * + * Generated from protobuf field map labels = 2; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + + /** + * The name of an existing Pub/Sub topic. The server will publish + * messages to this topic whenever the status of the operation changes. + * The Life Sciences Service Agent account must have publisher permissions to + * the specified topic or notifications will not be sent. + * + * Generated from protobuf field string pub_sub_topic = 3; + * @return string + */ + public function getPubSubTopic() + { + return $this->pub_sub_topic; + } + + /** + * The name of an existing Pub/Sub topic. The server will publish + * messages to this topic whenever the status of the operation changes. + * The Life Sciences Service Agent account must have publisher permissions to + * the specified topic or notifications will not be sent. + * + * Generated from protobuf field string pub_sub_topic = 3; + * @param string $var + * @return $this + */ + public function setPubSubTopic($var) + { + GPBUtil::checkString($var, True); + $this->pub_sub_topic = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/RunPipelineResponse.php b/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/RunPipelineResponse.php new file mode 100644 index 000000000000..a7f338e16cb7 --- /dev/null +++ b/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/RunPipelineResponse.php @@ -0,0 +1,34 @@ +google.cloud.lifesciences.v2beta.RunPipelineResponse + */ +class RunPipelineResponse extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Lifesciences\V2Beta\Workflows::initOnce(); + parent::__construct($data); + } + +} + diff --git a/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/Secret.php b/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/Secret.php new file mode 100644 index 000000000000..8e7db4eeb4bc --- /dev/null +++ b/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/Secret.php @@ -0,0 +1,114 @@ +google.cloud.lifesciences.v2beta.Secret + */ +class Secret extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the Cloud KMS key that will be used to decrypt the secret + * value. The VM service account must have the required permissions and + * authentication scopes to invoke the `decrypt` method on the specified key. + * + * Generated from protobuf field string key_name = 1; + */ + protected $key_name = ''; + /** + * The value of the cipherText response from the `encrypt` method. This field + * is intentionally unaudited. + * + * Generated from protobuf field string cipher_text = 2; + */ + protected $cipher_text = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $key_name + * The name of the Cloud KMS key that will be used to decrypt the secret + * value. The VM service account must have the required permissions and + * authentication scopes to invoke the `decrypt` method on the specified key. + * @type string $cipher_text + * The value of the cipherText response from the `encrypt` method. This field + * is intentionally unaudited. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Lifesciences\V2Beta\Workflows::initOnce(); + parent::__construct($data); + } + + /** + * The name of the Cloud KMS key that will be used to decrypt the secret + * value. The VM service account must have the required permissions and + * authentication scopes to invoke the `decrypt` method on the specified key. + * + * Generated from protobuf field string key_name = 1; + * @return string + */ + public function getKeyName() + { + return $this->key_name; + } + + /** + * The name of the Cloud KMS key that will be used to decrypt the secret + * value. The VM service account must have the required permissions and + * authentication scopes to invoke the `decrypt` method on the specified key. + * + * Generated from protobuf field string key_name = 1; + * @param string $var + * @return $this + */ + public function setKeyName($var) + { + GPBUtil::checkString($var, True); + $this->key_name = $var; + + return $this; + } + + /** + * The value of the cipherText response from the `encrypt` method. This field + * is intentionally unaudited. + * + * Generated from protobuf field string cipher_text = 2; + * @return string + */ + public function getCipherText() + { + return $this->cipher_text; + } + + /** + * The value of the cipherText response from the `encrypt` method. This field + * is intentionally unaudited. + * + * Generated from protobuf field string cipher_text = 2; + * @param string $var + * @return $this + */ + public function setCipherText($var) + { + GPBUtil::checkString($var, True); + $this->cipher_text = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/ServiceAccount.php b/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/ServiceAccount.php new file mode 100644 index 000000000000..cbe399edea64 --- /dev/null +++ b/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/ServiceAccount.php @@ -0,0 +1,109 @@ +google.cloud.lifesciences.v2beta.ServiceAccount + */ +class ServiceAccount extends \Google\Protobuf\Internal\Message +{ + /** + * Email address of the service account. If not specified, the default + * Compute Engine service account for the project will be used. + * + * Generated from protobuf field string email = 1; + */ + protected $email = ''; + /** + * List of scopes to be enabled for this service account on the VM, in + * addition to the cloud-platform API scope that will be added by default. + * + * Generated from protobuf field repeated string scopes = 2; + */ + private $scopes; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $email + * Email address of the service account. If not specified, the default + * Compute Engine service account for the project will be used. + * @type array|\Google\Protobuf\Internal\RepeatedField $scopes + * List of scopes to be enabled for this service account on the VM, in + * addition to the cloud-platform API scope that will be added by default. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Lifesciences\V2Beta\Workflows::initOnce(); + parent::__construct($data); + } + + /** + * Email address of the service account. If not specified, the default + * Compute Engine service account for the project will be used. + * + * Generated from protobuf field string email = 1; + * @return string + */ + public function getEmail() + { + return $this->email; + } + + /** + * Email address of the service account. If not specified, the default + * Compute Engine service account for the project will be used. + * + * Generated from protobuf field string email = 1; + * @param string $var + * @return $this + */ + public function setEmail($var) + { + GPBUtil::checkString($var, True); + $this->email = $var; + + return $this; + } + + /** + * List of scopes to be enabled for this service account on the VM, in + * addition to the cloud-platform API scope that will be added by default. + * + * Generated from protobuf field repeated string scopes = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getScopes() + { + return $this->scopes; + } + + /** + * List of scopes to be enabled for this service account on the VM, in + * addition to the cloud-platform API scope that will be added by default. + * + * Generated from protobuf field repeated string scopes = 2; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setScopes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->scopes = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/UnexpectedExitStatusEvent.php b/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/UnexpectedExitStatusEvent.php new file mode 100644 index 000000000000..a2e5307b0de0 --- /dev/null +++ b/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/UnexpectedExitStatusEvent.php @@ -0,0 +1,104 @@ +google.cloud.lifesciences.v2beta.UnexpectedExitStatusEvent + */ +class UnexpectedExitStatusEvent extends \Google\Protobuf\Internal\Message +{ + /** + * The numeric ID of the action that started the container. + * + * Generated from protobuf field int32 action_id = 1; + */ + protected $action_id = 0; + /** + * The exit status of the container. + * + * Generated from protobuf field int32 exit_status = 2; + */ + protected $exit_status = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $action_id + * The numeric ID of the action that started the container. + * @type int $exit_status + * The exit status of the container. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Lifesciences\V2Beta\Workflows::initOnce(); + parent::__construct($data); + } + + /** + * The numeric ID of the action that started the container. + * + * Generated from protobuf field int32 action_id = 1; + * @return int + */ + public function getActionId() + { + return $this->action_id; + } + + /** + * The numeric ID of the action that started the container. + * + * Generated from protobuf field int32 action_id = 1; + * @param int $var + * @return $this + */ + public function setActionId($var) + { + GPBUtil::checkInt32($var); + $this->action_id = $var; + + return $this; + } + + /** + * The exit status of the container. + * + * Generated from protobuf field int32 exit_status = 2; + * @return int + */ + public function getExitStatus() + { + return $this->exit_status; + } + + /** + * The exit status of the container. + * + * Generated from protobuf field int32 exit_status = 2; + * @param int $var + * @return $this + */ + public function setExitStatus($var) + { + GPBUtil::checkInt32($var); + $this->exit_status = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/VirtualMachine.php b/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/VirtualMachine.php new file mode 100644 index 000000000000..5b9fa04cfbb4 --- /dev/null +++ b/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/VirtualMachine.php @@ -0,0 +1,744 @@ +google.cloud.lifesciences.v2beta.VirtualMachine + */ +class VirtualMachine extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The machine type of the virtual machine to create. Must be the + * short name of a standard machine type (such as "n1-standard-1") or a custom + * machine type (such as "custom-1-4096", where "1" indicates the number of + * vCPUs and "4096" indicates the memory in MB). See [Creating an instance + * with a custom machine + * type](https://cloud.google.com/compute/docs/instances/creating-instance-with-custom-machine-type#create) + * for more specifications on creating a custom machine type. + * + * Generated from protobuf field string machine_type = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $machine_type = ''; + /** + * If true, allocate a preemptible VM. + * + * Generated from protobuf field bool preemptible = 2; + */ + protected $preemptible = false; + /** + * Optional set of labels to apply to the VM and any attached disk resources. + * These labels must adhere to the [name and value + * restrictions](https://cloud.google.com/compute/docs/labeling-resources) on + * VM labels imposed by Compute Engine. + * Labels keys with the prefix 'google-' are reserved for use by Google. + * Labels applied at creation time to the VM. Applied on a best-effort basis + * to attached disk resources shortly after VM creation. + * + * Generated from protobuf field map labels = 3; + */ + private $labels; + /** + * The list of disks to create and attach to the VM. + * Specify either the `volumes[]` field or the `disks[]` field, but not both. + * + * Generated from protobuf field repeated .google.cloud.lifesciences.v2beta.Disk disks = 4; + */ + private $disks; + /** + * The VM network configuration. + * + * Generated from protobuf field .google.cloud.lifesciences.v2beta.Network network = 5; + */ + protected $network = null; + /** + * The list of accelerators to attach to the VM. + * + * Generated from protobuf field repeated .google.cloud.lifesciences.v2beta.Accelerator accelerators = 6; + */ + private $accelerators; + /** + * The service account to install on the VM. This account does not need + * any permissions other than those required by the pipeline. + * + * Generated from protobuf field .google.cloud.lifesciences.v2beta.ServiceAccount service_account = 7; + */ + protected $service_account = null; + /** + * The size of the boot disk, in GB. The boot disk must be large + * enough to accommodate all of the Docker images from each action in the + * pipeline at the same time. If not specified, a small but reasonable + * default value is used. + * + * Generated from protobuf field int32 boot_disk_size_gb = 8; + */ + protected $boot_disk_size_gb = 0; + /** + * The CPU platform to request. An instance based on a newer platform can be + * allocated, but never one with fewer capabilities. The value of this + * parameter must be a valid Compute Engine CPU platform name (such as "Intel + * Skylake"). This parameter is only useful for carefully optimized work + * loads where the CPU platform has a significant impact. + * For more information about the effect of this parameter, see + * https://cloud.google.com/compute/docs/instances/specify-min-cpu-platform. + * + * Generated from protobuf field string cpu_platform = 9; + */ + protected $cpu_platform = ''; + /** + * The host operating system image to use. + * Currently, only Container-Optimized OS images can be used. + * The default value is `projects/cos-cloud/global/images/family/cos-stable`, + * which selects the latest stable release of Container-Optimized OS. + * This option is provided to allow testing against the beta release of the + * operating system to ensure that the new version does not interact + * negatively with production pipelines. + * To test a pipeline against the beta release of Container-Optimized OS, + * use the value `projects/cos-cloud/global/images/family/cos-beta`. + * + * Generated from protobuf field string boot_image = 10; + */ + protected $boot_image = ''; + /** + * The NVIDIA driver version to use when attaching an NVIDIA GPU accelerator. + * The version specified here must be compatible with the GPU libraries + * contained in the container being executed, and must be one of the drivers + * hosted in the `nvidia-drivers-us-public` bucket on Google Cloud Storage. + * + * Generated from protobuf field string nvidia_driver_version = 11 [deprecated = true]; + * @deprecated + */ + protected $nvidia_driver_version = ''; + /** + * Whether Stackdriver monitoring should be enabled on the VM. + * + * Generated from protobuf field bool enable_stackdriver_monitoring = 12; + */ + protected $enable_stackdriver_monitoring = false; + /** + * The Compute Engine Disk Images to use as a Docker cache. The disks will be + * mounted into the Docker folder in a way that the images present in the + * cache will not need to be pulled. The digests of the cached images must + * match those of the tags used or the latest version will still be pulled. + * The root directory of the ext4 image must contain `image` and `overlay2` + * directories copied from the Docker directory of a VM where the desired + * Docker images have already been pulled. Any images pulled that are not + * cached will be stored on the first cache disk instead of the boot disk. + * Only a single image is supported. + * + * Generated from protobuf field repeated string docker_cache_images = 13; + */ + private $docker_cache_images; + /** + * The list of disks and other storage to create or attach to the VM. + * Specify either the `volumes[]` field or the `disks[]` field, but not both. + * + * Generated from protobuf field repeated .google.cloud.lifesciences.v2beta.Volume volumes = 14; + */ + private $volumes; + /** + * If specified, the VM will only be allocated inside the matching + * reservation. It will fail if the VM parameters don't match the reservation. + * + * Generated from protobuf field string reservation = 15; + */ + protected $reservation = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $machine_type + * Required. The machine type of the virtual machine to create. Must be the + * short name of a standard machine type (such as "n1-standard-1") or a custom + * machine type (such as "custom-1-4096", where "1" indicates the number of + * vCPUs and "4096" indicates the memory in MB). See [Creating an instance + * with a custom machine + * type](https://cloud.google.com/compute/docs/instances/creating-instance-with-custom-machine-type#create) + * for more specifications on creating a custom machine type. + * @type bool $preemptible + * If true, allocate a preemptible VM. + * @type array|\Google\Protobuf\Internal\MapField $labels + * Optional set of labels to apply to the VM and any attached disk resources. + * These labels must adhere to the [name and value + * restrictions](https://cloud.google.com/compute/docs/labeling-resources) on + * VM labels imposed by Compute Engine. + * Labels keys with the prefix 'google-' are reserved for use by Google. + * Labels applied at creation time to the VM. Applied on a best-effort basis + * to attached disk resources shortly after VM creation. + * @type array<\Google\Cloud\LifeSciences\V2beta\Disk>|\Google\Protobuf\Internal\RepeatedField $disks + * The list of disks to create and attach to the VM. + * Specify either the `volumes[]` field or the `disks[]` field, but not both. + * @type \Google\Cloud\LifeSciences\V2beta\Network $network + * The VM network configuration. + * @type array<\Google\Cloud\LifeSciences\V2beta\Accelerator>|\Google\Protobuf\Internal\RepeatedField $accelerators + * The list of accelerators to attach to the VM. + * @type \Google\Cloud\LifeSciences\V2beta\ServiceAccount $service_account + * The service account to install on the VM. This account does not need + * any permissions other than those required by the pipeline. + * @type int $boot_disk_size_gb + * The size of the boot disk, in GB. The boot disk must be large + * enough to accommodate all of the Docker images from each action in the + * pipeline at the same time. If not specified, a small but reasonable + * default value is used. + * @type string $cpu_platform + * The CPU platform to request. An instance based on a newer platform can be + * allocated, but never one with fewer capabilities. The value of this + * parameter must be a valid Compute Engine CPU platform name (such as "Intel + * Skylake"). This parameter is only useful for carefully optimized work + * loads where the CPU platform has a significant impact. + * For more information about the effect of this parameter, see + * https://cloud.google.com/compute/docs/instances/specify-min-cpu-platform. + * @type string $boot_image + * The host operating system image to use. + * Currently, only Container-Optimized OS images can be used. + * The default value is `projects/cos-cloud/global/images/family/cos-stable`, + * which selects the latest stable release of Container-Optimized OS. + * This option is provided to allow testing against the beta release of the + * operating system to ensure that the new version does not interact + * negatively with production pipelines. + * To test a pipeline against the beta release of Container-Optimized OS, + * use the value `projects/cos-cloud/global/images/family/cos-beta`. + * @type string $nvidia_driver_version + * The NVIDIA driver version to use when attaching an NVIDIA GPU accelerator. + * The version specified here must be compatible with the GPU libraries + * contained in the container being executed, and must be one of the drivers + * hosted in the `nvidia-drivers-us-public` bucket on Google Cloud Storage. + * @type bool $enable_stackdriver_monitoring + * Whether Stackdriver monitoring should be enabled on the VM. + * @type array|\Google\Protobuf\Internal\RepeatedField $docker_cache_images + * The Compute Engine Disk Images to use as a Docker cache. The disks will be + * mounted into the Docker folder in a way that the images present in the + * cache will not need to be pulled. The digests of the cached images must + * match those of the tags used or the latest version will still be pulled. + * The root directory of the ext4 image must contain `image` and `overlay2` + * directories copied from the Docker directory of a VM where the desired + * Docker images have already been pulled. Any images pulled that are not + * cached will be stored on the first cache disk instead of the boot disk. + * Only a single image is supported. + * @type array<\Google\Cloud\LifeSciences\V2beta\Volume>|\Google\Protobuf\Internal\RepeatedField $volumes + * The list of disks and other storage to create or attach to the VM. + * Specify either the `volumes[]` field or the `disks[]` field, but not both. + * @type string $reservation + * If specified, the VM will only be allocated inside the matching + * reservation. It will fail if the VM parameters don't match the reservation. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Lifesciences\V2Beta\Workflows::initOnce(); + parent::__construct($data); + } + + /** + * Required. The machine type of the virtual machine to create. Must be the + * short name of a standard machine type (such as "n1-standard-1") or a custom + * machine type (such as "custom-1-4096", where "1" indicates the number of + * vCPUs and "4096" indicates the memory in MB). See [Creating an instance + * with a custom machine + * type](https://cloud.google.com/compute/docs/instances/creating-instance-with-custom-machine-type#create) + * for more specifications on creating a custom machine type. + * + * Generated from protobuf field string machine_type = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getMachineType() + { + return $this->machine_type; + } + + /** + * Required. The machine type of the virtual machine to create. Must be the + * short name of a standard machine type (such as "n1-standard-1") or a custom + * machine type (such as "custom-1-4096", where "1" indicates the number of + * vCPUs and "4096" indicates the memory in MB). See [Creating an instance + * with a custom machine + * type](https://cloud.google.com/compute/docs/instances/creating-instance-with-custom-machine-type#create) + * for more specifications on creating a custom machine type. + * + * Generated from protobuf field string machine_type = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setMachineType($var) + { + GPBUtil::checkString($var, True); + $this->machine_type = $var; + + return $this; + } + + /** + * If true, allocate a preemptible VM. + * + * Generated from protobuf field bool preemptible = 2; + * @return bool + */ + public function getPreemptible() + { + return $this->preemptible; + } + + /** + * If true, allocate a preemptible VM. + * + * Generated from protobuf field bool preemptible = 2; + * @param bool $var + * @return $this + */ + public function setPreemptible($var) + { + GPBUtil::checkBool($var); + $this->preemptible = $var; + + return $this; + } + + /** + * Optional set of labels to apply to the VM and any attached disk resources. + * These labels must adhere to the [name and value + * restrictions](https://cloud.google.com/compute/docs/labeling-resources) on + * VM labels imposed by Compute Engine. + * Labels keys with the prefix 'google-' are reserved for use by Google. + * Labels applied at creation time to the VM. Applied on a best-effort basis + * to attached disk resources shortly after VM creation. + * + * Generated from protobuf field map labels = 3; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * Optional set of labels to apply to the VM and any attached disk resources. + * These labels must adhere to the [name and value + * restrictions](https://cloud.google.com/compute/docs/labeling-resources) on + * VM labels imposed by Compute Engine. + * Labels keys with the prefix 'google-' are reserved for use by Google. + * Labels applied at creation time to the VM. Applied on a best-effort basis + * to attached disk resources shortly after VM creation. + * + * Generated from protobuf field map labels = 3; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + + /** + * The list of disks to create and attach to the VM. + * Specify either the `volumes[]` field or the `disks[]` field, but not both. + * + * Generated from protobuf field repeated .google.cloud.lifesciences.v2beta.Disk disks = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDisks() + { + return $this->disks; + } + + /** + * The list of disks to create and attach to the VM. + * Specify either the `volumes[]` field or the `disks[]` field, but not both. + * + * Generated from protobuf field repeated .google.cloud.lifesciences.v2beta.Disk disks = 4; + * @param array<\Google\Cloud\LifeSciences\V2beta\Disk>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDisks($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\LifeSciences\V2beta\Disk::class); + $this->disks = $arr; + + return $this; + } + + /** + * The VM network configuration. + * + * Generated from protobuf field .google.cloud.lifesciences.v2beta.Network network = 5; + * @return \Google\Cloud\LifeSciences\V2beta\Network|null + */ + public function getNetwork() + { + return $this->network; + } + + public function hasNetwork() + { + return isset($this->network); + } + + public function clearNetwork() + { + unset($this->network); + } + + /** + * The VM network configuration. + * + * Generated from protobuf field .google.cloud.lifesciences.v2beta.Network network = 5; + * @param \Google\Cloud\LifeSciences\V2beta\Network $var + * @return $this + */ + public function setNetwork($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\LifeSciences\V2beta\Network::class); + $this->network = $var; + + return $this; + } + + /** + * The list of accelerators to attach to the VM. + * + * Generated from protobuf field repeated .google.cloud.lifesciences.v2beta.Accelerator accelerators = 6; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAccelerators() + { + return $this->accelerators; + } + + /** + * The list of accelerators to attach to the VM. + * + * Generated from protobuf field repeated .google.cloud.lifesciences.v2beta.Accelerator accelerators = 6; + * @param array<\Google\Cloud\LifeSciences\V2beta\Accelerator>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAccelerators($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\LifeSciences\V2beta\Accelerator::class); + $this->accelerators = $arr; + + return $this; + } + + /** + * The service account to install on the VM. This account does not need + * any permissions other than those required by the pipeline. + * + * Generated from protobuf field .google.cloud.lifesciences.v2beta.ServiceAccount service_account = 7; + * @return \Google\Cloud\LifeSciences\V2beta\ServiceAccount|null + */ + public function getServiceAccount() + { + return $this->service_account; + } + + public function hasServiceAccount() + { + return isset($this->service_account); + } + + public function clearServiceAccount() + { + unset($this->service_account); + } + + /** + * The service account to install on the VM. This account does not need + * any permissions other than those required by the pipeline. + * + * Generated from protobuf field .google.cloud.lifesciences.v2beta.ServiceAccount service_account = 7; + * @param \Google\Cloud\LifeSciences\V2beta\ServiceAccount $var + * @return $this + */ + public function setServiceAccount($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\LifeSciences\V2beta\ServiceAccount::class); + $this->service_account = $var; + + return $this; + } + + /** + * The size of the boot disk, in GB. The boot disk must be large + * enough to accommodate all of the Docker images from each action in the + * pipeline at the same time. If not specified, a small but reasonable + * default value is used. + * + * Generated from protobuf field int32 boot_disk_size_gb = 8; + * @return int + */ + public function getBootDiskSizeGb() + { + return $this->boot_disk_size_gb; + } + + /** + * The size of the boot disk, in GB. The boot disk must be large + * enough to accommodate all of the Docker images from each action in the + * pipeline at the same time. If not specified, a small but reasonable + * default value is used. + * + * Generated from protobuf field int32 boot_disk_size_gb = 8; + * @param int $var + * @return $this + */ + public function setBootDiskSizeGb($var) + { + GPBUtil::checkInt32($var); + $this->boot_disk_size_gb = $var; + + return $this; + } + + /** + * The CPU platform to request. An instance based on a newer platform can be + * allocated, but never one with fewer capabilities. The value of this + * parameter must be a valid Compute Engine CPU platform name (such as "Intel + * Skylake"). This parameter is only useful for carefully optimized work + * loads where the CPU platform has a significant impact. + * For more information about the effect of this parameter, see + * https://cloud.google.com/compute/docs/instances/specify-min-cpu-platform. + * + * Generated from protobuf field string cpu_platform = 9; + * @return string + */ + public function getCpuPlatform() + { + return $this->cpu_platform; + } + + /** + * The CPU platform to request. An instance based on a newer platform can be + * allocated, but never one with fewer capabilities. The value of this + * parameter must be a valid Compute Engine CPU platform name (such as "Intel + * Skylake"). This parameter is only useful for carefully optimized work + * loads where the CPU platform has a significant impact. + * For more information about the effect of this parameter, see + * https://cloud.google.com/compute/docs/instances/specify-min-cpu-platform. + * + * Generated from protobuf field string cpu_platform = 9; + * @param string $var + * @return $this + */ + public function setCpuPlatform($var) + { + GPBUtil::checkString($var, True); + $this->cpu_platform = $var; + + return $this; + } + + /** + * The host operating system image to use. + * Currently, only Container-Optimized OS images can be used. + * The default value is `projects/cos-cloud/global/images/family/cos-stable`, + * which selects the latest stable release of Container-Optimized OS. + * This option is provided to allow testing against the beta release of the + * operating system to ensure that the new version does not interact + * negatively with production pipelines. + * To test a pipeline against the beta release of Container-Optimized OS, + * use the value `projects/cos-cloud/global/images/family/cos-beta`. + * + * Generated from protobuf field string boot_image = 10; + * @return string + */ + public function getBootImage() + { + return $this->boot_image; + } + + /** + * The host operating system image to use. + * Currently, only Container-Optimized OS images can be used. + * The default value is `projects/cos-cloud/global/images/family/cos-stable`, + * which selects the latest stable release of Container-Optimized OS. + * This option is provided to allow testing against the beta release of the + * operating system to ensure that the new version does not interact + * negatively with production pipelines. + * To test a pipeline against the beta release of Container-Optimized OS, + * use the value `projects/cos-cloud/global/images/family/cos-beta`. + * + * Generated from protobuf field string boot_image = 10; + * @param string $var + * @return $this + */ + public function setBootImage($var) + { + GPBUtil::checkString($var, True); + $this->boot_image = $var; + + return $this; + } + + /** + * The NVIDIA driver version to use when attaching an NVIDIA GPU accelerator. + * The version specified here must be compatible with the GPU libraries + * contained in the container being executed, and must be one of the drivers + * hosted in the `nvidia-drivers-us-public` bucket on Google Cloud Storage. + * + * Generated from protobuf field string nvidia_driver_version = 11 [deprecated = true]; + * @return string + * @deprecated + */ + public function getNvidiaDriverVersion() + { + @trigger_error('nvidia_driver_version is deprecated.', E_USER_DEPRECATED); + return $this->nvidia_driver_version; + } + + /** + * The NVIDIA driver version to use when attaching an NVIDIA GPU accelerator. + * The version specified here must be compatible with the GPU libraries + * contained in the container being executed, and must be one of the drivers + * hosted in the `nvidia-drivers-us-public` bucket on Google Cloud Storage. + * + * Generated from protobuf field string nvidia_driver_version = 11 [deprecated = true]; + * @param string $var + * @return $this + * @deprecated + */ + public function setNvidiaDriverVersion($var) + { + @trigger_error('nvidia_driver_version is deprecated.', E_USER_DEPRECATED); + GPBUtil::checkString($var, True); + $this->nvidia_driver_version = $var; + + return $this; + } + + /** + * Whether Stackdriver monitoring should be enabled on the VM. + * + * Generated from protobuf field bool enable_stackdriver_monitoring = 12; + * @return bool + */ + public function getEnableStackdriverMonitoring() + { + return $this->enable_stackdriver_monitoring; + } + + /** + * Whether Stackdriver monitoring should be enabled on the VM. + * + * Generated from protobuf field bool enable_stackdriver_monitoring = 12; + * @param bool $var + * @return $this + */ + public function setEnableStackdriverMonitoring($var) + { + GPBUtil::checkBool($var); + $this->enable_stackdriver_monitoring = $var; + + return $this; + } + + /** + * The Compute Engine Disk Images to use as a Docker cache. The disks will be + * mounted into the Docker folder in a way that the images present in the + * cache will not need to be pulled. The digests of the cached images must + * match those of the tags used or the latest version will still be pulled. + * The root directory of the ext4 image must contain `image` and `overlay2` + * directories copied from the Docker directory of a VM where the desired + * Docker images have already been pulled. Any images pulled that are not + * cached will be stored on the first cache disk instead of the boot disk. + * Only a single image is supported. + * + * Generated from protobuf field repeated string docker_cache_images = 13; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDockerCacheImages() + { + return $this->docker_cache_images; + } + + /** + * The Compute Engine Disk Images to use as a Docker cache. The disks will be + * mounted into the Docker folder in a way that the images present in the + * cache will not need to be pulled. The digests of the cached images must + * match those of the tags used or the latest version will still be pulled. + * The root directory of the ext4 image must contain `image` and `overlay2` + * directories copied from the Docker directory of a VM where the desired + * Docker images have already been pulled. Any images pulled that are not + * cached will be stored on the first cache disk instead of the boot disk. + * Only a single image is supported. + * + * Generated from protobuf field repeated string docker_cache_images = 13; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDockerCacheImages($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->docker_cache_images = $arr; + + return $this; + } + + /** + * The list of disks and other storage to create or attach to the VM. + * Specify either the `volumes[]` field or the `disks[]` field, but not both. + * + * Generated from protobuf field repeated .google.cloud.lifesciences.v2beta.Volume volumes = 14; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getVolumes() + { + return $this->volumes; + } + + /** + * The list of disks and other storage to create or attach to the VM. + * Specify either the `volumes[]` field or the `disks[]` field, but not both. + * + * Generated from protobuf field repeated .google.cloud.lifesciences.v2beta.Volume volumes = 14; + * @param array<\Google\Cloud\LifeSciences\V2beta\Volume>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setVolumes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\LifeSciences\V2beta\Volume::class); + $this->volumes = $arr; + + return $this; + } + + /** + * If specified, the VM will only be allocated inside the matching + * reservation. It will fail if the VM parameters don't match the reservation. + * + * Generated from protobuf field string reservation = 15; + * @return string + */ + public function getReservation() + { + return $this->reservation; + } + + /** + * If specified, the VM will only be allocated inside the matching + * reservation. It will fail if the VM parameters don't match the reservation. + * + * Generated from protobuf field string reservation = 15; + * @param string $var + * @return $this + */ + public function setReservation($var) + { + GPBUtil::checkString($var, True); + $this->reservation = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/Volume.php b/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/Volume.php new file mode 100644 index 000000000000..9b2da83dfeb1 --- /dev/null +++ b/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/Volume.php @@ -0,0 +1,189 @@ +google.cloud.lifesciences.v2beta.Volume + */ +class Volume extends \Google\Protobuf\Internal\Message +{ + /** + * A user-supplied name for the volume. Used when mounting the volume into + * [`Actions`][google.cloud.lifesciences.v2beta.Action]. The name must contain + * only upper and lowercase alphanumeric characters and hyphens and cannot + * start with a hyphen. + * + * Generated from protobuf field string volume = 1; + */ + protected $volume = ''; + protected $storage; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $volume + * A user-supplied name for the volume. Used when mounting the volume into + * [`Actions`][google.cloud.lifesciences.v2beta.Action]. The name must contain + * only upper and lowercase alphanumeric characters and hyphens and cannot + * start with a hyphen. + * @type \Google\Cloud\LifeSciences\V2beta\PersistentDisk $persistent_disk + * Configuration for a persistent disk. + * @type \Google\Cloud\LifeSciences\V2beta\ExistingDisk $existing_disk + * Configuration for a existing disk. + * @type \Google\Cloud\LifeSciences\V2beta\NFSMount $nfs_mount + * Configuration for an NFS mount. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Lifesciences\V2Beta\Workflows::initOnce(); + parent::__construct($data); + } + + /** + * A user-supplied name for the volume. Used when mounting the volume into + * [`Actions`][google.cloud.lifesciences.v2beta.Action]. The name must contain + * only upper and lowercase alphanumeric characters and hyphens and cannot + * start with a hyphen. + * + * Generated from protobuf field string volume = 1; + * @return string + */ + public function getVolume() + { + return $this->volume; + } + + /** + * A user-supplied name for the volume. Used when mounting the volume into + * [`Actions`][google.cloud.lifesciences.v2beta.Action]. The name must contain + * only upper and lowercase alphanumeric characters and hyphens and cannot + * start with a hyphen. + * + * Generated from protobuf field string volume = 1; + * @param string $var + * @return $this + */ + public function setVolume($var) + { + GPBUtil::checkString($var, True); + $this->volume = $var; + + return $this; + } + + /** + * Configuration for a persistent disk. + * + * Generated from protobuf field .google.cloud.lifesciences.v2beta.PersistentDisk persistent_disk = 2; + * @return \Google\Cloud\LifeSciences\V2beta\PersistentDisk|null + */ + public function getPersistentDisk() + { + return $this->readOneof(2); + } + + public function hasPersistentDisk() + { + return $this->hasOneof(2); + } + + /** + * Configuration for a persistent disk. + * + * Generated from protobuf field .google.cloud.lifesciences.v2beta.PersistentDisk persistent_disk = 2; + * @param \Google\Cloud\LifeSciences\V2beta\PersistentDisk $var + * @return $this + */ + public function setPersistentDisk($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\LifeSciences\V2beta\PersistentDisk::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * Configuration for a existing disk. + * + * Generated from protobuf field .google.cloud.lifesciences.v2beta.ExistingDisk existing_disk = 3; + * @return \Google\Cloud\LifeSciences\V2beta\ExistingDisk|null + */ + public function getExistingDisk() + { + return $this->readOneof(3); + } + + public function hasExistingDisk() + { + return $this->hasOneof(3); + } + + /** + * Configuration for a existing disk. + * + * Generated from protobuf field .google.cloud.lifesciences.v2beta.ExistingDisk existing_disk = 3; + * @param \Google\Cloud\LifeSciences\V2beta\ExistingDisk $var + * @return $this + */ + public function setExistingDisk($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\LifeSciences\V2beta\ExistingDisk::class); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * Configuration for an NFS mount. + * + * Generated from protobuf field .google.cloud.lifesciences.v2beta.NFSMount nfs_mount = 4; + * @return \Google\Cloud\LifeSciences\V2beta\NFSMount|null + */ + public function getNfsMount() + { + return $this->readOneof(4); + } + + public function hasNfsMount() + { + return $this->hasOneof(4); + } + + /** + * Configuration for an NFS mount. + * + * Generated from protobuf field .google.cloud.lifesciences.v2beta.NFSMount nfs_mount = 4; + * @param \Google\Cloud\LifeSciences\V2beta\NFSMount $var + * @return $this + */ + public function setNfsMount($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\LifeSciences\V2beta\NFSMount::class); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * @return string + */ + public function getStorage() + { + return $this->whichOneof("storage"); + } + +} + diff --git a/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/WorkerAssignedEvent.php b/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/WorkerAssignedEvent.php new file mode 100644 index 000000000000..59739bb1f03d --- /dev/null +++ b/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/WorkerAssignedEvent.php @@ -0,0 +1,136 @@ +google.cloud.lifesciences.v2beta.WorkerAssignedEvent + */ +class WorkerAssignedEvent extends \Google\Protobuf\Internal\Message +{ + /** + * The zone the worker is running in. + * + * Generated from protobuf field string zone = 1; + */ + protected $zone = ''; + /** + * The worker's instance name. + * + * Generated from protobuf field string instance = 2; + */ + protected $instance = ''; + /** + * The machine type that was assigned for the worker. + * + * Generated from protobuf field string machine_type = 3; + */ + protected $machine_type = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $zone + * The zone the worker is running in. + * @type string $instance + * The worker's instance name. + * @type string $machine_type + * The machine type that was assigned for the worker. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Lifesciences\V2Beta\Workflows::initOnce(); + parent::__construct($data); + } + + /** + * The zone the worker is running in. + * + * Generated from protobuf field string zone = 1; + * @return string + */ + public function getZone() + { + return $this->zone; + } + + /** + * The zone the worker is running in. + * + * Generated from protobuf field string zone = 1; + * @param string $var + * @return $this + */ + public function setZone($var) + { + GPBUtil::checkString($var, True); + $this->zone = $var; + + return $this; + } + + /** + * The worker's instance name. + * + * Generated from protobuf field string instance = 2; + * @return string + */ + public function getInstance() + { + return $this->instance; + } + + /** + * The worker's instance name. + * + * Generated from protobuf field string instance = 2; + * @param string $var + * @return $this + */ + public function setInstance($var) + { + GPBUtil::checkString($var, True); + $this->instance = $var; + + return $this; + } + + /** + * The machine type that was assigned for the worker. + * + * Generated from protobuf field string machine_type = 3; + * @return string + */ + public function getMachineType() + { + return $this->machine_type; + } + + /** + * The machine type that was assigned for the worker. + * + * Generated from protobuf field string machine_type = 3; + * @param string $var + * @return $this + */ + public function setMachineType($var) + { + GPBUtil::checkString($var, True); + $this->machine_type = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/WorkerReleasedEvent.php b/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/WorkerReleasedEvent.php new file mode 100644 index 000000000000..8cc7ed6a39bc --- /dev/null +++ b/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/WorkerReleasedEvent.php @@ -0,0 +1,102 @@ +google.cloud.lifesciences.v2beta.WorkerReleasedEvent + */ +class WorkerReleasedEvent extends \Google\Protobuf\Internal\Message +{ + /** + * The zone the worker was running in. + * + * Generated from protobuf field string zone = 1; + */ + protected $zone = ''; + /** + * The worker's instance name. + * + * Generated from protobuf field string instance = 2; + */ + protected $instance = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $zone + * The zone the worker was running in. + * @type string $instance + * The worker's instance name. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Lifesciences\V2Beta\Workflows::initOnce(); + parent::__construct($data); + } + + /** + * The zone the worker was running in. + * + * Generated from protobuf field string zone = 1; + * @return string + */ + public function getZone() + { + return $this->zone; + } + + /** + * The zone the worker was running in. + * + * Generated from protobuf field string zone = 1; + * @param string $var + * @return $this + */ + public function setZone($var) + { + GPBUtil::checkString($var, True); + $this->zone = $var; + + return $this; + } + + /** + * The worker's instance name. + * + * Generated from protobuf field string instance = 2; + * @return string + */ + public function getInstance() + { + return $this->instance; + } + + /** + * The worker's instance name. + * + * Generated from protobuf field string instance = 2; + * @param string $var + * @return $this + */ + public function setInstance($var) + { + GPBUtil::checkString($var, True); + $this->instance = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/WorkflowsServiceV2BetaGrpcClient.php b/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/WorkflowsServiceV2BetaGrpcClient.php new file mode 100644 index 000000000000..2490b592073f --- /dev/null +++ b/owl-bot-staging/LifeSciences/v2beta/proto/src/Google/Cloud/LifeSciences/V2beta/WorkflowsServiceV2BetaGrpcClient.php @@ -0,0 +1,67 @@ +_simpleRequest('/google.cloud.lifesciences.v2beta.WorkflowsServiceV2Beta/RunPipeline', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + +} diff --git a/owl-bot-staging/LifeSciences/v2beta/samples/V2beta/WorkflowsServiceV2BetaClient/get_location.php b/owl-bot-staging/LifeSciences/v2beta/samples/V2beta/WorkflowsServiceV2BetaClient/get_location.php new file mode 100644 index 000000000000..d76b51988033 --- /dev/null +++ b/owl-bot-staging/LifeSciences/v2beta/samples/V2beta/WorkflowsServiceV2BetaClient/get_location.php @@ -0,0 +1,57 @@ +getLocation($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END lifesciences_v2beta_generated_WorkflowsServiceV2Beta_GetLocation_sync] diff --git a/owl-bot-staging/LifeSciences/v2beta/samples/V2beta/WorkflowsServiceV2BetaClient/list_locations.php b/owl-bot-staging/LifeSciences/v2beta/samples/V2beta/WorkflowsServiceV2BetaClient/list_locations.php new file mode 100644 index 000000000000..7000fa1d649f --- /dev/null +++ b/owl-bot-staging/LifeSciences/v2beta/samples/V2beta/WorkflowsServiceV2BetaClient/list_locations.php @@ -0,0 +1,62 @@ +listLocations($request); + + /** @var Location $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()); + } +} +// [END lifesciences_v2beta_generated_WorkflowsServiceV2Beta_ListLocations_sync] diff --git a/owl-bot-staging/LifeSciences/v2beta/samples/V2beta/WorkflowsServiceV2BetaClient/run_pipeline.php b/owl-bot-staging/LifeSciences/v2beta/samples/V2beta/WorkflowsServiceV2BetaClient/run_pipeline.php new file mode 100644 index 000000000000..ea57ecd0423b --- /dev/null +++ b/owl-bot-staging/LifeSciences/v2beta/samples/V2beta/WorkflowsServiceV2BetaClient/run_pipeline.php @@ -0,0 +1,88 @@ +setPipeline($pipeline); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $workflowsServiceV2BetaClient->runPipeline($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var RunPipelineResponse $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()); + } +} +// [END lifesciences_v2beta_generated_WorkflowsServiceV2Beta_RunPipeline_sync] diff --git a/owl-bot-staging/LifeSciences/v2beta/src/V2beta/Client/BaseClient/WorkflowsServiceV2BetaBaseClient.php b/owl-bot-staging/LifeSciences/v2beta/src/V2beta/Client/BaseClient/WorkflowsServiceV2BetaBaseClient.php new file mode 100644 index 000000000000..27659f47fbd3 --- /dev/null +++ b/owl-bot-staging/LifeSciences/v2beta/src/V2beta/Client/BaseClient/WorkflowsServiceV2BetaBaseClient.php @@ -0,0 +1,307 @@ + self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../../resources/workflows_service_v2_beta_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../../resources/workflows_service_v2_beta_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../../resources/workflows_service_v2_beta_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../../resources/workflows_service_v2_beta_rest_client_config.php', + ], + ], + ]; + } + + /** + * Return an OperationsClient object with the same endpoint as $this. + * + * @return OperationsClient + * + * @experimental + */ + 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 + * + * @experimental + */ + 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; + } + + /** + * 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 'lifesciences.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. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *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' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods 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 + * + * @experimental + */ + 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); + } + + /** + * Runs a pipeline. The returned Operation's [metadata] + * [google.longrunning.Operation.metadata] field will contain a + * [google.cloud.lifesciences.v2beta.Metadata][google.cloud.lifesciences.v2beta.Metadata] + * object describing the status of the pipeline execution. The + * [response][google.longrunning.Operation.response] field will contain a + * [google.cloud.lifesciences.v2beta.RunPipelineResponse][google.cloud.lifesciences.v2beta.RunPipelineResponse] + * object if the pipeline completes successfully. + * + * **Note:** Before you can use this method, the *Life Sciences Service Agent* + * must have access to your project. This is done automatically when the + * Cloud Life Sciences API is first enabled, but if you delete this permission + * you must disable and re-enable the API to grant the Life Sciences + * Service Agent the required permissions. + * Authorization requires the following [Google + * IAM](https://cloud.google.com/iam/) permission: + * + * * `lifesciences.workflows.run` + * + * The async variant is {@see self::runPipelineAsync()} . + * + * @param RunPipelineRequest $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. + * + * @experimental + */ + public function runPipeline(RunPipelineRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('RunPipeline', $request, $callOptions)->wait(); + } + + /** + * Gets information about a location. + * + * The async variant is {@see self::getLocationAsync()} . + * + * @param GetLocationRequest $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 Location + * + * @throws ApiException Thrown if the API call fails. + * + * @experimental + */ + public function getLocation(GetLocationRequest $request, array $callOptions = []): Location + { + return $this->startApiCall('GetLocation', $request, $callOptions)->wait(); + } + + /** + * Lists information about the supported locations for this service. + * + * The async variant is {@see self::listLocationsAsync()} . + * + * @param ListLocationsRequest $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. + * + * @experimental + */ + public function listLocations(ListLocationsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListLocations', $request, $callOptions); + } +} diff --git a/owl-bot-staging/LifeSciences/v2beta/src/V2beta/Client/WorkflowsServiceV2BetaClient.php b/owl-bot-staging/LifeSciences/v2beta/src/V2beta/Client/WorkflowsServiceV2BetaClient.php new file mode 100644 index 000000000000..6183192b0cfa --- /dev/null +++ b/owl-bot-staging/LifeSciences/v2beta/src/V2beta/Client/WorkflowsServiceV2BetaClient.php @@ -0,0 +1,42 @@ +runPipeline($pipeline); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $workflowsServiceV2BetaClient->runPipeline($pipeline); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $workflowsServiceV2BetaClient->resumeOperation($operationName, 'runPipeline'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $workflowsServiceV2BetaClient->close(); + * } + * ``` + * + * @experimental + */ +class WorkflowsServiceV2BetaGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.lifesciences.v2beta.WorkflowsServiceV2Beta'; + + /** The default address of the service. */ + const SERVICE_ADDRESS = 'lifesciences.googleapis.com'; + + /** The default port of the service. */ + const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + ]; + + private $operationsClient; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/workflows_service_v2_beta_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/workflows_service_v2_beta_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/workflows_service_v2_beta_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/workflows_service_v2_beta_rest_client_config.php', + ], + ], + ]; + } + + /** + * Return an OperationsClient object with the same endpoint as $this. + * + * @return OperationsClient + * + * @experimental + */ + 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 + * + * @experimental + */ + 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; + } + + /** + * 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 'lifesciences.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. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *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' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods 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 + * + * @experimental + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + $this->operationsClient = $this->createOperationsClient($clientOptions); + } + + /** + * Runs a pipeline. The returned Operation's [metadata] + * [google.longrunning.Operation.metadata] field will contain a + * [google.cloud.lifesciences.v2beta.Metadata][google.cloud.lifesciences.v2beta.Metadata] + * object describing the status of the pipeline execution. The + * [response][google.longrunning.Operation.response] field will contain a + * [google.cloud.lifesciences.v2beta.RunPipelineResponse][google.cloud.lifesciences.v2beta.RunPipelineResponse] + * object if the pipeline completes successfully. + * + * **Note:** Before you can use this method, the *Life Sciences Service Agent* + * must have access to your project. This is done automatically when the + * Cloud Life Sciences API is first enabled, but if you delete this permission + * you must disable and re-enable the API to grant the Life Sciences + * Service Agent the required permissions. + * Authorization requires the following [Google + * IAM](https://cloud.google.com/iam/) permission: + * + * * `lifesciences.workflows.run` + * + * Sample code: + * ``` + * $workflowsServiceV2BetaClient = new WorkflowsServiceV2BetaClient(); + * try { + * $pipeline = new Pipeline(); + * $operationResponse = $workflowsServiceV2BetaClient->runPipeline($pipeline); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $workflowsServiceV2BetaClient->runPipeline($pipeline); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $workflowsServiceV2BetaClient->resumeOperation($operationName, 'runPipeline'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $workflowsServiceV2BetaClient->close(); + * } + * ``` + * + * @param Pipeline $pipeline Required. The description of the pipeline to run. + * @param array $optionalArgs { + * Optional. + * + * @type string $parent + * The project and location that this request should be executed against. + * @type array $labels + * User-defined labels to associate with the returned operation. These + * labels are not propagated to any Google Cloud Platform resources used by + * the operation, and can be modified at any time. + * + * To associate labels with resources created while executing the operation, + * see the appropriate resource message (for example, `VirtualMachine`). + * @type string $pubSubTopic + * The name of an existing Pub/Sub topic. The server will publish + * messages to this topic whenever the status of the operation changes. + * The Life Sciences Service Agent account must have publisher permissions to + * the specified topic or notifications will not be sent. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function runPipeline($pipeline, array $optionalArgs = []) + { + $request = new RunPipelineRequest(); + $requestParamHeaders = []; + $request->setPipeline($pipeline); + if (isset($optionalArgs['parent'])) { + $request->setParent($optionalArgs['parent']); + $requestParamHeaders['parent'] = $optionalArgs['parent']; + } + + if (isset($optionalArgs['labels'])) { + $request->setLabels($optionalArgs['labels']); + } + + if (isset($optionalArgs['pubSubTopic'])) { + $request->setPubSubTopic($optionalArgs['pubSubTopic']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('RunPipeline', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Gets information about a location. + * + * Sample code: + * ``` + * $workflowsServiceV2BetaClient = new WorkflowsServiceV2BetaClient(); + * try { + * $response = $workflowsServiceV2BetaClient->getLocation(); + * } finally { + * $workflowsServiceV2BetaClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * Resource name for the location. + * @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 \Google\Cloud\Location\Location + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function getLocation(array $optionalArgs = []) + { + $request = new GetLocationRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetLocation', Location::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.cloud.location.Locations')->wait(); + } + + /** + * Lists information about the supported locations for this service. + * + * Sample code: + * ``` + * $workflowsServiceV2BetaClient = new WorkflowsServiceV2BetaClient(); + * try { + * // Iterate over pages of elements + * $pagedResponse = $workflowsServiceV2BetaClient->listLocations(); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $workflowsServiceV2BetaClient->listLocations(); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $workflowsServiceV2BetaClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * The resource that owns the locations collection, if applicable. + * @type string $filter + * The standard list filter. + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @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 \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function listLocations(array $optionalArgs = []) + { + $request = new ListLocationsRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListLocations', $optionalArgs, ListLocationsResponse::class, $request, 'google.cloud.location.Locations'); + } +} diff --git a/owl-bot-staging/LifeSciences/v2beta/src/V2beta/WorkflowsServiceV2BetaClient.php b/owl-bot-staging/LifeSciences/v2beta/src/V2beta/WorkflowsServiceV2BetaClient.php new file mode 100644 index 000000000000..492391f20edf --- /dev/null +++ b/owl-bot-staging/LifeSciences/v2beta/src/V2beta/WorkflowsServiceV2BetaClient.php @@ -0,0 +1,36 @@ + [ + 'google.cloud.lifesciences.v2beta.WorkflowsServiceV2Beta' => [ + 'RunPipeline' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\LifeSciences\V2beta\RunPipelineResponse', + 'metadataReturnType' => '\Google\Cloud\LifeSciences\V2beta\Metadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'GetLocation' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Location\Location', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + 'interfaceOverride' => 'google.cloud.location.Locations', + ], + 'ListLocations' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getLocations', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Location\ListLocationsResponse', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + 'interfaceOverride' => 'google.cloud.location.Locations', + ], + ], + ], +]; diff --git a/owl-bot-staging/LifeSciences/v2beta/src/V2beta/resources/workflows_service_v2_beta_rest_client_config.php b/owl-bot-staging/LifeSciences/v2beta/src/V2beta/resources/workflows_service_v2_beta_rest_client_config.php new file mode 100644 index 000000000000..b41759c0aab6 --- /dev/null +++ b/owl-bot-staging/LifeSciences/v2beta/src/V2beta/resources/workflows_service_v2_beta_rest_client_config.php @@ -0,0 +1,81 @@ + [ + 'google.cloud.lifesciences.v2beta.WorkflowsServiceV2Beta' => [ + 'RunPipeline' => [ + 'method' => 'post', + 'uriTemplate' => '/v2beta/{parent=projects/*/locations/*}/pipelines:run', + 'body' => '*', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + ], + 'google.cloud.location.Locations' => [ + 'GetLocation' => [ + 'method' => 'get', + 'uriTemplate' => '/v2beta/{name=projects/*/locations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListLocations' => [ + 'method' => 'get', + 'uriTemplate' => '/v2beta/{name=projects/*}/locations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + 'google.longrunning.Operations' => [ + 'CancelOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v2beta/{name=projects/*/locations/*/operations/*}:cancel', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetOperation' => [ + 'method' => 'get', + 'uriTemplate' => '/v2beta/{name=projects/*/locations/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListOperations' => [ + 'method' => 'get', + 'uriTemplate' => '/v2beta/{name=projects/*/locations/*}/operations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/LifeSciences/v2beta/tests/Unit/V2beta/Client/WorkflowsServiceV2BetaClientTest.php b/owl-bot-staging/LifeSciences/v2beta/tests/Unit/V2beta/Client/WorkflowsServiceV2BetaClientTest.php new file mode 100644 index 000000000000..c37de65ffa7f --- /dev/null +++ b/owl-bot-staging/LifeSciences/v2beta/tests/Unit/V2beta/Client/WorkflowsServiceV2BetaClientTest.php @@ -0,0 +1,380 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return WorkflowsServiceV2BetaClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new WorkflowsServiceV2BetaClient($options); + } + + /** @test */ + public function runPipelineTest() + { + $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/runPipelineTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new RunPipelineResponse(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/runPipelineTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $pipeline = new Pipeline(); + $request = (new RunPipelineRequest()) + ->setPipeline($pipeline); + $response = $gapicClient->runPipeline($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.cloud.lifesciences.v2beta.WorkflowsServiceV2Beta/RunPipeline', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getPipeline(); + $this->assertProtobufEquals($pipeline, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/runPipelineTest'); + $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 runPipelineExceptionTest() + { + $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/runPipelineTest'); + $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 + $pipeline = new Pipeline(); + $request = (new RunPipelineRequest()) + ->setPipeline($pipeline); + $response = $gapicClient->runPipeline($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/runPipelineTest'); + 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 getLocationTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $locationId = 'locationId552319461'; + $displayName = 'displayName1615086568'; + $expectedResponse = new Location(); + $expectedResponse->setName($name2); + $expectedResponse->setLocationId($locationId); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + $request = new GetLocationRequest(); + $response = $gapicClient->getLocation($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/GetLocation', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getLocationExceptionTest() + { + $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); + $request = new GetLocationRequest(); + try { + $gapicClient->getLocation($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 listLocationsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $locationsElement = new Location(); + $locations = [ + $locationsElement, + ]; + $expectedResponse = new ListLocationsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setLocations($locations); + $transport->addResponse($expectedResponse); + $request = new ListLocationsRequest(); + $response = $gapicClient->listLocations($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getLocations()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/ListLocations', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listLocationsExceptionTest() + { + $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); + $request = new ListLocationsRequest(); + try { + $gapicClient->listLocations($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 runPipelineAsyncTest() + { + $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/runPipelineTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new RunPipelineResponse(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/runPipelineTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $pipeline = new Pipeline(); + $request = (new RunPipelineRequest()) + ->setPipeline($pipeline); + $response = $gapicClient->runPipelineAsync($request)->wait(); + $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.cloud.lifesciences.v2beta.WorkflowsServiceV2Beta/RunPipeline', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getPipeline(); + $this->assertProtobufEquals($pipeline, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/runPipelineTest'); + $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()); + } +} diff --git a/owl-bot-staging/LifeSciences/v2beta/tests/Unit/V2beta/WorkflowsServiceV2BetaClientTest.php b/owl-bot-staging/LifeSciences/v2beta/tests/Unit/V2beta/WorkflowsServiceV2BetaClientTest.php new file mode 100644 index 000000000000..f344c7a51a64 --- /dev/null +++ b/owl-bot-staging/LifeSciences/v2beta/tests/Unit/V2beta/WorkflowsServiceV2BetaClientTest.php @@ -0,0 +1,305 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return WorkflowsServiceV2BetaClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new WorkflowsServiceV2BetaClient($options); + } + + /** @test */ + public function runPipelineTest() + { + $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/runPipelineTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new RunPipelineResponse(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/runPipelineTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $pipeline = new Pipeline(); + $response = $gapicClient->runPipeline($pipeline); + $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.cloud.lifesciences.v2beta.WorkflowsServiceV2Beta/RunPipeline', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getPipeline(); + $this->assertProtobufEquals($pipeline, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/runPipelineTest'); + $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 runPipelineExceptionTest() + { + $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/runPipelineTest'); + $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 + $pipeline = new Pipeline(); + $response = $gapicClient->runPipeline($pipeline); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/runPipelineTest'); + 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 getLocationTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $locationId = 'locationId552319461'; + $displayName = 'displayName1615086568'; + $expectedResponse = new Location(); + $expectedResponse->setName($name2); + $expectedResponse->setLocationId($locationId); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + $response = $gapicClient->getLocation(); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/GetLocation', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getLocationExceptionTest() + { + $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); + try { + $gapicClient->getLocation(); + // 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 listLocationsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $locationsElement = new Location(); + $locations = [ + $locationsElement, + ]; + $expectedResponse = new ListLocationsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setLocations($locations); + $transport->addResponse($expectedResponse); + $response = $gapicClient->listLocations(); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getLocations()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/ListLocations', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listLocationsExceptionTest() + { + $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); + try { + $gapicClient->listLocations(); + // 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()); + } +} diff --git a/owl-bot-staging/MediaTranslation/v1beta1/proto/src/GPBMetadata/Google/Cloud/Mediatranslation/V1Beta1/MediaTranslation.php b/owl-bot-staging/MediaTranslation/v1beta1/proto/src/GPBMetadata/Google/Cloud/Mediatranslation/V1Beta1/MediaTranslation.php new file mode 100644 index 000000000000..bf1b2516f517 Binary files /dev/null and b/owl-bot-staging/MediaTranslation/v1beta1/proto/src/GPBMetadata/Google/Cloud/Mediatranslation/V1Beta1/MediaTranslation.php differ diff --git a/owl-bot-staging/MediaTranslation/v1beta1/proto/src/Google/Cloud/MediaTranslation/V1beta1/SpeechTranslationServiceGrpcClient.php b/owl-bot-staging/MediaTranslation/v1beta1/proto/src/Google/Cloud/MediaTranslation/V1beta1/SpeechTranslationServiceGrpcClient.php new file mode 100644 index 000000000000..7118c47242a6 --- /dev/null +++ b/owl-bot-staging/MediaTranslation/v1beta1/proto/src/Google/Cloud/MediaTranslation/V1beta1/SpeechTranslationServiceGrpcClient.php @@ -0,0 +1,48 @@ +_bidiRequest('/google.cloud.mediatranslation.v1beta1.SpeechTranslationService/StreamingTranslateSpeech', + ['\Google\Cloud\MediaTranslation\V1beta1\StreamingTranslateSpeechResponse','decode'], + $metadata, $options); + } + +} diff --git a/owl-bot-staging/MediaTranslation/v1beta1/proto/src/Google/Cloud/MediaTranslation/V1beta1/StreamingTranslateSpeechConfig.php b/owl-bot-staging/MediaTranslation/v1beta1/proto/src/Google/Cloud/MediaTranslation/V1beta1/StreamingTranslateSpeechConfig.php new file mode 100644 index 000000000000..410ed6ffea0f --- /dev/null +++ b/owl-bot-staging/MediaTranslation/v1beta1/proto/src/Google/Cloud/MediaTranslation/V1beta1/StreamingTranslateSpeechConfig.php @@ -0,0 +1,159 @@ +google.cloud.mediatranslation.v1beta1.StreamingTranslateSpeechConfig + */ +class StreamingTranslateSpeechConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The common config for all the following audio contents. + * + * Generated from protobuf field .google.cloud.mediatranslation.v1beta1.TranslateSpeechConfig audio_config = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $audio_config = null; + /** + * Optional. If `false` or omitted, the system performs + * continuous translation (continuing to wait for and process audio even if + * the user pauses speaking) until the client closes the input stream (gRPC + * API) or until the maximum time limit has been reached. May return multiple + * `StreamingTranslateSpeechResult`s with the `is_final` flag set to `true`. + * If `true`, the speech translator will detect a single spoken utterance. + * When it detects that the user has paused or stopped speaking, it will + * return an `END_OF_SINGLE_UTTERANCE` event and cease translation. + * When the client receives 'END_OF_SINGLE_UTTERANCE' event, the client should + * stop sending the requests. However, clients should keep receiving remaining + * responses until the stream is terminated. To construct the complete + * sentence in a streaming way, one should override (if 'is_final' of previous + * response is false), or append (if 'is_final' of previous response is true). + * + * Generated from protobuf field bool single_utterance = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $single_utterance = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\MediaTranslation\V1beta1\TranslateSpeechConfig $audio_config + * Required. The common config for all the following audio contents. + * @type bool $single_utterance + * Optional. If `false` or omitted, the system performs + * continuous translation (continuing to wait for and process audio even if + * the user pauses speaking) until the client closes the input stream (gRPC + * API) or until the maximum time limit has been reached. May return multiple + * `StreamingTranslateSpeechResult`s with the `is_final` flag set to `true`. + * If `true`, the speech translator will detect a single spoken utterance. + * When it detects that the user has paused or stopped speaking, it will + * return an `END_OF_SINGLE_UTTERANCE` event and cease translation. + * When the client receives 'END_OF_SINGLE_UTTERANCE' event, the client should + * stop sending the requests. However, clients should keep receiving remaining + * responses until the stream is terminated. To construct the complete + * sentence in a streaming way, one should override (if 'is_final' of previous + * response is false), or append (if 'is_final' of previous response is true). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Mediatranslation\V1Beta1\MediaTranslation::initOnce(); + parent::__construct($data); + } + + /** + * Required. The common config for all the following audio contents. + * + * Generated from protobuf field .google.cloud.mediatranslation.v1beta1.TranslateSpeechConfig audio_config = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\MediaTranslation\V1beta1\TranslateSpeechConfig|null + */ + public function getAudioConfig() + { + return $this->audio_config; + } + + public function hasAudioConfig() + { + return isset($this->audio_config); + } + + public function clearAudioConfig() + { + unset($this->audio_config); + } + + /** + * Required. The common config for all the following audio contents. + * + * Generated from protobuf field .google.cloud.mediatranslation.v1beta1.TranslateSpeechConfig audio_config = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\MediaTranslation\V1beta1\TranslateSpeechConfig $var + * @return $this + */ + public function setAudioConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\MediaTranslation\V1beta1\TranslateSpeechConfig::class); + $this->audio_config = $var; + + return $this; + } + + /** + * Optional. If `false` or omitted, the system performs + * continuous translation (continuing to wait for and process audio even if + * the user pauses speaking) until the client closes the input stream (gRPC + * API) or until the maximum time limit has been reached. May return multiple + * `StreamingTranslateSpeechResult`s with the `is_final` flag set to `true`. + * If `true`, the speech translator will detect a single spoken utterance. + * When it detects that the user has paused or stopped speaking, it will + * return an `END_OF_SINGLE_UTTERANCE` event and cease translation. + * When the client receives 'END_OF_SINGLE_UTTERANCE' event, the client should + * stop sending the requests. However, clients should keep receiving remaining + * responses until the stream is terminated. To construct the complete + * sentence in a streaming way, one should override (if 'is_final' of previous + * response is false), or append (if 'is_final' of previous response is true). + * + * Generated from protobuf field bool single_utterance = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getSingleUtterance() + { + return $this->single_utterance; + } + + /** + * Optional. If `false` or omitted, the system performs + * continuous translation (continuing to wait for and process audio even if + * the user pauses speaking) until the client closes the input stream (gRPC + * API) or until the maximum time limit has been reached. May return multiple + * `StreamingTranslateSpeechResult`s with the `is_final` flag set to `true`. + * If `true`, the speech translator will detect a single spoken utterance. + * When it detects that the user has paused or stopped speaking, it will + * return an `END_OF_SINGLE_UTTERANCE` event and cease translation. + * When the client receives 'END_OF_SINGLE_UTTERANCE' event, the client should + * stop sending the requests. However, clients should keep receiving remaining + * responses until the stream is terminated. To construct the complete + * sentence in a streaming way, one should override (if 'is_final' of previous + * response is false), or append (if 'is_final' of previous response is true). + * + * Generated from protobuf field bool single_utterance = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setSingleUtterance($var) + { + GPBUtil::checkBool($var); + $this->single_utterance = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/MediaTranslation/v1beta1/proto/src/Google/Cloud/MediaTranslation/V1beta1/StreamingTranslateSpeechRequest.php b/owl-bot-staging/MediaTranslation/v1beta1/proto/src/Google/Cloud/MediaTranslation/V1beta1/StreamingTranslateSpeechRequest.php new file mode 100644 index 000000000000..7675f1ceba05 --- /dev/null +++ b/owl-bot-staging/MediaTranslation/v1beta1/proto/src/Google/Cloud/MediaTranslation/V1beta1/StreamingTranslateSpeechRequest.php @@ -0,0 +1,139 @@ +google.cloud.mediatranslation.v1beta1.StreamingTranslateSpeechRequest + */ +class StreamingTranslateSpeechRequest extends \Google\Protobuf\Internal\Message +{ + protected $streaming_request; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\MediaTranslation\V1beta1\StreamingTranslateSpeechConfig $streaming_config + * Provides information to the recognizer that specifies how to process the + * request. The first `StreamingTranslateSpeechRequest` message must contain + * a `streaming_config` message. + * @type string $audio_content + * The audio data to be translated. Sequential chunks of audio data are sent + * in sequential `StreamingTranslateSpeechRequest` messages. The first + * `StreamingTranslateSpeechRequest` message must not contain + * `audio_content` data and all subsequent `StreamingTranslateSpeechRequest` + * messages must contain `audio_content` data. The audio bytes must be + * encoded as specified in `StreamingTranslateSpeechConfig`. Note: as with + * all bytes fields, protobuffers use a pure binary representation (not + * base64). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Mediatranslation\V1Beta1\MediaTranslation::initOnce(); + parent::__construct($data); + } + + /** + * Provides information to the recognizer that specifies how to process the + * request. The first `StreamingTranslateSpeechRequest` message must contain + * a `streaming_config` message. + * + * Generated from protobuf field .google.cloud.mediatranslation.v1beta1.StreamingTranslateSpeechConfig streaming_config = 1; + * @return \Google\Cloud\MediaTranslation\V1beta1\StreamingTranslateSpeechConfig|null + */ + public function getStreamingConfig() + { + return $this->readOneof(1); + } + + public function hasStreamingConfig() + { + return $this->hasOneof(1); + } + + /** + * Provides information to the recognizer that specifies how to process the + * request. The first `StreamingTranslateSpeechRequest` message must contain + * a `streaming_config` message. + * + * Generated from protobuf field .google.cloud.mediatranslation.v1beta1.StreamingTranslateSpeechConfig streaming_config = 1; + * @param \Google\Cloud\MediaTranslation\V1beta1\StreamingTranslateSpeechConfig $var + * @return $this + */ + public function setStreamingConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\MediaTranslation\V1beta1\StreamingTranslateSpeechConfig::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * The audio data to be translated. Sequential chunks of audio data are sent + * in sequential `StreamingTranslateSpeechRequest` messages. The first + * `StreamingTranslateSpeechRequest` message must not contain + * `audio_content` data and all subsequent `StreamingTranslateSpeechRequest` + * messages must contain `audio_content` data. The audio bytes must be + * encoded as specified in `StreamingTranslateSpeechConfig`. Note: as with + * all bytes fields, protobuffers use a pure binary representation (not + * base64). + * + * Generated from protobuf field bytes audio_content = 2; + * @return string + */ + public function getAudioContent() + { + return $this->readOneof(2); + } + + public function hasAudioContent() + { + return $this->hasOneof(2); + } + + /** + * The audio data to be translated. Sequential chunks of audio data are sent + * in sequential `StreamingTranslateSpeechRequest` messages. The first + * `StreamingTranslateSpeechRequest` message must not contain + * `audio_content` data and all subsequent `StreamingTranslateSpeechRequest` + * messages must contain `audio_content` data. The audio bytes must be + * encoded as specified in `StreamingTranslateSpeechConfig`. Note: as with + * all bytes fields, protobuffers use a pure binary representation (not + * base64). + * + * Generated from protobuf field bytes audio_content = 2; + * @param string $var + * @return $this + */ + public function setAudioContent($var) + { + GPBUtil::checkString($var, False); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * @return string + */ + public function getStreamingRequest() + { + return $this->whichOneof("streaming_request"); + } + +} + diff --git a/owl-bot-staging/MediaTranslation/v1beta1/proto/src/Google/Cloud/MediaTranslation/V1beta1/StreamingTranslateSpeechResponse.php b/owl-bot-staging/MediaTranslation/v1beta1/proto/src/Google/Cloud/MediaTranslation/V1beta1/StreamingTranslateSpeechResponse.php new file mode 100644 index 000000000000..8760ccf25ab8 --- /dev/null +++ b/owl-bot-staging/MediaTranslation/v1beta1/proto/src/Google/Cloud/MediaTranslation/V1beta1/StreamingTranslateSpeechResponse.php @@ -0,0 +1,164 @@ +google.cloud.mediatranslation.v1beta1.StreamingTranslateSpeechResponse + */ +class StreamingTranslateSpeechResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. If set, returns a [google.rpc.Status][google.rpc.Status] message that + * specifies the error for the operation. + * + * Generated from protobuf field .google.rpc.Status error = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $error = null; + /** + * Output only. The translation result that is currently being processed (is_final could be + * true or false). + * + * Generated from protobuf field .google.cloud.mediatranslation.v1beta1.StreamingTranslateSpeechResult result = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $result = null; + /** + * Output only. Indicates the type of speech event. + * + * Generated from protobuf field .google.cloud.mediatranslation.v1beta1.StreamingTranslateSpeechResponse.SpeechEventType speech_event_type = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $speech_event_type = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Rpc\Status $error + * Output only. If set, returns a [google.rpc.Status][google.rpc.Status] message that + * specifies the error for the operation. + * @type \Google\Cloud\MediaTranslation\V1beta1\StreamingTranslateSpeechResult $result + * Output only. The translation result that is currently being processed (is_final could be + * true or false). + * @type int $speech_event_type + * Output only. Indicates the type of speech event. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Mediatranslation\V1Beta1\MediaTranslation::initOnce(); + parent::__construct($data); + } + + /** + * Output only. If set, returns a [google.rpc.Status][google.rpc.Status] message that + * specifies the error for the operation. + * + * Generated from protobuf field .google.rpc.Status error = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Rpc\Status|null + */ + public function getError() + { + return $this->error; + } + + public function hasError() + { + return isset($this->error); + } + + public function clearError() + { + unset($this->error); + } + + /** + * Output only. If set, returns a [google.rpc.Status][google.rpc.Status] message that + * specifies the error for the operation. + * + * Generated from protobuf field .google.rpc.Status error = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Rpc\Status $var + * @return $this + */ + public function setError($var) + { + GPBUtil::checkMessage($var, \Google\Rpc\Status::class); + $this->error = $var; + + return $this; + } + + /** + * Output only. The translation result that is currently being processed (is_final could be + * true or false). + * + * Generated from protobuf field .google.cloud.mediatranslation.v1beta1.StreamingTranslateSpeechResult result = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\MediaTranslation\V1beta1\StreamingTranslateSpeechResult|null + */ + public function getResult() + { + return $this->result; + } + + public function hasResult() + { + return isset($this->result); + } + + public function clearResult() + { + unset($this->result); + } + + /** + * Output only. The translation result that is currently being processed (is_final could be + * true or false). + * + * Generated from protobuf field .google.cloud.mediatranslation.v1beta1.StreamingTranslateSpeechResult result = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\MediaTranslation\V1beta1\StreamingTranslateSpeechResult $var + * @return $this + */ + public function setResult($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\MediaTranslation\V1beta1\StreamingTranslateSpeechResult::class); + $this->result = $var; + + return $this; + } + + /** + * Output only. Indicates the type of speech event. + * + * Generated from protobuf field .google.cloud.mediatranslation.v1beta1.StreamingTranslateSpeechResponse.SpeechEventType speech_event_type = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getSpeechEventType() + { + return $this->speech_event_type; + } + + /** + * Output only. Indicates the type of speech event. + * + * Generated from protobuf field .google.cloud.mediatranslation.v1beta1.StreamingTranslateSpeechResponse.SpeechEventType speech_event_type = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setSpeechEventType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\MediaTranslation\V1beta1\StreamingTranslateSpeechResponse\SpeechEventType::class); + $this->speech_event_type = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/MediaTranslation/v1beta1/proto/src/Google/Cloud/MediaTranslation/V1beta1/StreamingTranslateSpeechResponse/SpeechEventType.php b/owl-bot-staging/MediaTranslation/v1beta1/proto/src/Google/Cloud/MediaTranslation/V1beta1/StreamingTranslateSpeechResponse/SpeechEventType.php new file mode 100644 index 000000000000..f8dd4b40d7ee --- /dev/null +++ b/owl-bot-staging/MediaTranslation/v1beta1/proto/src/Google/Cloud/MediaTranslation/V1beta1/StreamingTranslateSpeechResponse/SpeechEventType.php @@ -0,0 +1,66 @@ +google.cloud.mediatranslation.v1beta1.StreamingTranslateSpeechResponse.SpeechEventType + */ +class SpeechEventType +{ + /** + * No speech event specified. + * + * Generated from protobuf enum SPEECH_EVENT_TYPE_UNSPECIFIED = 0; + */ + const SPEECH_EVENT_TYPE_UNSPECIFIED = 0; + /** + * This event indicates that the server has detected the end of the user's + * speech utterance and expects no additional speech. Therefore, the server + * will not process additional audio (although it may subsequently return + * additional results). When the client receives 'END_OF_SINGLE_UTTERANCE' + * event, the client should stop sending the requests. However, clients + * should keep receiving remaining responses until the stream is terminated. + * To construct the complete sentence in a streaming way, one should + * override (if 'is_final' of previous response is false), or append (if + * 'is_final' of previous response is true). This event is only sent if + * `single_utterance` was set to `true`, and is not used otherwise. + * + * Generated from protobuf enum END_OF_SINGLE_UTTERANCE = 1; + */ + const END_OF_SINGLE_UTTERANCE = 1; + + private static $valueToName = [ + self::SPEECH_EVENT_TYPE_UNSPECIFIED => 'SPEECH_EVENT_TYPE_UNSPECIFIED', + self::END_OF_SINGLE_UTTERANCE => 'END_OF_SINGLE_UTTERANCE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(SpeechEventType::class, \Google\Cloud\MediaTranslation\V1beta1\StreamingTranslateSpeechResponse_SpeechEventType::class); + diff --git a/owl-bot-staging/MediaTranslation/v1beta1/proto/src/Google/Cloud/MediaTranslation/V1beta1/StreamingTranslateSpeechResponse_SpeechEventType.php b/owl-bot-staging/MediaTranslation/v1beta1/proto/src/Google/Cloud/MediaTranslation/V1beta1/StreamingTranslateSpeechResponse_SpeechEventType.php new file mode 100644 index 000000000000..440d36381676 --- /dev/null +++ b/owl-bot-staging/MediaTranslation/v1beta1/proto/src/Google/Cloud/MediaTranslation/V1beta1/StreamingTranslateSpeechResponse_SpeechEventType.php @@ -0,0 +1,16 @@ +google.cloud.mediatranslation.v1beta1.StreamingTranslateSpeechResult + */ +class StreamingTranslateSpeechResult extends \Google\Protobuf\Internal\Message +{ + protected $result; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\MediaTranslation\V1beta1\StreamingTranslateSpeechResult\TextTranslationResult $text_translation_result + * Text translation result. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Mediatranslation\V1Beta1\MediaTranslation::initOnce(); + parent::__construct($data); + } + + /** + * Text translation result. + * + * Generated from protobuf field .google.cloud.mediatranslation.v1beta1.StreamingTranslateSpeechResult.TextTranslationResult text_translation_result = 1; + * @return \Google\Cloud\MediaTranslation\V1beta1\StreamingTranslateSpeechResult\TextTranslationResult|null + */ + public function getTextTranslationResult() + { + return $this->readOneof(1); + } + + public function hasTextTranslationResult() + { + return $this->hasOneof(1); + } + + /** + * Text translation result. + * + * Generated from protobuf field .google.cloud.mediatranslation.v1beta1.StreamingTranslateSpeechResult.TextTranslationResult text_translation_result = 1; + * @param \Google\Cloud\MediaTranslation\V1beta1\StreamingTranslateSpeechResult\TextTranslationResult $var + * @return $this + */ + public function setTextTranslationResult($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\MediaTranslation\V1beta1\StreamingTranslateSpeechResult\TextTranslationResult::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * @return string + */ + public function getResult() + { + return $this->whichOneof("result"); + } + +} + diff --git a/owl-bot-staging/MediaTranslation/v1beta1/proto/src/Google/Cloud/MediaTranslation/V1beta1/StreamingTranslateSpeechResult/TextTranslationResult.php b/owl-bot-staging/MediaTranslation/v1beta1/proto/src/Google/Cloud/MediaTranslation/V1beta1/StreamingTranslateSpeechResult/TextTranslationResult.php new file mode 100644 index 000000000000..30b706ff4853 --- /dev/null +++ b/owl-bot-staging/MediaTranslation/v1beta1/proto/src/Google/Cloud/MediaTranslation/V1beta1/StreamingTranslateSpeechResult/TextTranslationResult.php @@ -0,0 +1,124 @@ +google.cloud.mediatranslation.v1beta1.StreamingTranslateSpeechResult.TextTranslationResult + */ +class TextTranslationResult extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The translated sentence. + * + * Generated from protobuf field string translation = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $translation = ''; + /** + * Output only. If `false`, this `StreamingTranslateSpeechResult` represents + * an interim result that may change. If `true`, this is the final time the + * translation service will return this particular + * `StreamingTranslateSpeechResult`, the streaming translator will not + * return any further hypotheses for this portion of the transcript and + * corresponding audio. + * + * Generated from protobuf field bool is_final = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $is_final = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $translation + * Output only. The translated sentence. + * @type bool $is_final + * Output only. If `false`, this `StreamingTranslateSpeechResult` represents + * an interim result that may change. If `true`, this is the final time the + * translation service will return this particular + * `StreamingTranslateSpeechResult`, the streaming translator will not + * return any further hypotheses for this portion of the transcript and + * corresponding audio. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Mediatranslation\V1Beta1\MediaTranslation::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The translated sentence. + * + * Generated from protobuf field string translation = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getTranslation() + { + return $this->translation; + } + + /** + * Output only. The translated sentence. + * + * Generated from protobuf field string translation = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setTranslation($var) + { + GPBUtil::checkString($var, True); + $this->translation = $var; + + return $this; + } + + /** + * Output only. If `false`, this `StreamingTranslateSpeechResult` represents + * an interim result that may change. If `true`, this is the final time the + * translation service will return this particular + * `StreamingTranslateSpeechResult`, the streaming translator will not + * return any further hypotheses for this portion of the transcript and + * corresponding audio. + * + * Generated from protobuf field bool is_final = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return bool + */ + public function getIsFinal() + { + return $this->is_final; + } + + /** + * Output only. If `false`, this `StreamingTranslateSpeechResult` represents + * an interim result that may change. If `true`, this is the final time the + * translation service will return this particular + * `StreamingTranslateSpeechResult`, the streaming translator will not + * return any further hypotheses for this portion of the transcript and + * corresponding audio. + * + * Generated from protobuf field bool is_final = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param bool $var + * @return $this + */ + public function setIsFinal($var) + { + GPBUtil::checkBool($var); + $this->is_final = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(TextTranslationResult::class, \Google\Cloud\MediaTranslation\V1beta1\StreamingTranslateSpeechResult_TextTranslationResult::class); + diff --git a/owl-bot-staging/MediaTranslation/v1beta1/proto/src/Google/Cloud/MediaTranslation/V1beta1/StreamingTranslateSpeechResult_TextTranslationResult.php b/owl-bot-staging/MediaTranslation/v1beta1/proto/src/Google/Cloud/MediaTranslation/V1beta1/StreamingTranslateSpeechResult_TextTranslationResult.php new file mode 100644 index 000000000000..cb67c69bf8dd --- /dev/null +++ b/owl-bot-staging/MediaTranslation/v1beta1/proto/src/Google/Cloud/MediaTranslation/V1beta1/StreamingTranslateSpeechResult_TextTranslationResult.php @@ -0,0 +1,16 @@ +google.cloud.mediatranslation.v1beta1.TranslateSpeechConfig + */ +class TranslateSpeechConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Encoding of audio data. + * Supported formats: + * - `linear16` + * Uncompressed 16-bit signed little-endian samples (Linear PCM). + * - `flac` + * `flac` (Free Lossless Audio Codec) is the recommended encoding + * because it is lossless--therefore recognition is not compromised--and + * requires only about half the bandwidth of `linear16`. + * - `mulaw` + * 8-bit samples that compand 14-bit audio samples using G.711 PCMU/mu-law. + * - `amr` + * Adaptive Multi-Rate Narrowband codec. `sample_rate_hertz` must be 8000. + * - `amr-wb` + * Adaptive Multi-Rate Wideband codec. `sample_rate_hertz` must be 16000. + * - `ogg-opus` + * Opus encoded audio frames in [Ogg](https://wikipedia.org/wiki/Ogg) + * container. `sample_rate_hertz` must be one of 8000, 12000, 16000, 24000, + * or 48000. + * - `mp3` + * MP3 audio. Support all standard MP3 bitrates (which range from 32-320 + * kbps). When using this encoding, `sample_rate_hertz` has to match the + * sample rate of the file being used. + * + * Generated from protobuf field string audio_encoding = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $audio_encoding = ''; + /** + * Required. Source language code (BCP-47) of the input audio. + * + * Generated from protobuf field string source_language_code = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $source_language_code = ''; + /** + * Required. Target language code (BCP-47) of the output. + * + * Generated from protobuf field string target_language_code = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $target_language_code = ''; + /** + * Optional. Sample rate in Hertz of the audio data. Valid values are: + * 8000-48000. 16000 is optimal. For best results, set the sampling rate of + * the audio source to 16000 Hz. If that's not possible, use the native sample + * rate of the audio source (instead of re-sampling). + * + * Generated from protobuf field int32 sample_rate_hertz = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $sample_rate_hertz = 0; + /** + * Optional. `google-provided-model/video` and + * `google-provided-model/enhanced-phone-call` are premium models. + * `google-provided-model/phone-call` is not premium model. + * + * Generated from protobuf field string model = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $model = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $audio_encoding + * Required. Encoding of audio data. + * Supported formats: + * - `linear16` + * Uncompressed 16-bit signed little-endian samples (Linear PCM). + * - `flac` + * `flac` (Free Lossless Audio Codec) is the recommended encoding + * because it is lossless--therefore recognition is not compromised--and + * requires only about half the bandwidth of `linear16`. + * - `mulaw` + * 8-bit samples that compand 14-bit audio samples using G.711 PCMU/mu-law. + * - `amr` + * Adaptive Multi-Rate Narrowband codec. `sample_rate_hertz` must be 8000. + * - `amr-wb` + * Adaptive Multi-Rate Wideband codec. `sample_rate_hertz` must be 16000. + * - `ogg-opus` + * Opus encoded audio frames in [Ogg](https://wikipedia.org/wiki/Ogg) + * container. `sample_rate_hertz` must be one of 8000, 12000, 16000, 24000, + * or 48000. + * - `mp3` + * MP3 audio. Support all standard MP3 bitrates (which range from 32-320 + * kbps). When using this encoding, `sample_rate_hertz` has to match the + * sample rate of the file being used. + * @type string $source_language_code + * Required. Source language code (BCP-47) of the input audio. + * @type string $target_language_code + * Required. Target language code (BCP-47) of the output. + * @type int $sample_rate_hertz + * Optional. Sample rate in Hertz of the audio data. Valid values are: + * 8000-48000. 16000 is optimal. For best results, set the sampling rate of + * the audio source to 16000 Hz. If that's not possible, use the native sample + * rate of the audio source (instead of re-sampling). + * @type string $model + * Optional. `google-provided-model/video` and + * `google-provided-model/enhanced-phone-call` are premium models. + * `google-provided-model/phone-call` is not premium model. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Mediatranslation\V1Beta1\MediaTranslation::initOnce(); + parent::__construct($data); + } + + /** + * Required. Encoding of audio data. + * Supported formats: + * - `linear16` + * Uncompressed 16-bit signed little-endian samples (Linear PCM). + * - `flac` + * `flac` (Free Lossless Audio Codec) is the recommended encoding + * because it is lossless--therefore recognition is not compromised--and + * requires only about half the bandwidth of `linear16`. + * - `mulaw` + * 8-bit samples that compand 14-bit audio samples using G.711 PCMU/mu-law. + * - `amr` + * Adaptive Multi-Rate Narrowband codec. `sample_rate_hertz` must be 8000. + * - `amr-wb` + * Adaptive Multi-Rate Wideband codec. `sample_rate_hertz` must be 16000. + * - `ogg-opus` + * Opus encoded audio frames in [Ogg](https://wikipedia.org/wiki/Ogg) + * container. `sample_rate_hertz` must be one of 8000, 12000, 16000, 24000, + * or 48000. + * - `mp3` + * MP3 audio. Support all standard MP3 bitrates (which range from 32-320 + * kbps). When using this encoding, `sample_rate_hertz` has to match the + * sample rate of the file being used. + * + * Generated from protobuf field string audio_encoding = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getAudioEncoding() + { + return $this->audio_encoding; + } + + /** + * Required. Encoding of audio data. + * Supported formats: + * - `linear16` + * Uncompressed 16-bit signed little-endian samples (Linear PCM). + * - `flac` + * `flac` (Free Lossless Audio Codec) is the recommended encoding + * because it is lossless--therefore recognition is not compromised--and + * requires only about half the bandwidth of `linear16`. + * - `mulaw` + * 8-bit samples that compand 14-bit audio samples using G.711 PCMU/mu-law. + * - `amr` + * Adaptive Multi-Rate Narrowband codec. `sample_rate_hertz` must be 8000. + * - `amr-wb` + * Adaptive Multi-Rate Wideband codec. `sample_rate_hertz` must be 16000. + * - `ogg-opus` + * Opus encoded audio frames in [Ogg](https://wikipedia.org/wiki/Ogg) + * container. `sample_rate_hertz` must be one of 8000, 12000, 16000, 24000, + * or 48000. + * - `mp3` + * MP3 audio. Support all standard MP3 bitrates (which range from 32-320 + * kbps). When using this encoding, `sample_rate_hertz` has to match the + * sample rate of the file being used. + * + * Generated from protobuf field string audio_encoding = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setAudioEncoding($var) + { + GPBUtil::checkString($var, True); + $this->audio_encoding = $var; + + return $this; + } + + /** + * Required. Source language code (BCP-47) of the input audio. + * + * Generated from protobuf field string source_language_code = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getSourceLanguageCode() + { + return $this->source_language_code; + } + + /** + * Required. Source language code (BCP-47) of the input audio. + * + * Generated from protobuf field string source_language_code = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setSourceLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->source_language_code = $var; + + return $this; + } + + /** + * Required. Target language code (BCP-47) of the output. + * + * Generated from protobuf field string target_language_code = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getTargetLanguageCode() + { + return $this->target_language_code; + } + + /** + * Required. Target language code (BCP-47) of the output. + * + * Generated from protobuf field string target_language_code = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setTargetLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->target_language_code = $var; + + return $this; + } + + /** + * Optional. Sample rate in Hertz of the audio data. Valid values are: + * 8000-48000. 16000 is optimal. For best results, set the sampling rate of + * the audio source to 16000 Hz. If that's not possible, use the native sample + * rate of the audio source (instead of re-sampling). + * + * Generated from protobuf field int32 sample_rate_hertz = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getSampleRateHertz() + { + return $this->sample_rate_hertz; + } + + /** + * Optional. Sample rate in Hertz of the audio data. Valid values are: + * 8000-48000. 16000 is optimal. For best results, set the sampling rate of + * the audio source to 16000 Hz. If that's not possible, use the native sample + * rate of the audio source (instead of re-sampling). + * + * Generated from protobuf field int32 sample_rate_hertz = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setSampleRateHertz($var) + { + GPBUtil::checkInt32($var); + $this->sample_rate_hertz = $var; + + return $this; + } + + /** + * Optional. `google-provided-model/video` and + * `google-provided-model/enhanced-phone-call` are premium models. + * `google-provided-model/phone-call` is not premium model. + * + * Generated from protobuf field string model = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getModel() + { + return $this->model; + } + + /** + * Optional. `google-provided-model/video` and + * `google-provided-model/enhanced-phone-call` are premium models. + * `google-provided-model/phone-call` is not premium model. + * + * Generated from protobuf field string model = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setModel($var) + { + GPBUtil::checkString($var, True); + $this->model = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/MediaTranslation/v1beta1/samples/V1beta1/SpeechTranslationServiceClient/streaming_translate_speech.php b/owl-bot-staging/MediaTranslation/v1beta1/samples/V1beta1/SpeechTranslationServiceClient/streaming_translate_speech.php new file mode 100644 index 000000000000..529b86304dd9 --- /dev/null +++ b/owl-bot-staging/MediaTranslation/v1beta1/samples/V1beta1/SpeechTranslationServiceClient/streaming_translate_speech.php @@ -0,0 +1,64 @@ +streamingTranslateSpeech(); + $stream->writeAll([$request,]); + + /** @var StreamingTranslateSpeechResponse $element */ + foreach ($stream->closeWriteAndReadAll() as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END mediatranslation_v1beta1_generated_SpeechTranslationService_StreamingTranslateSpeech_sync] diff --git a/owl-bot-staging/MediaTranslation/v1beta1/src/V1beta1/Client/BaseClient/SpeechTranslationServiceBaseClient.php b/owl-bot-staging/MediaTranslation/v1beta1/src/V1beta1/Client/BaseClient/SpeechTranslationServiceBaseClient.php new file mode 100644 index 000000000000..8905d1be1b50 --- /dev/null +++ b/owl-bot-staging/MediaTranslation/v1beta1/src/V1beta1/Client/BaseClient/SpeechTranslationServiceBaseClient.php @@ -0,0 +1,172 @@ + self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../../resources/speech_translation_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../../resources/speech_translation_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../../resources/speech_translation_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../../resources/speech_translation_service_rest_client_config.php', + ], + ], + ]; + } + + /** + * 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 'mediatranslation.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. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *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' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods 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 + * + * @experimental + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + } + + /** + * Performs bidirectional streaming speech translation: receive results while + * sending audio. This method is only available via the gRPC API (not REST). + * + * @param array $callOptions { + * Optional. + * + * @type int $timeoutMillis + * Timeout to use for this call. + * } + * + * @return BidiStream + * + * @throws ApiException Thrown if the API call fails. + * + * @experimental + */ + public function streamingTranslateSpeech(array $callOptions = []): BidiStream + { + return $this->startApiCall('StreamingTranslateSpeech', null, $callOptions); + } +} diff --git a/owl-bot-staging/MediaTranslation/v1beta1/src/V1beta1/Client/SpeechTranslationServiceClient.php b/owl-bot-staging/MediaTranslation/v1beta1/src/V1beta1/Client/SpeechTranslationServiceClient.php new file mode 100644 index 000000000000..c15d958ba103 --- /dev/null +++ b/owl-bot-staging/MediaTranslation/v1beta1/src/V1beta1/Client/SpeechTranslationServiceClient.php @@ -0,0 +1,42 @@ +streamingTranslateSpeech(); + * $stream->writeAll($requests); + * foreach ($stream->closeWriteAndReadAll() as $element) { + * // doSomethingWith($element); + * } + * // Alternatively: + * // Write requests individually, making read() calls if + * // required. Call closeWrite() once writes are complete, and read the + * // remaining responses from the server. + * $requests = [ + * $request, + * ]; + * $stream = $speechTranslationServiceClient->streamingTranslateSpeech(); + * foreach ($requests as $request) { + * $stream->write($request); + * // if required, read a single response from the stream + * $element = $stream->read(); + * // doSomethingWith($element) + * } + * $stream->closeWrite(); + * $element = $stream->read(); + * while (!is_null($element)) { + * // doSomethingWith($element) + * $element = $stream->read(); + * } + * } finally { + * $speechTranslationServiceClient->close(); + * } + * ``` + * + * @experimental + */ +class SpeechTranslationServiceGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.mediatranslation.v1beta1.SpeechTranslationService'; + + /** The default address of the service. */ + const SERVICE_ADDRESS = 'mediatranslation.googleapis.com'; + + /** The default port of the service. */ + const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + ]; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/speech_translation_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/speech_translation_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/speech_translation_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/speech_translation_service_rest_client_config.php', + ], + ], + ]; + } + + /** + * 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 'mediatranslation.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. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *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' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods 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 + * + * @experimental + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + } + + /** + * Performs bidirectional streaming speech translation: receive results while + * sending audio. This method is only available via the gRPC API (not REST). + * + * Sample code: + * ``` + * $speechTranslationServiceClient = new SpeechTranslationServiceClient(); + * try { + * $request = new StreamingTranslateSpeechRequest(); + * // Write all requests to the server, then read all responses until the + * // stream is complete + * $requests = [ + * $request, + * ]; + * $stream = $speechTranslationServiceClient->streamingTranslateSpeech(); + * $stream->writeAll($requests); + * foreach ($stream->closeWriteAndReadAll() as $element) { + * // doSomethingWith($element); + * } + * // Alternatively: + * // Write requests individually, making read() calls if + * // required. Call closeWrite() once writes are complete, and read the + * // remaining responses from the server. + * $requests = [ + * $request, + * ]; + * $stream = $speechTranslationServiceClient->streamingTranslateSpeech(); + * foreach ($requests as $request) { + * $stream->write($request); + * // if required, read a single response from the stream + * $element = $stream->read(); + * // doSomethingWith($element) + * } + * $stream->closeWrite(); + * $element = $stream->read(); + * while (!is_null($element)) { + * // doSomethingWith($element) + * $element = $stream->read(); + * } + * } finally { + * $speechTranslationServiceClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type int $timeoutMillis + * Timeout to use for this call. + * } + * + * @return \Google\ApiCore\BidiStream + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function streamingTranslateSpeech(array $optionalArgs = []) + { + return $this->startCall('StreamingTranslateSpeech', StreamingTranslateSpeechResponse::class, $optionalArgs, null, Call::BIDI_STREAMING_CALL); + } +} diff --git a/owl-bot-staging/MediaTranslation/v1beta1/src/V1beta1/SpeechTranslationServiceClient.php b/owl-bot-staging/MediaTranslation/v1beta1/src/V1beta1/SpeechTranslationServiceClient.php new file mode 100644 index 000000000000..8705bb9dc906 --- /dev/null +++ b/owl-bot-staging/MediaTranslation/v1beta1/src/V1beta1/SpeechTranslationServiceClient.php @@ -0,0 +1,36 @@ + [ + 'google.cloud.mediatranslation.v1beta1.SpeechTranslationService' => [ + 'StreamingTranslateSpeech' => [ + 'grpcStreaming' => [ + 'grpcStreamingType' => 'BidiStreaming', + ], + 'callType' => \Google\ApiCore\Call::BIDI_STREAMING_CALL, + 'responseType' => 'Google\Cloud\MediaTranslation\V1beta1\StreamingTranslateSpeechResponse', + ], + ], + ], +]; diff --git a/owl-bot-staging/MediaTranslation/v1beta1/src/V1beta1/resources/speech_translation_service_rest_client_config.php b/owl-bot-staging/MediaTranslation/v1beta1/src/V1beta1/resources/speech_translation_service_rest_client_config.php new file mode 100644 index 000000000000..180f8ce91961 --- /dev/null +++ b/owl-bot-staging/MediaTranslation/v1beta1/src/V1beta1/resources/speech_translation_service_rest_client_config.php @@ -0,0 +1,6 @@ + [], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/MediaTranslation/v1beta1/tests/Unit/V1beta1/Client/SpeechTranslationServiceClientTest.php b/owl-bot-staging/MediaTranslation/v1beta1/tests/Unit/V1beta1/Client/SpeechTranslationServiceClientTest.php new file mode 100644 index 000000000000..9713533addc6 --- /dev/null +++ b/owl-bot-staging/MediaTranslation/v1beta1/tests/Unit/V1beta1/Client/SpeechTranslationServiceClientTest.php @@ -0,0 +1,151 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return SpeechTranslationServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new SpeechTranslationServiceClient($options); + } + + /** @test */ + public function streamingTranslateSpeechTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new StreamingTranslateSpeechResponse(); + $transport->addResponse($expectedResponse); + $expectedResponse2 = new StreamingTranslateSpeechResponse(); + $transport->addResponse($expectedResponse2); + $expectedResponse3 = new StreamingTranslateSpeechResponse(); + $transport->addResponse($expectedResponse3); + // Mock request + $request = new StreamingTranslateSpeechRequest(); + $request2 = new StreamingTranslateSpeechRequest(); + $request3 = new StreamingTranslateSpeechRequest(); + $bidi = $gapicClient->streamingTranslateSpeech(); + $this->assertInstanceOf(BidiStream::class, $bidi); + $bidi->write($request); + $responses = []; + $responses[] = $bidi->read(); + $bidi->writeAll([ + $request2, + $request3, + ]); + foreach ($bidi->closeWriteAndReadAll() as $response) { + $responses[] = $response; + } + + $expectedResponses = []; + $expectedResponses[] = $expectedResponse; + $expectedResponses[] = $expectedResponse2; + $expectedResponses[] = $expectedResponse3; + $this->assertEquals($expectedResponses, $responses); + $createStreamRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($createStreamRequests)); + $streamFuncCall = $createStreamRequests[0]->getFuncCall(); + $streamRequestObject = $createStreamRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.mediatranslation.v1beta1.SpeechTranslationService/StreamingTranslateSpeech', $streamFuncCall); + $this->assertNull($streamRequestObject); + $callObjects = $transport->popCallObjects(); + $this->assertSame(1, count($callObjects)); + $bidiCall = $callObjects[0]; + $writeRequests = $bidiCall->popReceivedCalls(); + $expectedRequests = []; + $expectedRequests[] = $request; + $expectedRequests[] = $request2; + $expectedRequests[] = $request3; + $this->assertEquals($expectedRequests, $writeRequests); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function streamingTranslateSpeechExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $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->setStreamingStatus($status); + $this->assertTrue($transport->isExhausted()); + $bidi = $gapicClient->streamingTranslateSpeech(); + $results = $bidi->closeWriteAndReadAll(); + try { + iterator_to_array($results); + // If the close stream 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()); + } +} diff --git a/owl-bot-staging/MediaTranslation/v1beta1/tests/Unit/V1beta1/SpeechTranslationServiceClientTest.php b/owl-bot-staging/MediaTranslation/v1beta1/tests/Unit/V1beta1/SpeechTranslationServiceClientTest.php new file mode 100644 index 000000000000..bb68651ec63e --- /dev/null +++ b/owl-bot-staging/MediaTranslation/v1beta1/tests/Unit/V1beta1/SpeechTranslationServiceClientTest.php @@ -0,0 +1,151 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return SpeechTranslationServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new SpeechTranslationServiceClient($options); + } + + /** @test */ + public function streamingTranslateSpeechTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new StreamingTranslateSpeechResponse(); + $transport->addResponse($expectedResponse); + $expectedResponse2 = new StreamingTranslateSpeechResponse(); + $transport->addResponse($expectedResponse2); + $expectedResponse3 = new StreamingTranslateSpeechResponse(); + $transport->addResponse($expectedResponse3); + // Mock request + $request = new StreamingTranslateSpeechRequest(); + $request2 = new StreamingTranslateSpeechRequest(); + $request3 = new StreamingTranslateSpeechRequest(); + $bidi = $gapicClient->streamingTranslateSpeech(); + $this->assertInstanceOf(BidiStream::class, $bidi); + $bidi->write($request); + $responses = []; + $responses[] = $bidi->read(); + $bidi->writeAll([ + $request2, + $request3, + ]); + foreach ($bidi->closeWriteAndReadAll() as $response) { + $responses[] = $response; + } + + $expectedResponses = []; + $expectedResponses[] = $expectedResponse; + $expectedResponses[] = $expectedResponse2; + $expectedResponses[] = $expectedResponse3; + $this->assertEquals($expectedResponses, $responses); + $createStreamRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($createStreamRequests)); + $streamFuncCall = $createStreamRequests[0]->getFuncCall(); + $streamRequestObject = $createStreamRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.mediatranslation.v1beta1.SpeechTranslationService/StreamingTranslateSpeech', $streamFuncCall); + $this->assertNull($streamRequestObject); + $callObjects = $transport->popCallObjects(); + $this->assertSame(1, count($callObjects)); + $bidiCall = $callObjects[0]; + $writeRequests = $bidiCall->popReceivedCalls(); + $expectedRequests = []; + $expectedRequests[] = $request; + $expectedRequests[] = $request2; + $expectedRequests[] = $request3; + $this->assertEquals($expectedRequests, $writeRequests); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function streamingTranslateSpeechExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $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->setStreamingStatus($status); + $this->assertTrue($transport->isExhausted()); + $bidi = $gapicClient->streamingTranslateSpeech(); + $results = $bidi->closeWriteAndReadAll(); + try { + iterator_to_array($results); + // If the close stream 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()); + } +} diff --git a/owl-bot-staging/Optimization/v1/proto/src/GPBMetadata/Google/Cloud/Optimization/V1/AsyncModel.php b/owl-bot-staging/Optimization/v1/proto/src/GPBMetadata/Google/Cloud/Optimization/V1/AsyncModel.php new file mode 100644 index 000000000000..2746ec6deb03 Binary files /dev/null and b/owl-bot-staging/Optimization/v1/proto/src/GPBMetadata/Google/Cloud/Optimization/V1/AsyncModel.php differ diff --git a/owl-bot-staging/Optimization/v1/proto/src/GPBMetadata/Google/Cloud/Optimization/V1/FleetRouting.php b/owl-bot-staging/Optimization/v1/proto/src/GPBMetadata/Google/Cloud/Optimization/V1/FleetRouting.php new file mode 100644 index 000000000000..b291fe3ef349 Binary files /dev/null and b/owl-bot-staging/Optimization/v1/proto/src/GPBMetadata/Google/Cloud/Optimization/V1/FleetRouting.php differ diff --git a/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/AggregatedMetrics.php b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/AggregatedMetrics.php new file mode 100644 index 000000000000..d297ab98f943 --- /dev/null +++ b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/AggregatedMetrics.php @@ -0,0 +1,554 @@ +google.cloud.optimization.v1.AggregatedMetrics + */ +class AggregatedMetrics extends \Google\Protobuf\Internal\Message +{ + /** + * Number of shipments performed. Note that a pickup and delivery pair only + * counts once. + * + * Generated from protobuf field int32 performed_shipment_count = 1; + */ + protected $performed_shipment_count = 0; + /** + * Total travel duration for a route or a solution. + * + * Generated from protobuf field .google.protobuf.Duration travel_duration = 2; + */ + protected $travel_duration = null; + /** + * Total wait duration for a route or a solution. + * + * Generated from protobuf field .google.protobuf.Duration wait_duration = 3; + */ + protected $wait_duration = null; + /** + * Total delay duration for a route or a solution. + * + * Generated from protobuf field .google.protobuf.Duration delay_duration = 4; + */ + protected $delay_duration = null; + /** + * Total break duration for a route or a solution. + * + * Generated from protobuf field .google.protobuf.Duration break_duration = 5; + */ + protected $break_duration = null; + /** + * Total visit duration for a route or a solution. + * + * Generated from protobuf field .google.protobuf.Duration visit_duration = 6; + */ + protected $visit_duration = null; + /** + * The total duration should be equal to the sum of all durations above. + * For routes, it also corresponds to + * [ShipmentRoute.vehicle_end_time][google.cloud.optimization.v1.ShipmentRoute.vehicle_end_time] + * - + * [ShipmentRoute.vehicle_start_time][google.cloud.optimization.v1.ShipmentRoute.vehicle_start_time]. + * + * Generated from protobuf field .google.protobuf.Duration total_duration = 7; + */ + protected $total_duration = null; + /** + * Total travel distance for a route or a solution. + * + * Generated from protobuf field double travel_distance_meters = 8; + */ + protected $travel_distance_meters = 0.0; + /** + * Maximum load achieved over the entire route (resp. solution), for each of + * the quantities on this route (resp. solution), computed as the maximum over + * all + * [Transition.vehicle_loads][google.cloud.optimization.v1.ShipmentRoute.Transition.vehicle_loads] + * (resp. + * [ShipmentRoute.metrics.max_loads][google.cloud.optimization.v1.AggregatedMetrics.max_loads]. + * + * Generated from protobuf field map max_loads = 9; + */ + private $max_loads; + /** + * Deprecated: Use + * [ShipmentRoute.route_costs][google.cloud.optimization.v1.ShipmentRoute.route_costs] + * and + * [OptimizeToursResponse.Metrics.costs][google.cloud.optimization.v1.OptimizeToursResponse.Metrics.costs] + * instead. + * + * Generated from protobuf field map costs = 10 [deprecated = true]; + * @deprecated + */ + private $costs; + /** + * Deprecated: Use + * [ShipmentRoute.route_total_cost][google.cloud.optimization.v1.ShipmentRoute.route_total_cost] + * and + * [OptimizeToursResponse.Metrics.total_cost][google.cloud.optimization.v1.OptimizeToursResponse.Metrics.total_cost] + * instead. + * + * Generated from protobuf field double total_cost = 11 [deprecated = true]; + * @deprecated + */ + protected $total_cost = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $performed_shipment_count + * Number of shipments performed. Note that a pickup and delivery pair only + * counts once. + * @type \Google\Protobuf\Duration $travel_duration + * Total travel duration for a route or a solution. + * @type \Google\Protobuf\Duration $wait_duration + * Total wait duration for a route or a solution. + * @type \Google\Protobuf\Duration $delay_duration + * Total delay duration for a route or a solution. + * @type \Google\Protobuf\Duration $break_duration + * Total break duration for a route or a solution. + * @type \Google\Protobuf\Duration $visit_duration + * Total visit duration for a route or a solution. + * @type \Google\Protobuf\Duration $total_duration + * The total duration should be equal to the sum of all durations above. + * For routes, it also corresponds to + * [ShipmentRoute.vehicle_end_time][google.cloud.optimization.v1.ShipmentRoute.vehicle_end_time] + * - + * [ShipmentRoute.vehicle_start_time][google.cloud.optimization.v1.ShipmentRoute.vehicle_start_time]. + * @type float $travel_distance_meters + * Total travel distance for a route or a solution. + * @type array|\Google\Protobuf\Internal\MapField $max_loads + * Maximum load achieved over the entire route (resp. solution), for each of + * the quantities on this route (resp. solution), computed as the maximum over + * all + * [Transition.vehicle_loads][google.cloud.optimization.v1.ShipmentRoute.Transition.vehicle_loads] + * (resp. + * [ShipmentRoute.metrics.max_loads][google.cloud.optimization.v1.AggregatedMetrics.max_loads]. + * @type array|\Google\Protobuf\Internal\MapField $costs + * Deprecated: Use + * [ShipmentRoute.route_costs][google.cloud.optimization.v1.ShipmentRoute.route_costs] + * and + * [OptimizeToursResponse.Metrics.costs][google.cloud.optimization.v1.OptimizeToursResponse.Metrics.costs] + * instead. + * @type float $total_cost + * Deprecated: Use + * [ShipmentRoute.route_total_cost][google.cloud.optimization.v1.ShipmentRoute.route_total_cost] + * and + * [OptimizeToursResponse.Metrics.total_cost][google.cloud.optimization.v1.OptimizeToursResponse.Metrics.total_cost] + * instead. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * Number of shipments performed. Note that a pickup and delivery pair only + * counts once. + * + * Generated from protobuf field int32 performed_shipment_count = 1; + * @return int + */ + public function getPerformedShipmentCount() + { + return $this->performed_shipment_count; + } + + /** + * Number of shipments performed. Note that a pickup and delivery pair only + * counts once. + * + * Generated from protobuf field int32 performed_shipment_count = 1; + * @param int $var + * @return $this + */ + public function setPerformedShipmentCount($var) + { + GPBUtil::checkInt32($var); + $this->performed_shipment_count = $var; + + return $this; + } + + /** + * Total travel duration for a route or a solution. + * + * Generated from protobuf field .google.protobuf.Duration travel_duration = 2; + * @return \Google\Protobuf\Duration|null + */ + public function getTravelDuration() + { + return $this->travel_duration; + } + + public function hasTravelDuration() + { + return isset($this->travel_duration); + } + + public function clearTravelDuration() + { + unset($this->travel_duration); + } + + /** + * Total travel duration for a route or a solution. + * + * Generated from protobuf field .google.protobuf.Duration travel_duration = 2; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setTravelDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->travel_duration = $var; + + return $this; + } + + /** + * Total wait duration for a route or a solution. + * + * Generated from protobuf field .google.protobuf.Duration wait_duration = 3; + * @return \Google\Protobuf\Duration|null + */ + public function getWaitDuration() + { + return $this->wait_duration; + } + + public function hasWaitDuration() + { + return isset($this->wait_duration); + } + + public function clearWaitDuration() + { + unset($this->wait_duration); + } + + /** + * Total wait duration for a route or a solution. + * + * Generated from protobuf field .google.protobuf.Duration wait_duration = 3; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setWaitDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->wait_duration = $var; + + return $this; + } + + /** + * Total delay duration for a route or a solution. + * + * Generated from protobuf field .google.protobuf.Duration delay_duration = 4; + * @return \Google\Protobuf\Duration|null + */ + public function getDelayDuration() + { + return $this->delay_duration; + } + + public function hasDelayDuration() + { + return isset($this->delay_duration); + } + + public function clearDelayDuration() + { + unset($this->delay_duration); + } + + /** + * Total delay duration for a route or a solution. + * + * Generated from protobuf field .google.protobuf.Duration delay_duration = 4; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setDelayDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->delay_duration = $var; + + return $this; + } + + /** + * Total break duration for a route or a solution. + * + * Generated from protobuf field .google.protobuf.Duration break_duration = 5; + * @return \Google\Protobuf\Duration|null + */ + public function getBreakDuration() + { + return $this->break_duration; + } + + public function hasBreakDuration() + { + return isset($this->break_duration); + } + + public function clearBreakDuration() + { + unset($this->break_duration); + } + + /** + * Total break duration for a route or a solution. + * + * Generated from protobuf field .google.protobuf.Duration break_duration = 5; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setBreakDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->break_duration = $var; + + return $this; + } + + /** + * Total visit duration for a route or a solution. + * + * Generated from protobuf field .google.protobuf.Duration visit_duration = 6; + * @return \Google\Protobuf\Duration|null + */ + public function getVisitDuration() + { + return $this->visit_duration; + } + + public function hasVisitDuration() + { + return isset($this->visit_duration); + } + + public function clearVisitDuration() + { + unset($this->visit_duration); + } + + /** + * Total visit duration for a route or a solution. + * + * Generated from protobuf field .google.protobuf.Duration visit_duration = 6; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setVisitDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->visit_duration = $var; + + return $this; + } + + /** + * The total duration should be equal to the sum of all durations above. + * For routes, it also corresponds to + * [ShipmentRoute.vehicle_end_time][google.cloud.optimization.v1.ShipmentRoute.vehicle_end_time] + * - + * [ShipmentRoute.vehicle_start_time][google.cloud.optimization.v1.ShipmentRoute.vehicle_start_time]. + * + * Generated from protobuf field .google.protobuf.Duration total_duration = 7; + * @return \Google\Protobuf\Duration|null + */ + public function getTotalDuration() + { + return $this->total_duration; + } + + public function hasTotalDuration() + { + return isset($this->total_duration); + } + + public function clearTotalDuration() + { + unset($this->total_duration); + } + + /** + * The total duration should be equal to the sum of all durations above. + * For routes, it also corresponds to + * [ShipmentRoute.vehicle_end_time][google.cloud.optimization.v1.ShipmentRoute.vehicle_end_time] + * - + * [ShipmentRoute.vehicle_start_time][google.cloud.optimization.v1.ShipmentRoute.vehicle_start_time]. + * + * Generated from protobuf field .google.protobuf.Duration total_duration = 7; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setTotalDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->total_duration = $var; + + return $this; + } + + /** + * Total travel distance for a route or a solution. + * + * Generated from protobuf field double travel_distance_meters = 8; + * @return float + */ + public function getTravelDistanceMeters() + { + return $this->travel_distance_meters; + } + + /** + * Total travel distance for a route or a solution. + * + * Generated from protobuf field double travel_distance_meters = 8; + * @param float $var + * @return $this + */ + public function setTravelDistanceMeters($var) + { + GPBUtil::checkDouble($var); + $this->travel_distance_meters = $var; + + return $this; + } + + /** + * Maximum load achieved over the entire route (resp. solution), for each of + * the quantities on this route (resp. solution), computed as the maximum over + * all + * [Transition.vehicle_loads][google.cloud.optimization.v1.ShipmentRoute.Transition.vehicle_loads] + * (resp. + * [ShipmentRoute.metrics.max_loads][google.cloud.optimization.v1.AggregatedMetrics.max_loads]. + * + * Generated from protobuf field map max_loads = 9; + * @return \Google\Protobuf\Internal\MapField + */ + public function getMaxLoads() + { + return $this->max_loads; + } + + /** + * Maximum load achieved over the entire route (resp. solution), for each of + * the quantities on this route (resp. solution), computed as the maximum over + * all + * [Transition.vehicle_loads][google.cloud.optimization.v1.ShipmentRoute.Transition.vehicle_loads] + * (resp. + * [ShipmentRoute.metrics.max_loads][google.cloud.optimization.v1.AggregatedMetrics.max_loads]. + * + * Generated from protobuf field map max_loads = 9; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setMaxLoads($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\ShipmentRoute\VehicleLoad::class); + $this->max_loads = $arr; + + return $this; + } + + /** + * Deprecated: Use + * [ShipmentRoute.route_costs][google.cloud.optimization.v1.ShipmentRoute.route_costs] + * and + * [OptimizeToursResponse.Metrics.costs][google.cloud.optimization.v1.OptimizeToursResponse.Metrics.costs] + * instead. + * + * Generated from protobuf field map costs = 10 [deprecated = true]; + * @return \Google\Protobuf\Internal\MapField + * @deprecated + */ + public function getCosts() + { + @trigger_error('costs is deprecated.', E_USER_DEPRECATED); + return $this->costs; + } + + /** + * Deprecated: Use + * [ShipmentRoute.route_costs][google.cloud.optimization.v1.ShipmentRoute.route_costs] + * and + * [OptimizeToursResponse.Metrics.costs][google.cloud.optimization.v1.OptimizeToursResponse.Metrics.costs] + * instead. + * + * Generated from protobuf field map costs = 10 [deprecated = true]; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + * @deprecated + */ + public function setCosts($var) + { + @trigger_error('costs is deprecated.', E_USER_DEPRECATED); + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::DOUBLE); + $this->costs = $arr; + + return $this; + } + + /** + * Deprecated: Use + * [ShipmentRoute.route_total_cost][google.cloud.optimization.v1.ShipmentRoute.route_total_cost] + * and + * [OptimizeToursResponse.Metrics.total_cost][google.cloud.optimization.v1.OptimizeToursResponse.Metrics.total_cost] + * instead. + * + * Generated from protobuf field double total_cost = 11 [deprecated = true]; + * @return float + * @deprecated + */ + public function getTotalCost() + { + @trigger_error('total_cost is deprecated.', E_USER_DEPRECATED); + return $this->total_cost; + } + + /** + * Deprecated: Use + * [ShipmentRoute.route_total_cost][google.cloud.optimization.v1.ShipmentRoute.route_total_cost] + * and + * [OptimizeToursResponse.Metrics.total_cost][google.cloud.optimization.v1.OptimizeToursResponse.Metrics.total_cost] + * instead. + * + * Generated from protobuf field double total_cost = 11 [deprecated = true]; + * @param float $var + * @return $this + * @deprecated + */ + public function setTotalCost($var) + { + @trigger_error('total_cost is deprecated.', E_USER_DEPRECATED); + GPBUtil::checkDouble($var); + $this->total_cost = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/AsyncModelMetadata.php b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/AsyncModelMetadata.php new file mode 100644 index 000000000000..a2578dd38100 --- /dev/null +++ b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/AsyncModelMetadata.php @@ -0,0 +1,193 @@ +google.cloud.optimization.v1.AsyncModelMetadata + */ +class AsyncModelMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * The state of the current operation. + * + * Generated from protobuf field .google.cloud.optimization.v1.AsyncModelMetadata.State state = 1; + */ + protected $state = 0; + /** + * A message providing more details about the current state of the operation. + * For example, the error message if the operation is failed. + * + * Generated from protobuf field string state_message = 2; + */ + protected $state_message = ''; + /** + * The creation time of the operation. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 3; + */ + protected $create_time = null; + /** + * The last update time of the operation. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 4; + */ + protected $update_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $state + * The state of the current operation. + * @type string $state_message + * A message providing more details about the current state of the operation. + * For example, the error message if the operation is failed. + * @type \Google\Protobuf\Timestamp $create_time + * The creation time of the operation. + * @type \Google\Protobuf\Timestamp $update_time + * The last update time of the operation. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\AsyncModel::initOnce(); + parent::__construct($data); + } + + /** + * The state of the current operation. + * + * Generated from protobuf field .google.cloud.optimization.v1.AsyncModelMetadata.State state = 1; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * The state of the current operation. + * + * Generated from protobuf field .google.cloud.optimization.v1.AsyncModelMetadata.State state = 1; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Optimization\V1\AsyncModelMetadata\State::class); + $this->state = $var; + + return $this; + } + + /** + * A message providing more details about the current state of the operation. + * For example, the error message if the operation is failed. + * + * Generated from protobuf field string state_message = 2; + * @return string + */ + public function getStateMessage() + { + return $this->state_message; + } + + /** + * A message providing more details about the current state of the operation. + * For example, the error message if the operation is failed. + * + * Generated from protobuf field string state_message = 2; + * @param string $var + * @return $this + */ + public function setStateMessage($var) + { + GPBUtil::checkString($var, True); + $this->state_message = $var; + + return $this; + } + + /** + * The creation time of the operation. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 3; + * @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); + } + + /** + * The creation time of the operation. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 3; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * The last update time of the operation. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 4; + * @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); + } + + /** + * The last update time of the operation. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 4; + * @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/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/AsyncModelMetadata/State.php b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/AsyncModelMetadata/State.php new file mode 100644 index 000000000000..72004fd5de80 --- /dev/null +++ b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/AsyncModelMetadata/State.php @@ -0,0 +1,78 @@ +google.cloud.optimization.v1.AsyncModelMetadata.State + */ +class State +{ + /** + * The default value. This value is used if the state is omitted. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * Request is being processed. + * + * Generated from protobuf enum RUNNING = 1; + */ + const RUNNING = 1; + /** + * The operation completed successfully. + * + * Generated from protobuf enum SUCCEEDED = 2; + */ + const SUCCEEDED = 2; + /** + * The operation was cancelled. + * + * Generated from protobuf enum CANCELLED = 3; + */ + const CANCELLED = 3; + /** + * The operation has failed. + * + * Generated from protobuf enum FAILED = 4; + */ + const FAILED = 4; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::RUNNING => 'RUNNING', + self::SUCCEEDED => 'SUCCEEDED', + self::CANCELLED => 'CANCELLED', + self::FAILED => 'FAILED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\Optimization\V1\AsyncModelMetadata_State::class); + diff --git a/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/AsyncModelMetadata_State.php b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/AsyncModelMetadata_State.php new file mode 100644 index 000000000000..5aa6dbd6718e --- /dev/null +++ b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/AsyncModelMetadata_State.php @@ -0,0 +1,16 @@ +google.cloud.optimization.v1.BatchOptimizeToursRequest + */ +class BatchOptimizeToursRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Target project and location to make a call. + * Format: `projects/{project-id}/locations/{location-id}`. + * If no location is specified, a region will be chosen automatically. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $parent = ''; + /** + * Required. Input/Output information each purchase model, such as file paths + * and data formats. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.BatchOptimizeToursRequest.AsyncModelConfig model_configs = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + private $model_configs; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. Target project and location to make a call. + * Format: `projects/{project-id}/locations/{location-id}`. + * If no location is specified, a region will be chosen automatically. + * @type array<\Google\Cloud\Optimization\V1\BatchOptimizeToursRequest\AsyncModelConfig>|\Google\Protobuf\Internal\RepeatedField $model_configs + * Required. Input/Output information each purchase model, such as file paths + * and data formats. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * Required. Target project and location to make a call. + * Format: `projects/{project-id}/locations/{location-id}`. + * If no location is specified, a region will be chosen automatically. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. Target project and location to make a call. + * Format: `projects/{project-id}/locations/{location-id}`. + * If no location is specified, a region will be chosen automatically. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. Input/Output information each purchase model, such as file paths + * and data formats. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.BatchOptimizeToursRequest.AsyncModelConfig model_configs = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getModelConfigs() + { + return $this->model_configs; + } + + /** + * Required. Input/Output information each purchase model, such as file paths + * and data formats. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.BatchOptimizeToursRequest.AsyncModelConfig model_configs = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param array<\Google\Cloud\Optimization\V1\BatchOptimizeToursRequest\AsyncModelConfig>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setModelConfigs($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\BatchOptimizeToursRequest\AsyncModelConfig::class); + $this->model_configs = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/BatchOptimizeToursRequest/AsyncModelConfig.php b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/BatchOptimizeToursRequest/AsyncModelConfig.php new file mode 100644 index 000000000000..b2479e9efec5 --- /dev/null +++ b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/BatchOptimizeToursRequest/AsyncModelConfig.php @@ -0,0 +1,224 @@ +google.cloud.optimization.v1.BatchOptimizeToursRequest.AsyncModelConfig + */ +class AsyncModelConfig extends \Google\Protobuf\Internal\Message +{ + /** + * User defined model name, can be used as alias by users to keep track of + * models. + * + * Generated from protobuf field string display_name = 1; + */ + protected $display_name = ''; + /** + * Required. Information about the input model. + * + * Generated from protobuf field .google.cloud.optimization.v1.InputConfig input_config = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $input_config = null; + /** + * Required. The desired output location information. + * + * Generated from protobuf field .google.cloud.optimization.v1.OutputConfig output_config = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $output_config = null; + /** + * If this is set, the model will be solved in the checkpoint mode. In this + * mode, the input model can have a deadline longer than 30 mins without the + * risk of interruption. The model will be solved in multiple short-running + * stages. Each stage generates an intermediate checkpoint + * and stores it in the user's Cloud Storage buckets. The checkpoint + * mode should be preferred over + * allow_large_deadline_despite_interruption_risk since it prevents the risk + * of interruption. + * + * Generated from protobuf field bool enable_checkpoints = 4; + */ + protected $enable_checkpoints = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $display_name + * User defined model name, can be used as alias by users to keep track of + * models. + * @type \Google\Cloud\Optimization\V1\InputConfig $input_config + * Required. Information about the input model. + * @type \Google\Cloud\Optimization\V1\OutputConfig $output_config + * Required. The desired output location information. + * @type bool $enable_checkpoints + * If this is set, the model will be solved in the checkpoint mode. In this + * mode, the input model can have a deadline longer than 30 mins without the + * risk of interruption. The model will be solved in multiple short-running + * stages. Each stage generates an intermediate checkpoint + * and stores it in the user's Cloud Storage buckets. The checkpoint + * mode should be preferred over + * allow_large_deadline_despite_interruption_risk since it prevents the risk + * of interruption. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * User defined model name, can be used as alias by users to keep track of + * models. + * + * Generated from protobuf field string display_name = 1; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * User defined model name, can be used as alias by users to keep track of + * models. + * + * Generated from protobuf field string display_name = 1; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * Required. Information about the input model. + * + * Generated from protobuf field .google.cloud.optimization.v1.InputConfig input_config = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Optimization\V1\InputConfig|null + */ + public function getInputConfig() + { + return $this->input_config; + } + + public function hasInputConfig() + { + return isset($this->input_config); + } + + public function clearInputConfig() + { + unset($this->input_config); + } + + /** + * Required. Information about the input model. + * + * Generated from protobuf field .google.cloud.optimization.v1.InputConfig input_config = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Optimization\V1\InputConfig $var + * @return $this + */ + public function setInputConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Optimization\V1\InputConfig::class); + $this->input_config = $var; + + return $this; + } + + /** + * Required. The desired output location information. + * + * Generated from protobuf field .google.cloud.optimization.v1.OutputConfig output_config = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Optimization\V1\OutputConfig|null + */ + public function getOutputConfig() + { + return $this->output_config; + } + + public function hasOutputConfig() + { + return isset($this->output_config); + } + + public function clearOutputConfig() + { + unset($this->output_config); + } + + /** + * Required. The desired output location information. + * + * Generated from protobuf field .google.cloud.optimization.v1.OutputConfig output_config = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Optimization\V1\OutputConfig $var + * @return $this + */ + public function setOutputConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Optimization\V1\OutputConfig::class); + $this->output_config = $var; + + return $this; + } + + /** + * If this is set, the model will be solved in the checkpoint mode. In this + * mode, the input model can have a deadline longer than 30 mins without the + * risk of interruption. The model will be solved in multiple short-running + * stages. Each stage generates an intermediate checkpoint + * and stores it in the user's Cloud Storage buckets. The checkpoint + * mode should be preferred over + * allow_large_deadline_despite_interruption_risk since it prevents the risk + * of interruption. + * + * Generated from protobuf field bool enable_checkpoints = 4; + * @return bool + */ + public function getEnableCheckpoints() + { + return $this->enable_checkpoints; + } + + /** + * If this is set, the model will be solved in the checkpoint mode. In this + * mode, the input model can have a deadline longer than 30 mins without the + * risk of interruption. The model will be solved in multiple short-running + * stages. Each stage generates an intermediate checkpoint + * and stores it in the user's Cloud Storage buckets. The checkpoint + * mode should be preferred over + * allow_large_deadline_despite_interruption_risk since it prevents the risk + * of interruption. + * + * Generated from protobuf field bool enable_checkpoints = 4; + * @param bool $var + * @return $this + */ + public function setEnableCheckpoints($var) + { + GPBUtil::checkBool($var); + $this->enable_checkpoints = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(AsyncModelConfig::class, \Google\Cloud\Optimization\V1\BatchOptimizeToursRequest_AsyncModelConfig::class); + diff --git a/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/BatchOptimizeToursRequest_AsyncModelConfig.php b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/BatchOptimizeToursRequest_AsyncModelConfig.php new file mode 100644 index 000000000000..9424d12480db --- /dev/null +++ b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/BatchOptimizeToursRequest_AsyncModelConfig.php @@ -0,0 +1,16 @@ +google.cloud.optimization.v1.BatchOptimizeToursResponse + */ +class BatchOptimizeToursResponse extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + +} + diff --git a/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/BreakRule.php b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/BreakRule.php new file mode 100644 index 000000000000..b284a82824c1 --- /dev/null +++ b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/BreakRule.php @@ -0,0 +1,113 @@ +google.cloud.optimization.v1.BreakRule + */ +class BreakRule extends \Google\Protobuf\Internal\Message +{ + /** + * Sequence of breaks. See the `BreakRequest` message. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.BreakRule.BreakRequest break_requests = 1; + */ + private $break_requests; + /** + * Several `FrequencyConstraint` may apply. They must all be satisfied by + * the `BreakRequest`s of this `BreakRule`. See `FrequencyConstraint`. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.BreakRule.FrequencyConstraint frequency_constraints = 2; + */ + private $frequency_constraints; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Optimization\V1\BreakRule\BreakRequest>|\Google\Protobuf\Internal\RepeatedField $break_requests + * Sequence of breaks. See the `BreakRequest` message. + * @type array<\Google\Cloud\Optimization\V1\BreakRule\FrequencyConstraint>|\Google\Protobuf\Internal\RepeatedField $frequency_constraints + * Several `FrequencyConstraint` may apply. They must all be satisfied by + * the `BreakRequest`s of this `BreakRule`. See `FrequencyConstraint`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * Sequence of breaks. See the `BreakRequest` message. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.BreakRule.BreakRequest break_requests = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getBreakRequests() + { + return $this->break_requests; + } + + /** + * Sequence of breaks. See the `BreakRequest` message. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.BreakRule.BreakRequest break_requests = 1; + * @param array<\Google\Cloud\Optimization\V1\BreakRule\BreakRequest>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setBreakRequests($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\BreakRule\BreakRequest::class); + $this->break_requests = $arr; + + return $this; + } + + /** + * Several `FrequencyConstraint` may apply. They must all be satisfied by + * the `BreakRequest`s of this `BreakRule`. See `FrequencyConstraint`. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.BreakRule.FrequencyConstraint frequency_constraints = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getFrequencyConstraints() + { + return $this->frequency_constraints; + } + + /** + * Several `FrequencyConstraint` may apply. They must all be satisfied by + * the `BreakRequest`s of this `BreakRule`. See `FrequencyConstraint`. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.BreakRule.FrequencyConstraint frequency_constraints = 2; + * @param array<\Google\Cloud\Optimization\V1\BreakRule\FrequencyConstraint>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setFrequencyConstraints($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\BreakRule\FrequencyConstraint::class); + $this->frequency_constraints = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/BreakRule/BreakRequest.php b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/BreakRule/BreakRequest.php new file mode 100644 index 000000000000..1519bc5e0923 --- /dev/null +++ b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/BreakRule/BreakRequest.php @@ -0,0 +1,172 @@ +google.cloud.optimization.v1.BreakRule.BreakRequest + */ +class BreakRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Lower bound (inclusive) on the start of the break. + * + * Generated from protobuf field .google.protobuf.Timestamp earliest_start_time = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $earliest_start_time = null; + /** + * Required. Upper bound (inclusive) on the start of the break. + * + * Generated from protobuf field .google.protobuf.Timestamp latest_start_time = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $latest_start_time = null; + /** + * Required. Minimum duration of the break. Must be positive. + * + * Generated from protobuf field .google.protobuf.Duration min_duration = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $min_duration = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Timestamp $earliest_start_time + * Required. Lower bound (inclusive) on the start of the break. + * @type \Google\Protobuf\Timestamp $latest_start_time + * Required. Upper bound (inclusive) on the start of the break. + * @type \Google\Protobuf\Duration $min_duration + * Required. Minimum duration of the break. Must be positive. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * Required. Lower bound (inclusive) on the start of the break. + * + * Generated from protobuf field .google.protobuf.Timestamp earliest_start_time = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getEarliestStartTime() + { + return $this->earliest_start_time; + } + + public function hasEarliestStartTime() + { + return isset($this->earliest_start_time); + } + + public function clearEarliestStartTime() + { + unset($this->earliest_start_time); + } + + /** + * Required. Lower bound (inclusive) on the start of the break. + * + * Generated from protobuf field .google.protobuf.Timestamp earliest_start_time = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setEarliestStartTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->earliest_start_time = $var; + + return $this; + } + + /** + * Required. Upper bound (inclusive) on the start of the break. + * + * Generated from protobuf field .google.protobuf.Timestamp latest_start_time = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getLatestStartTime() + { + return $this->latest_start_time; + } + + public function hasLatestStartTime() + { + return isset($this->latest_start_time); + } + + public function clearLatestStartTime() + { + unset($this->latest_start_time); + } + + /** + * Required. Upper bound (inclusive) on the start of the break. + * + * Generated from protobuf field .google.protobuf.Timestamp latest_start_time = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setLatestStartTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->latest_start_time = $var; + + return $this; + } + + /** + * Required. Minimum duration of the break. Must be positive. + * + * Generated from protobuf field .google.protobuf.Duration min_duration = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Duration|null + */ + public function getMinDuration() + { + return $this->min_duration; + } + + public function hasMinDuration() + { + return isset($this->min_duration); + } + + public function clearMinDuration() + { + unset($this->min_duration); + } + + /** + * Required. Minimum duration of the break. Must be positive. + * + * Generated from protobuf field .google.protobuf.Duration min_duration = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setMinDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->min_duration = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(BreakRequest::class, \Google\Cloud\Optimization\V1\BreakRule_BreakRequest::class); + diff --git a/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/BreakRule/FrequencyConstraint.php b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/BreakRule/FrequencyConstraint.php new file mode 100644 index 000000000000..6c2a3960a6a0 --- /dev/null +++ b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/BreakRule/FrequencyConstraint.php @@ -0,0 +1,166 @@ +google.cloud.optimization.v1.BreakRule.FrequencyConstraint + */ +class FrequencyConstraint extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Minimum break duration for this constraint. Nonnegative. + * See description of `FrequencyConstraint`. + * + * Generated from protobuf field .google.protobuf.Duration min_break_duration = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $min_break_duration = null; + /** + * Required. Maximum allowed span of any interval of time in the route that + * does not include at least partially a break of `duration >= + * min_break_duration`. Must be positive. + * + * Generated from protobuf field .google.protobuf.Duration max_inter_break_duration = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $max_inter_break_duration = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Duration $min_break_duration + * Required. Minimum break duration for this constraint. Nonnegative. + * See description of `FrequencyConstraint`. + * @type \Google\Protobuf\Duration $max_inter_break_duration + * Required. Maximum allowed span of any interval of time in the route that + * does not include at least partially a break of `duration >= + * min_break_duration`. Must be positive. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * Required. Minimum break duration for this constraint. Nonnegative. + * See description of `FrequencyConstraint`. + * + * Generated from protobuf field .google.protobuf.Duration min_break_duration = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Duration|null + */ + public function getMinBreakDuration() + { + return $this->min_break_duration; + } + + public function hasMinBreakDuration() + { + return isset($this->min_break_duration); + } + + public function clearMinBreakDuration() + { + unset($this->min_break_duration); + } + + /** + * Required. Minimum break duration for this constraint. Nonnegative. + * See description of `FrequencyConstraint`. + * + * Generated from protobuf field .google.protobuf.Duration min_break_duration = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setMinBreakDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->min_break_duration = $var; + + return $this; + } + + /** + * Required. Maximum allowed span of any interval of time in the route that + * does not include at least partially a break of `duration >= + * min_break_duration`. Must be positive. + * + * Generated from protobuf field .google.protobuf.Duration max_inter_break_duration = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Duration|null + */ + public function getMaxInterBreakDuration() + { + return $this->max_inter_break_duration; + } + + public function hasMaxInterBreakDuration() + { + return isset($this->max_inter_break_duration); + } + + public function clearMaxInterBreakDuration() + { + unset($this->max_inter_break_duration); + } + + /** + * Required. Maximum allowed span of any interval of time in the route that + * does not include at least partially a break of `duration >= + * min_break_duration`. Must be positive. + * + * Generated from protobuf field .google.protobuf.Duration max_inter_break_duration = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setMaxInterBreakDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->max_inter_break_duration = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(FrequencyConstraint::class, \Google\Cloud\Optimization\V1\BreakRule_FrequencyConstraint::class); + diff --git a/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/BreakRule_BreakRequest.php b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/BreakRule_BreakRequest.php new file mode 100644 index 000000000000..0fce557588c6 --- /dev/null +++ b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/BreakRule_BreakRequest.php @@ -0,0 +1,16 @@ +google.cloud.optimization.v1.CapacityQuantity + */ +class CapacityQuantity extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field string type = 1; + */ + protected $type = ''; + /** + * Generated from protobuf field int64 value = 2; + */ + protected $value = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $type + * @type int|string $value + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field string type = 1; + * @return string + */ + public function getType() + { + return $this->type; + } + + /** + * Generated from protobuf field string type = 1; + * @param string $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkString($var, True); + $this->type = $var; + + return $this; + } + + /** + * Generated from protobuf field int64 value = 2; + * @return int|string + */ + public function getValue() + { + return $this->value; + } + + /** + * Generated from protobuf field int64 value = 2; + * @param int|string $var + * @return $this + */ + public function setValue($var) + { + GPBUtil::checkInt64($var); + $this->value = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/CapacityQuantityInterval.php b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/CapacityQuantityInterval.php new file mode 100644 index 000000000000..b59966787bd1 --- /dev/null +++ b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/CapacityQuantityInterval.php @@ -0,0 +1,136 @@ +google.cloud.optimization.v1.CapacityQuantityInterval + */ +class CapacityQuantityInterval extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field string type = 1; + */ + protected $type = ''; + /** + * Generated from protobuf field optional int64 min_value = 2; + */ + protected $min_value = null; + /** + * Generated from protobuf field optional int64 max_value = 3; + */ + protected $max_value = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $type + * @type int|string $min_value + * @type int|string $max_value + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field string type = 1; + * @return string + */ + public function getType() + { + return $this->type; + } + + /** + * Generated from protobuf field string type = 1; + * @param string $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkString($var, True); + $this->type = $var; + + return $this; + } + + /** + * Generated from protobuf field optional int64 min_value = 2; + * @return int|string + */ + public function getMinValue() + { + return isset($this->min_value) ? $this->min_value : 0; + } + + public function hasMinValue() + { + return isset($this->min_value); + } + + public function clearMinValue() + { + unset($this->min_value); + } + + /** + * Generated from protobuf field optional int64 min_value = 2; + * @param int|string $var + * @return $this + */ + public function setMinValue($var) + { + GPBUtil::checkInt64($var); + $this->min_value = $var; + + return $this; + } + + /** + * Generated from protobuf field optional int64 max_value = 3; + * @return int|string + */ + public function getMaxValue() + { + return isset($this->max_value) ? $this->max_value : 0; + } + + public function hasMaxValue() + { + return isset($this->max_value); + } + + public function clearMaxValue() + { + unset($this->max_value); + } + + /** + * Generated from protobuf field optional int64 max_value = 3; + * @param int|string $var + * @return $this + */ + public function setMaxValue($var) + { + GPBUtil::checkInt64($var); + $this->max_value = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/DataFormat.php b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/DataFormat.php new file mode 100644 index 000000000000..9e77bfe52a85 --- /dev/null +++ b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/DataFormat.php @@ -0,0 +1,61 @@ +google.cloud.optimization.v1.DataFormat + */ +class DataFormat +{ + /** + * Default value. + * + * Generated from protobuf enum DATA_FORMAT_UNSPECIFIED = 0; + */ + const DATA_FORMAT_UNSPECIFIED = 0; + /** + * Input data in json format. + * + * Generated from protobuf enum JSON = 1; + */ + const JSON = 1; + /** + * Input data in string format. + * + * Generated from protobuf enum STRING = 2; + */ + const STRING = 2; + + private static $valueToName = [ + self::DATA_FORMAT_UNSPECIFIED => 'DATA_FORMAT_UNSPECIFIED', + self::JSON => 'JSON', + self::STRING => 'STRING', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/DistanceLimit.php b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/DistanceLimit.php new file mode 100644 index 000000000000..be1533221bd1 --- /dev/null +++ b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/DistanceLimit.php @@ -0,0 +1,216 @@ +google.cloud.optimization.v1.DistanceLimit + */ +class DistanceLimit extends \Google\Protobuf\Internal\Message +{ + /** + * A hard limit constraining the distance to be at most max_meters. The limit + * must be nonnegative. + * + * Generated from protobuf field optional int64 max_meters = 1; + */ + protected $max_meters = null; + /** + * A soft limit not enforcing a maximum distance limit, but when violated + * results in a cost which adds up to other costs defined in the model, + * with the same unit. + * If defined soft_max_meters must be less than max_meters and must be + * nonnegative. + * + * Generated from protobuf field optional int64 soft_max_meters = 2; + */ + protected $soft_max_meters = null; + /** + * Cost per kilometer incurred if distance is above `soft_max_meters` limit. + * The additional cost is 0 if the distance is under the limit, otherwise the + * formula used to compute the cost is the following: + * ``` + * (distance_meters - soft_max_meters) / 1000.0 * + * cost_per_kilometer_above_soft_max. + * ``` + * The cost must be nonnegative. + * + * Generated from protobuf field optional double cost_per_kilometer_above_soft_max = 3; + */ + protected $cost_per_kilometer_above_soft_max = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int|string $max_meters + * A hard limit constraining the distance to be at most max_meters. The limit + * must be nonnegative. + * @type int|string $soft_max_meters + * A soft limit not enforcing a maximum distance limit, but when violated + * results in a cost which adds up to other costs defined in the model, + * with the same unit. + * If defined soft_max_meters must be less than max_meters and must be + * nonnegative. + * @type float $cost_per_kilometer_above_soft_max + * Cost per kilometer incurred if distance is above `soft_max_meters` limit. + * The additional cost is 0 if the distance is under the limit, otherwise the + * formula used to compute the cost is the following: + * ``` + * (distance_meters - soft_max_meters) / 1000.0 * + * cost_per_kilometer_above_soft_max. + * ``` + * The cost must be nonnegative. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * A hard limit constraining the distance to be at most max_meters. The limit + * must be nonnegative. + * + * Generated from protobuf field optional int64 max_meters = 1; + * @return int|string + */ + public function getMaxMeters() + { + return isset($this->max_meters) ? $this->max_meters : 0; + } + + public function hasMaxMeters() + { + return isset($this->max_meters); + } + + public function clearMaxMeters() + { + unset($this->max_meters); + } + + /** + * A hard limit constraining the distance to be at most max_meters. The limit + * must be nonnegative. + * + * Generated from protobuf field optional int64 max_meters = 1; + * @param int|string $var + * @return $this + */ + public function setMaxMeters($var) + { + GPBUtil::checkInt64($var); + $this->max_meters = $var; + + return $this; + } + + /** + * A soft limit not enforcing a maximum distance limit, but when violated + * results in a cost which adds up to other costs defined in the model, + * with the same unit. + * If defined soft_max_meters must be less than max_meters and must be + * nonnegative. + * + * Generated from protobuf field optional int64 soft_max_meters = 2; + * @return int|string + */ + public function getSoftMaxMeters() + { + return isset($this->soft_max_meters) ? $this->soft_max_meters : 0; + } + + public function hasSoftMaxMeters() + { + return isset($this->soft_max_meters); + } + + public function clearSoftMaxMeters() + { + unset($this->soft_max_meters); + } + + /** + * A soft limit not enforcing a maximum distance limit, but when violated + * results in a cost which adds up to other costs defined in the model, + * with the same unit. + * If defined soft_max_meters must be less than max_meters and must be + * nonnegative. + * + * Generated from protobuf field optional int64 soft_max_meters = 2; + * @param int|string $var + * @return $this + */ + public function setSoftMaxMeters($var) + { + GPBUtil::checkInt64($var); + $this->soft_max_meters = $var; + + return $this; + } + + /** + * Cost per kilometer incurred if distance is above `soft_max_meters` limit. + * The additional cost is 0 if the distance is under the limit, otherwise the + * formula used to compute the cost is the following: + * ``` + * (distance_meters - soft_max_meters) / 1000.0 * + * cost_per_kilometer_above_soft_max. + * ``` + * The cost must be nonnegative. + * + * Generated from protobuf field optional double cost_per_kilometer_above_soft_max = 3; + * @return float + */ + public function getCostPerKilometerAboveSoftMax() + { + return isset($this->cost_per_kilometer_above_soft_max) ? $this->cost_per_kilometer_above_soft_max : 0.0; + } + + public function hasCostPerKilometerAboveSoftMax() + { + return isset($this->cost_per_kilometer_above_soft_max); + } + + public function clearCostPerKilometerAboveSoftMax() + { + unset($this->cost_per_kilometer_above_soft_max); + } + + /** + * Cost per kilometer incurred if distance is above `soft_max_meters` limit. + * The additional cost is 0 if the distance is under the limit, otherwise the + * formula used to compute the cost is the following: + * ``` + * (distance_meters - soft_max_meters) / 1000.0 * + * cost_per_kilometer_above_soft_max. + * ``` + * The cost must be nonnegative. + * + * Generated from protobuf field optional double cost_per_kilometer_above_soft_max = 3; + * @param float $var + * @return $this + */ + public function setCostPerKilometerAboveSoftMax($var) + { + GPBUtil::checkDouble($var); + $this->cost_per_kilometer_above_soft_max = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/FleetRoutingGrpcClient.php b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/FleetRoutingGrpcClient.php new file mode 100644 index 000000000000..4b62fdeed1ef --- /dev/null +++ b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/FleetRoutingGrpcClient.php @@ -0,0 +1,103 @@ +_simpleRequest('/google.cloud.optimization.v1.FleetRouting/OptimizeTours', + $argument, + ['\Google\Cloud\Optimization\V1\OptimizeToursResponse', 'decode'], + $metadata, $options); + } + + /** + * Optimizes vehicle tours for one or more `OptimizeToursRequest` + * messages as a batch. + * + * This method is a Long Running Operation (LRO). The inputs for optimization + * (`OptimizeToursRequest` messages) and outputs (`OptimizeToursResponse` + * messages) are read/written from/to Cloud Storage in user-specified + * format. Like the `OptimizeTours` method, each `OptimizeToursRequest` + * contains a `ShipmentModel` and returns an `OptimizeToursResponse` + * containing `ShipmentRoute`s, which are a set of routes to be performed by + * vehicles minimizing the overall cost. + * @param \Google\Cloud\Optimization\V1\BatchOptimizeToursRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function BatchOptimizeTours(\Google\Cloud\Optimization\V1\BatchOptimizeToursRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.optimization.v1.FleetRouting/BatchOptimizeTours', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + +} diff --git a/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/GcsDestination.php b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/GcsDestination.php new file mode 100644 index 000000000000..3ccb29cfd250 --- /dev/null +++ b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/GcsDestination.php @@ -0,0 +1,67 @@ +google.cloud.optimization.v1.GcsDestination + */ +class GcsDestination extends \Google\Protobuf\Internal\Message +{ + /** + * Required. URI of the Google Cloud Storage location. + * + * Generated from protobuf field string uri = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $uri = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $uri + * Required. URI of the Google Cloud Storage location. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\AsyncModel::initOnce(); + parent::__construct($data); + } + + /** + * Required. URI of the Google Cloud Storage location. + * + * Generated from protobuf field string uri = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getUri() + { + return $this->uri; + } + + /** + * Required. URI of the Google Cloud Storage location. + * + * Generated from protobuf field string uri = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setUri($var) + { + GPBUtil::checkString($var, True); + $this->uri = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/GcsSource.php b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/GcsSource.php new file mode 100644 index 000000000000..9ddec1cbc0f7 --- /dev/null +++ b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/GcsSource.php @@ -0,0 +1,67 @@ +google.cloud.optimization.v1.GcsSource + */ +class GcsSource extends \Google\Protobuf\Internal\Message +{ + /** + * Required. URI of the Google Cloud Storage location. + * + * Generated from protobuf field string uri = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $uri = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $uri + * Required. URI of the Google Cloud Storage location. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\AsyncModel::initOnce(); + parent::__construct($data); + } + + /** + * Required. URI of the Google Cloud Storage location. + * + * Generated from protobuf field string uri = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getUri() + { + return $this->uri; + } + + /** + * Required. URI of the Google Cloud Storage location. + * + * Generated from protobuf field string uri = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setUri($var) + { + GPBUtil::checkString($var, True); + $this->uri = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/InjectedSolutionConstraint.php b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/InjectedSolutionConstraint.php new file mode 100644 index 000000000000..24875c1d2acd --- /dev/null +++ b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/InjectedSolutionConstraint.php @@ -0,0 +1,156 @@ +google.cloud.optimization.v1.InjectedSolutionConstraint + */ +class InjectedSolutionConstraint extends \Google\Protobuf\Internal\Message +{ + /** + * Routes of the solution to inject. Some routes may be omitted from the + * original solution. The routes and skipped shipments must satisfy the basic + * validity assumptions listed for `injected_first_solution_routes`. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentRoute routes = 1; + */ + private $routes; + /** + * Skipped shipments of the solution to inject. Some may be omitted from the + * original solution. See the `routes` field. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.SkippedShipment skipped_shipments = 2; + */ + private $skipped_shipments; + /** + * For zero or more groups of vehicles, specifies when and how much to relax + * constraints. If this field is empty, all non-empty vehicle routes are + * fully constrained. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.InjectedSolutionConstraint.ConstraintRelaxation constraint_relaxations = 3; + */ + private $constraint_relaxations; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Optimization\V1\ShipmentRoute>|\Google\Protobuf\Internal\RepeatedField $routes + * Routes of the solution to inject. Some routes may be omitted from the + * original solution. The routes and skipped shipments must satisfy the basic + * validity assumptions listed for `injected_first_solution_routes`. + * @type array<\Google\Cloud\Optimization\V1\SkippedShipment>|\Google\Protobuf\Internal\RepeatedField $skipped_shipments + * Skipped shipments of the solution to inject. Some may be omitted from the + * original solution. See the `routes` field. + * @type array<\Google\Cloud\Optimization\V1\InjectedSolutionConstraint\ConstraintRelaxation>|\Google\Protobuf\Internal\RepeatedField $constraint_relaxations + * For zero or more groups of vehicles, specifies when and how much to relax + * constraints. If this field is empty, all non-empty vehicle routes are + * fully constrained. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * Routes of the solution to inject. Some routes may be omitted from the + * original solution. The routes and skipped shipments must satisfy the basic + * validity assumptions listed for `injected_first_solution_routes`. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentRoute routes = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRoutes() + { + return $this->routes; + } + + /** + * Routes of the solution to inject. Some routes may be omitted from the + * original solution. The routes and skipped shipments must satisfy the basic + * validity assumptions listed for `injected_first_solution_routes`. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentRoute routes = 1; + * @param array<\Google\Cloud\Optimization\V1\ShipmentRoute>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRoutes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\ShipmentRoute::class); + $this->routes = $arr; + + return $this; + } + + /** + * Skipped shipments of the solution to inject. Some may be omitted from the + * original solution. See the `routes` field. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.SkippedShipment skipped_shipments = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSkippedShipments() + { + return $this->skipped_shipments; + } + + /** + * Skipped shipments of the solution to inject. Some may be omitted from the + * original solution. See the `routes` field. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.SkippedShipment skipped_shipments = 2; + * @param array<\Google\Cloud\Optimization\V1\SkippedShipment>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSkippedShipments($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\SkippedShipment::class); + $this->skipped_shipments = $arr; + + return $this; + } + + /** + * For zero or more groups of vehicles, specifies when and how much to relax + * constraints. If this field is empty, all non-empty vehicle routes are + * fully constrained. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.InjectedSolutionConstraint.ConstraintRelaxation constraint_relaxations = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getConstraintRelaxations() + { + return $this->constraint_relaxations; + } + + /** + * For zero or more groups of vehicles, specifies when and how much to relax + * constraints. If this field is empty, all non-empty vehicle routes are + * fully constrained. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.InjectedSolutionConstraint.ConstraintRelaxation constraint_relaxations = 3; + * @param array<\Google\Cloud\Optimization\V1\InjectedSolutionConstraint\ConstraintRelaxation>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setConstraintRelaxations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\InjectedSolutionConstraint\ConstraintRelaxation::class); + $this->constraint_relaxations = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/InjectedSolutionConstraint/ConstraintRelaxation.php b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/InjectedSolutionConstraint/ConstraintRelaxation.php new file mode 100644 index 000000000000..0a9ea36e234a --- /dev/null +++ b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/InjectedSolutionConstraint/ConstraintRelaxation.php @@ -0,0 +1,151 @@ +google.cloud.optimization.v1.InjectedSolutionConstraint.ConstraintRelaxation + */ +class ConstraintRelaxation extends \Google\Protobuf\Internal\Message +{ + /** + * All the visit constraint relaxations that will apply to visits on + * routes with vehicles in `vehicle_indices`. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.InjectedSolutionConstraint.ConstraintRelaxation.Relaxation relaxations = 1; + */ + private $relaxations; + /** + * Specifies the vehicle indices to which the visit constraint + * `relaxations` apply. If empty, this is considered the default and the + * `relaxations` apply to all vehicles that are not specified in other + * `constraint_relaxations`. There can be at most one default, i.e., at + * most one constraint relaxation field is allowed empty + * `vehicle_indices`. A vehicle index can only be listed once, even within + * several `constraint_relaxations`. + * A vehicle index is mapped the same as + * [ShipmentRoute.vehicle_index][google.cloud.optimization.v1.ShipmentRoute.vehicle_index], + * if `interpret_injected_solutions_using_labels` is true (see `fields` + * comment). + * + * Generated from protobuf field repeated int32 vehicle_indices = 2; + */ + private $vehicle_indices; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Optimization\V1\InjectedSolutionConstraint\ConstraintRelaxation\Relaxation>|\Google\Protobuf\Internal\RepeatedField $relaxations + * All the visit constraint relaxations that will apply to visits on + * routes with vehicles in `vehicle_indices`. + * @type array|\Google\Protobuf\Internal\RepeatedField $vehicle_indices + * Specifies the vehicle indices to which the visit constraint + * `relaxations` apply. If empty, this is considered the default and the + * `relaxations` apply to all vehicles that are not specified in other + * `constraint_relaxations`. There can be at most one default, i.e., at + * most one constraint relaxation field is allowed empty + * `vehicle_indices`. A vehicle index can only be listed once, even within + * several `constraint_relaxations`. + * A vehicle index is mapped the same as + * [ShipmentRoute.vehicle_index][google.cloud.optimization.v1.ShipmentRoute.vehicle_index], + * if `interpret_injected_solutions_using_labels` is true (see `fields` + * comment). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * All the visit constraint relaxations that will apply to visits on + * routes with vehicles in `vehicle_indices`. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.InjectedSolutionConstraint.ConstraintRelaxation.Relaxation relaxations = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRelaxations() + { + return $this->relaxations; + } + + /** + * All the visit constraint relaxations that will apply to visits on + * routes with vehicles in `vehicle_indices`. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.InjectedSolutionConstraint.ConstraintRelaxation.Relaxation relaxations = 1; + * @param array<\Google\Cloud\Optimization\V1\InjectedSolutionConstraint\ConstraintRelaxation\Relaxation>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRelaxations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\InjectedSolutionConstraint\ConstraintRelaxation\Relaxation::class); + $this->relaxations = $arr; + + return $this; + } + + /** + * Specifies the vehicle indices to which the visit constraint + * `relaxations` apply. If empty, this is considered the default and the + * `relaxations` apply to all vehicles that are not specified in other + * `constraint_relaxations`. There can be at most one default, i.e., at + * most one constraint relaxation field is allowed empty + * `vehicle_indices`. A vehicle index can only be listed once, even within + * several `constraint_relaxations`. + * A vehicle index is mapped the same as + * [ShipmentRoute.vehicle_index][google.cloud.optimization.v1.ShipmentRoute.vehicle_index], + * if `interpret_injected_solutions_using_labels` is true (see `fields` + * comment). + * + * Generated from protobuf field repeated int32 vehicle_indices = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getVehicleIndices() + { + return $this->vehicle_indices; + } + + /** + * Specifies the vehicle indices to which the visit constraint + * `relaxations` apply. If empty, this is considered the default and the + * `relaxations` apply to all vehicles that are not specified in other + * `constraint_relaxations`. There can be at most one default, i.e., at + * most one constraint relaxation field is allowed empty + * `vehicle_indices`. A vehicle index can only be listed once, even within + * several `constraint_relaxations`. + * A vehicle index is mapped the same as + * [ShipmentRoute.vehicle_index][google.cloud.optimization.v1.ShipmentRoute.vehicle_index], + * if `interpret_injected_solutions_using_labels` is true (see `fields` + * comment). + * + * Generated from protobuf field repeated int32 vehicle_indices = 2; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setVehicleIndices($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); + $this->vehicle_indices = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ConstraintRelaxation::class, \Google\Cloud\Optimization\V1\InjectedSolutionConstraint_ConstraintRelaxation::class); + diff --git a/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/InjectedSolutionConstraint/ConstraintRelaxation/Relaxation.php b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/InjectedSolutionConstraint/ConstraintRelaxation/Relaxation.php new file mode 100644 index 000000000000..751a516bfd34 --- /dev/null +++ b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/InjectedSolutionConstraint/ConstraintRelaxation/Relaxation.php @@ -0,0 +1,204 @@ += relaxations(i).threshold_time` AND + * * `j + 1 >= relaxations(i).threshold_visit_count` + * Similarly, the vehicle start is relaxed to `relaxations(i).level` if it + * satisfies: + * * `vehicle_start_time >= relaxations(i).threshold_time` AND + * * `relaxations(i).threshold_visit_count == 0` + * and the vehicle end is relaxed to `relaxations(i).level` if it satisfies: + * * `vehicle_end_time >= relaxations(i).threshold_time` AND + * * `route.visits_size() + 1 >= relaxations(i).threshold_visit_count` + * To apply a relaxation level if a visit meets the `threshold_visit_count` + * OR the `threshold_time` add two `relaxations` with the same `level`: + * one with only `threshold_visit_count` set and the other with only + * `threshold_time` set. If a visit satisfies the conditions of multiple + * `relaxations`, the most relaxed level applies. As a result, from the + * vehicle start through the route visits in order to the vehicle end, the + * relaxation level becomes more relaxed: i.e., the relaxation level is + * non-decreasing as the route progresses. + * The timing and sequence of route visits that do not satisfy the + * threshold conditions of any `relaxations` are fully constrained + * and no visits may be inserted into these sequences. Also, if a + * vehicle start or end does not satisfy the conditions of any + * relaxation the time is fixed, unless the vehicle is empty. + * + * Generated from protobuf message google.cloud.optimization.v1.InjectedSolutionConstraint.ConstraintRelaxation.Relaxation + */ +class Relaxation extends \Google\Protobuf\Internal\Message +{ + /** + * The constraint relaxation level that applies when the conditions + * at or after `threshold_time` AND at least `threshold_visit_count` are + * satisfied. + * + * Generated from protobuf field .google.cloud.optimization.v1.InjectedSolutionConstraint.ConstraintRelaxation.Relaxation.Level level = 1; + */ + protected $level = 0; + /** + * The time at or after which the relaxation `level` may be applied. + * + * Generated from protobuf field .google.protobuf.Timestamp threshold_time = 2; + */ + protected $threshold_time = null; + /** + * The number of visits at or after which the relaxation `level` may be + * applied. If `threshold_visit_count` is 0 (or unset), the `level` may be + * applied directly at the vehicle start. + * If it is `route.visits_size() + 1`, the `level` may only be applied to + * the vehicle end. If it is more than `route.visits_size() + 1`, + * `level` is not applied at all for that route. + * + * Generated from protobuf field int32 threshold_visit_count = 3; + */ + protected $threshold_visit_count = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $level + * The constraint relaxation level that applies when the conditions + * at or after `threshold_time` AND at least `threshold_visit_count` are + * satisfied. + * @type \Google\Protobuf\Timestamp $threshold_time + * The time at or after which the relaxation `level` may be applied. + * @type int $threshold_visit_count + * The number of visits at or after which the relaxation `level` may be + * applied. If `threshold_visit_count` is 0 (or unset), the `level` may be + * applied directly at the vehicle start. + * If it is `route.visits_size() + 1`, the `level` may only be applied to + * the vehicle end. If it is more than `route.visits_size() + 1`, + * `level` is not applied at all for that route. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * The constraint relaxation level that applies when the conditions + * at or after `threshold_time` AND at least `threshold_visit_count` are + * satisfied. + * + * Generated from protobuf field .google.cloud.optimization.v1.InjectedSolutionConstraint.ConstraintRelaxation.Relaxation.Level level = 1; + * @return int + */ + public function getLevel() + { + return $this->level; + } + + /** + * The constraint relaxation level that applies when the conditions + * at or after `threshold_time` AND at least `threshold_visit_count` are + * satisfied. + * + * Generated from protobuf field .google.cloud.optimization.v1.InjectedSolutionConstraint.ConstraintRelaxation.Relaxation.Level level = 1; + * @param int $var + * @return $this + */ + public function setLevel($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Optimization\V1\InjectedSolutionConstraint\ConstraintRelaxation\Relaxation\Level::class); + $this->level = $var; + + return $this; + } + + /** + * The time at or after which the relaxation `level` may be applied. + * + * Generated from protobuf field .google.protobuf.Timestamp threshold_time = 2; + * @return \Google\Protobuf\Timestamp|null + */ + public function getThresholdTime() + { + return $this->threshold_time; + } + + public function hasThresholdTime() + { + return isset($this->threshold_time); + } + + public function clearThresholdTime() + { + unset($this->threshold_time); + } + + /** + * The time at or after which the relaxation `level` may be applied. + * + * Generated from protobuf field .google.protobuf.Timestamp threshold_time = 2; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setThresholdTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->threshold_time = $var; + + return $this; + } + + /** + * The number of visits at or after which the relaxation `level` may be + * applied. If `threshold_visit_count` is 0 (or unset), the `level` may be + * applied directly at the vehicle start. + * If it is `route.visits_size() + 1`, the `level` may only be applied to + * the vehicle end. If it is more than `route.visits_size() + 1`, + * `level` is not applied at all for that route. + * + * Generated from protobuf field int32 threshold_visit_count = 3; + * @return int + */ + public function getThresholdVisitCount() + { + return $this->threshold_visit_count; + } + + /** + * The number of visits at or after which the relaxation `level` may be + * applied. If `threshold_visit_count` is 0 (or unset), the `level` may be + * applied directly at the vehicle start. + * If it is `route.visits_size() + 1`, the `level` may only be applied to + * the vehicle end. If it is more than `route.visits_size() + 1`, + * `level` is not applied at all for that route. + * + * Generated from protobuf field int32 threshold_visit_count = 3; + * @param int $var + * @return $this + */ + public function setThresholdVisitCount($var) + { + GPBUtil::checkInt32($var); + $this->threshold_visit_count = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Relaxation::class, \Google\Cloud\Optimization\V1\InjectedSolutionConstraint_ConstraintRelaxation_Relaxation::class); + diff --git a/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/InjectedSolutionConstraint/ConstraintRelaxation/Relaxation/Level.php b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/InjectedSolutionConstraint/ConstraintRelaxation/Relaxation/Level.php new file mode 100644 index 000000000000..1f1c8b8b23de --- /dev/null +++ b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/InjectedSolutionConstraint/ConstraintRelaxation/Relaxation/Level.php @@ -0,0 +1,82 @@ +google.cloud.optimization.v1.InjectedSolutionConstraint.ConstraintRelaxation.Relaxation.Level + */ +class Level +{ + /** + * Implicit default relaxation level: no constraints are relaxed, + * i.e., all visits are fully constrained. + * This value must not be explicitly used in `level`. + * + * Generated from protobuf enum LEVEL_UNSPECIFIED = 0; + */ + const LEVEL_UNSPECIFIED = 0; + /** + * Visit start times and vehicle start/end times will be relaxed, but + * each visit remains bound to the same vehicle and the visit sequence + * must be observed: no visit can be inserted between them or before + * them. + * + * Generated from protobuf enum RELAX_VISIT_TIMES_AFTER_THRESHOLD = 1; + */ + const RELAX_VISIT_TIMES_AFTER_THRESHOLD = 1; + /** + * Same as `RELAX_VISIT_TIMES_AFTER_THRESHOLD`, but the visit sequence + * is also relaxed: visits remain simply bound to their vehicle. + * + * Generated from protobuf enum RELAX_VISIT_TIMES_AND_SEQUENCE_AFTER_THRESHOLD = 2; + */ + const RELAX_VISIT_TIMES_AND_SEQUENCE_AFTER_THRESHOLD = 2; + /** + * Same as `RELAX_VISIT_TIMES_AND_SEQUENCE_AFTER_THRESHOLD`, but the + * vehicle is also relaxed: visits are completely free at or after the + * threshold time and can potentially become unperformed. + * + * Generated from protobuf enum RELAX_ALL_AFTER_THRESHOLD = 3; + */ + const RELAX_ALL_AFTER_THRESHOLD = 3; + + private static $valueToName = [ + self::LEVEL_UNSPECIFIED => 'LEVEL_UNSPECIFIED', + self::RELAX_VISIT_TIMES_AFTER_THRESHOLD => 'RELAX_VISIT_TIMES_AFTER_THRESHOLD', + self::RELAX_VISIT_TIMES_AND_SEQUENCE_AFTER_THRESHOLD => 'RELAX_VISIT_TIMES_AND_SEQUENCE_AFTER_THRESHOLD', + self::RELAX_ALL_AFTER_THRESHOLD => 'RELAX_ALL_AFTER_THRESHOLD', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Level::class, \Google\Cloud\Optimization\V1\InjectedSolutionConstraint_ConstraintRelaxation_Relaxation_Level::class); + diff --git a/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/InjectedSolutionConstraint_ConstraintRelaxation.php b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/InjectedSolutionConstraint_ConstraintRelaxation.php new file mode 100644 index 000000000000..498a480cfbfc --- /dev/null +++ b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/InjectedSolutionConstraint_ConstraintRelaxation.php @@ -0,0 +1,16 @@ +google.cloud.optimization.v1.InputConfig + */ +class InputConfig extends \Google\Protobuf\Internal\Message +{ + /** + * The input data format that used to store the model in Cloud Storage. + * + * Generated from protobuf field .google.cloud.optimization.v1.DataFormat data_format = 2; + */ + protected $data_format = 0; + protected $source; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Optimization\V1\GcsSource $gcs_source + * The Google Cloud Storage location to read the input from. This must be a + * single file. + * @type int $data_format + * The input data format that used to store the model in Cloud Storage. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\AsyncModel::initOnce(); + parent::__construct($data); + } + + /** + * The Google Cloud Storage location to read the input from. This must be a + * single file. + * + * Generated from protobuf field .google.cloud.optimization.v1.GcsSource gcs_source = 1; + * @return \Google\Cloud\Optimization\V1\GcsSource|null + */ + public function getGcsSource() + { + return $this->readOneof(1); + } + + public function hasGcsSource() + { + return $this->hasOneof(1); + } + + /** + * The Google Cloud Storage location to read the input from. This must be a + * single file. + * + * Generated from protobuf field .google.cloud.optimization.v1.GcsSource gcs_source = 1; + * @param \Google\Cloud\Optimization\V1\GcsSource $var + * @return $this + */ + public function setGcsSource($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Optimization\V1\GcsSource::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * The input data format that used to store the model in Cloud Storage. + * + * Generated from protobuf field .google.cloud.optimization.v1.DataFormat data_format = 2; + * @return int + */ + public function getDataFormat() + { + return $this->data_format; + } + + /** + * The input data format that used to store the model in Cloud Storage. + * + * Generated from protobuf field .google.cloud.optimization.v1.DataFormat data_format = 2; + * @param int $var + * @return $this + */ + public function setDataFormat($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Optimization\V1\DataFormat::class); + $this->data_format = $var; + + return $this; + } + + /** + * @return string + */ + public function getSource() + { + return $this->whichOneof("source"); + } + +} + diff --git a/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/Location.php b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/Location.php new file mode 100644 index 000000000000..cb4cfc3a20de --- /dev/null +++ b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/Location.php @@ -0,0 +1,133 @@ +google.cloud.optimization.v1.Location + */ +class Location extends \Google\Protobuf\Internal\Message +{ + /** + * The waypoint's geographic coordinates. + * + * Generated from protobuf field .google.type.LatLng lat_lng = 1; + */ + protected $lat_lng = null; + /** + * The compass heading associated with the direction of the flow of traffic. + * This value is used to specify the side of the road to use for pickup and + * drop-off. Heading values can be from 0 to 360, where 0 specifies a heading + * of due North, 90 specifies a heading of due East, etc. + * + * Generated from protobuf field optional int32 heading = 2; + */ + protected $heading = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Type\LatLng $lat_lng + * The waypoint's geographic coordinates. + * @type int $heading + * The compass heading associated with the direction of the flow of traffic. + * This value is used to specify the side of the road to use for pickup and + * drop-off. Heading values can be from 0 to 360, where 0 specifies a heading + * of due North, 90 specifies a heading of due East, etc. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * The waypoint's geographic coordinates. + * + * Generated from protobuf field .google.type.LatLng lat_lng = 1; + * @return \Google\Type\LatLng|null + */ + public function getLatLng() + { + return $this->lat_lng; + } + + public function hasLatLng() + { + return isset($this->lat_lng); + } + + public function clearLatLng() + { + unset($this->lat_lng); + } + + /** + * The waypoint's geographic coordinates. + * + * Generated from protobuf field .google.type.LatLng lat_lng = 1; + * @param \Google\Type\LatLng $var + * @return $this + */ + public function setLatLng($var) + { + GPBUtil::checkMessage($var, \Google\Type\LatLng::class); + $this->lat_lng = $var; + + return $this; + } + + /** + * The compass heading associated with the direction of the flow of traffic. + * This value is used to specify the side of the road to use for pickup and + * drop-off. Heading values can be from 0 to 360, where 0 specifies a heading + * of due North, 90 specifies a heading of due East, etc. + * + * Generated from protobuf field optional int32 heading = 2; + * @return int + */ + public function getHeading() + { + return isset($this->heading) ? $this->heading : 0; + } + + public function hasHeading() + { + return isset($this->heading); + } + + public function clearHeading() + { + unset($this->heading); + } + + /** + * The compass heading associated with the direction of the flow of traffic. + * This value is used to specify the side of the road to use for pickup and + * drop-off. Heading values can be from 0 to 360, where 0 specifies a heading + * of due North, 90 specifies a heading of due East, etc. + * + * Generated from protobuf field optional int32 heading = 2; + * @param int $var + * @return $this + */ + public function setHeading($var) + { + GPBUtil::checkInt32($var); + $this->heading = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/OptimizeToursRequest.php b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/OptimizeToursRequest.php new file mode 100644 index 000000000000..509ba28fea7f --- /dev/null +++ b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/OptimizeToursRequest.php @@ -0,0 +1,1237 @@ +google.cloud.optimization.v1.OptimizeToursRequest + */ +class OptimizeToursRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Target project and location to make a call. + * Format: `projects/{project-id}/locations/{location-id}`. + * If no location is specified, a region will be chosen automatically. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $parent = ''; + /** + * If this timeout is set, the server returns a response before the timeout + * period has elapsed or the server deadline for synchronous requests is + * reached, whichever is sooner. + * For asynchronous requests, the server will generate a solution (if + * possible) before the timeout has elapsed. + * + * Generated from protobuf field .google.protobuf.Duration timeout = 2; + */ + protected $timeout = null; + /** + * Shipment model to solve. + * + * Generated from protobuf field .google.cloud.optimization.v1.ShipmentModel model = 3; + */ + protected $model = null; + /** + * By default, the solving mode is `DEFAULT_SOLVE` (0). + * + * Generated from protobuf field .google.cloud.optimization.v1.OptimizeToursRequest.SolvingMode solving_mode = 4; + */ + protected $solving_mode = 0; + /** + * Truncates the number of validation errors returned. These errors are + * typically attached to an INVALID_ARGUMENT error payload as a BadRequest + * error detail (https://cloud.google.com/apis/design/errors#error_details), + * unless solving_mode=VALIDATE_ONLY: see the + * [OptimizeToursResponse.validation_errors][google.cloud.optimization.v1.OptimizeToursResponse.validation_errors] + * field. + * This defaults to 100 and is capped at 10,000. + * + * Generated from protobuf field optional int32 max_validation_errors = 5; + */ + protected $max_validation_errors = null; + /** + * Search mode used to solve the request. + * + * Generated from protobuf field .google.cloud.optimization.v1.OptimizeToursRequest.SearchMode search_mode = 6; + */ + protected $search_mode = 0; + /** + * Guide the optimization algorithm in finding a first solution that is + * similar to a previous solution. + * The model is constrained when the first solution is built. + * Any shipments not performed on a route are implicitly skipped in the first + * solution, but they may be performed in successive solutions. + * The solution must satisfy some basic validity assumptions: + * * for all routes, `vehicle_index` must be in range and not be duplicated. + * * for all visits, `shipment_index` and `visit_request_index` must be + * in range. + * * a shipment may only be referenced on one route. + * * the pickup of a pickup-delivery shipment must be performed before + * the delivery. + * * no more than one pickup alternative or delivery alternative of + * a shipment may be performed. + * * for all routes, times are increasing (i.e., `vehicle_start_time + * <= visits[0].start_time <= visits[1].start_time ... + * <= vehicle_end_time`). + * * a shipment may only be performed on a vehicle that is allowed. A + * vehicle is allowed if + * [Shipment.allowed_vehicle_indices][google.cloud.optimization.v1.Shipment.allowed_vehicle_indices] + * is empty or its `vehicle_index` is included in + * [Shipment.allowed_vehicle_indices][google.cloud.optimization.v1.Shipment.allowed_vehicle_indices]. + * If the injected solution is not feasible, a validation error is not + * necessarily returned and an error indicating infeasibility may be returned + * instead. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentRoute injected_first_solution_routes = 7; + */ + private $injected_first_solution_routes; + /** + * Constrain the optimization algorithm to find a final solution that is + * similar to a previous solution. For example, this may be used to freeze + * portions of routes which have already been completed or which are to be + * completed but must not be modified. + * If the injected solution is not feasible, a validation error is not + * necessarily returned and an error indicating infeasibility may be returned + * instead. + * + * Generated from protobuf field .google.cloud.optimization.v1.InjectedSolutionConstraint injected_solution_constraint = 8; + */ + protected $injected_solution_constraint = null; + /** + * If non-empty, the given routes will be refreshed, without modifying their + * underlying sequence of visits or travel times: only other details will be + * updated. This does not solve the model. + * As of 2020/11, this only populates the polylines of non-empty routes and + * requires that `populate_polylines` is true. + * The `route_polyline` fields of the passed-in routes may be inconsistent + * with route `transitions`. + * This field must not be used together with `injected_first_solution_routes` + * or `injected_solution_constraint`. + * `Shipment.ignore` and `Vehicle.ignore` have no effect on the behavior. + * Polylines are still populated between all visits in all non-empty routes + * regardless of whether the related shipments or vehicles are ignored. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentRoute refresh_details_routes = 9; + */ + private $refresh_details_routes; + /** + * If true: + * * uses + * [ShipmentRoute.vehicle_label][google.cloud.optimization.v1.ShipmentRoute.vehicle_label] + * instead of `vehicle_index` to + * match routes in an injected solution with vehicles in the request; + * reuses the mapping of original + * [ShipmentRoute.vehicle_index][google.cloud.optimization.v1.ShipmentRoute.vehicle_index] + * to new + * [ShipmentRoute.vehicle_index][google.cloud.optimization.v1.ShipmentRoute.vehicle_index] + * to update + * [ConstraintRelaxation.vehicle_indices][google.cloud.optimization.v1.InjectedSolutionConstraint.ConstraintRelaxation.vehicle_indices] + * if non-empty, but the mapping must be unambiguous (i.e., multiple + * `ShipmentRoute`s must not share the same original `vehicle_index`). + * * uses + * [ShipmentRoute.Visit.shipment_label][google.cloud.optimization.v1.ShipmentRoute.Visit.shipment_label] + * instead of `shipment_index` + * to match visits in an injected solution with shipments in the request; + * * uses + * [SkippedShipment.label][google.cloud.optimization.v1.SkippedShipment.label] + * instead of + * [SkippedShipment.index][google.cloud.optimization.v1.SkippedShipment.index] + * to + * match skipped shipments in the injected solution with request + * shipments. + * This interpretation applies to the `injected_first_solution_routes`, + * `injected_solution_constraint`, and `refresh_details_routes` fields. + * It can be used when shipment or vehicle indices in the request have + * changed since the solution was created, perhaps because shipments or + * vehicles have been removed from or added to the request. + * If true, labels in the following categories must appear at most once in + * their category: + * * [Vehicle.label][google.cloud.optimization.v1.Vehicle.label] in the + * request; + * * [Shipment.label][google.cloud.optimization.v1.Shipment.label] in the + * request; + * * [ShipmentRoute.vehicle_label][google.cloud.optimization.v1.ShipmentRoute.vehicle_label] in the injected solution; + * * [SkippedShipment.label][google.cloud.optimization.v1.SkippedShipment.label] and [ShipmentRoute.Visit.shipment_label][google.cloud.optimization.v1.ShipmentRoute.Visit.shipment_label] in + * the injected solution (except pickup/delivery visit pairs, whose + * `shipment_label` must appear twice). + * If a `vehicle_label` in the injected solution does not correspond to a + * request vehicle, the corresponding route is removed from the solution + * along with its visits. If a `shipment_label` in the injected solution does + * not correspond to a request shipment, the corresponding visit is removed + * from the solution. If a + * [SkippedShipment.label][google.cloud.optimization.v1.SkippedShipment.label] + * in the injected solution does not correspond to a request shipment, the + * `SkippedShipment` is removed from the solution. + * Removing route visits or entire routes from an injected solution may + * have an effect on the implied constraints, which may lead to change in + * solution, validation errors, or infeasibility. + * NOTE: The caller must ensure that each + * [Vehicle.label][google.cloud.optimization.v1.Vehicle.label] (resp. + * [Shipment.label][google.cloud.optimization.v1.Shipment.label]) uniquely + * identifies a vehicle (resp. shipment) entity used across the two relevant + * requests: the past request that produced the `OptimizeToursResponse` used + * in the injected solution and the current request that includes the injected + * solution. The uniqueness checks described above are not enough to guarantee + * this requirement. + * + * Generated from protobuf field bool interpret_injected_solutions_using_labels = 10; + */ + protected $interpret_injected_solutions_using_labels = false; + /** + * Consider traffic estimation in calculating `ShipmentRoute` fields + * [Transition.travel_duration][google.cloud.optimization.v1.ShipmentRoute.Transition.travel_duration], + * [Visit.start_time][google.cloud.optimization.v1.ShipmentRoute.Visit.start_time], + * and `vehicle_end_time`; in setting the + * [ShipmentRoute.has_traffic_infeasibilities][google.cloud.optimization.v1.ShipmentRoute.has_traffic_infeasibilities] + * field, and in calculating the + * [OptimizeToursResponse.total_cost][google.cloud.optimization.v1.OptimizeToursResponse.total_cost] + * field. + * + * Generated from protobuf field bool consider_road_traffic = 11; + */ + protected $consider_road_traffic = false; + /** + * If true, polylines will be populated in response `ShipmentRoute`s. + * + * Generated from protobuf field bool populate_polylines = 12; + */ + protected $populate_polylines = false; + /** + * If true, polylines will be populated in response + * [ShipmentRoute.transitions][google.cloud.optimization.v1.ShipmentRoute.transitions]. + * Note that in this case, the polylines will also be populated in the + * deprecated `travel_steps`. + * + * Generated from protobuf field bool populate_transition_polylines = 13; + */ + protected $populate_transition_polylines = false; + /** + * If this is set, then the request can have a deadline + * (see https://grpc.io/blog/deadlines) of up to 60 minutes. + * Otherwise, the maximum deadline is only 30 minutes. + * Note that long-lived requests have a significantly larger (but still small) + * risk of interruption. + * + * Generated from protobuf field bool allow_large_deadline_despite_interruption_risk = 14; + */ + protected $allow_large_deadline_despite_interruption_risk = false; + /** + * If true, travel distances will be computed using geodesic distances instead + * of Google Maps distances, and travel times will be computed using geodesic + * distances with a speed defined by `geodesic_meters_per_second`. + * + * Generated from protobuf field bool use_geodesic_distances = 15; + */ + protected $use_geodesic_distances = false; + /** + * When `use_geodesic_distances` is true, this field must be set and defines + * the speed applied to compute travel times. Its value must be at least 1.0 + * meters/seconds. + * + * Generated from protobuf field optional double geodesic_meters_per_second = 16; + */ + protected $geodesic_meters_per_second = null; + /** + * Label that may be used to identify this request, reported back in the + * [OptimizeToursResponse.request_label][google.cloud.optimization.v1.OptimizeToursResponse.request_label]. + * + * Generated from protobuf field string label = 17; + */ + protected $label = ''; + /** + * Deprecated: Use + * [OptimizeToursRequest.populate_transition_polylines][google.cloud.optimization.v1.OptimizeToursRequest.populate_transition_polylines] + * instead. If true, polylines will be populated in response + * [ShipmentRoute.transitions][google.cloud.optimization.v1.ShipmentRoute.transitions]. + * Note that in this case, the polylines will also be populated in the + * deprecated `travel_steps`. + * + * Generated from protobuf field bool populate_travel_step_polylines = 20 [deprecated = true]; + * @deprecated + */ + protected $populate_travel_step_polylines = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. Target project and location to make a call. + * Format: `projects/{project-id}/locations/{location-id}`. + * If no location is specified, a region will be chosen automatically. + * @type \Google\Protobuf\Duration $timeout + * If this timeout is set, the server returns a response before the timeout + * period has elapsed or the server deadline for synchronous requests is + * reached, whichever is sooner. + * For asynchronous requests, the server will generate a solution (if + * possible) before the timeout has elapsed. + * @type \Google\Cloud\Optimization\V1\ShipmentModel $model + * Shipment model to solve. + * @type int $solving_mode + * By default, the solving mode is `DEFAULT_SOLVE` (0). + * @type int $max_validation_errors + * Truncates the number of validation errors returned. These errors are + * typically attached to an INVALID_ARGUMENT error payload as a BadRequest + * error detail (https://cloud.google.com/apis/design/errors#error_details), + * unless solving_mode=VALIDATE_ONLY: see the + * [OptimizeToursResponse.validation_errors][google.cloud.optimization.v1.OptimizeToursResponse.validation_errors] + * field. + * This defaults to 100 and is capped at 10,000. + * @type int $search_mode + * Search mode used to solve the request. + * @type array<\Google\Cloud\Optimization\V1\ShipmentRoute>|\Google\Protobuf\Internal\RepeatedField $injected_first_solution_routes + * Guide the optimization algorithm in finding a first solution that is + * similar to a previous solution. + * The model is constrained when the first solution is built. + * Any shipments not performed on a route are implicitly skipped in the first + * solution, but they may be performed in successive solutions. + * The solution must satisfy some basic validity assumptions: + * * for all routes, `vehicle_index` must be in range and not be duplicated. + * * for all visits, `shipment_index` and `visit_request_index` must be + * in range. + * * a shipment may only be referenced on one route. + * * the pickup of a pickup-delivery shipment must be performed before + * the delivery. + * * no more than one pickup alternative or delivery alternative of + * a shipment may be performed. + * * for all routes, times are increasing (i.e., `vehicle_start_time + * <= visits[0].start_time <= visits[1].start_time ... + * <= vehicle_end_time`). + * * a shipment may only be performed on a vehicle that is allowed. A + * vehicle is allowed if + * [Shipment.allowed_vehicle_indices][google.cloud.optimization.v1.Shipment.allowed_vehicle_indices] + * is empty or its `vehicle_index` is included in + * [Shipment.allowed_vehicle_indices][google.cloud.optimization.v1.Shipment.allowed_vehicle_indices]. + * If the injected solution is not feasible, a validation error is not + * necessarily returned and an error indicating infeasibility may be returned + * instead. + * @type \Google\Cloud\Optimization\V1\InjectedSolutionConstraint $injected_solution_constraint + * Constrain the optimization algorithm to find a final solution that is + * similar to a previous solution. For example, this may be used to freeze + * portions of routes which have already been completed or which are to be + * completed but must not be modified. + * If the injected solution is not feasible, a validation error is not + * necessarily returned and an error indicating infeasibility may be returned + * instead. + * @type array<\Google\Cloud\Optimization\V1\ShipmentRoute>|\Google\Protobuf\Internal\RepeatedField $refresh_details_routes + * If non-empty, the given routes will be refreshed, without modifying their + * underlying sequence of visits or travel times: only other details will be + * updated. This does not solve the model. + * As of 2020/11, this only populates the polylines of non-empty routes and + * requires that `populate_polylines` is true. + * The `route_polyline` fields of the passed-in routes may be inconsistent + * with route `transitions`. + * This field must not be used together with `injected_first_solution_routes` + * or `injected_solution_constraint`. + * `Shipment.ignore` and `Vehicle.ignore` have no effect on the behavior. + * Polylines are still populated between all visits in all non-empty routes + * regardless of whether the related shipments or vehicles are ignored. + * @type bool $interpret_injected_solutions_using_labels + * If true: + * * uses + * [ShipmentRoute.vehicle_label][google.cloud.optimization.v1.ShipmentRoute.vehicle_label] + * instead of `vehicle_index` to + * match routes in an injected solution with vehicles in the request; + * reuses the mapping of original + * [ShipmentRoute.vehicle_index][google.cloud.optimization.v1.ShipmentRoute.vehicle_index] + * to new + * [ShipmentRoute.vehicle_index][google.cloud.optimization.v1.ShipmentRoute.vehicle_index] + * to update + * [ConstraintRelaxation.vehicle_indices][google.cloud.optimization.v1.InjectedSolutionConstraint.ConstraintRelaxation.vehicle_indices] + * if non-empty, but the mapping must be unambiguous (i.e., multiple + * `ShipmentRoute`s must not share the same original `vehicle_index`). + * * uses + * [ShipmentRoute.Visit.shipment_label][google.cloud.optimization.v1.ShipmentRoute.Visit.shipment_label] + * instead of `shipment_index` + * to match visits in an injected solution with shipments in the request; + * * uses + * [SkippedShipment.label][google.cloud.optimization.v1.SkippedShipment.label] + * instead of + * [SkippedShipment.index][google.cloud.optimization.v1.SkippedShipment.index] + * to + * match skipped shipments in the injected solution with request + * shipments. + * This interpretation applies to the `injected_first_solution_routes`, + * `injected_solution_constraint`, and `refresh_details_routes` fields. + * It can be used when shipment or vehicle indices in the request have + * changed since the solution was created, perhaps because shipments or + * vehicles have been removed from or added to the request. + * If true, labels in the following categories must appear at most once in + * their category: + * * [Vehicle.label][google.cloud.optimization.v1.Vehicle.label] in the + * request; + * * [Shipment.label][google.cloud.optimization.v1.Shipment.label] in the + * request; + * * [ShipmentRoute.vehicle_label][google.cloud.optimization.v1.ShipmentRoute.vehicle_label] in the injected solution; + * * [SkippedShipment.label][google.cloud.optimization.v1.SkippedShipment.label] and [ShipmentRoute.Visit.shipment_label][google.cloud.optimization.v1.ShipmentRoute.Visit.shipment_label] in + * the injected solution (except pickup/delivery visit pairs, whose + * `shipment_label` must appear twice). + * If a `vehicle_label` in the injected solution does not correspond to a + * request vehicle, the corresponding route is removed from the solution + * along with its visits. If a `shipment_label` in the injected solution does + * not correspond to a request shipment, the corresponding visit is removed + * from the solution. If a + * [SkippedShipment.label][google.cloud.optimization.v1.SkippedShipment.label] + * in the injected solution does not correspond to a request shipment, the + * `SkippedShipment` is removed from the solution. + * Removing route visits or entire routes from an injected solution may + * have an effect on the implied constraints, which may lead to change in + * solution, validation errors, or infeasibility. + * NOTE: The caller must ensure that each + * [Vehicle.label][google.cloud.optimization.v1.Vehicle.label] (resp. + * [Shipment.label][google.cloud.optimization.v1.Shipment.label]) uniquely + * identifies a vehicle (resp. shipment) entity used across the two relevant + * requests: the past request that produced the `OptimizeToursResponse` used + * in the injected solution and the current request that includes the injected + * solution. The uniqueness checks described above are not enough to guarantee + * this requirement. + * @type bool $consider_road_traffic + * Consider traffic estimation in calculating `ShipmentRoute` fields + * [Transition.travel_duration][google.cloud.optimization.v1.ShipmentRoute.Transition.travel_duration], + * [Visit.start_time][google.cloud.optimization.v1.ShipmentRoute.Visit.start_time], + * and `vehicle_end_time`; in setting the + * [ShipmentRoute.has_traffic_infeasibilities][google.cloud.optimization.v1.ShipmentRoute.has_traffic_infeasibilities] + * field, and in calculating the + * [OptimizeToursResponse.total_cost][google.cloud.optimization.v1.OptimizeToursResponse.total_cost] + * field. + * @type bool $populate_polylines + * If true, polylines will be populated in response `ShipmentRoute`s. + * @type bool $populate_transition_polylines + * If true, polylines will be populated in response + * [ShipmentRoute.transitions][google.cloud.optimization.v1.ShipmentRoute.transitions]. + * Note that in this case, the polylines will also be populated in the + * deprecated `travel_steps`. + * @type bool $allow_large_deadline_despite_interruption_risk + * If this is set, then the request can have a deadline + * (see https://grpc.io/blog/deadlines) of up to 60 minutes. + * Otherwise, the maximum deadline is only 30 minutes. + * Note that long-lived requests have a significantly larger (but still small) + * risk of interruption. + * @type bool $use_geodesic_distances + * If true, travel distances will be computed using geodesic distances instead + * of Google Maps distances, and travel times will be computed using geodesic + * distances with a speed defined by `geodesic_meters_per_second`. + * @type float $geodesic_meters_per_second + * When `use_geodesic_distances` is true, this field must be set and defines + * the speed applied to compute travel times. Its value must be at least 1.0 + * meters/seconds. + * @type string $label + * Label that may be used to identify this request, reported back in the + * [OptimizeToursResponse.request_label][google.cloud.optimization.v1.OptimizeToursResponse.request_label]. + * @type bool $populate_travel_step_polylines + * Deprecated: Use + * [OptimizeToursRequest.populate_transition_polylines][google.cloud.optimization.v1.OptimizeToursRequest.populate_transition_polylines] + * instead. If true, polylines will be populated in response + * [ShipmentRoute.transitions][google.cloud.optimization.v1.ShipmentRoute.transitions]. + * Note that in this case, the polylines will also be populated in the + * deprecated `travel_steps`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * Required. Target project and location to make a call. + * Format: `projects/{project-id}/locations/{location-id}`. + * If no location is specified, a region will be chosen automatically. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. Target project and location to make a call. + * Format: `projects/{project-id}/locations/{location-id}`. + * If no location is specified, a region will be chosen automatically. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * If this timeout is set, the server returns a response before the timeout + * period has elapsed or the server deadline for synchronous requests is + * reached, whichever is sooner. + * For asynchronous requests, the server will generate a solution (if + * possible) before the timeout has elapsed. + * + * Generated from protobuf field .google.protobuf.Duration timeout = 2; + * @return \Google\Protobuf\Duration|null + */ + public function getTimeout() + { + return $this->timeout; + } + + public function hasTimeout() + { + return isset($this->timeout); + } + + public function clearTimeout() + { + unset($this->timeout); + } + + /** + * If this timeout is set, the server returns a response before the timeout + * period has elapsed or the server deadline for synchronous requests is + * reached, whichever is sooner. + * For asynchronous requests, the server will generate a solution (if + * possible) before the timeout has elapsed. + * + * Generated from protobuf field .google.protobuf.Duration timeout = 2; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setTimeout($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->timeout = $var; + + return $this; + } + + /** + * Shipment model to solve. + * + * Generated from protobuf field .google.cloud.optimization.v1.ShipmentModel model = 3; + * @return \Google\Cloud\Optimization\V1\ShipmentModel|null + */ + public function getModel() + { + return $this->model; + } + + public function hasModel() + { + return isset($this->model); + } + + public function clearModel() + { + unset($this->model); + } + + /** + * Shipment model to solve. + * + * Generated from protobuf field .google.cloud.optimization.v1.ShipmentModel model = 3; + * @param \Google\Cloud\Optimization\V1\ShipmentModel $var + * @return $this + */ + public function setModel($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Optimization\V1\ShipmentModel::class); + $this->model = $var; + + return $this; + } + + /** + * By default, the solving mode is `DEFAULT_SOLVE` (0). + * + * Generated from protobuf field .google.cloud.optimization.v1.OptimizeToursRequest.SolvingMode solving_mode = 4; + * @return int + */ + public function getSolvingMode() + { + return $this->solving_mode; + } + + /** + * By default, the solving mode is `DEFAULT_SOLVE` (0). + * + * Generated from protobuf field .google.cloud.optimization.v1.OptimizeToursRequest.SolvingMode solving_mode = 4; + * @param int $var + * @return $this + */ + public function setSolvingMode($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Optimization\V1\OptimizeToursRequest\SolvingMode::class); + $this->solving_mode = $var; + + return $this; + } + + /** + * Truncates the number of validation errors returned. These errors are + * typically attached to an INVALID_ARGUMENT error payload as a BadRequest + * error detail (https://cloud.google.com/apis/design/errors#error_details), + * unless solving_mode=VALIDATE_ONLY: see the + * [OptimizeToursResponse.validation_errors][google.cloud.optimization.v1.OptimizeToursResponse.validation_errors] + * field. + * This defaults to 100 and is capped at 10,000. + * + * Generated from protobuf field optional int32 max_validation_errors = 5; + * @return int + */ + public function getMaxValidationErrors() + { + return isset($this->max_validation_errors) ? $this->max_validation_errors : 0; + } + + public function hasMaxValidationErrors() + { + return isset($this->max_validation_errors); + } + + public function clearMaxValidationErrors() + { + unset($this->max_validation_errors); + } + + /** + * Truncates the number of validation errors returned. These errors are + * typically attached to an INVALID_ARGUMENT error payload as a BadRequest + * error detail (https://cloud.google.com/apis/design/errors#error_details), + * unless solving_mode=VALIDATE_ONLY: see the + * [OptimizeToursResponse.validation_errors][google.cloud.optimization.v1.OptimizeToursResponse.validation_errors] + * field. + * This defaults to 100 and is capped at 10,000. + * + * Generated from protobuf field optional int32 max_validation_errors = 5; + * @param int $var + * @return $this + */ + public function setMaxValidationErrors($var) + { + GPBUtil::checkInt32($var); + $this->max_validation_errors = $var; + + return $this; + } + + /** + * Search mode used to solve the request. + * + * Generated from protobuf field .google.cloud.optimization.v1.OptimizeToursRequest.SearchMode search_mode = 6; + * @return int + */ + public function getSearchMode() + { + return $this->search_mode; + } + + /** + * Search mode used to solve the request. + * + * Generated from protobuf field .google.cloud.optimization.v1.OptimizeToursRequest.SearchMode search_mode = 6; + * @param int $var + * @return $this + */ + public function setSearchMode($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Optimization\V1\OptimizeToursRequest\SearchMode::class); + $this->search_mode = $var; + + return $this; + } + + /** + * Guide the optimization algorithm in finding a first solution that is + * similar to a previous solution. + * The model is constrained when the first solution is built. + * Any shipments not performed on a route are implicitly skipped in the first + * solution, but they may be performed in successive solutions. + * The solution must satisfy some basic validity assumptions: + * * for all routes, `vehicle_index` must be in range and not be duplicated. + * * for all visits, `shipment_index` and `visit_request_index` must be + * in range. + * * a shipment may only be referenced on one route. + * * the pickup of a pickup-delivery shipment must be performed before + * the delivery. + * * no more than one pickup alternative or delivery alternative of + * a shipment may be performed. + * * for all routes, times are increasing (i.e., `vehicle_start_time + * <= visits[0].start_time <= visits[1].start_time ... + * <= vehicle_end_time`). + * * a shipment may only be performed on a vehicle that is allowed. A + * vehicle is allowed if + * [Shipment.allowed_vehicle_indices][google.cloud.optimization.v1.Shipment.allowed_vehicle_indices] + * is empty or its `vehicle_index` is included in + * [Shipment.allowed_vehicle_indices][google.cloud.optimization.v1.Shipment.allowed_vehicle_indices]. + * If the injected solution is not feasible, a validation error is not + * necessarily returned and an error indicating infeasibility may be returned + * instead. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentRoute injected_first_solution_routes = 7; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getInjectedFirstSolutionRoutes() + { + return $this->injected_first_solution_routes; + } + + /** + * Guide the optimization algorithm in finding a first solution that is + * similar to a previous solution. + * The model is constrained when the first solution is built. + * Any shipments not performed on a route are implicitly skipped in the first + * solution, but they may be performed in successive solutions. + * The solution must satisfy some basic validity assumptions: + * * for all routes, `vehicle_index` must be in range and not be duplicated. + * * for all visits, `shipment_index` and `visit_request_index` must be + * in range. + * * a shipment may only be referenced on one route. + * * the pickup of a pickup-delivery shipment must be performed before + * the delivery. + * * no more than one pickup alternative or delivery alternative of + * a shipment may be performed. + * * for all routes, times are increasing (i.e., `vehicle_start_time + * <= visits[0].start_time <= visits[1].start_time ... + * <= vehicle_end_time`). + * * a shipment may only be performed on a vehicle that is allowed. A + * vehicle is allowed if + * [Shipment.allowed_vehicle_indices][google.cloud.optimization.v1.Shipment.allowed_vehicle_indices] + * is empty or its `vehicle_index` is included in + * [Shipment.allowed_vehicle_indices][google.cloud.optimization.v1.Shipment.allowed_vehicle_indices]. + * If the injected solution is not feasible, a validation error is not + * necessarily returned and an error indicating infeasibility may be returned + * instead. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentRoute injected_first_solution_routes = 7; + * @param array<\Google\Cloud\Optimization\V1\ShipmentRoute>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setInjectedFirstSolutionRoutes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\ShipmentRoute::class); + $this->injected_first_solution_routes = $arr; + + return $this; + } + + /** + * Constrain the optimization algorithm to find a final solution that is + * similar to a previous solution. For example, this may be used to freeze + * portions of routes which have already been completed or which are to be + * completed but must not be modified. + * If the injected solution is not feasible, a validation error is not + * necessarily returned and an error indicating infeasibility may be returned + * instead. + * + * Generated from protobuf field .google.cloud.optimization.v1.InjectedSolutionConstraint injected_solution_constraint = 8; + * @return \Google\Cloud\Optimization\V1\InjectedSolutionConstraint|null + */ + public function getInjectedSolutionConstraint() + { + return $this->injected_solution_constraint; + } + + public function hasInjectedSolutionConstraint() + { + return isset($this->injected_solution_constraint); + } + + public function clearInjectedSolutionConstraint() + { + unset($this->injected_solution_constraint); + } + + /** + * Constrain the optimization algorithm to find a final solution that is + * similar to a previous solution. For example, this may be used to freeze + * portions of routes which have already been completed or which are to be + * completed but must not be modified. + * If the injected solution is not feasible, a validation error is not + * necessarily returned and an error indicating infeasibility may be returned + * instead. + * + * Generated from protobuf field .google.cloud.optimization.v1.InjectedSolutionConstraint injected_solution_constraint = 8; + * @param \Google\Cloud\Optimization\V1\InjectedSolutionConstraint $var + * @return $this + */ + public function setInjectedSolutionConstraint($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Optimization\V1\InjectedSolutionConstraint::class); + $this->injected_solution_constraint = $var; + + return $this; + } + + /** + * If non-empty, the given routes will be refreshed, without modifying their + * underlying sequence of visits or travel times: only other details will be + * updated. This does not solve the model. + * As of 2020/11, this only populates the polylines of non-empty routes and + * requires that `populate_polylines` is true. + * The `route_polyline` fields of the passed-in routes may be inconsistent + * with route `transitions`. + * This field must not be used together with `injected_first_solution_routes` + * or `injected_solution_constraint`. + * `Shipment.ignore` and `Vehicle.ignore` have no effect on the behavior. + * Polylines are still populated between all visits in all non-empty routes + * regardless of whether the related shipments or vehicles are ignored. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentRoute refresh_details_routes = 9; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRefreshDetailsRoutes() + { + return $this->refresh_details_routes; + } + + /** + * If non-empty, the given routes will be refreshed, without modifying their + * underlying sequence of visits or travel times: only other details will be + * updated. This does not solve the model. + * As of 2020/11, this only populates the polylines of non-empty routes and + * requires that `populate_polylines` is true. + * The `route_polyline` fields of the passed-in routes may be inconsistent + * with route `transitions`. + * This field must not be used together with `injected_first_solution_routes` + * or `injected_solution_constraint`. + * `Shipment.ignore` and `Vehicle.ignore` have no effect on the behavior. + * Polylines are still populated between all visits in all non-empty routes + * regardless of whether the related shipments or vehicles are ignored. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentRoute refresh_details_routes = 9; + * @param array<\Google\Cloud\Optimization\V1\ShipmentRoute>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRefreshDetailsRoutes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\ShipmentRoute::class); + $this->refresh_details_routes = $arr; + + return $this; + } + + /** + * If true: + * * uses + * [ShipmentRoute.vehicle_label][google.cloud.optimization.v1.ShipmentRoute.vehicle_label] + * instead of `vehicle_index` to + * match routes in an injected solution with vehicles in the request; + * reuses the mapping of original + * [ShipmentRoute.vehicle_index][google.cloud.optimization.v1.ShipmentRoute.vehicle_index] + * to new + * [ShipmentRoute.vehicle_index][google.cloud.optimization.v1.ShipmentRoute.vehicle_index] + * to update + * [ConstraintRelaxation.vehicle_indices][google.cloud.optimization.v1.InjectedSolutionConstraint.ConstraintRelaxation.vehicle_indices] + * if non-empty, but the mapping must be unambiguous (i.e., multiple + * `ShipmentRoute`s must not share the same original `vehicle_index`). + * * uses + * [ShipmentRoute.Visit.shipment_label][google.cloud.optimization.v1.ShipmentRoute.Visit.shipment_label] + * instead of `shipment_index` + * to match visits in an injected solution with shipments in the request; + * * uses + * [SkippedShipment.label][google.cloud.optimization.v1.SkippedShipment.label] + * instead of + * [SkippedShipment.index][google.cloud.optimization.v1.SkippedShipment.index] + * to + * match skipped shipments in the injected solution with request + * shipments. + * This interpretation applies to the `injected_first_solution_routes`, + * `injected_solution_constraint`, and `refresh_details_routes` fields. + * It can be used when shipment or vehicle indices in the request have + * changed since the solution was created, perhaps because shipments or + * vehicles have been removed from or added to the request. + * If true, labels in the following categories must appear at most once in + * their category: + * * [Vehicle.label][google.cloud.optimization.v1.Vehicle.label] in the + * request; + * * [Shipment.label][google.cloud.optimization.v1.Shipment.label] in the + * request; + * * [ShipmentRoute.vehicle_label][google.cloud.optimization.v1.ShipmentRoute.vehicle_label] in the injected solution; + * * [SkippedShipment.label][google.cloud.optimization.v1.SkippedShipment.label] and [ShipmentRoute.Visit.shipment_label][google.cloud.optimization.v1.ShipmentRoute.Visit.shipment_label] in + * the injected solution (except pickup/delivery visit pairs, whose + * `shipment_label` must appear twice). + * If a `vehicle_label` in the injected solution does not correspond to a + * request vehicle, the corresponding route is removed from the solution + * along with its visits. If a `shipment_label` in the injected solution does + * not correspond to a request shipment, the corresponding visit is removed + * from the solution. If a + * [SkippedShipment.label][google.cloud.optimization.v1.SkippedShipment.label] + * in the injected solution does not correspond to a request shipment, the + * `SkippedShipment` is removed from the solution. + * Removing route visits or entire routes from an injected solution may + * have an effect on the implied constraints, which may lead to change in + * solution, validation errors, or infeasibility. + * NOTE: The caller must ensure that each + * [Vehicle.label][google.cloud.optimization.v1.Vehicle.label] (resp. + * [Shipment.label][google.cloud.optimization.v1.Shipment.label]) uniquely + * identifies a vehicle (resp. shipment) entity used across the two relevant + * requests: the past request that produced the `OptimizeToursResponse` used + * in the injected solution and the current request that includes the injected + * solution. The uniqueness checks described above are not enough to guarantee + * this requirement. + * + * Generated from protobuf field bool interpret_injected_solutions_using_labels = 10; + * @return bool + */ + public function getInterpretInjectedSolutionsUsingLabels() + { + return $this->interpret_injected_solutions_using_labels; + } + + /** + * If true: + * * uses + * [ShipmentRoute.vehicle_label][google.cloud.optimization.v1.ShipmentRoute.vehicle_label] + * instead of `vehicle_index` to + * match routes in an injected solution with vehicles in the request; + * reuses the mapping of original + * [ShipmentRoute.vehicle_index][google.cloud.optimization.v1.ShipmentRoute.vehicle_index] + * to new + * [ShipmentRoute.vehicle_index][google.cloud.optimization.v1.ShipmentRoute.vehicle_index] + * to update + * [ConstraintRelaxation.vehicle_indices][google.cloud.optimization.v1.InjectedSolutionConstraint.ConstraintRelaxation.vehicle_indices] + * if non-empty, but the mapping must be unambiguous (i.e., multiple + * `ShipmentRoute`s must not share the same original `vehicle_index`). + * * uses + * [ShipmentRoute.Visit.shipment_label][google.cloud.optimization.v1.ShipmentRoute.Visit.shipment_label] + * instead of `shipment_index` + * to match visits in an injected solution with shipments in the request; + * * uses + * [SkippedShipment.label][google.cloud.optimization.v1.SkippedShipment.label] + * instead of + * [SkippedShipment.index][google.cloud.optimization.v1.SkippedShipment.index] + * to + * match skipped shipments in the injected solution with request + * shipments. + * This interpretation applies to the `injected_first_solution_routes`, + * `injected_solution_constraint`, and `refresh_details_routes` fields. + * It can be used when shipment or vehicle indices in the request have + * changed since the solution was created, perhaps because shipments or + * vehicles have been removed from or added to the request. + * If true, labels in the following categories must appear at most once in + * their category: + * * [Vehicle.label][google.cloud.optimization.v1.Vehicle.label] in the + * request; + * * [Shipment.label][google.cloud.optimization.v1.Shipment.label] in the + * request; + * * [ShipmentRoute.vehicle_label][google.cloud.optimization.v1.ShipmentRoute.vehicle_label] in the injected solution; + * * [SkippedShipment.label][google.cloud.optimization.v1.SkippedShipment.label] and [ShipmentRoute.Visit.shipment_label][google.cloud.optimization.v1.ShipmentRoute.Visit.shipment_label] in + * the injected solution (except pickup/delivery visit pairs, whose + * `shipment_label` must appear twice). + * If a `vehicle_label` in the injected solution does not correspond to a + * request vehicle, the corresponding route is removed from the solution + * along with its visits. If a `shipment_label` in the injected solution does + * not correspond to a request shipment, the corresponding visit is removed + * from the solution. If a + * [SkippedShipment.label][google.cloud.optimization.v1.SkippedShipment.label] + * in the injected solution does not correspond to a request shipment, the + * `SkippedShipment` is removed from the solution. + * Removing route visits or entire routes from an injected solution may + * have an effect on the implied constraints, which may lead to change in + * solution, validation errors, or infeasibility. + * NOTE: The caller must ensure that each + * [Vehicle.label][google.cloud.optimization.v1.Vehicle.label] (resp. + * [Shipment.label][google.cloud.optimization.v1.Shipment.label]) uniquely + * identifies a vehicle (resp. shipment) entity used across the two relevant + * requests: the past request that produced the `OptimizeToursResponse` used + * in the injected solution and the current request that includes the injected + * solution. The uniqueness checks described above are not enough to guarantee + * this requirement. + * + * Generated from protobuf field bool interpret_injected_solutions_using_labels = 10; + * @param bool $var + * @return $this + */ + public function setInterpretInjectedSolutionsUsingLabels($var) + { + GPBUtil::checkBool($var); + $this->interpret_injected_solutions_using_labels = $var; + + return $this; + } + + /** + * Consider traffic estimation in calculating `ShipmentRoute` fields + * [Transition.travel_duration][google.cloud.optimization.v1.ShipmentRoute.Transition.travel_duration], + * [Visit.start_time][google.cloud.optimization.v1.ShipmentRoute.Visit.start_time], + * and `vehicle_end_time`; in setting the + * [ShipmentRoute.has_traffic_infeasibilities][google.cloud.optimization.v1.ShipmentRoute.has_traffic_infeasibilities] + * field, and in calculating the + * [OptimizeToursResponse.total_cost][google.cloud.optimization.v1.OptimizeToursResponse.total_cost] + * field. + * + * Generated from protobuf field bool consider_road_traffic = 11; + * @return bool + */ + public function getConsiderRoadTraffic() + { + return $this->consider_road_traffic; + } + + /** + * Consider traffic estimation in calculating `ShipmentRoute` fields + * [Transition.travel_duration][google.cloud.optimization.v1.ShipmentRoute.Transition.travel_duration], + * [Visit.start_time][google.cloud.optimization.v1.ShipmentRoute.Visit.start_time], + * and `vehicle_end_time`; in setting the + * [ShipmentRoute.has_traffic_infeasibilities][google.cloud.optimization.v1.ShipmentRoute.has_traffic_infeasibilities] + * field, and in calculating the + * [OptimizeToursResponse.total_cost][google.cloud.optimization.v1.OptimizeToursResponse.total_cost] + * field. + * + * Generated from protobuf field bool consider_road_traffic = 11; + * @param bool $var + * @return $this + */ + public function setConsiderRoadTraffic($var) + { + GPBUtil::checkBool($var); + $this->consider_road_traffic = $var; + + return $this; + } + + /** + * If true, polylines will be populated in response `ShipmentRoute`s. + * + * Generated from protobuf field bool populate_polylines = 12; + * @return bool + */ + public function getPopulatePolylines() + { + return $this->populate_polylines; + } + + /** + * If true, polylines will be populated in response `ShipmentRoute`s. + * + * Generated from protobuf field bool populate_polylines = 12; + * @param bool $var + * @return $this + */ + public function setPopulatePolylines($var) + { + GPBUtil::checkBool($var); + $this->populate_polylines = $var; + + return $this; + } + + /** + * If true, polylines will be populated in response + * [ShipmentRoute.transitions][google.cloud.optimization.v1.ShipmentRoute.transitions]. + * Note that in this case, the polylines will also be populated in the + * deprecated `travel_steps`. + * + * Generated from protobuf field bool populate_transition_polylines = 13; + * @return bool + */ + public function getPopulateTransitionPolylines() + { + return $this->populate_transition_polylines; + } + + /** + * If true, polylines will be populated in response + * [ShipmentRoute.transitions][google.cloud.optimization.v1.ShipmentRoute.transitions]. + * Note that in this case, the polylines will also be populated in the + * deprecated `travel_steps`. + * + * Generated from protobuf field bool populate_transition_polylines = 13; + * @param bool $var + * @return $this + */ + public function setPopulateTransitionPolylines($var) + { + GPBUtil::checkBool($var); + $this->populate_transition_polylines = $var; + + return $this; + } + + /** + * If this is set, then the request can have a deadline + * (see https://grpc.io/blog/deadlines) of up to 60 minutes. + * Otherwise, the maximum deadline is only 30 minutes. + * Note that long-lived requests have a significantly larger (but still small) + * risk of interruption. + * + * Generated from protobuf field bool allow_large_deadline_despite_interruption_risk = 14; + * @return bool + */ + public function getAllowLargeDeadlineDespiteInterruptionRisk() + { + return $this->allow_large_deadline_despite_interruption_risk; + } + + /** + * If this is set, then the request can have a deadline + * (see https://grpc.io/blog/deadlines) of up to 60 minutes. + * Otherwise, the maximum deadline is only 30 minutes. + * Note that long-lived requests have a significantly larger (but still small) + * risk of interruption. + * + * Generated from protobuf field bool allow_large_deadline_despite_interruption_risk = 14; + * @param bool $var + * @return $this + */ + public function setAllowLargeDeadlineDespiteInterruptionRisk($var) + { + GPBUtil::checkBool($var); + $this->allow_large_deadline_despite_interruption_risk = $var; + + return $this; + } + + /** + * If true, travel distances will be computed using geodesic distances instead + * of Google Maps distances, and travel times will be computed using geodesic + * distances with a speed defined by `geodesic_meters_per_second`. + * + * Generated from protobuf field bool use_geodesic_distances = 15; + * @return bool + */ + public function getUseGeodesicDistances() + { + return $this->use_geodesic_distances; + } + + /** + * If true, travel distances will be computed using geodesic distances instead + * of Google Maps distances, and travel times will be computed using geodesic + * distances with a speed defined by `geodesic_meters_per_second`. + * + * Generated from protobuf field bool use_geodesic_distances = 15; + * @param bool $var + * @return $this + */ + public function setUseGeodesicDistances($var) + { + GPBUtil::checkBool($var); + $this->use_geodesic_distances = $var; + + return $this; + } + + /** + * When `use_geodesic_distances` is true, this field must be set and defines + * the speed applied to compute travel times. Its value must be at least 1.0 + * meters/seconds. + * + * Generated from protobuf field optional double geodesic_meters_per_second = 16; + * @return float + */ + public function getGeodesicMetersPerSecond() + { + return isset($this->geodesic_meters_per_second) ? $this->geodesic_meters_per_second : 0.0; + } + + public function hasGeodesicMetersPerSecond() + { + return isset($this->geodesic_meters_per_second); + } + + public function clearGeodesicMetersPerSecond() + { + unset($this->geodesic_meters_per_second); + } + + /** + * When `use_geodesic_distances` is true, this field must be set and defines + * the speed applied to compute travel times. Its value must be at least 1.0 + * meters/seconds. + * + * Generated from protobuf field optional double geodesic_meters_per_second = 16; + * @param float $var + * @return $this + */ + public function setGeodesicMetersPerSecond($var) + { + GPBUtil::checkDouble($var); + $this->geodesic_meters_per_second = $var; + + return $this; + } + + /** + * Label that may be used to identify this request, reported back in the + * [OptimizeToursResponse.request_label][google.cloud.optimization.v1.OptimizeToursResponse.request_label]. + * + * Generated from protobuf field string label = 17; + * @return string + */ + public function getLabel() + { + return $this->label; + } + + /** + * Label that may be used to identify this request, reported back in the + * [OptimizeToursResponse.request_label][google.cloud.optimization.v1.OptimizeToursResponse.request_label]. + * + * Generated from protobuf field string label = 17; + * @param string $var + * @return $this + */ + public function setLabel($var) + { + GPBUtil::checkString($var, True); + $this->label = $var; + + return $this; + } + + /** + * Deprecated: Use + * [OptimizeToursRequest.populate_transition_polylines][google.cloud.optimization.v1.OptimizeToursRequest.populate_transition_polylines] + * instead. If true, polylines will be populated in response + * [ShipmentRoute.transitions][google.cloud.optimization.v1.ShipmentRoute.transitions]. + * Note that in this case, the polylines will also be populated in the + * deprecated `travel_steps`. + * + * Generated from protobuf field bool populate_travel_step_polylines = 20 [deprecated = true]; + * @return bool + * @deprecated + */ + public function getPopulateTravelStepPolylines() + { + @trigger_error('populate_travel_step_polylines is deprecated.', E_USER_DEPRECATED); + return $this->populate_travel_step_polylines; + } + + /** + * Deprecated: Use + * [OptimizeToursRequest.populate_transition_polylines][google.cloud.optimization.v1.OptimizeToursRequest.populate_transition_polylines] + * instead. If true, polylines will be populated in response + * [ShipmentRoute.transitions][google.cloud.optimization.v1.ShipmentRoute.transitions]. + * Note that in this case, the polylines will also be populated in the + * deprecated `travel_steps`. + * + * Generated from protobuf field bool populate_travel_step_polylines = 20 [deprecated = true]; + * @param bool $var + * @return $this + * @deprecated + */ + public function setPopulateTravelStepPolylines($var) + { + @trigger_error('populate_travel_step_polylines is deprecated.', E_USER_DEPRECATED); + GPBUtil::checkBool($var); + $this->populate_travel_step_polylines = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/OptimizeToursRequest/SearchMode.php b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/OptimizeToursRequest/SearchMode.php new file mode 100644 index 000000000000..45c8c781f948 --- /dev/null +++ b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/OptimizeToursRequest/SearchMode.php @@ -0,0 +1,65 @@ +google.cloud.optimization.v1.OptimizeToursRequest.SearchMode + */ +class SearchMode +{ + /** + * Unspecified search mode, equivalent to `RETURN_FAST`. + * + * Generated from protobuf enum SEARCH_MODE_UNSPECIFIED = 0; + */ + const SEARCH_MODE_UNSPECIFIED = 0; + /** + * Stop the search after finding the first good solution. + * + * Generated from protobuf enum RETURN_FAST = 1; + */ + const RETURN_FAST = 1; + /** + * Spend all the available time to search for better solutions. + * + * Generated from protobuf enum CONSUME_ALL_AVAILABLE_TIME = 2; + */ + const CONSUME_ALL_AVAILABLE_TIME = 2; + + private static $valueToName = [ + self::SEARCH_MODE_UNSPECIFIED => 'SEARCH_MODE_UNSPECIFIED', + self::RETURN_FAST => 'RETURN_FAST', + self::CONSUME_ALL_AVAILABLE_TIME => 'CONSUME_ALL_AVAILABLE_TIME', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(SearchMode::class, \Google\Cloud\Optimization\V1\OptimizeToursRequest_SearchMode::class); + diff --git a/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/OptimizeToursRequest/SolvingMode.php b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/OptimizeToursRequest/SolvingMode.php new file mode 100644 index 000000000000..f9327b31bd1b --- /dev/null +++ b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/OptimizeToursRequest/SolvingMode.php @@ -0,0 +1,75 @@ +google.cloud.optimization.v1.OptimizeToursRequest.SolvingMode + */ +class SolvingMode +{ + /** + * Solve the model. + * + * Generated from protobuf enum DEFAULT_SOLVE = 0; + */ + const DEFAULT_SOLVE = 0; + /** + * Only validates the model without solving it: populates as many + * [OptimizeToursResponse.validation_errors][google.cloud.optimization.v1.OptimizeToursResponse.validation_errors] + * as possible. + * + * Generated from protobuf enum VALIDATE_ONLY = 1; + */ + const VALIDATE_ONLY = 1; + /** + * Only populates + * [OptimizeToursResponse.skipped_shipments][google.cloud.optimization.v1.OptimizeToursResponse.skipped_shipments], + * and doesn't actually solve the rest of the request (`status` and `routes` + * are unset in the response). + * *IMPORTANT*: not all infeasible shipments are returned here, but only the + * ones that are detected as infeasible as a preprocessing. + * + * Generated from protobuf enum DETECT_SOME_INFEASIBLE_SHIPMENTS = 2; + */ + const DETECT_SOME_INFEASIBLE_SHIPMENTS = 2; + + private static $valueToName = [ + self::DEFAULT_SOLVE => 'DEFAULT_SOLVE', + self::VALIDATE_ONLY => 'VALIDATE_ONLY', + self::DETECT_SOME_INFEASIBLE_SHIPMENTS => 'DETECT_SOME_INFEASIBLE_SHIPMENTS', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(SolvingMode::class, \Google\Cloud\Optimization\V1\OptimizeToursRequest_SolvingMode::class); + diff --git a/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/OptimizeToursRequest_SearchMode.php b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/OptimizeToursRequest_SearchMode.php new file mode 100644 index 000000000000..a5dca73a093b --- /dev/null +++ b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/OptimizeToursRequest_SearchMode.php @@ -0,0 +1,16 @@ +google.cloud.optimization.v1.OptimizeToursResponse + */ +class OptimizeToursResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Routes computed for each vehicle; the i-th route corresponds to the i-th + * vehicle in the model. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentRoute routes = 1; + */ + private $routes; + /** + * Copy of the + * [OptimizeToursRequest.label][google.cloud.optimization.v1.OptimizeToursRequest.label], + * if a label was specified in the request. + * + * Generated from protobuf field string request_label = 3; + */ + protected $request_label = ''; + /** + * The list of all shipments skipped. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.SkippedShipment skipped_shipments = 4; + */ + private $skipped_shipments; + /** + * List of all the validation errors that we were able to detect + * independently. See the "MULTIPLE ERRORS" explanation for the + * [OptimizeToursValidationError][google.cloud.optimization.v1.OptimizeToursValidationError] + * message. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.OptimizeToursValidationError validation_errors = 5; + */ + private $validation_errors; + /** + * Duration, distance and usage metrics for this solution. + * + * Generated from protobuf field .google.cloud.optimization.v1.OptimizeToursResponse.Metrics metrics = 6; + */ + protected $metrics = null; + /** + * Deprecated: Use + * [Metrics.total_cost][google.cloud.optimization.v1.OptimizeToursResponse.Metrics.total_cost] + * instead. Total cost of the solution. This takes into account all costs: + * costs per per hour and travel hour, fixed vehicle costs, unperformed + * shipment penalty costs, global duration cost, etc. + * + * Generated from protobuf field double total_cost = 2 [deprecated = true]; + * @deprecated + */ + protected $total_cost = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Optimization\V1\ShipmentRoute>|\Google\Protobuf\Internal\RepeatedField $routes + * Routes computed for each vehicle; the i-th route corresponds to the i-th + * vehicle in the model. + * @type string $request_label + * Copy of the + * [OptimizeToursRequest.label][google.cloud.optimization.v1.OptimizeToursRequest.label], + * if a label was specified in the request. + * @type array<\Google\Cloud\Optimization\V1\SkippedShipment>|\Google\Protobuf\Internal\RepeatedField $skipped_shipments + * The list of all shipments skipped. + * @type array<\Google\Cloud\Optimization\V1\OptimizeToursValidationError>|\Google\Protobuf\Internal\RepeatedField $validation_errors + * List of all the validation errors that we were able to detect + * independently. See the "MULTIPLE ERRORS" explanation for the + * [OptimizeToursValidationError][google.cloud.optimization.v1.OptimizeToursValidationError] + * message. + * @type \Google\Cloud\Optimization\V1\OptimizeToursResponse\Metrics $metrics + * Duration, distance and usage metrics for this solution. + * @type float $total_cost + * Deprecated: Use + * [Metrics.total_cost][google.cloud.optimization.v1.OptimizeToursResponse.Metrics.total_cost] + * instead. Total cost of the solution. This takes into account all costs: + * costs per per hour and travel hour, fixed vehicle costs, unperformed + * shipment penalty costs, global duration cost, etc. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * Routes computed for each vehicle; the i-th route corresponds to the i-th + * vehicle in the model. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentRoute routes = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRoutes() + { + return $this->routes; + } + + /** + * Routes computed for each vehicle; the i-th route corresponds to the i-th + * vehicle in the model. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentRoute routes = 1; + * @param array<\Google\Cloud\Optimization\V1\ShipmentRoute>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRoutes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\ShipmentRoute::class); + $this->routes = $arr; + + return $this; + } + + /** + * Copy of the + * [OptimizeToursRequest.label][google.cloud.optimization.v1.OptimizeToursRequest.label], + * if a label was specified in the request. + * + * Generated from protobuf field string request_label = 3; + * @return string + */ + public function getRequestLabel() + { + return $this->request_label; + } + + /** + * Copy of the + * [OptimizeToursRequest.label][google.cloud.optimization.v1.OptimizeToursRequest.label], + * if a label was specified in the request. + * + * Generated from protobuf field string request_label = 3; + * @param string $var + * @return $this + */ + public function setRequestLabel($var) + { + GPBUtil::checkString($var, True); + $this->request_label = $var; + + return $this; + } + + /** + * The list of all shipments skipped. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.SkippedShipment skipped_shipments = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSkippedShipments() + { + return $this->skipped_shipments; + } + + /** + * The list of all shipments skipped. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.SkippedShipment skipped_shipments = 4; + * @param array<\Google\Cloud\Optimization\V1\SkippedShipment>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSkippedShipments($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\SkippedShipment::class); + $this->skipped_shipments = $arr; + + return $this; + } + + /** + * List of all the validation errors that we were able to detect + * independently. See the "MULTIPLE ERRORS" explanation for the + * [OptimizeToursValidationError][google.cloud.optimization.v1.OptimizeToursValidationError] + * message. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.OptimizeToursValidationError validation_errors = 5; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getValidationErrors() + { + return $this->validation_errors; + } + + /** + * List of all the validation errors that we were able to detect + * independently. See the "MULTIPLE ERRORS" explanation for the + * [OptimizeToursValidationError][google.cloud.optimization.v1.OptimizeToursValidationError] + * message. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.OptimizeToursValidationError validation_errors = 5; + * @param array<\Google\Cloud\Optimization\V1\OptimizeToursValidationError>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setValidationErrors($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\OptimizeToursValidationError::class); + $this->validation_errors = $arr; + + return $this; + } + + /** + * Duration, distance and usage metrics for this solution. + * + * Generated from protobuf field .google.cloud.optimization.v1.OptimizeToursResponse.Metrics metrics = 6; + * @return \Google\Cloud\Optimization\V1\OptimizeToursResponse\Metrics|null + */ + public function getMetrics() + { + return $this->metrics; + } + + public function hasMetrics() + { + return isset($this->metrics); + } + + public function clearMetrics() + { + unset($this->metrics); + } + + /** + * Duration, distance and usage metrics for this solution. + * + * Generated from protobuf field .google.cloud.optimization.v1.OptimizeToursResponse.Metrics metrics = 6; + * @param \Google\Cloud\Optimization\V1\OptimizeToursResponse\Metrics $var + * @return $this + */ + public function setMetrics($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Optimization\V1\OptimizeToursResponse\Metrics::class); + $this->metrics = $var; + + return $this; + } + + /** + * Deprecated: Use + * [Metrics.total_cost][google.cloud.optimization.v1.OptimizeToursResponse.Metrics.total_cost] + * instead. Total cost of the solution. This takes into account all costs: + * costs per per hour and travel hour, fixed vehicle costs, unperformed + * shipment penalty costs, global duration cost, etc. + * + * Generated from protobuf field double total_cost = 2 [deprecated = true]; + * @return float + * @deprecated + */ + public function getTotalCost() + { + @trigger_error('total_cost is deprecated.', E_USER_DEPRECATED); + return $this->total_cost; + } + + /** + * Deprecated: Use + * [Metrics.total_cost][google.cloud.optimization.v1.OptimizeToursResponse.Metrics.total_cost] + * instead. Total cost of the solution. This takes into account all costs: + * costs per per hour and travel hour, fixed vehicle costs, unperformed + * shipment penalty costs, global duration cost, etc. + * + * Generated from protobuf field double total_cost = 2 [deprecated = true]; + * @param float $var + * @return $this + * @deprecated + */ + public function setTotalCost($var) + { + @trigger_error('total_cost is deprecated.', E_USER_DEPRECATED); + GPBUtil::checkDouble($var); + $this->total_cost = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/OptimizeToursResponse/Metrics.php b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/OptimizeToursResponse/Metrics.php new file mode 100644 index 000000000000..b4e2c006dd75 --- /dev/null +++ b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/OptimizeToursResponse/Metrics.php @@ -0,0 +1,372 @@ +google.cloud.optimization.v1.OptimizeToursResponse.Metrics + */ +class Metrics extends \Google\Protobuf\Internal\Message +{ + /** + * Aggregated over the routes. Each metric is the sum (or max, for loads) + * over all + * [ShipmentRoute.metrics][google.cloud.optimization.v1.ShipmentRoute.metrics] + * fields of the same name. + * + * Generated from protobuf field .google.cloud.optimization.v1.AggregatedMetrics aggregated_route_metrics = 1; + */ + protected $aggregated_route_metrics = null; + /** + * Number of mandatory shipments skipped. + * + * Generated from protobuf field int32 skipped_mandatory_shipment_count = 2; + */ + protected $skipped_mandatory_shipment_count = 0; + /** + * Number of vehicles used. Note: if a vehicle route is empty and + * [Vehicle.used_if_route_is_empty][google.cloud.optimization.v1.Vehicle.used_if_route_is_empty] + * is true, the vehicle is considered used. + * + * Generated from protobuf field int32 used_vehicle_count = 3; + */ + protected $used_vehicle_count = 0; + /** + * The earliest start time for a used vehicle, computed as the minimum over + * all used vehicles of + * [ShipmentRoute.vehicle_start_time][google.cloud.optimization.v1.ShipmentRoute.vehicle_start_time]. + * + * Generated from protobuf field .google.protobuf.Timestamp earliest_vehicle_start_time = 4; + */ + protected $earliest_vehicle_start_time = null; + /** + * The latest end time for a used vehicle, computed as the maximum over all + * used vehicles of + * [ShipmentRoute.vehicle_end_time][google.cloud.optimization.v1.ShipmentRoute.vehicle_end_time]. + * + * Generated from protobuf field .google.protobuf.Timestamp latest_vehicle_end_time = 5; + */ + protected $latest_vehicle_end_time = null; + /** + * Cost of the solution, broken down by cost-related request fields. + * The keys are proto paths, relative to the input OptimizeToursRequest, + * e.g. "model.shipments.pickups.cost", and the values are the total cost + * generated by the corresponding cost field, aggregated over the whole + * solution. In other words, costs["model.shipments.pickups.cost"] is the + * sum of all pickup costs over the solution. All costs defined in the model + * are reported in detail here with the exception of costs related to + * TransitionAttributes that are only reported in an aggregated way as of + * 2022/01. + * + * Generated from protobuf field map costs = 10; + */ + private $costs; + /** + * Total cost of the solution. The sum of all values in the costs map. + * + * Generated from protobuf field double total_cost = 6; + */ + protected $total_cost = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Optimization\V1\AggregatedMetrics $aggregated_route_metrics + * Aggregated over the routes. Each metric is the sum (or max, for loads) + * over all + * [ShipmentRoute.metrics][google.cloud.optimization.v1.ShipmentRoute.metrics] + * fields of the same name. + * @type int $skipped_mandatory_shipment_count + * Number of mandatory shipments skipped. + * @type int $used_vehicle_count + * Number of vehicles used. Note: if a vehicle route is empty and + * [Vehicle.used_if_route_is_empty][google.cloud.optimization.v1.Vehicle.used_if_route_is_empty] + * is true, the vehicle is considered used. + * @type \Google\Protobuf\Timestamp $earliest_vehicle_start_time + * The earliest start time for a used vehicle, computed as the minimum over + * all used vehicles of + * [ShipmentRoute.vehicle_start_time][google.cloud.optimization.v1.ShipmentRoute.vehicle_start_time]. + * @type \Google\Protobuf\Timestamp $latest_vehicle_end_time + * The latest end time for a used vehicle, computed as the maximum over all + * used vehicles of + * [ShipmentRoute.vehicle_end_time][google.cloud.optimization.v1.ShipmentRoute.vehicle_end_time]. + * @type array|\Google\Protobuf\Internal\MapField $costs + * Cost of the solution, broken down by cost-related request fields. + * The keys are proto paths, relative to the input OptimizeToursRequest, + * e.g. "model.shipments.pickups.cost", and the values are the total cost + * generated by the corresponding cost field, aggregated over the whole + * solution. In other words, costs["model.shipments.pickups.cost"] is the + * sum of all pickup costs over the solution. All costs defined in the model + * are reported in detail here with the exception of costs related to + * TransitionAttributes that are only reported in an aggregated way as of + * 2022/01. + * @type float $total_cost + * Total cost of the solution. The sum of all values in the costs map. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * Aggregated over the routes. Each metric is the sum (or max, for loads) + * over all + * [ShipmentRoute.metrics][google.cloud.optimization.v1.ShipmentRoute.metrics] + * fields of the same name. + * + * Generated from protobuf field .google.cloud.optimization.v1.AggregatedMetrics aggregated_route_metrics = 1; + * @return \Google\Cloud\Optimization\V1\AggregatedMetrics|null + */ + public function getAggregatedRouteMetrics() + { + return $this->aggregated_route_metrics; + } + + public function hasAggregatedRouteMetrics() + { + return isset($this->aggregated_route_metrics); + } + + public function clearAggregatedRouteMetrics() + { + unset($this->aggregated_route_metrics); + } + + /** + * Aggregated over the routes. Each metric is the sum (or max, for loads) + * over all + * [ShipmentRoute.metrics][google.cloud.optimization.v1.ShipmentRoute.metrics] + * fields of the same name. + * + * Generated from protobuf field .google.cloud.optimization.v1.AggregatedMetrics aggregated_route_metrics = 1; + * @param \Google\Cloud\Optimization\V1\AggregatedMetrics $var + * @return $this + */ + public function setAggregatedRouteMetrics($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Optimization\V1\AggregatedMetrics::class); + $this->aggregated_route_metrics = $var; + + return $this; + } + + /** + * Number of mandatory shipments skipped. + * + * Generated from protobuf field int32 skipped_mandatory_shipment_count = 2; + * @return int + */ + public function getSkippedMandatoryShipmentCount() + { + return $this->skipped_mandatory_shipment_count; + } + + /** + * Number of mandatory shipments skipped. + * + * Generated from protobuf field int32 skipped_mandatory_shipment_count = 2; + * @param int $var + * @return $this + */ + public function setSkippedMandatoryShipmentCount($var) + { + GPBUtil::checkInt32($var); + $this->skipped_mandatory_shipment_count = $var; + + return $this; + } + + /** + * Number of vehicles used. Note: if a vehicle route is empty and + * [Vehicle.used_if_route_is_empty][google.cloud.optimization.v1.Vehicle.used_if_route_is_empty] + * is true, the vehicle is considered used. + * + * Generated from protobuf field int32 used_vehicle_count = 3; + * @return int + */ + public function getUsedVehicleCount() + { + return $this->used_vehicle_count; + } + + /** + * Number of vehicles used. Note: if a vehicle route is empty and + * [Vehicle.used_if_route_is_empty][google.cloud.optimization.v1.Vehicle.used_if_route_is_empty] + * is true, the vehicle is considered used. + * + * Generated from protobuf field int32 used_vehicle_count = 3; + * @param int $var + * @return $this + */ + public function setUsedVehicleCount($var) + { + GPBUtil::checkInt32($var); + $this->used_vehicle_count = $var; + + return $this; + } + + /** + * The earliest start time for a used vehicle, computed as the minimum over + * all used vehicles of + * [ShipmentRoute.vehicle_start_time][google.cloud.optimization.v1.ShipmentRoute.vehicle_start_time]. + * + * Generated from protobuf field .google.protobuf.Timestamp earliest_vehicle_start_time = 4; + * @return \Google\Protobuf\Timestamp|null + */ + public function getEarliestVehicleStartTime() + { + return $this->earliest_vehicle_start_time; + } + + public function hasEarliestVehicleStartTime() + { + return isset($this->earliest_vehicle_start_time); + } + + public function clearEarliestVehicleStartTime() + { + unset($this->earliest_vehicle_start_time); + } + + /** + * The earliest start time for a used vehicle, computed as the minimum over + * all used vehicles of + * [ShipmentRoute.vehicle_start_time][google.cloud.optimization.v1.ShipmentRoute.vehicle_start_time]. + * + * Generated from protobuf field .google.protobuf.Timestamp earliest_vehicle_start_time = 4; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setEarliestVehicleStartTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->earliest_vehicle_start_time = $var; + + return $this; + } + + /** + * The latest end time for a used vehicle, computed as the maximum over all + * used vehicles of + * [ShipmentRoute.vehicle_end_time][google.cloud.optimization.v1.ShipmentRoute.vehicle_end_time]. + * + * Generated from protobuf field .google.protobuf.Timestamp latest_vehicle_end_time = 5; + * @return \Google\Protobuf\Timestamp|null + */ + public function getLatestVehicleEndTime() + { + return $this->latest_vehicle_end_time; + } + + public function hasLatestVehicleEndTime() + { + return isset($this->latest_vehicle_end_time); + } + + public function clearLatestVehicleEndTime() + { + unset($this->latest_vehicle_end_time); + } + + /** + * The latest end time for a used vehicle, computed as the maximum over all + * used vehicles of + * [ShipmentRoute.vehicle_end_time][google.cloud.optimization.v1.ShipmentRoute.vehicle_end_time]. + * + * Generated from protobuf field .google.protobuf.Timestamp latest_vehicle_end_time = 5; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setLatestVehicleEndTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->latest_vehicle_end_time = $var; + + return $this; + } + + /** + * Cost of the solution, broken down by cost-related request fields. + * The keys are proto paths, relative to the input OptimizeToursRequest, + * e.g. "model.shipments.pickups.cost", and the values are the total cost + * generated by the corresponding cost field, aggregated over the whole + * solution. In other words, costs["model.shipments.pickups.cost"] is the + * sum of all pickup costs over the solution. All costs defined in the model + * are reported in detail here with the exception of costs related to + * TransitionAttributes that are only reported in an aggregated way as of + * 2022/01. + * + * Generated from protobuf field map costs = 10; + * @return \Google\Protobuf\Internal\MapField + */ + public function getCosts() + { + return $this->costs; + } + + /** + * Cost of the solution, broken down by cost-related request fields. + * The keys are proto paths, relative to the input OptimizeToursRequest, + * e.g. "model.shipments.pickups.cost", and the values are the total cost + * generated by the corresponding cost field, aggregated over the whole + * solution. In other words, costs["model.shipments.pickups.cost"] is the + * sum of all pickup costs over the solution. All costs defined in the model + * are reported in detail here with the exception of costs related to + * TransitionAttributes that are only reported in an aggregated way as of + * 2022/01. + * + * Generated from protobuf field map costs = 10; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setCosts($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::DOUBLE); + $this->costs = $arr; + + return $this; + } + + /** + * Total cost of the solution. The sum of all values in the costs map. + * + * Generated from protobuf field double total_cost = 6; + * @return float + */ + public function getTotalCost() + { + return $this->total_cost; + } + + /** + * Total cost of the solution. The sum of all values in the costs map. + * + * Generated from protobuf field double total_cost = 6; + * @param float $var + * @return $this + */ + public function setTotalCost($var) + { + GPBUtil::checkDouble($var); + $this->total_cost = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Metrics::class, \Google\Cloud\Optimization\V1\OptimizeToursResponse_Metrics::class); + diff --git a/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/OptimizeToursResponse_Metrics.php b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/OptimizeToursResponse_Metrics.php new file mode 100644 index 000000000000..b6547ff71edb --- /dev/null +++ b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/OptimizeToursResponse_Metrics.php @@ -0,0 +1,16 @@ +google.cloud.optimization.v1.OptimizeToursValidationError + */ +class OptimizeToursValidationError extends \Google\Protobuf\Internal\Message +{ + /** + * A validation error is defined by the pair (`code`, `display_name`) which + * are always present. + * Other fields (below) provide more context about the error. + * *MULTIPLE ERRORS*: + * When there are multiple errors, the validation process tries to output + * several of them. Much like a compiler, this is an imperfect process. Some + * validation errors will be "fatal", meaning that they stop the entire + * validation process. This is the case for `display_name="UNSPECIFIED"` + * errors, among others. Some may cause the validation process to skip other + * errors. + * *STABILITY*: + * `code` and `display_name` should be very stable. But new codes and + * display names may appear over time, which may cause a given (invalid) + * request to yield a different (`code`, `display_name`) pair because the new + * error hid the old one (see "MULTIPLE ERRORS"). + * *REFERENCE*: A list of all (code, name) pairs: + * * UNSPECIFIED = 0; + * * VALIDATION_TIMEOUT_ERROR = 10; Validation couldn't be completed within + * the deadline. + * * REQUEST_OPTIONS_ERROR = 12; + * * REQUEST_OPTIONS_INVALID_SOLVING_MODE = 1201; + * * REQUEST_OPTIONS_INVALID_MAX_VALIDATION_ERRORS = 1203; + * * REQUEST_OPTIONS_INVALID_GEODESIC_METERS_PER_SECOND = 1204; + * * REQUEST_OPTIONS_GEODESIC_METERS_PER_SECOND_TOO_SMALL = 1205; + * * REQUEST_OPTIONS_MISSING_GEODESIC_METERS_PER_SECOND = 1206; + * * REQUEST_OPTIONS_POPULATE_PATHFINDER_TRIPS_AND_GEODESIC_DISTANCE + * = 1207; + * * REQUEST_OPTIONS_COST_MODEL_OPTIONS_AND_GEODESIC_DISTANCE = 1208; + * * REQUEST_OPTIONS_TRAVEL_MODE_INCOMPATIBLE_WITH_TRAFFIC = 1211; + * * REQUEST_OPTIONS_MULTIPLE_TRAFFIC_FLAVORS = 1212; + * * REQUEST_OPTIONS_INVALID_TRAFFIC_FLAVOR = 1213; + * * REQUEST_OPTIONS_TRAFFIC_ENABLED_WITHOUT_GLOBAL_START_TIME = 1214; + * * REQUEST_OPTIONS_TRAFFIC_ENABLED_WITH_PRECEDENCES = 1215; + * * REQUEST_OPTIONS_TRAFFIC_PREFILL_MODE_INVALID = 1216; + * * REQUEST_OPTIONS_TRAFFIC_PREFILL_ENABLED_WITHOUT_TRAFFIC = 1217; + * * INJECTED_SOLUTION_ERROR = 20; + * * INJECTED_SOLUTION_MISSING_LABEL = 2000; + * * INJECTED_SOLUTION_DUPLICATE_LABEL = 2001; + * * INJECTED_SOLUTION_AMBIGUOUS_INDEX = 2002; + * * INJECTED_SOLUTION_INFEASIBLE_AFTER_GETTING_TRAVEL_TIMES = 2003; + * * INJECTED_SOLUTION_TRANSITION_INCONSISTENT_WITH_ACTUAL_TRAVEL = 2004; + * * INJECTED_SOLUTION_CONCURRENT_SOLUTION_TYPES = 2005; + * * INJECTED_SOLUTION_MORE_THAN_ONE_PER_TYPE = 2006; + * * INJECTED_SOLUTION_REFRESH_WITHOUT_POPULATE = 2008; + * * SHIPMENT_MODEL_ERROR = 22; + * * SHIPMENT_MODEL_TOO_LARGE = 2200; + * * SHIPMENT_MODEL_TOO_MANY_CAPACITY_TYPES = 2201; + * * SHIPMENT_MODEL_GLOBAL_START_TIME_NEGATIVE_OR_NAN = 2202; + * * SHIPMENT_MODEL_GLOBAL_END_TIME_TOO_LARGE_OR_NAN = 2203; + * * SHIPMENT_MODEL_GLOBAL_START_TIME_AFTER_GLOBAL_END_TIME = 2204; + * * SHIPMENT_MODEL_GLOBAL_DURATION_TOO_LONG = 2205; + * * SHIPMENT_MODEL_MAX_ACTIVE_VEHICLES_NOT_POSITIVE = 2206; + * * SHIPMENT_MODEL_DURATION_MATRIX_TOO_LARGE = 2207; + * * INDEX_ERROR = 24; + * * TAG_ERROR = 26; + * * TIME_WINDOW_ERROR = 28; + * * TIME_WINDOW_INVALID_START_TIME = 2800; + * * TIME_WINDOW_INVALID_END_TIME = 2801; + * * TIME_WINDOW_INVALID_SOFT_START_TIME = 2802; + * * TIME_WINDOW_INVALID_SOFT_END_TIME = 2803; + * * TIME_WINDOW_OUTSIDE_GLOBAL_TIME_WINDOW = 2804; + * * TIME_WINDOW_START_TIME_AFTER_END_TIME = 2805; + * * TIME_WINDOW_INVALID_COST_PER_HOUR_BEFORE_SOFT_START_TIME = 2806; + * * TIME_WINDOW_INVALID_COST_PER_HOUR_AFTER_SOFT_END_TIME = 2807; + * * TIME_WINDOW_COST_BEFORE_SOFT_START_TIME_WITHOUT_SOFT_START_TIME + * = 2808; + * * TIME_WINDOW_COST_AFTER_SOFT_END_TIME_WITHOUT_SOFT_END_TIME = 2809; + * * TIME_WINDOW_SOFT_START_TIME_WITHOUT_COST_BEFORE_SOFT_START_TIME + * = 2810; + * * TIME_WINDOW_SOFT_END_TIME_WITHOUT_COST_AFTER_SOFT_END_TIME = 2811; + * * TIME_WINDOW_OVERLAPPING_ADJACENT_OR_EARLIER_THAN_PREVIOUS = 2812; + * * TIME_WINDOW_START_TIME_AFTER_SOFT_START_TIME = 2813; + * * TIME_WINDOW_SOFT_START_TIME_AFTER_END_TIME = 2814; + * * TIME_WINDOW_START_TIME_AFTER_SOFT_END_TIME = 2815; + * * TIME_WINDOW_SOFT_END_TIME_AFTER_END_TIME = 2816; + * * TIME_WINDOW_COST_BEFORE_SOFT_START_TIME_SET_AND_MULTIPLE_WINDOWS + * = 2817; + * * TIME_WINDOW_COST_AFTER_SOFT_END_TIME_SET_AND_MULTIPLE_WINDOWS = 2818; + * * TRANSITION_ATTRIBUTES_ERROR = 30; + * * TRANSITION_ATTRIBUTES_INVALID_COST = 3000; + * * TRANSITION_ATTRIBUTES_INVALID_COST_PER_KILOMETER = 3001; + * * TRANSITION_ATTRIBUTES_DUPLICATE_TAG_PAIR = 3002; + * * TRANSITION_ATTRIBUTES_DISTANCE_LIMIT_MAX_METERS_UNSUPPORTED = 3003; + * * TRANSITION_ATTRIBUTES_UNSPECIFIED_SOURCE_TAGS = 3004; + * * TRANSITION_ATTRIBUTES_CONFLICTING_SOURCE_TAGS_FIELDS = 3005; + * * TRANSITION_ATTRIBUTES_UNSPECIFIED_DESTINATION_TAGS = 3006; + * * TRANSITION_ATTRIBUTES_CONFLICTING_DESTINATION_TAGS_FIELDS = 3007; + * * TRANSITION_ATTRIBUTES_DELAY_DURATION_NEGATIVE_OR_NAN = 3008; + * * TRANSITION_ATTRIBUTES_DELAY_DURATION_EXCEEDS_GLOBAL_DURATION = 3009; + * * AMOUNT_ERROR = 31; + * * AMOUNT_NEGATIVE_VALUE = 3100; + * * LOAD_LIMIT_ERROR = 33; + * * LOAD_LIMIT_INVALID_COST_ABOVE_SOFT_MAX = 3303; + * * LOAD_LIMIT_SOFT_MAX_WITHOUT_COST_ABOVE_SOFT_MAX = 3304; + * * LOAD_LIMIT_COST_ABOVE_SOFT_MAX_WITHOUT_SOFT_MAX = 3305; + * * LOAD_LIMIT_NEGATIVE_SOFT_MAX = 3306; + * * LOAD_LIMIT_MIXED_DEMAND_TYPE = 3307; + * * LOAD_LIMIT_MAX_LOAD_NEGATIVE_VALUE = 3308; + * * LOAD_LIMIT_SOFT_MAX_ABOVE_MAX = 3309; + * * INTERVAL_ERROR = 34; + * * INTERVAL_MIN_EXCEEDS_MAX = 3401; + * * INTERVAL_NEGATIVE_MIN = 3402; + * * INTERVAL_NEGATIVE_MAX = 3403; + * * INTERVAL_MIN_EXCEEDS_CAPACITY = 3404; + * * INTERVAL_MAX_EXCEEDS_CAPACITY = 3405; + * * DISTANCE_LIMIT_ERROR = 36; + * * DISTANCE_LIMIT_INVALID_COST_AFTER_SOFT_MAX = 3601; + * * DISTANCE_LIMIT_SOFT_MAX_WITHOUT_COST_AFTER_SOFT_MAX = 3602; + * * DISTANCE_LIMIT_COST_AFTER_SOFT_MAX_WITHOUT_SOFT_MAX = 3603; + * * DISTANCE_LIMIT_NEGATIVE_MAX = 3604; + * * DISTANCE_LIMIT_NEGATIVE_SOFT_MAX = 3605; + * * DISTANCE_LIMIT_SOFT_MAX_LARGER_THAN_MAX = 3606; + * * DURATION_LIMIT_ERROR = 38; + * * DURATION_LIMIT_MAX_DURATION_NEGATIVE_OR_NAN = 3800; + * * DURATION_LIMIT_SOFT_MAX_DURATION_NEGATIVE_OR_NAN = 3801; + * * DURATION_LIMIT_INVALID_COST_PER_HOUR_AFTER_SOFT_MAX = 3802; + * * DURATION_LIMIT_SOFT_MAX_WITHOUT_COST_AFTER_SOFT_MAX = 3803; + * * DURATION_LIMIT_COST_AFTER_SOFT_MAX_WITHOUT_SOFT_MAX = 3804; + * * DURATION_LIMIT_QUADRATIC_SOFT_MAX_DURATION_NEGATIVE_OR_NAN = 3805; + * * DURATION_LIMIT_INVALID_COST_AFTER_QUADRATIC_SOFT_MAX = 3806; + * * DURATION_LIMIT_QUADRATIC_SOFT_MAX_WITHOUT_COST_PER_SQUARE_HOUR + * = 3807; + * * DURATION_LIMIT_COST_PER_SQUARE_HOUR_WITHOUT_QUADRATIC_SOFT_MAX + * = 3808; + * * DURATION_LIMIT_QUADRATIC_SOFT_MAX_WITHOUT_MAX = 3809; + * * DURATION_LIMIT_SOFT_MAX_LARGER_THAN_MAX = 3810; + * * DURATION_LIMIT_QUADRATIC_SOFT_MAX_LARGER_THAN_MAX = 3811; + * * DURATION_LIMIT_DIFF_BETWEEN_MAX_AND_QUADRATIC_SOFT_MAX_TOO_LARGE + * = 3812; + * * DURATION_LIMIT_MAX_DURATION_EXCEEDS_GLOBAL_DURATION = 3813; + * * DURATION_LIMIT_SOFT_MAX_DURATION_EXCEEDS_GLOBAL_DURATION = 3814; + * * DURATION_LIMIT_QUADRATIC_SOFT_MAX_DURATION_EXCEEDS_GLOBAL_DURATION + * = 3815; + * * SHIPMENT_ERROR = 40; + * * SHIPMENT_PD_LIMIT_WITHOUT_PICKUP_AND_DELIVERY = 4014; + * * SHIPMENT_PD_ABSOLUTE_DETOUR_LIMIT_DURATION_NEGATIVE_OR_NAN = 4000; + * * SHIPMENT_PD_ABSOLUTE_DETOUR_LIMIT_DURATION_EXCEEDS_GLOBAL_DURATION + * = 4001; + * * SHIPMENT_PD_RELATIVE_DETOUR_LIMIT_INVALID = 4015; + * * SHIPMENT_PD_DETOUR_LIMIT_AND_EXTRA_VISIT_DURATION = 4016; + * * SHIPMENT_PD_TIME_LIMIT_DURATION_NEGATIVE_OR_NAN = 4002; + * * SHIPMENT_PD_TIME_LIMIT_DURATION_EXCEEDS_GLOBAL_DURATION = 4003; + * * SHIPMENT_EMPTY_SHIPMENT_TYPE = 4004; + * * SHIPMENT_NO_PICKUP_NO_DELIVERY = 4005; + * * SHIPMENT_INVALID_PENALTY_COST = 4006; + * * SHIPMENT_ALLOWED_VEHICLE_INDEX_OUT_OF_BOUNDS = 4007; + * * SHIPMENT_DUPLICATE_ALLOWED_VEHICLE_INDEX = 4008; + * * SHIPMENT_INCONSISTENT_COST_FOR_VEHICLE_SIZE_WITHOUT_INDEX = 4009; + * * SHIPMENT_INCONSISTENT_COST_FOR_VEHICLE_SIZE_WITH_INDEX = 4010; + * * SHIPMENT_INVALID_COST_FOR_VEHICLE = 4011; + * * SHIPMENT_COST_FOR_VEHICLE_INDEX_OUT_OF_BOUNDS = 4012; + * * SHIPMENT_DUPLICATE_COST_FOR_VEHICLE_INDEX = 4013; + * * VEHICLE_ERROR = 42; + * * VEHICLE_EMPTY_REQUIRED_OPERATOR_TYPE = 4200; + * * VEHICLE_DUPLICATE_REQUIRED_OPERATOR_TYPE = 4201; + * * VEHICLE_NO_OPERATOR_WITH_REQUIRED_OPERATOR_TYPE = 4202; + * * VEHICLE_EMPTY_START_TAG = 4203; + * * VEHICLE_DUPLICATE_START_TAG = 4204; + * * VEHICLE_EMPTY_END_TAG = 4205; + * * VEHICLE_DUPLICATE_END_TAG = 4206; + * * VEHICLE_EXTRA_VISIT_DURATION_NEGATIVE_OR_NAN = 4207; + * * VEHICLE_EXTRA_VISIT_DURATION_EXCEEDS_GLOBAL_DURATION = 4208; + * * VEHICLE_EXTRA_VISIT_DURATION_EMPTY_KEY = 4209; + * * VEHICLE_FIRST_SHIPMENT_INDEX_OUT_OF_BOUNDS = 4210; + * * VEHICLE_FIRST_SHIPMENT_IGNORED = 4211; + * * VEHICLE_FIRST_SHIPMENT_NOT_BOUND = 4212; + * * VEHICLE_LAST_SHIPMENT_INDEX_OUT_OF_BOUNDS = 4213; + * * VEHICLE_LAST_SHIPMENT_IGNORED = 4214; + * * VEHICLE_LAST_SHIPMENT_NOT_BOUND = 4215; + * * VEHICLE_IGNORED_WITH_USED_IF_ROUTE_IS_EMPTY = 4216; + * * VEHICLE_INVALID_COST_PER_KILOMETER = 4217; + * * VEHICLE_INVALID_COST_PER_HOUR = 4218; + * * VEHICLE_INVALID_COST_PER_TRAVELED_HOUR = 4219; + * * VEHICLE_INVALID_FIXED_COST = 4220; + * * VEHICLE_INVALID_TRAVEL_DURATION_MULTIPLE = 4221; + * * VEHICLE_TRAVEL_DURATION_MULTIPLE_WITH_SHIPMENT_PD_DETOUR_LIMITS + * = 4223; + * * VEHICLE_MATRIX_INDEX_WITH_SHIPMENT_PD_DETOUR_LIMITS = 4224; + * * VEHICLE_MINIMUM_DURATION_LONGER_THAN_DURATION_LIMIT = 4222; + * * VISIT_REQUEST_ERROR = 44; + * * VISIT_REQUEST_EMPTY_TAG = 4400; + * * VISIT_REQUEST_DUPLICATE_TAG = 4401; + * * VISIT_REQUEST_DURATION_NEGATIVE_OR_NAN = 4404; + * * VISIT_REQUEST_DURATION_EXCEEDS_GLOBAL_DURATION = 4405; + * * PRECEDENCE_ERROR = 46; + * * BREAK_ERROR = 48; + * * BREAK_RULE_EMPTY = 4800; + * * BREAK_REQUEST_UNSPECIFIED_DURATION = 4801; + * * BREAK_REQUEST_UNSPECIFIED_EARLIEST_START_TIME = 4802; + * * BREAK_REQUEST_UNSPECIFIED_LATEST_START_TIME = 4803; + * * BREAK_REQUEST_DURATION_NEGATIVE_OR_NAN = 4804; = 4804; + * * BREAK_REQUEST_LATEST_START_TIME_BEFORE_EARLIEST_START_TIME = 4805; + * * BREAK_REQUEST_EARLIEST_START_TIME_BEFORE_GLOBAL_START_TIME = 4806; + * * BREAK_REQUEST_LATEST_END_TIME_AFTER_GLOBAL_END_TIME = 4807; + * * BREAK_REQUEST_NON_SCHEDULABLE = 4808; + * * BREAK_FREQUENCY_MAX_INTER_BREAK_DURATION_NEGATIVE_OR_NAN = 4809; + * * BREAK_FREQUENCY_MIN_BREAK_DURATION_NEGATIVE_OR_NAN = 4810; + * * BREAK_FREQUENCY_MIN_BREAK_DURATION_EXCEEDS_GLOBAL_DURATION = 4811; + * * BREAK_FREQUENCY_MAX_INTER_BREAK_DURATION_EXCEEDS_GLOBAL_DURATION + * = 4812; + * * BREAK_REQUEST_DURATION_EXCEEDS_GLOBAL_DURATION = 4813; + * * BREAK_FREQUENCY_MISSING_MAX_INTER_BREAK_DURATION = 4814; + * * BREAK_FREQUENCY_MISSING_MIN_BREAK_DURATION = 4815; + * * SHIPMENT_TYPE_INCOMPATIBILITY_ERROR = 50; + * * SHIPMENT_TYPE_INCOMPATIBILITY_EMPTY_TYPE = 5001; + * * SHIPMENT_TYPE_INCOMPATIBILITY_LESS_THAN_TWO_TYPES = 5002; + * * SHIPMENT_TYPE_INCOMPATIBILITY_DUPLICATE_TYPE = 5003; + * * SHIPMENT_TYPE_INCOMPATIBILITY_INVALID_INCOMPATIBILITY_MODE = 5004; + * * SHIPMENT_TYPE_INCOMPATIBILITY_TOO_MANY_INCOMPATIBILITIES = 5005; + * * SHIPMENT_TYPE_REQUIREMENT_ERROR = 52; + * * SHIPMENT_TYPE_REQUIREMENT_NO_REQUIRED_TYPE = 52001; + * * SHIPMENT_TYPE_REQUIREMENT_NO_DEPENDENT_TYPE = 52002; + * * SHIPMENT_TYPE_REQUIREMENT_INVALID_REQUIREMENT_MODE = 52003; + * * SHIPMENT_TYPE_REQUIREMENT_TOO_MANY_REQUIREMENTS = 52004; + * * SHIPMENT_TYPE_REQUIREMENT_EMPTY_REQUIRED_TYPE = 52005; + * * SHIPMENT_TYPE_REQUIREMENT_DUPLICATE_REQUIRED_TYPE = 52006; + * * SHIPMENT_TYPE_REQUIREMENT_NO_REQUIRED_TYPE_FOUND = 52007; + * * SHIPMENT_TYPE_REQUIREMENT_EMPTY_DEPENDENT_TYPE = 52008; + * * SHIPMENT_TYPE_REQUIREMENT_DUPLICATE_DEPENDENT_TYPE = 52009; + * * SHIPMENT_TYPE_REQUIREMENT_SELF_DEPENDENT_TYPE = 52010; + * * SHIPMENT_TYPE_REQUIREMENT_GRAPH_HAS_CYCLES = 52011; + * * VEHICLE_OPERATOR_ERROR = 54; + * * VEHICLE_OPERATOR_EMPTY_TYPE = 5400; + * * VEHICLE_OPERATOR_MULTIPLE_START_TIME_WINDOWS = 5401; + * * VEHICLE_OPERATOR_SOFT_START_TIME_WINDOW = 5402; + * * VEHICLE_OPERATOR_MULTIPLE_END_TIME_WINDOWS = 5403; + * * VEHICLE_OPERATOR_SOFT_END_TIME_WINDOW = 5404; + * * DURATION_SECONDS_MATRIX_ERROR = 56; + * * DURATION_SECONDS_MATRIX_DURATION_NEGATIVE_OR_NAN = 5600; + * * DURATION_SECONDS_MATRIX_DURATION_EXCEEDS_GLOBAL_DURATION = 5601; + * + * Generated from protobuf field int32 code = 1; + */ + protected $code = 0; + /** + * The error display name. + * + * Generated from protobuf field string display_name = 2; + */ + protected $display_name = ''; + /** + * An error context may involve 0, 1 (most of the time) or more fields. For + * example, referring to vehicle #4 and shipment #2's first pickup can be + * done as follows: + * ``` + * fields { name: "vehicles" index: 4} + * fields { name: "shipments" index: 2 sub_field {name: "pickups" index: 0} } + * ``` + * Note, however, that the cardinality of `fields` should not change for a + * given error code. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.OptimizeToursValidationError.FieldReference fields = 3; + */ + private $fields; + /** + * Human-readable string describing the error. There is a 1:1 mapping + * between `code` and `error_message` (when code != "UNSPECIFIED"). + * *STABILITY*: Not stable: the error message associated to a given `code` may + * change (hopefully to clarify it) over time. Please rely on the + * `display_name` and `code` instead. + * + * Generated from protobuf field string error_message = 4; + */ + protected $error_message = ''; + /** + * May contain the value(s) of the field(s). This is not always available. You + * should absolutely not rely on it and use it only for manual model + * debugging. + * + * Generated from protobuf field string offending_values = 5; + */ + protected $offending_values = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $code + * A validation error is defined by the pair (`code`, `display_name`) which + * are always present. + * Other fields (below) provide more context about the error. + * *MULTIPLE ERRORS*: + * When there are multiple errors, the validation process tries to output + * several of them. Much like a compiler, this is an imperfect process. Some + * validation errors will be "fatal", meaning that they stop the entire + * validation process. This is the case for `display_name="UNSPECIFIED"` + * errors, among others. Some may cause the validation process to skip other + * errors. + * *STABILITY*: + * `code` and `display_name` should be very stable. But new codes and + * display names may appear over time, which may cause a given (invalid) + * request to yield a different (`code`, `display_name`) pair because the new + * error hid the old one (see "MULTIPLE ERRORS"). + * *REFERENCE*: A list of all (code, name) pairs: + * * UNSPECIFIED = 0; + * * VALIDATION_TIMEOUT_ERROR = 10; Validation couldn't be completed within + * the deadline. + * * REQUEST_OPTIONS_ERROR = 12; + * * REQUEST_OPTIONS_INVALID_SOLVING_MODE = 1201; + * * REQUEST_OPTIONS_INVALID_MAX_VALIDATION_ERRORS = 1203; + * * REQUEST_OPTIONS_INVALID_GEODESIC_METERS_PER_SECOND = 1204; + * * REQUEST_OPTIONS_GEODESIC_METERS_PER_SECOND_TOO_SMALL = 1205; + * * REQUEST_OPTIONS_MISSING_GEODESIC_METERS_PER_SECOND = 1206; + * * REQUEST_OPTIONS_POPULATE_PATHFINDER_TRIPS_AND_GEODESIC_DISTANCE + * = 1207; + * * REQUEST_OPTIONS_COST_MODEL_OPTIONS_AND_GEODESIC_DISTANCE = 1208; + * * REQUEST_OPTIONS_TRAVEL_MODE_INCOMPATIBLE_WITH_TRAFFIC = 1211; + * * REQUEST_OPTIONS_MULTIPLE_TRAFFIC_FLAVORS = 1212; + * * REQUEST_OPTIONS_INVALID_TRAFFIC_FLAVOR = 1213; + * * REQUEST_OPTIONS_TRAFFIC_ENABLED_WITHOUT_GLOBAL_START_TIME = 1214; + * * REQUEST_OPTIONS_TRAFFIC_ENABLED_WITH_PRECEDENCES = 1215; + * * REQUEST_OPTIONS_TRAFFIC_PREFILL_MODE_INVALID = 1216; + * * REQUEST_OPTIONS_TRAFFIC_PREFILL_ENABLED_WITHOUT_TRAFFIC = 1217; + * * INJECTED_SOLUTION_ERROR = 20; + * * INJECTED_SOLUTION_MISSING_LABEL = 2000; + * * INJECTED_SOLUTION_DUPLICATE_LABEL = 2001; + * * INJECTED_SOLUTION_AMBIGUOUS_INDEX = 2002; + * * INJECTED_SOLUTION_INFEASIBLE_AFTER_GETTING_TRAVEL_TIMES = 2003; + * * INJECTED_SOLUTION_TRANSITION_INCONSISTENT_WITH_ACTUAL_TRAVEL = 2004; + * * INJECTED_SOLUTION_CONCURRENT_SOLUTION_TYPES = 2005; + * * INJECTED_SOLUTION_MORE_THAN_ONE_PER_TYPE = 2006; + * * INJECTED_SOLUTION_REFRESH_WITHOUT_POPULATE = 2008; + * * SHIPMENT_MODEL_ERROR = 22; + * * SHIPMENT_MODEL_TOO_LARGE = 2200; + * * SHIPMENT_MODEL_TOO_MANY_CAPACITY_TYPES = 2201; + * * SHIPMENT_MODEL_GLOBAL_START_TIME_NEGATIVE_OR_NAN = 2202; + * * SHIPMENT_MODEL_GLOBAL_END_TIME_TOO_LARGE_OR_NAN = 2203; + * * SHIPMENT_MODEL_GLOBAL_START_TIME_AFTER_GLOBAL_END_TIME = 2204; + * * SHIPMENT_MODEL_GLOBAL_DURATION_TOO_LONG = 2205; + * * SHIPMENT_MODEL_MAX_ACTIVE_VEHICLES_NOT_POSITIVE = 2206; + * * SHIPMENT_MODEL_DURATION_MATRIX_TOO_LARGE = 2207; + * * INDEX_ERROR = 24; + * * TAG_ERROR = 26; + * * TIME_WINDOW_ERROR = 28; + * * TIME_WINDOW_INVALID_START_TIME = 2800; + * * TIME_WINDOW_INVALID_END_TIME = 2801; + * * TIME_WINDOW_INVALID_SOFT_START_TIME = 2802; + * * TIME_WINDOW_INVALID_SOFT_END_TIME = 2803; + * * TIME_WINDOW_OUTSIDE_GLOBAL_TIME_WINDOW = 2804; + * * TIME_WINDOW_START_TIME_AFTER_END_TIME = 2805; + * * TIME_WINDOW_INVALID_COST_PER_HOUR_BEFORE_SOFT_START_TIME = 2806; + * * TIME_WINDOW_INVALID_COST_PER_HOUR_AFTER_SOFT_END_TIME = 2807; + * * TIME_WINDOW_COST_BEFORE_SOFT_START_TIME_WITHOUT_SOFT_START_TIME + * = 2808; + * * TIME_WINDOW_COST_AFTER_SOFT_END_TIME_WITHOUT_SOFT_END_TIME = 2809; + * * TIME_WINDOW_SOFT_START_TIME_WITHOUT_COST_BEFORE_SOFT_START_TIME + * = 2810; + * * TIME_WINDOW_SOFT_END_TIME_WITHOUT_COST_AFTER_SOFT_END_TIME = 2811; + * * TIME_WINDOW_OVERLAPPING_ADJACENT_OR_EARLIER_THAN_PREVIOUS = 2812; + * * TIME_WINDOW_START_TIME_AFTER_SOFT_START_TIME = 2813; + * * TIME_WINDOW_SOFT_START_TIME_AFTER_END_TIME = 2814; + * * TIME_WINDOW_START_TIME_AFTER_SOFT_END_TIME = 2815; + * * TIME_WINDOW_SOFT_END_TIME_AFTER_END_TIME = 2816; + * * TIME_WINDOW_COST_BEFORE_SOFT_START_TIME_SET_AND_MULTIPLE_WINDOWS + * = 2817; + * * TIME_WINDOW_COST_AFTER_SOFT_END_TIME_SET_AND_MULTIPLE_WINDOWS = 2818; + * * TRANSITION_ATTRIBUTES_ERROR = 30; + * * TRANSITION_ATTRIBUTES_INVALID_COST = 3000; + * * TRANSITION_ATTRIBUTES_INVALID_COST_PER_KILOMETER = 3001; + * * TRANSITION_ATTRIBUTES_DUPLICATE_TAG_PAIR = 3002; + * * TRANSITION_ATTRIBUTES_DISTANCE_LIMIT_MAX_METERS_UNSUPPORTED = 3003; + * * TRANSITION_ATTRIBUTES_UNSPECIFIED_SOURCE_TAGS = 3004; + * * TRANSITION_ATTRIBUTES_CONFLICTING_SOURCE_TAGS_FIELDS = 3005; + * * TRANSITION_ATTRIBUTES_UNSPECIFIED_DESTINATION_TAGS = 3006; + * * TRANSITION_ATTRIBUTES_CONFLICTING_DESTINATION_TAGS_FIELDS = 3007; + * * TRANSITION_ATTRIBUTES_DELAY_DURATION_NEGATIVE_OR_NAN = 3008; + * * TRANSITION_ATTRIBUTES_DELAY_DURATION_EXCEEDS_GLOBAL_DURATION = 3009; + * * AMOUNT_ERROR = 31; + * * AMOUNT_NEGATIVE_VALUE = 3100; + * * LOAD_LIMIT_ERROR = 33; + * * LOAD_LIMIT_INVALID_COST_ABOVE_SOFT_MAX = 3303; + * * LOAD_LIMIT_SOFT_MAX_WITHOUT_COST_ABOVE_SOFT_MAX = 3304; + * * LOAD_LIMIT_COST_ABOVE_SOFT_MAX_WITHOUT_SOFT_MAX = 3305; + * * LOAD_LIMIT_NEGATIVE_SOFT_MAX = 3306; + * * LOAD_LIMIT_MIXED_DEMAND_TYPE = 3307; + * * LOAD_LIMIT_MAX_LOAD_NEGATIVE_VALUE = 3308; + * * LOAD_LIMIT_SOFT_MAX_ABOVE_MAX = 3309; + * * INTERVAL_ERROR = 34; + * * INTERVAL_MIN_EXCEEDS_MAX = 3401; + * * INTERVAL_NEGATIVE_MIN = 3402; + * * INTERVAL_NEGATIVE_MAX = 3403; + * * INTERVAL_MIN_EXCEEDS_CAPACITY = 3404; + * * INTERVAL_MAX_EXCEEDS_CAPACITY = 3405; + * * DISTANCE_LIMIT_ERROR = 36; + * * DISTANCE_LIMIT_INVALID_COST_AFTER_SOFT_MAX = 3601; + * * DISTANCE_LIMIT_SOFT_MAX_WITHOUT_COST_AFTER_SOFT_MAX = 3602; + * * DISTANCE_LIMIT_COST_AFTER_SOFT_MAX_WITHOUT_SOFT_MAX = 3603; + * * DISTANCE_LIMIT_NEGATIVE_MAX = 3604; + * * DISTANCE_LIMIT_NEGATIVE_SOFT_MAX = 3605; + * * DISTANCE_LIMIT_SOFT_MAX_LARGER_THAN_MAX = 3606; + * * DURATION_LIMIT_ERROR = 38; + * * DURATION_LIMIT_MAX_DURATION_NEGATIVE_OR_NAN = 3800; + * * DURATION_LIMIT_SOFT_MAX_DURATION_NEGATIVE_OR_NAN = 3801; + * * DURATION_LIMIT_INVALID_COST_PER_HOUR_AFTER_SOFT_MAX = 3802; + * * DURATION_LIMIT_SOFT_MAX_WITHOUT_COST_AFTER_SOFT_MAX = 3803; + * * DURATION_LIMIT_COST_AFTER_SOFT_MAX_WITHOUT_SOFT_MAX = 3804; + * * DURATION_LIMIT_QUADRATIC_SOFT_MAX_DURATION_NEGATIVE_OR_NAN = 3805; + * * DURATION_LIMIT_INVALID_COST_AFTER_QUADRATIC_SOFT_MAX = 3806; + * * DURATION_LIMIT_QUADRATIC_SOFT_MAX_WITHOUT_COST_PER_SQUARE_HOUR + * = 3807; + * * DURATION_LIMIT_COST_PER_SQUARE_HOUR_WITHOUT_QUADRATIC_SOFT_MAX + * = 3808; + * * DURATION_LIMIT_QUADRATIC_SOFT_MAX_WITHOUT_MAX = 3809; + * * DURATION_LIMIT_SOFT_MAX_LARGER_THAN_MAX = 3810; + * * DURATION_LIMIT_QUADRATIC_SOFT_MAX_LARGER_THAN_MAX = 3811; + * * DURATION_LIMIT_DIFF_BETWEEN_MAX_AND_QUADRATIC_SOFT_MAX_TOO_LARGE + * = 3812; + * * DURATION_LIMIT_MAX_DURATION_EXCEEDS_GLOBAL_DURATION = 3813; + * * DURATION_LIMIT_SOFT_MAX_DURATION_EXCEEDS_GLOBAL_DURATION = 3814; + * * DURATION_LIMIT_QUADRATIC_SOFT_MAX_DURATION_EXCEEDS_GLOBAL_DURATION + * = 3815; + * * SHIPMENT_ERROR = 40; + * * SHIPMENT_PD_LIMIT_WITHOUT_PICKUP_AND_DELIVERY = 4014; + * * SHIPMENT_PD_ABSOLUTE_DETOUR_LIMIT_DURATION_NEGATIVE_OR_NAN = 4000; + * * SHIPMENT_PD_ABSOLUTE_DETOUR_LIMIT_DURATION_EXCEEDS_GLOBAL_DURATION + * = 4001; + * * SHIPMENT_PD_RELATIVE_DETOUR_LIMIT_INVALID = 4015; + * * SHIPMENT_PD_DETOUR_LIMIT_AND_EXTRA_VISIT_DURATION = 4016; + * * SHIPMENT_PD_TIME_LIMIT_DURATION_NEGATIVE_OR_NAN = 4002; + * * SHIPMENT_PD_TIME_LIMIT_DURATION_EXCEEDS_GLOBAL_DURATION = 4003; + * * SHIPMENT_EMPTY_SHIPMENT_TYPE = 4004; + * * SHIPMENT_NO_PICKUP_NO_DELIVERY = 4005; + * * SHIPMENT_INVALID_PENALTY_COST = 4006; + * * SHIPMENT_ALLOWED_VEHICLE_INDEX_OUT_OF_BOUNDS = 4007; + * * SHIPMENT_DUPLICATE_ALLOWED_VEHICLE_INDEX = 4008; + * * SHIPMENT_INCONSISTENT_COST_FOR_VEHICLE_SIZE_WITHOUT_INDEX = 4009; + * * SHIPMENT_INCONSISTENT_COST_FOR_VEHICLE_SIZE_WITH_INDEX = 4010; + * * SHIPMENT_INVALID_COST_FOR_VEHICLE = 4011; + * * SHIPMENT_COST_FOR_VEHICLE_INDEX_OUT_OF_BOUNDS = 4012; + * * SHIPMENT_DUPLICATE_COST_FOR_VEHICLE_INDEX = 4013; + * * VEHICLE_ERROR = 42; + * * VEHICLE_EMPTY_REQUIRED_OPERATOR_TYPE = 4200; + * * VEHICLE_DUPLICATE_REQUIRED_OPERATOR_TYPE = 4201; + * * VEHICLE_NO_OPERATOR_WITH_REQUIRED_OPERATOR_TYPE = 4202; + * * VEHICLE_EMPTY_START_TAG = 4203; + * * VEHICLE_DUPLICATE_START_TAG = 4204; + * * VEHICLE_EMPTY_END_TAG = 4205; + * * VEHICLE_DUPLICATE_END_TAG = 4206; + * * VEHICLE_EXTRA_VISIT_DURATION_NEGATIVE_OR_NAN = 4207; + * * VEHICLE_EXTRA_VISIT_DURATION_EXCEEDS_GLOBAL_DURATION = 4208; + * * VEHICLE_EXTRA_VISIT_DURATION_EMPTY_KEY = 4209; + * * VEHICLE_FIRST_SHIPMENT_INDEX_OUT_OF_BOUNDS = 4210; + * * VEHICLE_FIRST_SHIPMENT_IGNORED = 4211; + * * VEHICLE_FIRST_SHIPMENT_NOT_BOUND = 4212; + * * VEHICLE_LAST_SHIPMENT_INDEX_OUT_OF_BOUNDS = 4213; + * * VEHICLE_LAST_SHIPMENT_IGNORED = 4214; + * * VEHICLE_LAST_SHIPMENT_NOT_BOUND = 4215; + * * VEHICLE_IGNORED_WITH_USED_IF_ROUTE_IS_EMPTY = 4216; + * * VEHICLE_INVALID_COST_PER_KILOMETER = 4217; + * * VEHICLE_INVALID_COST_PER_HOUR = 4218; + * * VEHICLE_INVALID_COST_PER_TRAVELED_HOUR = 4219; + * * VEHICLE_INVALID_FIXED_COST = 4220; + * * VEHICLE_INVALID_TRAVEL_DURATION_MULTIPLE = 4221; + * * VEHICLE_TRAVEL_DURATION_MULTIPLE_WITH_SHIPMENT_PD_DETOUR_LIMITS + * = 4223; + * * VEHICLE_MATRIX_INDEX_WITH_SHIPMENT_PD_DETOUR_LIMITS = 4224; + * * VEHICLE_MINIMUM_DURATION_LONGER_THAN_DURATION_LIMIT = 4222; + * * VISIT_REQUEST_ERROR = 44; + * * VISIT_REQUEST_EMPTY_TAG = 4400; + * * VISIT_REQUEST_DUPLICATE_TAG = 4401; + * * VISIT_REQUEST_DURATION_NEGATIVE_OR_NAN = 4404; + * * VISIT_REQUEST_DURATION_EXCEEDS_GLOBAL_DURATION = 4405; + * * PRECEDENCE_ERROR = 46; + * * BREAK_ERROR = 48; + * * BREAK_RULE_EMPTY = 4800; + * * BREAK_REQUEST_UNSPECIFIED_DURATION = 4801; + * * BREAK_REQUEST_UNSPECIFIED_EARLIEST_START_TIME = 4802; + * * BREAK_REQUEST_UNSPECIFIED_LATEST_START_TIME = 4803; + * * BREAK_REQUEST_DURATION_NEGATIVE_OR_NAN = 4804; = 4804; + * * BREAK_REQUEST_LATEST_START_TIME_BEFORE_EARLIEST_START_TIME = 4805; + * * BREAK_REQUEST_EARLIEST_START_TIME_BEFORE_GLOBAL_START_TIME = 4806; + * * BREAK_REQUEST_LATEST_END_TIME_AFTER_GLOBAL_END_TIME = 4807; + * * BREAK_REQUEST_NON_SCHEDULABLE = 4808; + * * BREAK_FREQUENCY_MAX_INTER_BREAK_DURATION_NEGATIVE_OR_NAN = 4809; + * * BREAK_FREQUENCY_MIN_BREAK_DURATION_NEGATIVE_OR_NAN = 4810; + * * BREAK_FREQUENCY_MIN_BREAK_DURATION_EXCEEDS_GLOBAL_DURATION = 4811; + * * BREAK_FREQUENCY_MAX_INTER_BREAK_DURATION_EXCEEDS_GLOBAL_DURATION + * = 4812; + * * BREAK_REQUEST_DURATION_EXCEEDS_GLOBAL_DURATION = 4813; + * * BREAK_FREQUENCY_MISSING_MAX_INTER_BREAK_DURATION = 4814; + * * BREAK_FREQUENCY_MISSING_MIN_BREAK_DURATION = 4815; + * * SHIPMENT_TYPE_INCOMPATIBILITY_ERROR = 50; + * * SHIPMENT_TYPE_INCOMPATIBILITY_EMPTY_TYPE = 5001; + * * SHIPMENT_TYPE_INCOMPATIBILITY_LESS_THAN_TWO_TYPES = 5002; + * * SHIPMENT_TYPE_INCOMPATIBILITY_DUPLICATE_TYPE = 5003; + * * SHIPMENT_TYPE_INCOMPATIBILITY_INVALID_INCOMPATIBILITY_MODE = 5004; + * * SHIPMENT_TYPE_INCOMPATIBILITY_TOO_MANY_INCOMPATIBILITIES = 5005; + * * SHIPMENT_TYPE_REQUIREMENT_ERROR = 52; + * * SHIPMENT_TYPE_REQUIREMENT_NO_REQUIRED_TYPE = 52001; + * * SHIPMENT_TYPE_REQUIREMENT_NO_DEPENDENT_TYPE = 52002; + * * SHIPMENT_TYPE_REQUIREMENT_INVALID_REQUIREMENT_MODE = 52003; + * * SHIPMENT_TYPE_REQUIREMENT_TOO_MANY_REQUIREMENTS = 52004; + * * SHIPMENT_TYPE_REQUIREMENT_EMPTY_REQUIRED_TYPE = 52005; + * * SHIPMENT_TYPE_REQUIREMENT_DUPLICATE_REQUIRED_TYPE = 52006; + * * SHIPMENT_TYPE_REQUIREMENT_NO_REQUIRED_TYPE_FOUND = 52007; + * * SHIPMENT_TYPE_REQUIREMENT_EMPTY_DEPENDENT_TYPE = 52008; + * * SHIPMENT_TYPE_REQUIREMENT_DUPLICATE_DEPENDENT_TYPE = 52009; + * * SHIPMENT_TYPE_REQUIREMENT_SELF_DEPENDENT_TYPE = 52010; + * * SHIPMENT_TYPE_REQUIREMENT_GRAPH_HAS_CYCLES = 52011; + * * VEHICLE_OPERATOR_ERROR = 54; + * * VEHICLE_OPERATOR_EMPTY_TYPE = 5400; + * * VEHICLE_OPERATOR_MULTIPLE_START_TIME_WINDOWS = 5401; + * * VEHICLE_OPERATOR_SOFT_START_TIME_WINDOW = 5402; + * * VEHICLE_OPERATOR_MULTIPLE_END_TIME_WINDOWS = 5403; + * * VEHICLE_OPERATOR_SOFT_END_TIME_WINDOW = 5404; + * * DURATION_SECONDS_MATRIX_ERROR = 56; + * * DURATION_SECONDS_MATRIX_DURATION_NEGATIVE_OR_NAN = 5600; + * * DURATION_SECONDS_MATRIX_DURATION_EXCEEDS_GLOBAL_DURATION = 5601; + * @type string $display_name + * The error display name. + * @type array<\Google\Cloud\Optimization\V1\OptimizeToursValidationError\FieldReference>|\Google\Protobuf\Internal\RepeatedField $fields + * An error context may involve 0, 1 (most of the time) or more fields. For + * example, referring to vehicle #4 and shipment #2's first pickup can be + * done as follows: + * ``` + * fields { name: "vehicles" index: 4} + * fields { name: "shipments" index: 2 sub_field {name: "pickups" index: 0} } + * ``` + * Note, however, that the cardinality of `fields` should not change for a + * given error code. + * @type string $error_message + * Human-readable string describing the error. There is a 1:1 mapping + * between `code` and `error_message` (when code != "UNSPECIFIED"). + * *STABILITY*: Not stable: the error message associated to a given `code` may + * change (hopefully to clarify it) over time. Please rely on the + * `display_name` and `code` instead. + * @type string $offending_values + * May contain the value(s) of the field(s). This is not always available. You + * should absolutely not rely on it and use it only for manual model + * debugging. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * A validation error is defined by the pair (`code`, `display_name`) which + * are always present. + * Other fields (below) provide more context about the error. + * *MULTIPLE ERRORS*: + * When there are multiple errors, the validation process tries to output + * several of them. Much like a compiler, this is an imperfect process. Some + * validation errors will be "fatal", meaning that they stop the entire + * validation process. This is the case for `display_name="UNSPECIFIED"` + * errors, among others. Some may cause the validation process to skip other + * errors. + * *STABILITY*: + * `code` and `display_name` should be very stable. But new codes and + * display names may appear over time, which may cause a given (invalid) + * request to yield a different (`code`, `display_name`) pair because the new + * error hid the old one (see "MULTIPLE ERRORS"). + * *REFERENCE*: A list of all (code, name) pairs: + * * UNSPECIFIED = 0; + * * VALIDATION_TIMEOUT_ERROR = 10; Validation couldn't be completed within + * the deadline. + * * REQUEST_OPTIONS_ERROR = 12; + * * REQUEST_OPTIONS_INVALID_SOLVING_MODE = 1201; + * * REQUEST_OPTIONS_INVALID_MAX_VALIDATION_ERRORS = 1203; + * * REQUEST_OPTIONS_INVALID_GEODESIC_METERS_PER_SECOND = 1204; + * * REQUEST_OPTIONS_GEODESIC_METERS_PER_SECOND_TOO_SMALL = 1205; + * * REQUEST_OPTIONS_MISSING_GEODESIC_METERS_PER_SECOND = 1206; + * * REQUEST_OPTIONS_POPULATE_PATHFINDER_TRIPS_AND_GEODESIC_DISTANCE + * = 1207; + * * REQUEST_OPTIONS_COST_MODEL_OPTIONS_AND_GEODESIC_DISTANCE = 1208; + * * REQUEST_OPTIONS_TRAVEL_MODE_INCOMPATIBLE_WITH_TRAFFIC = 1211; + * * REQUEST_OPTIONS_MULTIPLE_TRAFFIC_FLAVORS = 1212; + * * REQUEST_OPTIONS_INVALID_TRAFFIC_FLAVOR = 1213; + * * REQUEST_OPTIONS_TRAFFIC_ENABLED_WITHOUT_GLOBAL_START_TIME = 1214; + * * REQUEST_OPTIONS_TRAFFIC_ENABLED_WITH_PRECEDENCES = 1215; + * * REQUEST_OPTIONS_TRAFFIC_PREFILL_MODE_INVALID = 1216; + * * REQUEST_OPTIONS_TRAFFIC_PREFILL_ENABLED_WITHOUT_TRAFFIC = 1217; + * * INJECTED_SOLUTION_ERROR = 20; + * * INJECTED_SOLUTION_MISSING_LABEL = 2000; + * * INJECTED_SOLUTION_DUPLICATE_LABEL = 2001; + * * INJECTED_SOLUTION_AMBIGUOUS_INDEX = 2002; + * * INJECTED_SOLUTION_INFEASIBLE_AFTER_GETTING_TRAVEL_TIMES = 2003; + * * INJECTED_SOLUTION_TRANSITION_INCONSISTENT_WITH_ACTUAL_TRAVEL = 2004; + * * INJECTED_SOLUTION_CONCURRENT_SOLUTION_TYPES = 2005; + * * INJECTED_SOLUTION_MORE_THAN_ONE_PER_TYPE = 2006; + * * INJECTED_SOLUTION_REFRESH_WITHOUT_POPULATE = 2008; + * * SHIPMENT_MODEL_ERROR = 22; + * * SHIPMENT_MODEL_TOO_LARGE = 2200; + * * SHIPMENT_MODEL_TOO_MANY_CAPACITY_TYPES = 2201; + * * SHIPMENT_MODEL_GLOBAL_START_TIME_NEGATIVE_OR_NAN = 2202; + * * SHIPMENT_MODEL_GLOBAL_END_TIME_TOO_LARGE_OR_NAN = 2203; + * * SHIPMENT_MODEL_GLOBAL_START_TIME_AFTER_GLOBAL_END_TIME = 2204; + * * SHIPMENT_MODEL_GLOBAL_DURATION_TOO_LONG = 2205; + * * SHIPMENT_MODEL_MAX_ACTIVE_VEHICLES_NOT_POSITIVE = 2206; + * * SHIPMENT_MODEL_DURATION_MATRIX_TOO_LARGE = 2207; + * * INDEX_ERROR = 24; + * * TAG_ERROR = 26; + * * TIME_WINDOW_ERROR = 28; + * * TIME_WINDOW_INVALID_START_TIME = 2800; + * * TIME_WINDOW_INVALID_END_TIME = 2801; + * * TIME_WINDOW_INVALID_SOFT_START_TIME = 2802; + * * TIME_WINDOW_INVALID_SOFT_END_TIME = 2803; + * * TIME_WINDOW_OUTSIDE_GLOBAL_TIME_WINDOW = 2804; + * * TIME_WINDOW_START_TIME_AFTER_END_TIME = 2805; + * * TIME_WINDOW_INVALID_COST_PER_HOUR_BEFORE_SOFT_START_TIME = 2806; + * * TIME_WINDOW_INVALID_COST_PER_HOUR_AFTER_SOFT_END_TIME = 2807; + * * TIME_WINDOW_COST_BEFORE_SOFT_START_TIME_WITHOUT_SOFT_START_TIME + * = 2808; + * * TIME_WINDOW_COST_AFTER_SOFT_END_TIME_WITHOUT_SOFT_END_TIME = 2809; + * * TIME_WINDOW_SOFT_START_TIME_WITHOUT_COST_BEFORE_SOFT_START_TIME + * = 2810; + * * TIME_WINDOW_SOFT_END_TIME_WITHOUT_COST_AFTER_SOFT_END_TIME = 2811; + * * TIME_WINDOW_OVERLAPPING_ADJACENT_OR_EARLIER_THAN_PREVIOUS = 2812; + * * TIME_WINDOW_START_TIME_AFTER_SOFT_START_TIME = 2813; + * * TIME_WINDOW_SOFT_START_TIME_AFTER_END_TIME = 2814; + * * TIME_WINDOW_START_TIME_AFTER_SOFT_END_TIME = 2815; + * * TIME_WINDOW_SOFT_END_TIME_AFTER_END_TIME = 2816; + * * TIME_WINDOW_COST_BEFORE_SOFT_START_TIME_SET_AND_MULTIPLE_WINDOWS + * = 2817; + * * TIME_WINDOW_COST_AFTER_SOFT_END_TIME_SET_AND_MULTIPLE_WINDOWS = 2818; + * * TRANSITION_ATTRIBUTES_ERROR = 30; + * * TRANSITION_ATTRIBUTES_INVALID_COST = 3000; + * * TRANSITION_ATTRIBUTES_INVALID_COST_PER_KILOMETER = 3001; + * * TRANSITION_ATTRIBUTES_DUPLICATE_TAG_PAIR = 3002; + * * TRANSITION_ATTRIBUTES_DISTANCE_LIMIT_MAX_METERS_UNSUPPORTED = 3003; + * * TRANSITION_ATTRIBUTES_UNSPECIFIED_SOURCE_TAGS = 3004; + * * TRANSITION_ATTRIBUTES_CONFLICTING_SOURCE_TAGS_FIELDS = 3005; + * * TRANSITION_ATTRIBUTES_UNSPECIFIED_DESTINATION_TAGS = 3006; + * * TRANSITION_ATTRIBUTES_CONFLICTING_DESTINATION_TAGS_FIELDS = 3007; + * * TRANSITION_ATTRIBUTES_DELAY_DURATION_NEGATIVE_OR_NAN = 3008; + * * TRANSITION_ATTRIBUTES_DELAY_DURATION_EXCEEDS_GLOBAL_DURATION = 3009; + * * AMOUNT_ERROR = 31; + * * AMOUNT_NEGATIVE_VALUE = 3100; + * * LOAD_LIMIT_ERROR = 33; + * * LOAD_LIMIT_INVALID_COST_ABOVE_SOFT_MAX = 3303; + * * LOAD_LIMIT_SOFT_MAX_WITHOUT_COST_ABOVE_SOFT_MAX = 3304; + * * LOAD_LIMIT_COST_ABOVE_SOFT_MAX_WITHOUT_SOFT_MAX = 3305; + * * LOAD_LIMIT_NEGATIVE_SOFT_MAX = 3306; + * * LOAD_LIMIT_MIXED_DEMAND_TYPE = 3307; + * * LOAD_LIMIT_MAX_LOAD_NEGATIVE_VALUE = 3308; + * * LOAD_LIMIT_SOFT_MAX_ABOVE_MAX = 3309; + * * INTERVAL_ERROR = 34; + * * INTERVAL_MIN_EXCEEDS_MAX = 3401; + * * INTERVAL_NEGATIVE_MIN = 3402; + * * INTERVAL_NEGATIVE_MAX = 3403; + * * INTERVAL_MIN_EXCEEDS_CAPACITY = 3404; + * * INTERVAL_MAX_EXCEEDS_CAPACITY = 3405; + * * DISTANCE_LIMIT_ERROR = 36; + * * DISTANCE_LIMIT_INVALID_COST_AFTER_SOFT_MAX = 3601; + * * DISTANCE_LIMIT_SOFT_MAX_WITHOUT_COST_AFTER_SOFT_MAX = 3602; + * * DISTANCE_LIMIT_COST_AFTER_SOFT_MAX_WITHOUT_SOFT_MAX = 3603; + * * DISTANCE_LIMIT_NEGATIVE_MAX = 3604; + * * DISTANCE_LIMIT_NEGATIVE_SOFT_MAX = 3605; + * * DISTANCE_LIMIT_SOFT_MAX_LARGER_THAN_MAX = 3606; + * * DURATION_LIMIT_ERROR = 38; + * * DURATION_LIMIT_MAX_DURATION_NEGATIVE_OR_NAN = 3800; + * * DURATION_LIMIT_SOFT_MAX_DURATION_NEGATIVE_OR_NAN = 3801; + * * DURATION_LIMIT_INVALID_COST_PER_HOUR_AFTER_SOFT_MAX = 3802; + * * DURATION_LIMIT_SOFT_MAX_WITHOUT_COST_AFTER_SOFT_MAX = 3803; + * * DURATION_LIMIT_COST_AFTER_SOFT_MAX_WITHOUT_SOFT_MAX = 3804; + * * DURATION_LIMIT_QUADRATIC_SOFT_MAX_DURATION_NEGATIVE_OR_NAN = 3805; + * * DURATION_LIMIT_INVALID_COST_AFTER_QUADRATIC_SOFT_MAX = 3806; + * * DURATION_LIMIT_QUADRATIC_SOFT_MAX_WITHOUT_COST_PER_SQUARE_HOUR + * = 3807; + * * DURATION_LIMIT_COST_PER_SQUARE_HOUR_WITHOUT_QUADRATIC_SOFT_MAX + * = 3808; + * * DURATION_LIMIT_QUADRATIC_SOFT_MAX_WITHOUT_MAX = 3809; + * * DURATION_LIMIT_SOFT_MAX_LARGER_THAN_MAX = 3810; + * * DURATION_LIMIT_QUADRATIC_SOFT_MAX_LARGER_THAN_MAX = 3811; + * * DURATION_LIMIT_DIFF_BETWEEN_MAX_AND_QUADRATIC_SOFT_MAX_TOO_LARGE + * = 3812; + * * DURATION_LIMIT_MAX_DURATION_EXCEEDS_GLOBAL_DURATION = 3813; + * * DURATION_LIMIT_SOFT_MAX_DURATION_EXCEEDS_GLOBAL_DURATION = 3814; + * * DURATION_LIMIT_QUADRATIC_SOFT_MAX_DURATION_EXCEEDS_GLOBAL_DURATION + * = 3815; + * * SHIPMENT_ERROR = 40; + * * SHIPMENT_PD_LIMIT_WITHOUT_PICKUP_AND_DELIVERY = 4014; + * * SHIPMENT_PD_ABSOLUTE_DETOUR_LIMIT_DURATION_NEGATIVE_OR_NAN = 4000; + * * SHIPMENT_PD_ABSOLUTE_DETOUR_LIMIT_DURATION_EXCEEDS_GLOBAL_DURATION + * = 4001; + * * SHIPMENT_PD_RELATIVE_DETOUR_LIMIT_INVALID = 4015; + * * SHIPMENT_PD_DETOUR_LIMIT_AND_EXTRA_VISIT_DURATION = 4016; + * * SHIPMENT_PD_TIME_LIMIT_DURATION_NEGATIVE_OR_NAN = 4002; + * * SHIPMENT_PD_TIME_LIMIT_DURATION_EXCEEDS_GLOBAL_DURATION = 4003; + * * SHIPMENT_EMPTY_SHIPMENT_TYPE = 4004; + * * SHIPMENT_NO_PICKUP_NO_DELIVERY = 4005; + * * SHIPMENT_INVALID_PENALTY_COST = 4006; + * * SHIPMENT_ALLOWED_VEHICLE_INDEX_OUT_OF_BOUNDS = 4007; + * * SHIPMENT_DUPLICATE_ALLOWED_VEHICLE_INDEX = 4008; + * * SHIPMENT_INCONSISTENT_COST_FOR_VEHICLE_SIZE_WITHOUT_INDEX = 4009; + * * SHIPMENT_INCONSISTENT_COST_FOR_VEHICLE_SIZE_WITH_INDEX = 4010; + * * SHIPMENT_INVALID_COST_FOR_VEHICLE = 4011; + * * SHIPMENT_COST_FOR_VEHICLE_INDEX_OUT_OF_BOUNDS = 4012; + * * SHIPMENT_DUPLICATE_COST_FOR_VEHICLE_INDEX = 4013; + * * VEHICLE_ERROR = 42; + * * VEHICLE_EMPTY_REQUIRED_OPERATOR_TYPE = 4200; + * * VEHICLE_DUPLICATE_REQUIRED_OPERATOR_TYPE = 4201; + * * VEHICLE_NO_OPERATOR_WITH_REQUIRED_OPERATOR_TYPE = 4202; + * * VEHICLE_EMPTY_START_TAG = 4203; + * * VEHICLE_DUPLICATE_START_TAG = 4204; + * * VEHICLE_EMPTY_END_TAG = 4205; + * * VEHICLE_DUPLICATE_END_TAG = 4206; + * * VEHICLE_EXTRA_VISIT_DURATION_NEGATIVE_OR_NAN = 4207; + * * VEHICLE_EXTRA_VISIT_DURATION_EXCEEDS_GLOBAL_DURATION = 4208; + * * VEHICLE_EXTRA_VISIT_DURATION_EMPTY_KEY = 4209; + * * VEHICLE_FIRST_SHIPMENT_INDEX_OUT_OF_BOUNDS = 4210; + * * VEHICLE_FIRST_SHIPMENT_IGNORED = 4211; + * * VEHICLE_FIRST_SHIPMENT_NOT_BOUND = 4212; + * * VEHICLE_LAST_SHIPMENT_INDEX_OUT_OF_BOUNDS = 4213; + * * VEHICLE_LAST_SHIPMENT_IGNORED = 4214; + * * VEHICLE_LAST_SHIPMENT_NOT_BOUND = 4215; + * * VEHICLE_IGNORED_WITH_USED_IF_ROUTE_IS_EMPTY = 4216; + * * VEHICLE_INVALID_COST_PER_KILOMETER = 4217; + * * VEHICLE_INVALID_COST_PER_HOUR = 4218; + * * VEHICLE_INVALID_COST_PER_TRAVELED_HOUR = 4219; + * * VEHICLE_INVALID_FIXED_COST = 4220; + * * VEHICLE_INVALID_TRAVEL_DURATION_MULTIPLE = 4221; + * * VEHICLE_TRAVEL_DURATION_MULTIPLE_WITH_SHIPMENT_PD_DETOUR_LIMITS + * = 4223; + * * VEHICLE_MATRIX_INDEX_WITH_SHIPMENT_PD_DETOUR_LIMITS = 4224; + * * VEHICLE_MINIMUM_DURATION_LONGER_THAN_DURATION_LIMIT = 4222; + * * VISIT_REQUEST_ERROR = 44; + * * VISIT_REQUEST_EMPTY_TAG = 4400; + * * VISIT_REQUEST_DUPLICATE_TAG = 4401; + * * VISIT_REQUEST_DURATION_NEGATIVE_OR_NAN = 4404; + * * VISIT_REQUEST_DURATION_EXCEEDS_GLOBAL_DURATION = 4405; + * * PRECEDENCE_ERROR = 46; + * * BREAK_ERROR = 48; + * * BREAK_RULE_EMPTY = 4800; + * * BREAK_REQUEST_UNSPECIFIED_DURATION = 4801; + * * BREAK_REQUEST_UNSPECIFIED_EARLIEST_START_TIME = 4802; + * * BREAK_REQUEST_UNSPECIFIED_LATEST_START_TIME = 4803; + * * BREAK_REQUEST_DURATION_NEGATIVE_OR_NAN = 4804; = 4804; + * * BREAK_REQUEST_LATEST_START_TIME_BEFORE_EARLIEST_START_TIME = 4805; + * * BREAK_REQUEST_EARLIEST_START_TIME_BEFORE_GLOBAL_START_TIME = 4806; + * * BREAK_REQUEST_LATEST_END_TIME_AFTER_GLOBAL_END_TIME = 4807; + * * BREAK_REQUEST_NON_SCHEDULABLE = 4808; + * * BREAK_FREQUENCY_MAX_INTER_BREAK_DURATION_NEGATIVE_OR_NAN = 4809; + * * BREAK_FREQUENCY_MIN_BREAK_DURATION_NEGATIVE_OR_NAN = 4810; + * * BREAK_FREQUENCY_MIN_BREAK_DURATION_EXCEEDS_GLOBAL_DURATION = 4811; + * * BREAK_FREQUENCY_MAX_INTER_BREAK_DURATION_EXCEEDS_GLOBAL_DURATION + * = 4812; + * * BREAK_REQUEST_DURATION_EXCEEDS_GLOBAL_DURATION = 4813; + * * BREAK_FREQUENCY_MISSING_MAX_INTER_BREAK_DURATION = 4814; + * * BREAK_FREQUENCY_MISSING_MIN_BREAK_DURATION = 4815; + * * SHIPMENT_TYPE_INCOMPATIBILITY_ERROR = 50; + * * SHIPMENT_TYPE_INCOMPATIBILITY_EMPTY_TYPE = 5001; + * * SHIPMENT_TYPE_INCOMPATIBILITY_LESS_THAN_TWO_TYPES = 5002; + * * SHIPMENT_TYPE_INCOMPATIBILITY_DUPLICATE_TYPE = 5003; + * * SHIPMENT_TYPE_INCOMPATIBILITY_INVALID_INCOMPATIBILITY_MODE = 5004; + * * SHIPMENT_TYPE_INCOMPATIBILITY_TOO_MANY_INCOMPATIBILITIES = 5005; + * * SHIPMENT_TYPE_REQUIREMENT_ERROR = 52; + * * SHIPMENT_TYPE_REQUIREMENT_NO_REQUIRED_TYPE = 52001; + * * SHIPMENT_TYPE_REQUIREMENT_NO_DEPENDENT_TYPE = 52002; + * * SHIPMENT_TYPE_REQUIREMENT_INVALID_REQUIREMENT_MODE = 52003; + * * SHIPMENT_TYPE_REQUIREMENT_TOO_MANY_REQUIREMENTS = 52004; + * * SHIPMENT_TYPE_REQUIREMENT_EMPTY_REQUIRED_TYPE = 52005; + * * SHIPMENT_TYPE_REQUIREMENT_DUPLICATE_REQUIRED_TYPE = 52006; + * * SHIPMENT_TYPE_REQUIREMENT_NO_REQUIRED_TYPE_FOUND = 52007; + * * SHIPMENT_TYPE_REQUIREMENT_EMPTY_DEPENDENT_TYPE = 52008; + * * SHIPMENT_TYPE_REQUIREMENT_DUPLICATE_DEPENDENT_TYPE = 52009; + * * SHIPMENT_TYPE_REQUIREMENT_SELF_DEPENDENT_TYPE = 52010; + * * SHIPMENT_TYPE_REQUIREMENT_GRAPH_HAS_CYCLES = 52011; + * * VEHICLE_OPERATOR_ERROR = 54; + * * VEHICLE_OPERATOR_EMPTY_TYPE = 5400; + * * VEHICLE_OPERATOR_MULTIPLE_START_TIME_WINDOWS = 5401; + * * VEHICLE_OPERATOR_SOFT_START_TIME_WINDOW = 5402; + * * VEHICLE_OPERATOR_MULTIPLE_END_TIME_WINDOWS = 5403; + * * VEHICLE_OPERATOR_SOFT_END_TIME_WINDOW = 5404; + * * DURATION_SECONDS_MATRIX_ERROR = 56; + * * DURATION_SECONDS_MATRIX_DURATION_NEGATIVE_OR_NAN = 5600; + * * DURATION_SECONDS_MATRIX_DURATION_EXCEEDS_GLOBAL_DURATION = 5601; + * + * Generated from protobuf field int32 code = 1; + * @return int + */ + public function getCode() + { + return $this->code; + } + + /** + * A validation error is defined by the pair (`code`, `display_name`) which + * are always present. + * Other fields (below) provide more context about the error. + * *MULTIPLE ERRORS*: + * When there are multiple errors, the validation process tries to output + * several of them. Much like a compiler, this is an imperfect process. Some + * validation errors will be "fatal", meaning that they stop the entire + * validation process. This is the case for `display_name="UNSPECIFIED"` + * errors, among others. Some may cause the validation process to skip other + * errors. + * *STABILITY*: + * `code` and `display_name` should be very stable. But new codes and + * display names may appear over time, which may cause a given (invalid) + * request to yield a different (`code`, `display_name`) pair because the new + * error hid the old one (see "MULTIPLE ERRORS"). + * *REFERENCE*: A list of all (code, name) pairs: + * * UNSPECIFIED = 0; + * * VALIDATION_TIMEOUT_ERROR = 10; Validation couldn't be completed within + * the deadline. + * * REQUEST_OPTIONS_ERROR = 12; + * * REQUEST_OPTIONS_INVALID_SOLVING_MODE = 1201; + * * REQUEST_OPTIONS_INVALID_MAX_VALIDATION_ERRORS = 1203; + * * REQUEST_OPTIONS_INVALID_GEODESIC_METERS_PER_SECOND = 1204; + * * REQUEST_OPTIONS_GEODESIC_METERS_PER_SECOND_TOO_SMALL = 1205; + * * REQUEST_OPTIONS_MISSING_GEODESIC_METERS_PER_SECOND = 1206; + * * REQUEST_OPTIONS_POPULATE_PATHFINDER_TRIPS_AND_GEODESIC_DISTANCE + * = 1207; + * * REQUEST_OPTIONS_COST_MODEL_OPTIONS_AND_GEODESIC_DISTANCE = 1208; + * * REQUEST_OPTIONS_TRAVEL_MODE_INCOMPATIBLE_WITH_TRAFFIC = 1211; + * * REQUEST_OPTIONS_MULTIPLE_TRAFFIC_FLAVORS = 1212; + * * REQUEST_OPTIONS_INVALID_TRAFFIC_FLAVOR = 1213; + * * REQUEST_OPTIONS_TRAFFIC_ENABLED_WITHOUT_GLOBAL_START_TIME = 1214; + * * REQUEST_OPTIONS_TRAFFIC_ENABLED_WITH_PRECEDENCES = 1215; + * * REQUEST_OPTIONS_TRAFFIC_PREFILL_MODE_INVALID = 1216; + * * REQUEST_OPTIONS_TRAFFIC_PREFILL_ENABLED_WITHOUT_TRAFFIC = 1217; + * * INJECTED_SOLUTION_ERROR = 20; + * * INJECTED_SOLUTION_MISSING_LABEL = 2000; + * * INJECTED_SOLUTION_DUPLICATE_LABEL = 2001; + * * INJECTED_SOLUTION_AMBIGUOUS_INDEX = 2002; + * * INJECTED_SOLUTION_INFEASIBLE_AFTER_GETTING_TRAVEL_TIMES = 2003; + * * INJECTED_SOLUTION_TRANSITION_INCONSISTENT_WITH_ACTUAL_TRAVEL = 2004; + * * INJECTED_SOLUTION_CONCURRENT_SOLUTION_TYPES = 2005; + * * INJECTED_SOLUTION_MORE_THAN_ONE_PER_TYPE = 2006; + * * INJECTED_SOLUTION_REFRESH_WITHOUT_POPULATE = 2008; + * * SHIPMENT_MODEL_ERROR = 22; + * * SHIPMENT_MODEL_TOO_LARGE = 2200; + * * SHIPMENT_MODEL_TOO_MANY_CAPACITY_TYPES = 2201; + * * SHIPMENT_MODEL_GLOBAL_START_TIME_NEGATIVE_OR_NAN = 2202; + * * SHIPMENT_MODEL_GLOBAL_END_TIME_TOO_LARGE_OR_NAN = 2203; + * * SHIPMENT_MODEL_GLOBAL_START_TIME_AFTER_GLOBAL_END_TIME = 2204; + * * SHIPMENT_MODEL_GLOBAL_DURATION_TOO_LONG = 2205; + * * SHIPMENT_MODEL_MAX_ACTIVE_VEHICLES_NOT_POSITIVE = 2206; + * * SHIPMENT_MODEL_DURATION_MATRIX_TOO_LARGE = 2207; + * * INDEX_ERROR = 24; + * * TAG_ERROR = 26; + * * TIME_WINDOW_ERROR = 28; + * * TIME_WINDOW_INVALID_START_TIME = 2800; + * * TIME_WINDOW_INVALID_END_TIME = 2801; + * * TIME_WINDOW_INVALID_SOFT_START_TIME = 2802; + * * TIME_WINDOW_INVALID_SOFT_END_TIME = 2803; + * * TIME_WINDOW_OUTSIDE_GLOBAL_TIME_WINDOW = 2804; + * * TIME_WINDOW_START_TIME_AFTER_END_TIME = 2805; + * * TIME_WINDOW_INVALID_COST_PER_HOUR_BEFORE_SOFT_START_TIME = 2806; + * * TIME_WINDOW_INVALID_COST_PER_HOUR_AFTER_SOFT_END_TIME = 2807; + * * TIME_WINDOW_COST_BEFORE_SOFT_START_TIME_WITHOUT_SOFT_START_TIME + * = 2808; + * * TIME_WINDOW_COST_AFTER_SOFT_END_TIME_WITHOUT_SOFT_END_TIME = 2809; + * * TIME_WINDOW_SOFT_START_TIME_WITHOUT_COST_BEFORE_SOFT_START_TIME + * = 2810; + * * TIME_WINDOW_SOFT_END_TIME_WITHOUT_COST_AFTER_SOFT_END_TIME = 2811; + * * TIME_WINDOW_OVERLAPPING_ADJACENT_OR_EARLIER_THAN_PREVIOUS = 2812; + * * TIME_WINDOW_START_TIME_AFTER_SOFT_START_TIME = 2813; + * * TIME_WINDOW_SOFT_START_TIME_AFTER_END_TIME = 2814; + * * TIME_WINDOW_START_TIME_AFTER_SOFT_END_TIME = 2815; + * * TIME_WINDOW_SOFT_END_TIME_AFTER_END_TIME = 2816; + * * TIME_WINDOW_COST_BEFORE_SOFT_START_TIME_SET_AND_MULTIPLE_WINDOWS + * = 2817; + * * TIME_WINDOW_COST_AFTER_SOFT_END_TIME_SET_AND_MULTIPLE_WINDOWS = 2818; + * * TRANSITION_ATTRIBUTES_ERROR = 30; + * * TRANSITION_ATTRIBUTES_INVALID_COST = 3000; + * * TRANSITION_ATTRIBUTES_INVALID_COST_PER_KILOMETER = 3001; + * * TRANSITION_ATTRIBUTES_DUPLICATE_TAG_PAIR = 3002; + * * TRANSITION_ATTRIBUTES_DISTANCE_LIMIT_MAX_METERS_UNSUPPORTED = 3003; + * * TRANSITION_ATTRIBUTES_UNSPECIFIED_SOURCE_TAGS = 3004; + * * TRANSITION_ATTRIBUTES_CONFLICTING_SOURCE_TAGS_FIELDS = 3005; + * * TRANSITION_ATTRIBUTES_UNSPECIFIED_DESTINATION_TAGS = 3006; + * * TRANSITION_ATTRIBUTES_CONFLICTING_DESTINATION_TAGS_FIELDS = 3007; + * * TRANSITION_ATTRIBUTES_DELAY_DURATION_NEGATIVE_OR_NAN = 3008; + * * TRANSITION_ATTRIBUTES_DELAY_DURATION_EXCEEDS_GLOBAL_DURATION = 3009; + * * AMOUNT_ERROR = 31; + * * AMOUNT_NEGATIVE_VALUE = 3100; + * * LOAD_LIMIT_ERROR = 33; + * * LOAD_LIMIT_INVALID_COST_ABOVE_SOFT_MAX = 3303; + * * LOAD_LIMIT_SOFT_MAX_WITHOUT_COST_ABOVE_SOFT_MAX = 3304; + * * LOAD_LIMIT_COST_ABOVE_SOFT_MAX_WITHOUT_SOFT_MAX = 3305; + * * LOAD_LIMIT_NEGATIVE_SOFT_MAX = 3306; + * * LOAD_LIMIT_MIXED_DEMAND_TYPE = 3307; + * * LOAD_LIMIT_MAX_LOAD_NEGATIVE_VALUE = 3308; + * * LOAD_LIMIT_SOFT_MAX_ABOVE_MAX = 3309; + * * INTERVAL_ERROR = 34; + * * INTERVAL_MIN_EXCEEDS_MAX = 3401; + * * INTERVAL_NEGATIVE_MIN = 3402; + * * INTERVAL_NEGATIVE_MAX = 3403; + * * INTERVAL_MIN_EXCEEDS_CAPACITY = 3404; + * * INTERVAL_MAX_EXCEEDS_CAPACITY = 3405; + * * DISTANCE_LIMIT_ERROR = 36; + * * DISTANCE_LIMIT_INVALID_COST_AFTER_SOFT_MAX = 3601; + * * DISTANCE_LIMIT_SOFT_MAX_WITHOUT_COST_AFTER_SOFT_MAX = 3602; + * * DISTANCE_LIMIT_COST_AFTER_SOFT_MAX_WITHOUT_SOFT_MAX = 3603; + * * DISTANCE_LIMIT_NEGATIVE_MAX = 3604; + * * DISTANCE_LIMIT_NEGATIVE_SOFT_MAX = 3605; + * * DISTANCE_LIMIT_SOFT_MAX_LARGER_THAN_MAX = 3606; + * * DURATION_LIMIT_ERROR = 38; + * * DURATION_LIMIT_MAX_DURATION_NEGATIVE_OR_NAN = 3800; + * * DURATION_LIMIT_SOFT_MAX_DURATION_NEGATIVE_OR_NAN = 3801; + * * DURATION_LIMIT_INVALID_COST_PER_HOUR_AFTER_SOFT_MAX = 3802; + * * DURATION_LIMIT_SOFT_MAX_WITHOUT_COST_AFTER_SOFT_MAX = 3803; + * * DURATION_LIMIT_COST_AFTER_SOFT_MAX_WITHOUT_SOFT_MAX = 3804; + * * DURATION_LIMIT_QUADRATIC_SOFT_MAX_DURATION_NEGATIVE_OR_NAN = 3805; + * * DURATION_LIMIT_INVALID_COST_AFTER_QUADRATIC_SOFT_MAX = 3806; + * * DURATION_LIMIT_QUADRATIC_SOFT_MAX_WITHOUT_COST_PER_SQUARE_HOUR + * = 3807; + * * DURATION_LIMIT_COST_PER_SQUARE_HOUR_WITHOUT_QUADRATIC_SOFT_MAX + * = 3808; + * * DURATION_LIMIT_QUADRATIC_SOFT_MAX_WITHOUT_MAX = 3809; + * * DURATION_LIMIT_SOFT_MAX_LARGER_THAN_MAX = 3810; + * * DURATION_LIMIT_QUADRATIC_SOFT_MAX_LARGER_THAN_MAX = 3811; + * * DURATION_LIMIT_DIFF_BETWEEN_MAX_AND_QUADRATIC_SOFT_MAX_TOO_LARGE + * = 3812; + * * DURATION_LIMIT_MAX_DURATION_EXCEEDS_GLOBAL_DURATION = 3813; + * * DURATION_LIMIT_SOFT_MAX_DURATION_EXCEEDS_GLOBAL_DURATION = 3814; + * * DURATION_LIMIT_QUADRATIC_SOFT_MAX_DURATION_EXCEEDS_GLOBAL_DURATION + * = 3815; + * * SHIPMENT_ERROR = 40; + * * SHIPMENT_PD_LIMIT_WITHOUT_PICKUP_AND_DELIVERY = 4014; + * * SHIPMENT_PD_ABSOLUTE_DETOUR_LIMIT_DURATION_NEGATIVE_OR_NAN = 4000; + * * SHIPMENT_PD_ABSOLUTE_DETOUR_LIMIT_DURATION_EXCEEDS_GLOBAL_DURATION + * = 4001; + * * SHIPMENT_PD_RELATIVE_DETOUR_LIMIT_INVALID = 4015; + * * SHIPMENT_PD_DETOUR_LIMIT_AND_EXTRA_VISIT_DURATION = 4016; + * * SHIPMENT_PD_TIME_LIMIT_DURATION_NEGATIVE_OR_NAN = 4002; + * * SHIPMENT_PD_TIME_LIMIT_DURATION_EXCEEDS_GLOBAL_DURATION = 4003; + * * SHIPMENT_EMPTY_SHIPMENT_TYPE = 4004; + * * SHIPMENT_NO_PICKUP_NO_DELIVERY = 4005; + * * SHIPMENT_INVALID_PENALTY_COST = 4006; + * * SHIPMENT_ALLOWED_VEHICLE_INDEX_OUT_OF_BOUNDS = 4007; + * * SHIPMENT_DUPLICATE_ALLOWED_VEHICLE_INDEX = 4008; + * * SHIPMENT_INCONSISTENT_COST_FOR_VEHICLE_SIZE_WITHOUT_INDEX = 4009; + * * SHIPMENT_INCONSISTENT_COST_FOR_VEHICLE_SIZE_WITH_INDEX = 4010; + * * SHIPMENT_INVALID_COST_FOR_VEHICLE = 4011; + * * SHIPMENT_COST_FOR_VEHICLE_INDEX_OUT_OF_BOUNDS = 4012; + * * SHIPMENT_DUPLICATE_COST_FOR_VEHICLE_INDEX = 4013; + * * VEHICLE_ERROR = 42; + * * VEHICLE_EMPTY_REQUIRED_OPERATOR_TYPE = 4200; + * * VEHICLE_DUPLICATE_REQUIRED_OPERATOR_TYPE = 4201; + * * VEHICLE_NO_OPERATOR_WITH_REQUIRED_OPERATOR_TYPE = 4202; + * * VEHICLE_EMPTY_START_TAG = 4203; + * * VEHICLE_DUPLICATE_START_TAG = 4204; + * * VEHICLE_EMPTY_END_TAG = 4205; + * * VEHICLE_DUPLICATE_END_TAG = 4206; + * * VEHICLE_EXTRA_VISIT_DURATION_NEGATIVE_OR_NAN = 4207; + * * VEHICLE_EXTRA_VISIT_DURATION_EXCEEDS_GLOBAL_DURATION = 4208; + * * VEHICLE_EXTRA_VISIT_DURATION_EMPTY_KEY = 4209; + * * VEHICLE_FIRST_SHIPMENT_INDEX_OUT_OF_BOUNDS = 4210; + * * VEHICLE_FIRST_SHIPMENT_IGNORED = 4211; + * * VEHICLE_FIRST_SHIPMENT_NOT_BOUND = 4212; + * * VEHICLE_LAST_SHIPMENT_INDEX_OUT_OF_BOUNDS = 4213; + * * VEHICLE_LAST_SHIPMENT_IGNORED = 4214; + * * VEHICLE_LAST_SHIPMENT_NOT_BOUND = 4215; + * * VEHICLE_IGNORED_WITH_USED_IF_ROUTE_IS_EMPTY = 4216; + * * VEHICLE_INVALID_COST_PER_KILOMETER = 4217; + * * VEHICLE_INVALID_COST_PER_HOUR = 4218; + * * VEHICLE_INVALID_COST_PER_TRAVELED_HOUR = 4219; + * * VEHICLE_INVALID_FIXED_COST = 4220; + * * VEHICLE_INVALID_TRAVEL_DURATION_MULTIPLE = 4221; + * * VEHICLE_TRAVEL_DURATION_MULTIPLE_WITH_SHIPMENT_PD_DETOUR_LIMITS + * = 4223; + * * VEHICLE_MATRIX_INDEX_WITH_SHIPMENT_PD_DETOUR_LIMITS = 4224; + * * VEHICLE_MINIMUM_DURATION_LONGER_THAN_DURATION_LIMIT = 4222; + * * VISIT_REQUEST_ERROR = 44; + * * VISIT_REQUEST_EMPTY_TAG = 4400; + * * VISIT_REQUEST_DUPLICATE_TAG = 4401; + * * VISIT_REQUEST_DURATION_NEGATIVE_OR_NAN = 4404; + * * VISIT_REQUEST_DURATION_EXCEEDS_GLOBAL_DURATION = 4405; + * * PRECEDENCE_ERROR = 46; + * * BREAK_ERROR = 48; + * * BREAK_RULE_EMPTY = 4800; + * * BREAK_REQUEST_UNSPECIFIED_DURATION = 4801; + * * BREAK_REQUEST_UNSPECIFIED_EARLIEST_START_TIME = 4802; + * * BREAK_REQUEST_UNSPECIFIED_LATEST_START_TIME = 4803; + * * BREAK_REQUEST_DURATION_NEGATIVE_OR_NAN = 4804; = 4804; + * * BREAK_REQUEST_LATEST_START_TIME_BEFORE_EARLIEST_START_TIME = 4805; + * * BREAK_REQUEST_EARLIEST_START_TIME_BEFORE_GLOBAL_START_TIME = 4806; + * * BREAK_REQUEST_LATEST_END_TIME_AFTER_GLOBAL_END_TIME = 4807; + * * BREAK_REQUEST_NON_SCHEDULABLE = 4808; + * * BREAK_FREQUENCY_MAX_INTER_BREAK_DURATION_NEGATIVE_OR_NAN = 4809; + * * BREAK_FREQUENCY_MIN_BREAK_DURATION_NEGATIVE_OR_NAN = 4810; + * * BREAK_FREQUENCY_MIN_BREAK_DURATION_EXCEEDS_GLOBAL_DURATION = 4811; + * * BREAK_FREQUENCY_MAX_INTER_BREAK_DURATION_EXCEEDS_GLOBAL_DURATION + * = 4812; + * * BREAK_REQUEST_DURATION_EXCEEDS_GLOBAL_DURATION = 4813; + * * BREAK_FREQUENCY_MISSING_MAX_INTER_BREAK_DURATION = 4814; + * * BREAK_FREQUENCY_MISSING_MIN_BREAK_DURATION = 4815; + * * SHIPMENT_TYPE_INCOMPATIBILITY_ERROR = 50; + * * SHIPMENT_TYPE_INCOMPATIBILITY_EMPTY_TYPE = 5001; + * * SHIPMENT_TYPE_INCOMPATIBILITY_LESS_THAN_TWO_TYPES = 5002; + * * SHIPMENT_TYPE_INCOMPATIBILITY_DUPLICATE_TYPE = 5003; + * * SHIPMENT_TYPE_INCOMPATIBILITY_INVALID_INCOMPATIBILITY_MODE = 5004; + * * SHIPMENT_TYPE_INCOMPATIBILITY_TOO_MANY_INCOMPATIBILITIES = 5005; + * * SHIPMENT_TYPE_REQUIREMENT_ERROR = 52; + * * SHIPMENT_TYPE_REQUIREMENT_NO_REQUIRED_TYPE = 52001; + * * SHIPMENT_TYPE_REQUIREMENT_NO_DEPENDENT_TYPE = 52002; + * * SHIPMENT_TYPE_REQUIREMENT_INVALID_REQUIREMENT_MODE = 52003; + * * SHIPMENT_TYPE_REQUIREMENT_TOO_MANY_REQUIREMENTS = 52004; + * * SHIPMENT_TYPE_REQUIREMENT_EMPTY_REQUIRED_TYPE = 52005; + * * SHIPMENT_TYPE_REQUIREMENT_DUPLICATE_REQUIRED_TYPE = 52006; + * * SHIPMENT_TYPE_REQUIREMENT_NO_REQUIRED_TYPE_FOUND = 52007; + * * SHIPMENT_TYPE_REQUIREMENT_EMPTY_DEPENDENT_TYPE = 52008; + * * SHIPMENT_TYPE_REQUIREMENT_DUPLICATE_DEPENDENT_TYPE = 52009; + * * SHIPMENT_TYPE_REQUIREMENT_SELF_DEPENDENT_TYPE = 52010; + * * SHIPMENT_TYPE_REQUIREMENT_GRAPH_HAS_CYCLES = 52011; + * * VEHICLE_OPERATOR_ERROR = 54; + * * VEHICLE_OPERATOR_EMPTY_TYPE = 5400; + * * VEHICLE_OPERATOR_MULTIPLE_START_TIME_WINDOWS = 5401; + * * VEHICLE_OPERATOR_SOFT_START_TIME_WINDOW = 5402; + * * VEHICLE_OPERATOR_MULTIPLE_END_TIME_WINDOWS = 5403; + * * VEHICLE_OPERATOR_SOFT_END_TIME_WINDOW = 5404; + * * DURATION_SECONDS_MATRIX_ERROR = 56; + * * DURATION_SECONDS_MATRIX_DURATION_NEGATIVE_OR_NAN = 5600; + * * DURATION_SECONDS_MATRIX_DURATION_EXCEEDS_GLOBAL_DURATION = 5601; + * + * Generated from protobuf field int32 code = 1; + * @param int $var + * @return $this + */ + public function setCode($var) + { + GPBUtil::checkInt32($var); + $this->code = $var; + + return $this; + } + + /** + * The error display name. + * + * Generated from protobuf field string display_name = 2; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * The error display name. + * + * Generated from protobuf field string display_name = 2; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * An error context may involve 0, 1 (most of the time) or more fields. For + * example, referring to vehicle #4 and shipment #2's first pickup can be + * done as follows: + * ``` + * fields { name: "vehicles" index: 4} + * fields { name: "shipments" index: 2 sub_field {name: "pickups" index: 0} } + * ``` + * Note, however, that the cardinality of `fields` should not change for a + * given error code. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.OptimizeToursValidationError.FieldReference fields = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getFields() + { + return $this->fields; + } + + /** + * An error context may involve 0, 1 (most of the time) or more fields. For + * example, referring to vehicle #4 and shipment #2's first pickup can be + * done as follows: + * ``` + * fields { name: "vehicles" index: 4} + * fields { name: "shipments" index: 2 sub_field {name: "pickups" index: 0} } + * ``` + * Note, however, that the cardinality of `fields` should not change for a + * given error code. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.OptimizeToursValidationError.FieldReference fields = 3; + * @param array<\Google\Cloud\Optimization\V1\OptimizeToursValidationError\FieldReference>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setFields($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\OptimizeToursValidationError\FieldReference::class); + $this->fields = $arr; + + return $this; + } + + /** + * Human-readable string describing the error. There is a 1:1 mapping + * between `code` and `error_message` (when code != "UNSPECIFIED"). + * *STABILITY*: Not stable: the error message associated to a given `code` may + * change (hopefully to clarify it) over time. Please rely on the + * `display_name` and `code` instead. + * + * Generated from protobuf field string error_message = 4; + * @return string + */ + public function getErrorMessage() + { + return $this->error_message; + } + + /** + * Human-readable string describing the error. There is a 1:1 mapping + * between `code` and `error_message` (when code != "UNSPECIFIED"). + * *STABILITY*: Not stable: the error message associated to a given `code` may + * change (hopefully to clarify it) over time. Please rely on the + * `display_name` and `code` instead. + * + * Generated from protobuf field string error_message = 4; + * @param string $var + * @return $this + */ + public function setErrorMessage($var) + { + GPBUtil::checkString($var, True); + $this->error_message = $var; + + return $this; + } + + /** + * May contain the value(s) of the field(s). This is not always available. You + * should absolutely not rely on it and use it only for manual model + * debugging. + * + * Generated from protobuf field string offending_values = 5; + * @return string + */ + public function getOffendingValues() + { + return $this->offending_values; + } + + /** + * May contain the value(s) of the field(s). This is not always available. You + * should absolutely not rely on it and use it only for manual model + * debugging. + * + * Generated from protobuf field string offending_values = 5; + * @param string $var + * @return $this + */ + public function setOffendingValues($var) + { + GPBUtil::checkString($var, True); + $this->offending_values = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/OptimizeToursValidationError/FieldReference.php b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/OptimizeToursValidationError/FieldReference.php new file mode 100644 index 000000000000..6054ab294a5e --- /dev/null +++ b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/OptimizeToursValidationError/FieldReference.php @@ -0,0 +1,197 @@ +google.cloud.optimization.v1.OptimizeToursValidationError.FieldReference + */ +class FieldReference extends \Google\Protobuf\Internal\Message +{ + /** + * Name of the field, e.g., "vehicles". + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * Recursively nested sub-field, if needed. + * + * Generated from protobuf field .google.cloud.optimization.v1.OptimizeToursValidationError.FieldReference sub_field = 3; + */ + protected $sub_field = null; + protected $index_or_key; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Name of the field, e.g., "vehicles". + * @type int $index + * Index of the field if repeated. + * @type string $key + * Key if the field is a map. + * @type \Google\Cloud\Optimization\V1\OptimizeToursValidationError\FieldReference $sub_field + * Recursively nested sub-field, if needed. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * Name of the field, e.g., "vehicles". + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Name of the field, e.g., "vehicles". + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Index of the field if repeated. + * + * Generated from protobuf field int32 index = 2; + * @return int + */ + public function getIndex() + { + return $this->readOneof(2); + } + + public function hasIndex() + { + return $this->hasOneof(2); + } + + /** + * Index of the field if repeated. + * + * Generated from protobuf field int32 index = 2; + * @param int $var + * @return $this + */ + public function setIndex($var) + { + GPBUtil::checkInt32($var); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * Key if the field is a map. + * + * Generated from protobuf field string key = 4; + * @return string + */ + public function getKey() + { + return $this->readOneof(4); + } + + public function hasKey() + { + return $this->hasOneof(4); + } + + /** + * Key if the field is a map. + * + * Generated from protobuf field string key = 4; + * @param string $var + * @return $this + */ + public function setKey($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * Recursively nested sub-field, if needed. + * + * Generated from protobuf field .google.cloud.optimization.v1.OptimizeToursValidationError.FieldReference sub_field = 3; + * @return \Google\Cloud\Optimization\V1\OptimizeToursValidationError\FieldReference|null + */ + public function getSubField() + { + return $this->sub_field; + } + + public function hasSubField() + { + return isset($this->sub_field); + } + + public function clearSubField() + { + unset($this->sub_field); + } + + /** + * Recursively nested sub-field, if needed. + * + * Generated from protobuf field .google.cloud.optimization.v1.OptimizeToursValidationError.FieldReference sub_field = 3; + * @param \Google\Cloud\Optimization\V1\OptimizeToursValidationError\FieldReference $var + * @return $this + */ + public function setSubField($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Optimization\V1\OptimizeToursValidationError\FieldReference::class); + $this->sub_field = $var; + + return $this; + } + + /** + * @return string + */ + public function getIndexOrKey() + { + return $this->whichOneof("index_or_key"); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(FieldReference::class, \Google\Cloud\Optimization\V1\OptimizeToursValidationError_FieldReference::class); + diff --git a/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/OptimizeToursValidationError_FieldReference.php b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/OptimizeToursValidationError_FieldReference.php new file mode 100644 index 000000000000..434856373f36 --- /dev/null +++ b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/OptimizeToursValidationError_FieldReference.php @@ -0,0 +1,16 @@ +google.cloud.optimization.v1.OutputConfig + */ +class OutputConfig extends \Google\Protobuf\Internal\Message +{ + /** + * The output data format that used to store the results in Cloud Storage. + * + * Generated from protobuf field .google.cloud.optimization.v1.DataFormat data_format = 2; + */ + protected $data_format = 0; + protected $destination; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Optimization\V1\GcsDestination $gcs_destination + * The Google Cloud Storage location to write the output to. + * @type int $data_format + * The output data format that used to store the results in Cloud Storage. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\AsyncModel::initOnce(); + parent::__construct($data); + } + + /** + * The Google Cloud Storage location to write the output to. + * + * Generated from protobuf field .google.cloud.optimization.v1.GcsDestination gcs_destination = 1; + * @return \Google\Cloud\Optimization\V1\GcsDestination|null + */ + public function getGcsDestination() + { + return $this->readOneof(1); + } + + public function hasGcsDestination() + { + return $this->hasOneof(1); + } + + /** + * The Google Cloud Storage location to write the output to. + * + * Generated from protobuf field .google.cloud.optimization.v1.GcsDestination gcs_destination = 1; + * @param \Google\Cloud\Optimization\V1\GcsDestination $var + * @return $this + */ + public function setGcsDestination($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Optimization\V1\GcsDestination::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * The output data format that used to store the results in Cloud Storage. + * + * Generated from protobuf field .google.cloud.optimization.v1.DataFormat data_format = 2; + * @return int + */ + public function getDataFormat() + { + return $this->data_format; + } + + /** + * The output data format that used to store the results in Cloud Storage. + * + * Generated from protobuf field .google.cloud.optimization.v1.DataFormat data_format = 2; + * @param int $var + * @return $this + */ + public function setDataFormat($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Optimization\V1\DataFormat::class); + $this->data_format = $var; + + return $this; + } + + /** + * @return string + */ + public function getDestination() + { + return $this->whichOneof("destination"); + } + +} + diff --git a/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/Shipment.php b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/Shipment.php new file mode 100644 index 000000000000..652069078d66 --- /dev/null +++ b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/Shipment.php @@ -0,0 +1,850 @@ +google.cloud.optimization.v1.Shipment + */ +class Shipment extends \Google\Protobuf\Internal\Message +{ + /** + * Set of pickup alternatives associated to the shipment. If not specified, + * the vehicle only needs to visit a location corresponding to the deliveries. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.Shipment.VisitRequest pickups = 1; + */ + private $pickups; + /** + * Set of delivery alternatives associated to the shipment. If not specified, + * the vehicle only needs to visit a location corresponding to the pickups. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.Shipment.VisitRequest deliveries = 2; + */ + private $deliveries; + /** + * Load demands of the shipment (for example weight, volume, number of + * pallets etc). The keys in the map should be identifiers describing the type + * of the corresponding load, ideally also including the units. + * For example: "weight_kg", "volume_gallons", "pallet_count", etc. + * If a given key does not appear in the map, the corresponding load is + * considered as null. + * + * Generated from protobuf field map load_demands = 14; + */ + private $load_demands; + /** + * If the shipment is not completed, this penalty is added to the overall + * cost of the routes. A shipment is considered completed if one of its pickup + * and delivery alternatives is visited. The cost may be expressed in the + * same unit used for all other cost-related fields in the model and must be + * positive. + * *IMPORTANT*: If this penalty is not specified, it is considered infinite, + * i.e. the shipment must be completed. + * + * Generated from protobuf field optional double penalty_cost = 4; + */ + protected $penalty_cost = null; + /** + * The set of vehicles that may perform this shipment. If empty, all vehicles + * may perform it. Vehicles are given by their index in the `ShipmentModel`'s + * `vehicles` list. + * + * Generated from protobuf field repeated int32 allowed_vehicle_indices = 5; + */ + private $allowed_vehicle_indices; + /** + * Specifies the cost that is incurred when this shipment is delivered by each + * vehicle. If specified, it must have EITHER: + * * the same number of elements as `costs_per_vehicle_indices`. + * `costs_per_vehicle[i]` corresponds to vehicle + * `costs_per_vehicle_indices[i]` of the model. + * * the same number of elements as there are vehicles in the model. The + * i-th element corresponds to vehicle #i of the model. + * These costs must be in the same unit as `penalty_cost` and must not be + * negative. Leave this field empty, if there are no such costs. + * + * Generated from protobuf field repeated double costs_per_vehicle = 6; + */ + private $costs_per_vehicle; + /** + * Indices of the vehicles to which `costs_per_vehicle` applies. If non-empty, + * it must have the same number of elements as `costs_per_vehicle`. A vehicle + * index may not be specified more than once. If a vehicle is excluded from + * `costs_per_vehicle_indices`, its cost is zero. + * + * Generated from protobuf field repeated int32 costs_per_vehicle_indices = 7; + */ + private $costs_per_vehicle_indices; + /** + * Specifies the maximum relative detour time compared to the shortest path + * from pickup to delivery. If specified, it must be nonnegative, and the + * shipment must contain at least a pickup and a delivery. + * For example, let t be the shortest time taken to go from the selected + * pickup alternative directly to the selected delivery alternative. Then + * setting `pickup_to_delivery_relative_detour_limit` enforces: + * ``` + * start_time(delivery) - start_time(pickup) <= + * std::ceil(t * (1.0 + pickup_to_delivery_relative_detour_limit)) + * ``` + * If both relative and absolute limits are specified on the same shipment, + * the more constraining limit is used for each possible pickup/delivery pair. + * As of 2017/10, detours are only supported when travel durations do not + * depend on vehicles. + * + * Generated from protobuf field optional double pickup_to_delivery_relative_detour_limit = 8; + */ + protected $pickup_to_delivery_relative_detour_limit = null; + /** + * Specifies the maximum absolute detour time compared to the shortest path + * from pickup to delivery. If specified, it must be nonnegative, and the + * shipment must contain at least a pickup and a delivery. + * For example, let t be the shortest time taken to go from the selected + * pickup alternative directly to the selected delivery alternative. Then + * setting `pickup_to_delivery_absolute_detour_limit` enforces: + * ``` + * start_time(delivery) - start_time(pickup) <= + * t + pickup_to_delivery_absolute_detour_limit + * ``` + * If both relative and absolute limits are specified on the same shipment, + * the more constraining limit is used for each possible pickup/delivery pair. + * As of 2017/10, detours are only supported when travel durations do not + * depend on vehicles. + * + * Generated from protobuf field .google.protobuf.Duration pickup_to_delivery_absolute_detour_limit = 9; + */ + protected $pickup_to_delivery_absolute_detour_limit = null; + /** + * Specifies the maximum duration from start of pickup to start of delivery of + * a shipment. If specified, it must be nonnegative, and the shipment must + * contain at least a pickup and a delivery. This does not depend on which + * alternatives are selected for pickup and delivery, nor on vehicle speed. + * This can be specified alongside maximum detour constraints: the solution + * will respect both specifications. + * + * Generated from protobuf field .google.protobuf.Duration pickup_to_delivery_time_limit = 10; + */ + protected $pickup_to_delivery_time_limit = null; + /** + * Non-empty string specifying a "type" for this shipment. + * This feature can be used to define incompatibilities or requirements + * between `shipment_types` (see `shipment_type_incompatibilities` and + * `shipment_type_requirements` in `ShipmentModel`). + * Differs from `visit_types` which is specified for a single visit: All + * pickup/deliveries belonging to the same shipment share the same + * `shipment_type`. + * + * Generated from protobuf field string shipment_type = 11; + */ + protected $shipment_type = ''; + /** + * Specifies a label for this shipment. This label is reported in the response + * in the `shipment_label` of the corresponding + * [ShipmentRoute.Visit][google.cloud.optimization.v1.ShipmentRoute.Visit]. + * + * Generated from protobuf field string label = 12; + */ + protected $label = ''; + /** + * If true, skip this shipment, but don't apply a `penalty_cost`. + * Ignoring a shipment results in a validation error when there are any + * `shipment_type_requirements` in the model. + * Ignoring a shipment that is performed in `injected_first_solution_routes` + * or `injected_solution_constraint` is permitted; the solver removes the + * related pickup/delivery visits from the performing route. + * `precedence_rules` that reference ignored shipments will also be ignored. + * + * Generated from protobuf field bool ignore = 13; + */ + protected $ignore = false; + /** + * Deprecated: Use + * [Shipment.load_demands][google.cloud.optimization.v1.Shipment.load_demands] + * instead. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.CapacityQuantity demands = 3 [deprecated = true]; + * @deprecated + */ + private $demands; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Optimization\V1\Shipment\VisitRequest>|\Google\Protobuf\Internal\RepeatedField $pickups + * Set of pickup alternatives associated to the shipment. If not specified, + * the vehicle only needs to visit a location corresponding to the deliveries. + * @type array<\Google\Cloud\Optimization\V1\Shipment\VisitRequest>|\Google\Protobuf\Internal\RepeatedField $deliveries + * Set of delivery alternatives associated to the shipment. If not specified, + * the vehicle only needs to visit a location corresponding to the pickups. + * @type array|\Google\Protobuf\Internal\MapField $load_demands + * Load demands of the shipment (for example weight, volume, number of + * pallets etc). The keys in the map should be identifiers describing the type + * of the corresponding load, ideally also including the units. + * For example: "weight_kg", "volume_gallons", "pallet_count", etc. + * If a given key does not appear in the map, the corresponding load is + * considered as null. + * @type float $penalty_cost + * If the shipment is not completed, this penalty is added to the overall + * cost of the routes. A shipment is considered completed if one of its pickup + * and delivery alternatives is visited. The cost may be expressed in the + * same unit used for all other cost-related fields in the model and must be + * positive. + * *IMPORTANT*: If this penalty is not specified, it is considered infinite, + * i.e. the shipment must be completed. + * @type array|\Google\Protobuf\Internal\RepeatedField $allowed_vehicle_indices + * The set of vehicles that may perform this shipment. If empty, all vehicles + * may perform it. Vehicles are given by their index in the `ShipmentModel`'s + * `vehicles` list. + * @type array|\Google\Protobuf\Internal\RepeatedField $costs_per_vehicle + * Specifies the cost that is incurred when this shipment is delivered by each + * vehicle. If specified, it must have EITHER: + * * the same number of elements as `costs_per_vehicle_indices`. + * `costs_per_vehicle[i]` corresponds to vehicle + * `costs_per_vehicle_indices[i]` of the model. + * * the same number of elements as there are vehicles in the model. The + * i-th element corresponds to vehicle #i of the model. + * These costs must be in the same unit as `penalty_cost` and must not be + * negative. Leave this field empty, if there are no such costs. + * @type array|\Google\Protobuf\Internal\RepeatedField $costs_per_vehicle_indices + * Indices of the vehicles to which `costs_per_vehicle` applies. If non-empty, + * it must have the same number of elements as `costs_per_vehicle`. A vehicle + * index may not be specified more than once. If a vehicle is excluded from + * `costs_per_vehicle_indices`, its cost is zero. + * @type float $pickup_to_delivery_relative_detour_limit + * Specifies the maximum relative detour time compared to the shortest path + * from pickup to delivery. If specified, it must be nonnegative, and the + * shipment must contain at least a pickup and a delivery. + * For example, let t be the shortest time taken to go from the selected + * pickup alternative directly to the selected delivery alternative. Then + * setting `pickup_to_delivery_relative_detour_limit` enforces: + * ``` + * start_time(delivery) - start_time(pickup) <= + * std::ceil(t * (1.0 + pickup_to_delivery_relative_detour_limit)) + * ``` + * If both relative and absolute limits are specified on the same shipment, + * the more constraining limit is used for each possible pickup/delivery pair. + * As of 2017/10, detours are only supported when travel durations do not + * depend on vehicles. + * @type \Google\Protobuf\Duration $pickup_to_delivery_absolute_detour_limit + * Specifies the maximum absolute detour time compared to the shortest path + * from pickup to delivery. If specified, it must be nonnegative, and the + * shipment must contain at least a pickup and a delivery. + * For example, let t be the shortest time taken to go from the selected + * pickup alternative directly to the selected delivery alternative. Then + * setting `pickup_to_delivery_absolute_detour_limit` enforces: + * ``` + * start_time(delivery) - start_time(pickup) <= + * t + pickup_to_delivery_absolute_detour_limit + * ``` + * If both relative and absolute limits are specified on the same shipment, + * the more constraining limit is used for each possible pickup/delivery pair. + * As of 2017/10, detours are only supported when travel durations do not + * depend on vehicles. + * @type \Google\Protobuf\Duration $pickup_to_delivery_time_limit + * Specifies the maximum duration from start of pickup to start of delivery of + * a shipment. If specified, it must be nonnegative, and the shipment must + * contain at least a pickup and a delivery. This does not depend on which + * alternatives are selected for pickup and delivery, nor on vehicle speed. + * This can be specified alongside maximum detour constraints: the solution + * will respect both specifications. + * @type string $shipment_type + * Non-empty string specifying a "type" for this shipment. + * This feature can be used to define incompatibilities or requirements + * between `shipment_types` (see `shipment_type_incompatibilities` and + * `shipment_type_requirements` in `ShipmentModel`). + * Differs from `visit_types` which is specified for a single visit: All + * pickup/deliveries belonging to the same shipment share the same + * `shipment_type`. + * @type string $label + * Specifies a label for this shipment. This label is reported in the response + * in the `shipment_label` of the corresponding + * [ShipmentRoute.Visit][google.cloud.optimization.v1.ShipmentRoute.Visit]. + * @type bool $ignore + * If true, skip this shipment, but don't apply a `penalty_cost`. + * Ignoring a shipment results in a validation error when there are any + * `shipment_type_requirements` in the model. + * Ignoring a shipment that is performed in `injected_first_solution_routes` + * or `injected_solution_constraint` is permitted; the solver removes the + * related pickup/delivery visits from the performing route. + * `precedence_rules` that reference ignored shipments will also be ignored. + * @type array<\Google\Cloud\Optimization\V1\CapacityQuantity>|\Google\Protobuf\Internal\RepeatedField $demands + * Deprecated: Use + * [Shipment.load_demands][google.cloud.optimization.v1.Shipment.load_demands] + * instead. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * Set of pickup alternatives associated to the shipment. If not specified, + * the vehicle only needs to visit a location corresponding to the deliveries. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.Shipment.VisitRequest pickups = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getPickups() + { + return $this->pickups; + } + + /** + * Set of pickup alternatives associated to the shipment. If not specified, + * the vehicle only needs to visit a location corresponding to the deliveries. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.Shipment.VisitRequest pickups = 1; + * @param array<\Google\Cloud\Optimization\V1\Shipment\VisitRequest>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setPickups($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\Shipment\VisitRequest::class); + $this->pickups = $arr; + + return $this; + } + + /** + * Set of delivery alternatives associated to the shipment. If not specified, + * the vehicle only needs to visit a location corresponding to the pickups. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.Shipment.VisitRequest deliveries = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDeliveries() + { + return $this->deliveries; + } + + /** + * Set of delivery alternatives associated to the shipment. If not specified, + * the vehicle only needs to visit a location corresponding to the pickups. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.Shipment.VisitRequest deliveries = 2; + * @param array<\Google\Cloud\Optimization\V1\Shipment\VisitRequest>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDeliveries($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\Shipment\VisitRequest::class); + $this->deliveries = $arr; + + return $this; + } + + /** + * Load demands of the shipment (for example weight, volume, number of + * pallets etc). The keys in the map should be identifiers describing the type + * of the corresponding load, ideally also including the units. + * For example: "weight_kg", "volume_gallons", "pallet_count", etc. + * If a given key does not appear in the map, the corresponding load is + * considered as null. + * + * Generated from protobuf field map load_demands = 14; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLoadDemands() + { + return $this->load_demands; + } + + /** + * Load demands of the shipment (for example weight, volume, number of + * pallets etc). The keys in the map should be identifiers describing the type + * of the corresponding load, ideally also including the units. + * For example: "weight_kg", "volume_gallons", "pallet_count", etc. + * If a given key does not appear in the map, the corresponding load is + * considered as null. + * + * Generated from protobuf field map load_demands = 14; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLoadDemands($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\Shipment\Load::class); + $this->load_demands = $arr; + + return $this; + } + + /** + * If the shipment is not completed, this penalty is added to the overall + * cost of the routes. A shipment is considered completed if one of its pickup + * and delivery alternatives is visited. The cost may be expressed in the + * same unit used for all other cost-related fields in the model and must be + * positive. + * *IMPORTANT*: If this penalty is not specified, it is considered infinite, + * i.e. the shipment must be completed. + * + * Generated from protobuf field optional double penalty_cost = 4; + * @return float + */ + public function getPenaltyCost() + { + return isset($this->penalty_cost) ? $this->penalty_cost : 0.0; + } + + public function hasPenaltyCost() + { + return isset($this->penalty_cost); + } + + public function clearPenaltyCost() + { + unset($this->penalty_cost); + } + + /** + * If the shipment is not completed, this penalty is added to the overall + * cost of the routes. A shipment is considered completed if one of its pickup + * and delivery alternatives is visited. The cost may be expressed in the + * same unit used for all other cost-related fields in the model and must be + * positive. + * *IMPORTANT*: If this penalty is not specified, it is considered infinite, + * i.e. the shipment must be completed. + * + * Generated from protobuf field optional double penalty_cost = 4; + * @param float $var + * @return $this + */ + public function setPenaltyCost($var) + { + GPBUtil::checkDouble($var); + $this->penalty_cost = $var; + + return $this; + } + + /** + * The set of vehicles that may perform this shipment. If empty, all vehicles + * may perform it. Vehicles are given by their index in the `ShipmentModel`'s + * `vehicles` list. + * + * Generated from protobuf field repeated int32 allowed_vehicle_indices = 5; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAllowedVehicleIndices() + { + return $this->allowed_vehicle_indices; + } + + /** + * The set of vehicles that may perform this shipment. If empty, all vehicles + * may perform it. Vehicles are given by their index in the `ShipmentModel`'s + * `vehicles` list. + * + * Generated from protobuf field repeated int32 allowed_vehicle_indices = 5; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAllowedVehicleIndices($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); + $this->allowed_vehicle_indices = $arr; + + return $this; + } + + /** + * Specifies the cost that is incurred when this shipment is delivered by each + * vehicle. If specified, it must have EITHER: + * * the same number of elements as `costs_per_vehicle_indices`. + * `costs_per_vehicle[i]` corresponds to vehicle + * `costs_per_vehicle_indices[i]` of the model. + * * the same number of elements as there are vehicles in the model. The + * i-th element corresponds to vehicle #i of the model. + * These costs must be in the same unit as `penalty_cost` and must not be + * negative. Leave this field empty, if there are no such costs. + * + * Generated from protobuf field repeated double costs_per_vehicle = 6; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getCostsPerVehicle() + { + return $this->costs_per_vehicle; + } + + /** + * Specifies the cost that is incurred when this shipment is delivered by each + * vehicle. If specified, it must have EITHER: + * * the same number of elements as `costs_per_vehicle_indices`. + * `costs_per_vehicle[i]` corresponds to vehicle + * `costs_per_vehicle_indices[i]` of the model. + * * the same number of elements as there are vehicles in the model. The + * i-th element corresponds to vehicle #i of the model. + * These costs must be in the same unit as `penalty_cost` and must not be + * negative. Leave this field empty, if there are no such costs. + * + * Generated from protobuf field repeated double costs_per_vehicle = 6; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setCostsPerVehicle($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::DOUBLE); + $this->costs_per_vehicle = $arr; + + return $this; + } + + /** + * Indices of the vehicles to which `costs_per_vehicle` applies. If non-empty, + * it must have the same number of elements as `costs_per_vehicle`. A vehicle + * index may not be specified more than once. If a vehicle is excluded from + * `costs_per_vehicle_indices`, its cost is zero. + * + * Generated from protobuf field repeated int32 costs_per_vehicle_indices = 7; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getCostsPerVehicleIndices() + { + return $this->costs_per_vehicle_indices; + } + + /** + * Indices of the vehicles to which `costs_per_vehicle` applies. If non-empty, + * it must have the same number of elements as `costs_per_vehicle`. A vehicle + * index may not be specified more than once. If a vehicle is excluded from + * `costs_per_vehicle_indices`, its cost is zero. + * + * Generated from protobuf field repeated int32 costs_per_vehicle_indices = 7; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setCostsPerVehicleIndices($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); + $this->costs_per_vehicle_indices = $arr; + + return $this; + } + + /** + * Specifies the maximum relative detour time compared to the shortest path + * from pickup to delivery. If specified, it must be nonnegative, and the + * shipment must contain at least a pickup and a delivery. + * For example, let t be the shortest time taken to go from the selected + * pickup alternative directly to the selected delivery alternative. Then + * setting `pickup_to_delivery_relative_detour_limit` enforces: + * ``` + * start_time(delivery) - start_time(pickup) <= + * std::ceil(t * (1.0 + pickup_to_delivery_relative_detour_limit)) + * ``` + * If both relative and absolute limits are specified on the same shipment, + * the more constraining limit is used for each possible pickup/delivery pair. + * As of 2017/10, detours are only supported when travel durations do not + * depend on vehicles. + * + * Generated from protobuf field optional double pickup_to_delivery_relative_detour_limit = 8; + * @return float + */ + public function getPickupToDeliveryRelativeDetourLimit() + { + return isset($this->pickup_to_delivery_relative_detour_limit) ? $this->pickup_to_delivery_relative_detour_limit : 0.0; + } + + public function hasPickupToDeliveryRelativeDetourLimit() + { + return isset($this->pickup_to_delivery_relative_detour_limit); + } + + public function clearPickupToDeliveryRelativeDetourLimit() + { + unset($this->pickup_to_delivery_relative_detour_limit); + } + + /** + * Specifies the maximum relative detour time compared to the shortest path + * from pickup to delivery. If specified, it must be nonnegative, and the + * shipment must contain at least a pickup and a delivery. + * For example, let t be the shortest time taken to go from the selected + * pickup alternative directly to the selected delivery alternative. Then + * setting `pickup_to_delivery_relative_detour_limit` enforces: + * ``` + * start_time(delivery) - start_time(pickup) <= + * std::ceil(t * (1.0 + pickup_to_delivery_relative_detour_limit)) + * ``` + * If both relative and absolute limits are specified on the same shipment, + * the more constraining limit is used for each possible pickup/delivery pair. + * As of 2017/10, detours are only supported when travel durations do not + * depend on vehicles. + * + * Generated from protobuf field optional double pickup_to_delivery_relative_detour_limit = 8; + * @param float $var + * @return $this + */ + public function setPickupToDeliveryRelativeDetourLimit($var) + { + GPBUtil::checkDouble($var); + $this->pickup_to_delivery_relative_detour_limit = $var; + + return $this; + } + + /** + * Specifies the maximum absolute detour time compared to the shortest path + * from pickup to delivery. If specified, it must be nonnegative, and the + * shipment must contain at least a pickup and a delivery. + * For example, let t be the shortest time taken to go from the selected + * pickup alternative directly to the selected delivery alternative. Then + * setting `pickup_to_delivery_absolute_detour_limit` enforces: + * ``` + * start_time(delivery) - start_time(pickup) <= + * t + pickup_to_delivery_absolute_detour_limit + * ``` + * If both relative and absolute limits are specified on the same shipment, + * the more constraining limit is used for each possible pickup/delivery pair. + * As of 2017/10, detours are only supported when travel durations do not + * depend on vehicles. + * + * Generated from protobuf field .google.protobuf.Duration pickup_to_delivery_absolute_detour_limit = 9; + * @return \Google\Protobuf\Duration|null + */ + public function getPickupToDeliveryAbsoluteDetourLimit() + { + return $this->pickup_to_delivery_absolute_detour_limit; + } + + public function hasPickupToDeliveryAbsoluteDetourLimit() + { + return isset($this->pickup_to_delivery_absolute_detour_limit); + } + + public function clearPickupToDeliveryAbsoluteDetourLimit() + { + unset($this->pickup_to_delivery_absolute_detour_limit); + } + + /** + * Specifies the maximum absolute detour time compared to the shortest path + * from pickup to delivery. If specified, it must be nonnegative, and the + * shipment must contain at least a pickup and a delivery. + * For example, let t be the shortest time taken to go from the selected + * pickup alternative directly to the selected delivery alternative. Then + * setting `pickup_to_delivery_absolute_detour_limit` enforces: + * ``` + * start_time(delivery) - start_time(pickup) <= + * t + pickup_to_delivery_absolute_detour_limit + * ``` + * If both relative and absolute limits are specified on the same shipment, + * the more constraining limit is used for each possible pickup/delivery pair. + * As of 2017/10, detours are only supported when travel durations do not + * depend on vehicles. + * + * Generated from protobuf field .google.protobuf.Duration pickup_to_delivery_absolute_detour_limit = 9; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setPickupToDeliveryAbsoluteDetourLimit($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->pickup_to_delivery_absolute_detour_limit = $var; + + return $this; + } + + /** + * Specifies the maximum duration from start of pickup to start of delivery of + * a shipment. If specified, it must be nonnegative, and the shipment must + * contain at least a pickup and a delivery. This does not depend on which + * alternatives are selected for pickup and delivery, nor on vehicle speed. + * This can be specified alongside maximum detour constraints: the solution + * will respect both specifications. + * + * Generated from protobuf field .google.protobuf.Duration pickup_to_delivery_time_limit = 10; + * @return \Google\Protobuf\Duration|null + */ + public function getPickupToDeliveryTimeLimit() + { + return $this->pickup_to_delivery_time_limit; + } + + public function hasPickupToDeliveryTimeLimit() + { + return isset($this->pickup_to_delivery_time_limit); + } + + public function clearPickupToDeliveryTimeLimit() + { + unset($this->pickup_to_delivery_time_limit); + } + + /** + * Specifies the maximum duration from start of pickup to start of delivery of + * a shipment. If specified, it must be nonnegative, and the shipment must + * contain at least a pickup and a delivery. This does not depend on which + * alternatives are selected for pickup and delivery, nor on vehicle speed. + * This can be specified alongside maximum detour constraints: the solution + * will respect both specifications. + * + * Generated from protobuf field .google.protobuf.Duration pickup_to_delivery_time_limit = 10; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setPickupToDeliveryTimeLimit($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->pickup_to_delivery_time_limit = $var; + + return $this; + } + + /** + * Non-empty string specifying a "type" for this shipment. + * This feature can be used to define incompatibilities or requirements + * between `shipment_types` (see `shipment_type_incompatibilities` and + * `shipment_type_requirements` in `ShipmentModel`). + * Differs from `visit_types` which is specified for a single visit: All + * pickup/deliveries belonging to the same shipment share the same + * `shipment_type`. + * + * Generated from protobuf field string shipment_type = 11; + * @return string + */ + public function getShipmentType() + { + return $this->shipment_type; + } + + /** + * Non-empty string specifying a "type" for this shipment. + * This feature can be used to define incompatibilities or requirements + * between `shipment_types` (see `shipment_type_incompatibilities` and + * `shipment_type_requirements` in `ShipmentModel`). + * Differs from `visit_types` which is specified for a single visit: All + * pickup/deliveries belonging to the same shipment share the same + * `shipment_type`. + * + * Generated from protobuf field string shipment_type = 11; + * @param string $var + * @return $this + */ + public function setShipmentType($var) + { + GPBUtil::checkString($var, True); + $this->shipment_type = $var; + + return $this; + } + + /** + * Specifies a label for this shipment. This label is reported in the response + * in the `shipment_label` of the corresponding + * [ShipmentRoute.Visit][google.cloud.optimization.v1.ShipmentRoute.Visit]. + * + * Generated from protobuf field string label = 12; + * @return string + */ + public function getLabel() + { + return $this->label; + } + + /** + * Specifies a label for this shipment. This label is reported in the response + * in the `shipment_label` of the corresponding + * [ShipmentRoute.Visit][google.cloud.optimization.v1.ShipmentRoute.Visit]. + * + * Generated from protobuf field string label = 12; + * @param string $var + * @return $this + */ + public function setLabel($var) + { + GPBUtil::checkString($var, True); + $this->label = $var; + + return $this; + } + + /** + * If true, skip this shipment, but don't apply a `penalty_cost`. + * Ignoring a shipment results in a validation error when there are any + * `shipment_type_requirements` in the model. + * Ignoring a shipment that is performed in `injected_first_solution_routes` + * or `injected_solution_constraint` is permitted; the solver removes the + * related pickup/delivery visits from the performing route. + * `precedence_rules` that reference ignored shipments will also be ignored. + * + * Generated from protobuf field bool ignore = 13; + * @return bool + */ + public function getIgnore() + { + return $this->ignore; + } + + /** + * If true, skip this shipment, but don't apply a `penalty_cost`. + * Ignoring a shipment results in a validation error when there are any + * `shipment_type_requirements` in the model. + * Ignoring a shipment that is performed in `injected_first_solution_routes` + * or `injected_solution_constraint` is permitted; the solver removes the + * related pickup/delivery visits from the performing route. + * `precedence_rules` that reference ignored shipments will also be ignored. + * + * Generated from protobuf field bool ignore = 13; + * @param bool $var + * @return $this + */ + public function setIgnore($var) + { + GPBUtil::checkBool($var); + $this->ignore = $var; + + return $this; + } + + /** + * Deprecated: Use + * [Shipment.load_demands][google.cloud.optimization.v1.Shipment.load_demands] + * instead. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.CapacityQuantity demands = 3 [deprecated = true]; + * @return \Google\Protobuf\Internal\RepeatedField + * @deprecated + */ + public function getDemands() + { + @trigger_error('demands is deprecated.', E_USER_DEPRECATED); + return $this->demands; + } + + /** + * Deprecated: Use + * [Shipment.load_demands][google.cloud.optimization.v1.Shipment.load_demands] + * instead. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.CapacityQuantity demands = 3 [deprecated = true]; + * @param array<\Google\Cloud\Optimization\V1\CapacityQuantity>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + * @deprecated + */ + public function setDemands($var) + { + @trigger_error('demands is deprecated.', E_USER_DEPRECATED); + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\CapacityQuantity::class); + $this->demands = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/Shipment/Load.php b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/Shipment/Load.php new file mode 100644 index 000000000000..cd27300e83b7 --- /dev/null +++ b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/Shipment/Load.php @@ -0,0 +1,81 @@ +google.cloud.optimization.v1.Shipment.Load + */ +class Load extends \Google\Protobuf\Internal\Message +{ + /** + * The amount by which the load of the vehicle performing the corresponding + * visit will vary. Since it is an integer, users are advised to choose an + * appropriate unit to avoid loss of precision. Must be ≥ 0. + * + * Generated from protobuf field int64 amount = 2; + */ + protected $amount = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int|string $amount + * The amount by which the load of the vehicle performing the corresponding + * visit will vary. Since it is an integer, users are advised to choose an + * appropriate unit to avoid loss of precision. Must be ≥ 0. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * The amount by which the load of the vehicle performing the corresponding + * visit will vary. Since it is an integer, users are advised to choose an + * appropriate unit to avoid loss of precision. Must be ≥ 0. + * + * Generated from protobuf field int64 amount = 2; + * @return int|string + */ + public function getAmount() + { + return $this->amount; + } + + /** + * The amount by which the load of the vehicle performing the corresponding + * visit will vary. Since it is an integer, users are advised to choose an + * appropriate unit to avoid loss of precision. Must be ≥ 0. + * + * Generated from protobuf field int64 amount = 2; + * @param int|string $var + * @return $this + */ + public function setAmount($var) + { + GPBUtil::checkInt64($var); + $this->amount = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Load::class, \Google\Cloud\Optimization\V1\Shipment_Load::class); + diff --git a/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/Shipment/VisitRequest.php b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/Shipment/VisitRequest.php new file mode 100644 index 000000000000..e21379e56c9c --- /dev/null +++ b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/Shipment/VisitRequest.php @@ -0,0 +1,658 @@ +google.cloud.optimization.v1.Shipment.VisitRequest + */ +class VisitRequest extends \Google\Protobuf\Internal\Message +{ + /** + * The geo-location where the vehicle arrives when performing this + * `VisitRequest`. If the shipment model has duration distance matrices, + * `arrival_location` must not be specified. + * + * Generated from protobuf field .google.type.LatLng arrival_location = 1; + */ + protected $arrival_location = null; + /** + * The waypoint where the vehicle arrives when performing this + * `VisitRequest`. If the shipment model has duration distance matrices, + * `arrival_waypoint` must not be specified. + * + * Generated from protobuf field .google.cloud.optimization.v1.Waypoint arrival_waypoint = 2; + */ + protected $arrival_waypoint = null; + /** + * The geo-location where the vehicle departs after completing this + * `VisitRequest`. Can be omitted if it is the same as `arrival_location`. + * If the shipment model has duration distance matrices, + * `departure_location` must not be specified. + * + * Generated from protobuf field .google.type.LatLng departure_location = 3; + */ + protected $departure_location = null; + /** + * The waypoint where the vehicle departs after completing this + * `VisitRequest`. Can be omitted if it is the same as `arrival_waypoint`. + * If the shipment model has duration distance matrices, + * `departure_waypoint` must not be specified. + * + * Generated from protobuf field .google.cloud.optimization.v1.Waypoint departure_waypoint = 4; + */ + protected $departure_waypoint = null; + /** + * Specifies tags attached to the visit request. + * Empty or duplicate strings are not allowed. + * + * Generated from protobuf field repeated string tags = 5; + */ + private $tags; + /** + * Time windows which constrain the arrival time at a visit. + * Note that a vehicle may depart outside of the arrival time window, i.e. + * arrival time + duration do not need to be inside a time window. This can + * result in waiting time if the vehicle arrives before + * [TimeWindow.start_time][google.cloud.optimization.v1.TimeWindow.start_time]. + * The absence of `TimeWindow` means that the vehicle can perform this visit + * at any time. + * Time windows must be disjoint, i.e. no time window must overlap with or + * be adjacent to another, and they must be in increasing order. + * `cost_per_hour_after_soft_end_time` and `soft_end_time` can only + * be set if there is a single time window. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.TimeWindow time_windows = 6; + */ + private $time_windows; + /** + * Duration of the visit, i.e. time spent by the vehicle between arrival + * and departure (to be added to the possible waiting time; see + * `time_windows`). + * + * Generated from protobuf field .google.protobuf.Duration duration = 7; + */ + protected $duration = null; + /** + * Cost to service this visit request on a vehicle route. This can be used + * to pay different costs for each alternative pickup or delivery of a + * shipment. This cost must be in the same unit as `Shipment.penalty_cost` + * and must not be negative. + * + * Generated from protobuf field double cost = 8; + */ + protected $cost = 0.0; + /** + * Load demands of this visit request. This is just like + * [Shipment.load_demands][google.cloud.optimization.v1.Shipment.load_demands] + * field, except that it only applies to this + * [VisitRequest][google.cloud.optimization.v1.Shipment.VisitRequest] + * instead of the whole [Shipment][google.cloud.optimization.v1.Shipment]. + * The demands listed here are added to the demands listed in + * [Shipment.load_demands][google.cloud.optimization.v1.Shipment.load_demands]. + * + * Generated from protobuf field map load_demands = 12; + */ + private $load_demands; + /** + * Specifies the types of the visit. This may be used to allocate additional + * time required for a vehicle to complete this visit (see + * [Vehicle.extra_visit_duration_for_visit_type][google.cloud.optimization.v1.Vehicle.extra_visit_duration_for_visit_type]). + * A type can only appear once. + * + * Generated from protobuf field repeated string visit_types = 10; + */ + private $visit_types; + /** + * Specifies a label for this `VisitRequest`. This label is reported in the + * response as `visit_label` in the corresponding + * [ShipmentRoute.Visit][google.cloud.optimization.v1.ShipmentRoute.Visit]. + * + * Generated from protobuf field string label = 11; + */ + protected $label = ''; + /** + * Deprecated: Use + * [VisitRequest.load_demands][google.cloud.optimization.v1.Shipment.VisitRequest.load_demands] + * instead. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.CapacityQuantity demands = 9 [deprecated = true]; + * @deprecated + */ + private $demands; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Type\LatLng $arrival_location + * The geo-location where the vehicle arrives when performing this + * `VisitRequest`. If the shipment model has duration distance matrices, + * `arrival_location` must not be specified. + * @type \Google\Cloud\Optimization\V1\Waypoint $arrival_waypoint + * The waypoint where the vehicle arrives when performing this + * `VisitRequest`. If the shipment model has duration distance matrices, + * `arrival_waypoint` must not be specified. + * @type \Google\Type\LatLng $departure_location + * The geo-location where the vehicle departs after completing this + * `VisitRequest`. Can be omitted if it is the same as `arrival_location`. + * If the shipment model has duration distance matrices, + * `departure_location` must not be specified. + * @type \Google\Cloud\Optimization\V1\Waypoint $departure_waypoint + * The waypoint where the vehicle departs after completing this + * `VisitRequest`. Can be omitted if it is the same as `arrival_waypoint`. + * If the shipment model has duration distance matrices, + * `departure_waypoint` must not be specified. + * @type array|\Google\Protobuf\Internal\RepeatedField $tags + * Specifies tags attached to the visit request. + * Empty or duplicate strings are not allowed. + * @type array<\Google\Cloud\Optimization\V1\TimeWindow>|\Google\Protobuf\Internal\RepeatedField $time_windows + * Time windows which constrain the arrival time at a visit. + * Note that a vehicle may depart outside of the arrival time window, i.e. + * arrival time + duration do not need to be inside a time window. This can + * result in waiting time if the vehicle arrives before + * [TimeWindow.start_time][google.cloud.optimization.v1.TimeWindow.start_time]. + * The absence of `TimeWindow` means that the vehicle can perform this visit + * at any time. + * Time windows must be disjoint, i.e. no time window must overlap with or + * be adjacent to another, and they must be in increasing order. + * `cost_per_hour_after_soft_end_time` and `soft_end_time` can only + * be set if there is a single time window. + * @type \Google\Protobuf\Duration $duration + * Duration of the visit, i.e. time spent by the vehicle between arrival + * and departure (to be added to the possible waiting time; see + * `time_windows`). + * @type float $cost + * Cost to service this visit request on a vehicle route. This can be used + * to pay different costs for each alternative pickup or delivery of a + * shipment. This cost must be in the same unit as `Shipment.penalty_cost` + * and must not be negative. + * @type array|\Google\Protobuf\Internal\MapField $load_demands + * Load demands of this visit request. This is just like + * [Shipment.load_demands][google.cloud.optimization.v1.Shipment.load_demands] + * field, except that it only applies to this + * [VisitRequest][google.cloud.optimization.v1.Shipment.VisitRequest] + * instead of the whole [Shipment][google.cloud.optimization.v1.Shipment]. + * The demands listed here are added to the demands listed in + * [Shipment.load_demands][google.cloud.optimization.v1.Shipment.load_demands]. + * @type array|\Google\Protobuf\Internal\RepeatedField $visit_types + * Specifies the types of the visit. This may be used to allocate additional + * time required for a vehicle to complete this visit (see + * [Vehicle.extra_visit_duration_for_visit_type][google.cloud.optimization.v1.Vehicle.extra_visit_duration_for_visit_type]). + * A type can only appear once. + * @type string $label + * Specifies a label for this `VisitRequest`. This label is reported in the + * response as `visit_label` in the corresponding + * [ShipmentRoute.Visit][google.cloud.optimization.v1.ShipmentRoute.Visit]. + * @type array<\Google\Cloud\Optimization\V1\CapacityQuantity>|\Google\Protobuf\Internal\RepeatedField $demands + * Deprecated: Use + * [VisitRequest.load_demands][google.cloud.optimization.v1.Shipment.VisitRequest.load_demands] + * instead. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * The geo-location where the vehicle arrives when performing this + * `VisitRequest`. If the shipment model has duration distance matrices, + * `arrival_location` must not be specified. + * + * Generated from protobuf field .google.type.LatLng arrival_location = 1; + * @return \Google\Type\LatLng|null + */ + public function getArrivalLocation() + { + return $this->arrival_location; + } + + public function hasArrivalLocation() + { + return isset($this->arrival_location); + } + + public function clearArrivalLocation() + { + unset($this->arrival_location); + } + + /** + * The geo-location where the vehicle arrives when performing this + * `VisitRequest`. If the shipment model has duration distance matrices, + * `arrival_location` must not be specified. + * + * Generated from protobuf field .google.type.LatLng arrival_location = 1; + * @param \Google\Type\LatLng $var + * @return $this + */ + public function setArrivalLocation($var) + { + GPBUtil::checkMessage($var, \Google\Type\LatLng::class); + $this->arrival_location = $var; + + return $this; + } + + /** + * The waypoint where the vehicle arrives when performing this + * `VisitRequest`. If the shipment model has duration distance matrices, + * `arrival_waypoint` must not be specified. + * + * Generated from protobuf field .google.cloud.optimization.v1.Waypoint arrival_waypoint = 2; + * @return \Google\Cloud\Optimization\V1\Waypoint|null + */ + public function getArrivalWaypoint() + { + return $this->arrival_waypoint; + } + + public function hasArrivalWaypoint() + { + return isset($this->arrival_waypoint); + } + + public function clearArrivalWaypoint() + { + unset($this->arrival_waypoint); + } + + /** + * The waypoint where the vehicle arrives when performing this + * `VisitRequest`. If the shipment model has duration distance matrices, + * `arrival_waypoint` must not be specified. + * + * Generated from protobuf field .google.cloud.optimization.v1.Waypoint arrival_waypoint = 2; + * @param \Google\Cloud\Optimization\V1\Waypoint $var + * @return $this + */ + public function setArrivalWaypoint($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Optimization\V1\Waypoint::class); + $this->arrival_waypoint = $var; + + return $this; + } + + /** + * The geo-location where the vehicle departs after completing this + * `VisitRequest`. Can be omitted if it is the same as `arrival_location`. + * If the shipment model has duration distance matrices, + * `departure_location` must not be specified. + * + * Generated from protobuf field .google.type.LatLng departure_location = 3; + * @return \Google\Type\LatLng|null + */ + public function getDepartureLocation() + { + return $this->departure_location; + } + + public function hasDepartureLocation() + { + return isset($this->departure_location); + } + + public function clearDepartureLocation() + { + unset($this->departure_location); + } + + /** + * The geo-location where the vehicle departs after completing this + * `VisitRequest`. Can be omitted if it is the same as `arrival_location`. + * If the shipment model has duration distance matrices, + * `departure_location` must not be specified. + * + * Generated from protobuf field .google.type.LatLng departure_location = 3; + * @param \Google\Type\LatLng $var + * @return $this + */ + public function setDepartureLocation($var) + { + GPBUtil::checkMessage($var, \Google\Type\LatLng::class); + $this->departure_location = $var; + + return $this; + } + + /** + * The waypoint where the vehicle departs after completing this + * `VisitRequest`. Can be omitted if it is the same as `arrival_waypoint`. + * If the shipment model has duration distance matrices, + * `departure_waypoint` must not be specified. + * + * Generated from protobuf field .google.cloud.optimization.v1.Waypoint departure_waypoint = 4; + * @return \Google\Cloud\Optimization\V1\Waypoint|null + */ + public function getDepartureWaypoint() + { + return $this->departure_waypoint; + } + + public function hasDepartureWaypoint() + { + return isset($this->departure_waypoint); + } + + public function clearDepartureWaypoint() + { + unset($this->departure_waypoint); + } + + /** + * The waypoint where the vehicle departs after completing this + * `VisitRequest`. Can be omitted if it is the same as `arrival_waypoint`. + * If the shipment model has duration distance matrices, + * `departure_waypoint` must not be specified. + * + * Generated from protobuf field .google.cloud.optimization.v1.Waypoint departure_waypoint = 4; + * @param \Google\Cloud\Optimization\V1\Waypoint $var + * @return $this + */ + public function setDepartureWaypoint($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Optimization\V1\Waypoint::class); + $this->departure_waypoint = $var; + + return $this; + } + + /** + * Specifies tags attached to the visit request. + * Empty or duplicate strings are not allowed. + * + * Generated from protobuf field repeated string tags = 5; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTags() + { + return $this->tags; + } + + /** + * Specifies tags attached to the visit request. + * Empty or duplicate strings are not allowed. + * + * Generated from protobuf field repeated string tags = 5; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTags($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->tags = $arr; + + return $this; + } + + /** + * Time windows which constrain the arrival time at a visit. + * Note that a vehicle may depart outside of the arrival time window, i.e. + * arrival time + duration do not need to be inside a time window. This can + * result in waiting time if the vehicle arrives before + * [TimeWindow.start_time][google.cloud.optimization.v1.TimeWindow.start_time]. + * The absence of `TimeWindow` means that the vehicle can perform this visit + * at any time. + * Time windows must be disjoint, i.e. no time window must overlap with or + * be adjacent to another, and they must be in increasing order. + * `cost_per_hour_after_soft_end_time` and `soft_end_time` can only + * be set if there is a single time window. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.TimeWindow time_windows = 6; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTimeWindows() + { + return $this->time_windows; + } + + /** + * Time windows which constrain the arrival time at a visit. + * Note that a vehicle may depart outside of the arrival time window, i.e. + * arrival time + duration do not need to be inside a time window. This can + * result in waiting time if the vehicle arrives before + * [TimeWindow.start_time][google.cloud.optimization.v1.TimeWindow.start_time]. + * The absence of `TimeWindow` means that the vehicle can perform this visit + * at any time. + * Time windows must be disjoint, i.e. no time window must overlap with or + * be adjacent to another, and they must be in increasing order. + * `cost_per_hour_after_soft_end_time` and `soft_end_time` can only + * be set if there is a single time window. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.TimeWindow time_windows = 6; + * @param array<\Google\Cloud\Optimization\V1\TimeWindow>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTimeWindows($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\TimeWindow::class); + $this->time_windows = $arr; + + return $this; + } + + /** + * Duration of the visit, i.e. time spent by the vehicle between arrival + * and departure (to be added to the possible waiting time; see + * `time_windows`). + * + * Generated from protobuf field .google.protobuf.Duration duration = 7; + * @return \Google\Protobuf\Duration|null + */ + public function getDuration() + { + return $this->duration; + } + + public function hasDuration() + { + return isset($this->duration); + } + + public function clearDuration() + { + unset($this->duration); + } + + /** + * Duration of the visit, i.e. time spent by the vehicle between arrival + * and departure (to be added to the possible waiting time; see + * `time_windows`). + * + * Generated from protobuf field .google.protobuf.Duration duration = 7; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->duration = $var; + + return $this; + } + + /** + * Cost to service this visit request on a vehicle route. This can be used + * to pay different costs for each alternative pickup or delivery of a + * shipment. This cost must be in the same unit as `Shipment.penalty_cost` + * and must not be negative. + * + * Generated from protobuf field double cost = 8; + * @return float + */ + public function getCost() + { + return $this->cost; + } + + /** + * Cost to service this visit request on a vehicle route. This can be used + * to pay different costs for each alternative pickup or delivery of a + * shipment. This cost must be in the same unit as `Shipment.penalty_cost` + * and must not be negative. + * + * Generated from protobuf field double cost = 8; + * @param float $var + * @return $this + */ + public function setCost($var) + { + GPBUtil::checkDouble($var); + $this->cost = $var; + + return $this; + } + + /** + * Load demands of this visit request. This is just like + * [Shipment.load_demands][google.cloud.optimization.v1.Shipment.load_demands] + * field, except that it only applies to this + * [VisitRequest][google.cloud.optimization.v1.Shipment.VisitRequest] + * instead of the whole [Shipment][google.cloud.optimization.v1.Shipment]. + * The demands listed here are added to the demands listed in + * [Shipment.load_demands][google.cloud.optimization.v1.Shipment.load_demands]. + * + * Generated from protobuf field map load_demands = 12; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLoadDemands() + { + return $this->load_demands; + } + + /** + * Load demands of this visit request. This is just like + * [Shipment.load_demands][google.cloud.optimization.v1.Shipment.load_demands] + * field, except that it only applies to this + * [VisitRequest][google.cloud.optimization.v1.Shipment.VisitRequest] + * instead of the whole [Shipment][google.cloud.optimization.v1.Shipment]. + * The demands listed here are added to the demands listed in + * [Shipment.load_demands][google.cloud.optimization.v1.Shipment.load_demands]. + * + * Generated from protobuf field map load_demands = 12; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLoadDemands($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\Shipment\Load::class); + $this->load_demands = $arr; + + return $this; + } + + /** + * Specifies the types of the visit. This may be used to allocate additional + * time required for a vehicle to complete this visit (see + * [Vehicle.extra_visit_duration_for_visit_type][google.cloud.optimization.v1.Vehicle.extra_visit_duration_for_visit_type]). + * A type can only appear once. + * + * Generated from protobuf field repeated string visit_types = 10; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getVisitTypes() + { + return $this->visit_types; + } + + /** + * Specifies the types of the visit. This may be used to allocate additional + * time required for a vehicle to complete this visit (see + * [Vehicle.extra_visit_duration_for_visit_type][google.cloud.optimization.v1.Vehicle.extra_visit_duration_for_visit_type]). + * A type can only appear once. + * + * Generated from protobuf field repeated string visit_types = 10; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setVisitTypes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->visit_types = $arr; + + return $this; + } + + /** + * Specifies a label for this `VisitRequest`. This label is reported in the + * response as `visit_label` in the corresponding + * [ShipmentRoute.Visit][google.cloud.optimization.v1.ShipmentRoute.Visit]. + * + * Generated from protobuf field string label = 11; + * @return string + */ + public function getLabel() + { + return $this->label; + } + + /** + * Specifies a label for this `VisitRequest`. This label is reported in the + * response as `visit_label` in the corresponding + * [ShipmentRoute.Visit][google.cloud.optimization.v1.ShipmentRoute.Visit]. + * + * Generated from protobuf field string label = 11; + * @param string $var + * @return $this + */ + public function setLabel($var) + { + GPBUtil::checkString($var, True); + $this->label = $var; + + return $this; + } + + /** + * Deprecated: Use + * [VisitRequest.load_demands][google.cloud.optimization.v1.Shipment.VisitRequest.load_demands] + * instead. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.CapacityQuantity demands = 9 [deprecated = true]; + * @return \Google\Protobuf\Internal\RepeatedField + * @deprecated + */ + public function getDemands() + { + @trigger_error('demands is deprecated.', E_USER_DEPRECATED); + return $this->demands; + } + + /** + * Deprecated: Use + * [VisitRequest.load_demands][google.cloud.optimization.v1.Shipment.VisitRequest.load_demands] + * instead. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.CapacityQuantity demands = 9 [deprecated = true]; + * @param array<\Google\Cloud\Optimization\V1\CapacityQuantity>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + * @deprecated + */ + public function setDemands($var) + { + @trigger_error('demands is deprecated.', E_USER_DEPRECATED); + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\CapacityQuantity::class); + $this->demands = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(VisitRequest::class, \Google\Cloud\Optimization\V1\Shipment_VisitRequest::class); + diff --git a/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/ShipmentModel.php b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/ShipmentModel.php new file mode 100644 index 000000000000..058949f5a9bd --- /dev/null +++ b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/ShipmentModel.php @@ -0,0 +1,1057 @@ +google.cloud.optimization.v1.ShipmentModel + */ +class ShipmentModel extends \Google\Protobuf\Internal\Message +{ + /** + * Set of shipments which must be performed in the model. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.Shipment shipments = 1; + */ + private $shipments; + /** + * Set of vehicles which can be used to perform visits. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.Vehicle vehicles = 2; + */ + private $vehicles; + /** + * Constrains the maximum number of active vehicles. A vehicle is active if + * its route performs at least one shipment. This can be used to limit the + * number of routes in the case where there are fewer drivers than + * vehicles and that the fleet of vehicles is heterogeneous. The optimization + * will then select the best subset of vehicles to use. + * Must be strictly positive. + * + * Generated from protobuf field optional int32 max_active_vehicles = 4; + */ + protected $max_active_vehicles = null; + /** + * Global start and end time of the model: no times outside of this range + * can be considered valid. + * The model's time span must be less than a year, i.e. the `global_end_time` + * and the `global_start_time` must be within 31536000 seconds of each other. + * When using `cost_per_*hour` fields, you might want to set this window to a + * smaller interval to increase performance (eg. if you model a single day, + * you should set the global time limits to that day). + * If unset, 00:00:00 UTC, January 1, 1970 (i.e. seconds: 0, nanos: 0) is used + * as default. + * + * Generated from protobuf field .google.protobuf.Timestamp global_start_time = 5; + */ + protected $global_start_time = null; + /** + * If unset, 00:00:00 UTC, January 1, 1971 (i.e. seconds: 31536000, nanos: 0) + * is used as default. + * + * Generated from protobuf field .google.protobuf.Timestamp global_end_time = 6; + */ + protected $global_end_time = null; + /** + * The "global duration" of the overall plan is the difference between the + * earliest effective start time and the latest effective end time of + * all vehicles. Users can assign a cost per hour to that quantity to try + * and optimize for earliest job completion, for example. This cost must be in + * the same unit as + * [Shipment.penalty_cost][google.cloud.optimization.v1.Shipment.penalty_cost]. + * + * Generated from protobuf field double global_duration_cost_per_hour = 7; + */ + protected $global_duration_cost_per_hour = 0.0; + /** + * Specifies duration and distance matrices used in the model. If this field + * is empty, Google Maps or geodesic distances will be used instead, depending + * on the value of the `use_geodesic_distances` field. If it is not empty, + * `use_geodesic_distances` cannot be true and neither + * `duration_distance_matrix_src_tags` nor `duration_distance_matrix_dst_tags` + * can be empty. + * Usage examples: + * * There are two locations: locA and locB. + * * 1 vehicle starting its route at locA and ending it at locA. + * * 1 pickup visit request at locB. + * ``` + * model { + * vehicles { start_tags: "locA" end_tags: "locA" } + * shipments { pickups { tags: "locB" } } + * duration_distance_matrix_src_tags: "locA" + * duration_distance_matrix_src_tags: "locB" + * duration_distance_matrix_dst_tags: "locA" + * duration_distance_matrix_dst_tags: "locB" + * duration_distance_matrices { + * rows { # from: locA + * durations { seconds: 0 } meters: 0 # to: locA + * durations { seconds: 100 } meters: 1000 # to: locB + * } + * rows { # from: locB + * durations { seconds: 102 } meters: 990 # to: locA + * durations { seconds: 0 } meters: 0 # to: locB + * } + * } + * } + * ``` + * * There are three locations: locA, locB and locC. + * * 1 vehicle starting its route at locA and ending it at locB, using + * matrix "fast". + * * 1 vehicle starting its route at locB and ending it at locB, using + * matrix "slow". + * * 1 vehicle starting its route at locB and ending it at locB, using + * matrix "fast". + * * 1 pickup visit request at locC. + * ``` + * model { + * vehicles { start_tags: "locA" end_tags: "locB" start_tags: "fast" } + * vehicles { start_tags: "locB" end_tags: "locB" start_tags: "slow" } + * vehicles { start_tags: "locB" end_tags: "locB" start_tags: "fast" } + * shipments { pickups { tags: "locC" } } + * duration_distance_matrix_src_tags: "locA" + * duration_distance_matrix_src_tags: "locB" + * duration_distance_matrix_src_tags: "locC" + * duration_distance_matrix_dst_tags: "locB" + * duration_distance_matrix_dst_tags: "locC" + * duration_distance_matrices { + * vehicle_start_tag: "fast" + * rows { # from: locA + * durations { seconds: 1000 } meters: 2000 # to: locB + * durations { seconds: 600 } meters: 1000 # to: locC + * } + * rows { # from: locB + * durations { seconds: 0 } meters: 0 # to: locB + * durations { seconds: 700 } meters: 1200 # to: locC + * } + * rows { # from: locC + * durations { seconds: 702 } meters: 1190 # to: locB + * durations { seconds: 0 } meters: 0 # to: locC + * } + * } + * duration_distance_matrices { + * vehicle_start_tag: "slow" + * rows { # from: locA + * durations { seconds: 1800 } meters: 2001 # to: locB + * durations { seconds: 900 } meters: 1002 # to: locC + * } + * rows { # from: locB + * durations { seconds: 0 } meters: 0 # to: locB + * durations { seconds: 1000 } meters: 1202 # to: locC + * } + * rows { # from: locC + * durations { seconds: 1001 } meters: 1195 # to: locB + * durations { seconds: 0 } meters: 0 # to: locC + * } + * } + * } + * ``` + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix duration_distance_matrices = 8; + */ + private $duration_distance_matrices; + /** + * Tags defining the sources of the duration and distance matrices; + * `duration_distance_matrices(i).rows(j)` defines durations and distances + * from visits with tag `duration_distance_matrix_src_tags(j)` to other visits + * in matrix i. + * Tags correspond to + * [VisitRequest.tags][google.cloud.optimization.v1.Shipment.VisitRequest.tags] + * or [Vehicle.start_tags][google.cloud.optimization.v1.Vehicle.start_tags]. + * A given `VisitRequest` or `Vehicle` must match exactly one tag in this + * field. Note that a `Vehicle`'s source, destination and matrix tags may be + * the same; similarly a `VisitRequest`'s source and destination tags may be + * the same. All tags must be different and cannot be empty strings. If this + * field is not empty, then `duration_distance_matrices` must not be empty. + * + * Generated from protobuf field repeated string duration_distance_matrix_src_tags = 9; + */ + private $duration_distance_matrix_src_tags; + /** + * Tags defining the destinations of the duration and distance matrices; + * `duration_distance_matrices(i).rows(j).durations(k)` (resp. + * `duration_distance_matrices(i).rows(j).meters(k))` defines the duration + * (resp. the distance) of the travel from visits with tag + * `duration_distance_matrix_src_tags(j)` to visits with tag + * `duration_distance_matrix_dst_tags(k)` in matrix i. + * Tags correspond to + * [VisitRequest.tags][google.cloud.optimization.v1.Shipment.VisitRequest.tags] + * or [Vehicle.start_tags][google.cloud.optimization.v1.Vehicle.start_tags]. + * A given `VisitRequest` or `Vehicle` must match exactly one tag in this + * field. Note that a `Vehicle`'s source, destination and matrix tags may be + * the same; similarly a `VisitRequest`'s source and destination tags may be + * the same. All tags must be different and cannot be empty strings. If this + * field is not empty, then `duration_distance_matrices` must not be empty. + * + * Generated from protobuf field repeated string duration_distance_matrix_dst_tags = 10; + */ + private $duration_distance_matrix_dst_tags; + /** + * Transition attributes added to the model. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.TransitionAttributes transition_attributes = 11; + */ + private $transition_attributes; + /** + * Sets of incompatible shipment_types (see `ShipmentTypeIncompatibility`). + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentTypeIncompatibility shipment_type_incompatibilities = 12; + */ + private $shipment_type_incompatibilities; + /** + * Sets of `shipment_type` requirements (see `ShipmentTypeRequirement`). + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentTypeRequirement shipment_type_requirements = 13; + */ + private $shipment_type_requirements; + /** + * Set of precedence rules which must be enforced in the model. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentModel.PrecedenceRule precedence_rules = 14; + */ + private $precedence_rules; + /** + * Deprecated: No longer used. + * Set of break rules used in the model. + * Each vehicle specifies the `BreakRule` that applies to it via the + * [Vehicle.break_rule_indices][google.cloud.optimization.v1.Vehicle.break_rule_indices] + * field (which must be a singleton). + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule break_rules = 15 [deprecated = true]; + * @deprecated + */ + private $break_rules; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Optimization\V1\Shipment>|\Google\Protobuf\Internal\RepeatedField $shipments + * Set of shipments which must be performed in the model. + * @type array<\Google\Cloud\Optimization\V1\Vehicle>|\Google\Protobuf\Internal\RepeatedField $vehicles + * Set of vehicles which can be used to perform visits. + * @type int $max_active_vehicles + * Constrains the maximum number of active vehicles. A vehicle is active if + * its route performs at least one shipment. This can be used to limit the + * number of routes in the case where there are fewer drivers than + * vehicles and that the fleet of vehicles is heterogeneous. The optimization + * will then select the best subset of vehicles to use. + * Must be strictly positive. + * @type \Google\Protobuf\Timestamp $global_start_time + * Global start and end time of the model: no times outside of this range + * can be considered valid. + * The model's time span must be less than a year, i.e. the `global_end_time` + * and the `global_start_time` must be within 31536000 seconds of each other. + * When using `cost_per_*hour` fields, you might want to set this window to a + * smaller interval to increase performance (eg. if you model a single day, + * you should set the global time limits to that day). + * If unset, 00:00:00 UTC, January 1, 1970 (i.e. seconds: 0, nanos: 0) is used + * as default. + * @type \Google\Protobuf\Timestamp $global_end_time + * If unset, 00:00:00 UTC, January 1, 1971 (i.e. seconds: 31536000, nanos: 0) + * is used as default. + * @type float $global_duration_cost_per_hour + * The "global duration" of the overall plan is the difference between the + * earliest effective start time and the latest effective end time of + * all vehicles. Users can assign a cost per hour to that quantity to try + * and optimize for earliest job completion, for example. This cost must be in + * the same unit as + * [Shipment.penalty_cost][google.cloud.optimization.v1.Shipment.penalty_cost]. + * @type array<\Google\Cloud\Optimization\V1\ShipmentModel\DurationDistanceMatrix>|\Google\Protobuf\Internal\RepeatedField $duration_distance_matrices + * Specifies duration and distance matrices used in the model. If this field + * is empty, Google Maps or geodesic distances will be used instead, depending + * on the value of the `use_geodesic_distances` field. If it is not empty, + * `use_geodesic_distances` cannot be true and neither + * `duration_distance_matrix_src_tags` nor `duration_distance_matrix_dst_tags` + * can be empty. + * Usage examples: + * * There are two locations: locA and locB. + * * 1 vehicle starting its route at locA and ending it at locA. + * * 1 pickup visit request at locB. + * ``` + * model { + * vehicles { start_tags: "locA" end_tags: "locA" } + * shipments { pickups { tags: "locB" } } + * duration_distance_matrix_src_tags: "locA" + * duration_distance_matrix_src_tags: "locB" + * duration_distance_matrix_dst_tags: "locA" + * duration_distance_matrix_dst_tags: "locB" + * duration_distance_matrices { + * rows { # from: locA + * durations { seconds: 0 } meters: 0 # to: locA + * durations { seconds: 100 } meters: 1000 # to: locB + * } + * rows { # from: locB + * durations { seconds: 102 } meters: 990 # to: locA + * durations { seconds: 0 } meters: 0 # to: locB + * } + * } + * } + * ``` + * * There are three locations: locA, locB and locC. + * * 1 vehicle starting its route at locA and ending it at locB, using + * matrix "fast". + * * 1 vehicle starting its route at locB and ending it at locB, using + * matrix "slow". + * * 1 vehicle starting its route at locB and ending it at locB, using + * matrix "fast". + * * 1 pickup visit request at locC. + * ``` + * model { + * vehicles { start_tags: "locA" end_tags: "locB" start_tags: "fast" } + * vehicles { start_tags: "locB" end_tags: "locB" start_tags: "slow" } + * vehicles { start_tags: "locB" end_tags: "locB" start_tags: "fast" } + * shipments { pickups { tags: "locC" } } + * duration_distance_matrix_src_tags: "locA" + * duration_distance_matrix_src_tags: "locB" + * duration_distance_matrix_src_tags: "locC" + * duration_distance_matrix_dst_tags: "locB" + * duration_distance_matrix_dst_tags: "locC" + * duration_distance_matrices { + * vehicle_start_tag: "fast" + * rows { # from: locA + * durations { seconds: 1000 } meters: 2000 # to: locB + * durations { seconds: 600 } meters: 1000 # to: locC + * } + * rows { # from: locB + * durations { seconds: 0 } meters: 0 # to: locB + * durations { seconds: 700 } meters: 1200 # to: locC + * } + * rows { # from: locC + * durations { seconds: 702 } meters: 1190 # to: locB + * durations { seconds: 0 } meters: 0 # to: locC + * } + * } + * duration_distance_matrices { + * vehicle_start_tag: "slow" + * rows { # from: locA + * durations { seconds: 1800 } meters: 2001 # to: locB + * durations { seconds: 900 } meters: 1002 # to: locC + * } + * rows { # from: locB + * durations { seconds: 0 } meters: 0 # to: locB + * durations { seconds: 1000 } meters: 1202 # to: locC + * } + * rows { # from: locC + * durations { seconds: 1001 } meters: 1195 # to: locB + * durations { seconds: 0 } meters: 0 # to: locC + * } + * } + * } + * ``` + * @type array|\Google\Protobuf\Internal\RepeatedField $duration_distance_matrix_src_tags + * Tags defining the sources of the duration and distance matrices; + * `duration_distance_matrices(i).rows(j)` defines durations and distances + * from visits with tag `duration_distance_matrix_src_tags(j)` to other visits + * in matrix i. + * Tags correspond to + * [VisitRequest.tags][google.cloud.optimization.v1.Shipment.VisitRequest.tags] + * or [Vehicle.start_tags][google.cloud.optimization.v1.Vehicle.start_tags]. + * A given `VisitRequest` or `Vehicle` must match exactly one tag in this + * field. Note that a `Vehicle`'s source, destination and matrix tags may be + * the same; similarly a `VisitRequest`'s source and destination tags may be + * the same. All tags must be different and cannot be empty strings. If this + * field is not empty, then `duration_distance_matrices` must not be empty. + * @type array|\Google\Protobuf\Internal\RepeatedField $duration_distance_matrix_dst_tags + * Tags defining the destinations of the duration and distance matrices; + * `duration_distance_matrices(i).rows(j).durations(k)` (resp. + * `duration_distance_matrices(i).rows(j).meters(k))` defines the duration + * (resp. the distance) of the travel from visits with tag + * `duration_distance_matrix_src_tags(j)` to visits with tag + * `duration_distance_matrix_dst_tags(k)` in matrix i. + * Tags correspond to + * [VisitRequest.tags][google.cloud.optimization.v1.Shipment.VisitRequest.tags] + * or [Vehicle.start_tags][google.cloud.optimization.v1.Vehicle.start_tags]. + * A given `VisitRequest` or `Vehicle` must match exactly one tag in this + * field. Note that a `Vehicle`'s source, destination and matrix tags may be + * the same; similarly a `VisitRequest`'s source and destination tags may be + * the same. All tags must be different and cannot be empty strings. If this + * field is not empty, then `duration_distance_matrices` must not be empty. + * @type array<\Google\Cloud\Optimization\V1\TransitionAttributes>|\Google\Protobuf\Internal\RepeatedField $transition_attributes + * Transition attributes added to the model. + * @type array<\Google\Cloud\Optimization\V1\ShipmentTypeIncompatibility>|\Google\Protobuf\Internal\RepeatedField $shipment_type_incompatibilities + * Sets of incompatible shipment_types (see `ShipmentTypeIncompatibility`). + * @type array<\Google\Cloud\Optimization\V1\ShipmentTypeRequirement>|\Google\Protobuf\Internal\RepeatedField $shipment_type_requirements + * Sets of `shipment_type` requirements (see `ShipmentTypeRequirement`). + * @type array<\Google\Cloud\Optimization\V1\ShipmentModel\PrecedenceRule>|\Google\Protobuf\Internal\RepeatedField $precedence_rules + * Set of precedence rules which must be enforced in the model. + * @type array<\Google\Cloud\Optimization\V1\ShipmentModel\BreakRule>|\Google\Protobuf\Internal\RepeatedField $break_rules + * Deprecated: No longer used. + * Set of break rules used in the model. + * Each vehicle specifies the `BreakRule` that applies to it via the + * [Vehicle.break_rule_indices][google.cloud.optimization.v1.Vehicle.break_rule_indices] + * field (which must be a singleton). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * Set of shipments which must be performed in the model. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.Shipment shipments = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getShipments() + { + return $this->shipments; + } + + /** + * Set of shipments which must be performed in the model. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.Shipment shipments = 1; + * @param array<\Google\Cloud\Optimization\V1\Shipment>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setShipments($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\Shipment::class); + $this->shipments = $arr; + + return $this; + } + + /** + * Set of vehicles which can be used to perform visits. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.Vehicle vehicles = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getVehicles() + { + return $this->vehicles; + } + + /** + * Set of vehicles which can be used to perform visits. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.Vehicle vehicles = 2; + * @param array<\Google\Cloud\Optimization\V1\Vehicle>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setVehicles($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\Vehicle::class); + $this->vehicles = $arr; + + return $this; + } + + /** + * Constrains the maximum number of active vehicles. A vehicle is active if + * its route performs at least one shipment. This can be used to limit the + * number of routes in the case where there are fewer drivers than + * vehicles and that the fleet of vehicles is heterogeneous. The optimization + * will then select the best subset of vehicles to use. + * Must be strictly positive. + * + * Generated from protobuf field optional int32 max_active_vehicles = 4; + * @return int + */ + public function getMaxActiveVehicles() + { + return isset($this->max_active_vehicles) ? $this->max_active_vehicles : 0; + } + + public function hasMaxActiveVehicles() + { + return isset($this->max_active_vehicles); + } + + public function clearMaxActiveVehicles() + { + unset($this->max_active_vehicles); + } + + /** + * Constrains the maximum number of active vehicles. A vehicle is active if + * its route performs at least one shipment. This can be used to limit the + * number of routes in the case where there are fewer drivers than + * vehicles and that the fleet of vehicles is heterogeneous. The optimization + * will then select the best subset of vehicles to use. + * Must be strictly positive. + * + * Generated from protobuf field optional int32 max_active_vehicles = 4; + * @param int $var + * @return $this + */ + public function setMaxActiveVehicles($var) + { + GPBUtil::checkInt32($var); + $this->max_active_vehicles = $var; + + return $this; + } + + /** + * Global start and end time of the model: no times outside of this range + * can be considered valid. + * The model's time span must be less than a year, i.e. the `global_end_time` + * and the `global_start_time` must be within 31536000 seconds of each other. + * When using `cost_per_*hour` fields, you might want to set this window to a + * smaller interval to increase performance (eg. if you model a single day, + * you should set the global time limits to that day). + * If unset, 00:00:00 UTC, January 1, 1970 (i.e. seconds: 0, nanos: 0) is used + * as default. + * + * Generated from protobuf field .google.protobuf.Timestamp global_start_time = 5; + * @return \Google\Protobuf\Timestamp|null + */ + public function getGlobalStartTime() + { + return $this->global_start_time; + } + + public function hasGlobalStartTime() + { + return isset($this->global_start_time); + } + + public function clearGlobalStartTime() + { + unset($this->global_start_time); + } + + /** + * Global start and end time of the model: no times outside of this range + * can be considered valid. + * The model's time span must be less than a year, i.e. the `global_end_time` + * and the `global_start_time` must be within 31536000 seconds of each other. + * When using `cost_per_*hour` fields, you might want to set this window to a + * smaller interval to increase performance (eg. if you model a single day, + * you should set the global time limits to that day). + * If unset, 00:00:00 UTC, January 1, 1970 (i.e. seconds: 0, nanos: 0) is used + * as default. + * + * Generated from protobuf field .google.protobuf.Timestamp global_start_time = 5; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setGlobalStartTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->global_start_time = $var; + + return $this; + } + + /** + * If unset, 00:00:00 UTC, January 1, 1971 (i.e. seconds: 31536000, nanos: 0) + * is used as default. + * + * Generated from protobuf field .google.protobuf.Timestamp global_end_time = 6; + * @return \Google\Protobuf\Timestamp|null + */ + public function getGlobalEndTime() + { + return $this->global_end_time; + } + + public function hasGlobalEndTime() + { + return isset($this->global_end_time); + } + + public function clearGlobalEndTime() + { + unset($this->global_end_time); + } + + /** + * If unset, 00:00:00 UTC, January 1, 1971 (i.e. seconds: 31536000, nanos: 0) + * is used as default. + * + * Generated from protobuf field .google.protobuf.Timestamp global_end_time = 6; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setGlobalEndTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->global_end_time = $var; + + return $this; + } + + /** + * The "global duration" of the overall plan is the difference between the + * earliest effective start time and the latest effective end time of + * all vehicles. Users can assign a cost per hour to that quantity to try + * and optimize for earliest job completion, for example. This cost must be in + * the same unit as + * [Shipment.penalty_cost][google.cloud.optimization.v1.Shipment.penalty_cost]. + * + * Generated from protobuf field double global_duration_cost_per_hour = 7; + * @return float + */ + public function getGlobalDurationCostPerHour() + { + return $this->global_duration_cost_per_hour; + } + + /** + * The "global duration" of the overall plan is the difference between the + * earliest effective start time and the latest effective end time of + * all vehicles. Users can assign a cost per hour to that quantity to try + * and optimize for earliest job completion, for example. This cost must be in + * the same unit as + * [Shipment.penalty_cost][google.cloud.optimization.v1.Shipment.penalty_cost]. + * + * Generated from protobuf field double global_duration_cost_per_hour = 7; + * @param float $var + * @return $this + */ + public function setGlobalDurationCostPerHour($var) + { + GPBUtil::checkDouble($var); + $this->global_duration_cost_per_hour = $var; + + return $this; + } + + /** + * Specifies duration and distance matrices used in the model. If this field + * is empty, Google Maps or geodesic distances will be used instead, depending + * on the value of the `use_geodesic_distances` field. If it is not empty, + * `use_geodesic_distances` cannot be true and neither + * `duration_distance_matrix_src_tags` nor `duration_distance_matrix_dst_tags` + * can be empty. + * Usage examples: + * * There are two locations: locA and locB. + * * 1 vehicle starting its route at locA and ending it at locA. + * * 1 pickup visit request at locB. + * ``` + * model { + * vehicles { start_tags: "locA" end_tags: "locA" } + * shipments { pickups { tags: "locB" } } + * duration_distance_matrix_src_tags: "locA" + * duration_distance_matrix_src_tags: "locB" + * duration_distance_matrix_dst_tags: "locA" + * duration_distance_matrix_dst_tags: "locB" + * duration_distance_matrices { + * rows { # from: locA + * durations { seconds: 0 } meters: 0 # to: locA + * durations { seconds: 100 } meters: 1000 # to: locB + * } + * rows { # from: locB + * durations { seconds: 102 } meters: 990 # to: locA + * durations { seconds: 0 } meters: 0 # to: locB + * } + * } + * } + * ``` + * * There are three locations: locA, locB and locC. + * * 1 vehicle starting its route at locA and ending it at locB, using + * matrix "fast". + * * 1 vehicle starting its route at locB and ending it at locB, using + * matrix "slow". + * * 1 vehicle starting its route at locB and ending it at locB, using + * matrix "fast". + * * 1 pickup visit request at locC. + * ``` + * model { + * vehicles { start_tags: "locA" end_tags: "locB" start_tags: "fast" } + * vehicles { start_tags: "locB" end_tags: "locB" start_tags: "slow" } + * vehicles { start_tags: "locB" end_tags: "locB" start_tags: "fast" } + * shipments { pickups { tags: "locC" } } + * duration_distance_matrix_src_tags: "locA" + * duration_distance_matrix_src_tags: "locB" + * duration_distance_matrix_src_tags: "locC" + * duration_distance_matrix_dst_tags: "locB" + * duration_distance_matrix_dst_tags: "locC" + * duration_distance_matrices { + * vehicle_start_tag: "fast" + * rows { # from: locA + * durations { seconds: 1000 } meters: 2000 # to: locB + * durations { seconds: 600 } meters: 1000 # to: locC + * } + * rows { # from: locB + * durations { seconds: 0 } meters: 0 # to: locB + * durations { seconds: 700 } meters: 1200 # to: locC + * } + * rows { # from: locC + * durations { seconds: 702 } meters: 1190 # to: locB + * durations { seconds: 0 } meters: 0 # to: locC + * } + * } + * duration_distance_matrices { + * vehicle_start_tag: "slow" + * rows { # from: locA + * durations { seconds: 1800 } meters: 2001 # to: locB + * durations { seconds: 900 } meters: 1002 # to: locC + * } + * rows { # from: locB + * durations { seconds: 0 } meters: 0 # to: locB + * durations { seconds: 1000 } meters: 1202 # to: locC + * } + * rows { # from: locC + * durations { seconds: 1001 } meters: 1195 # to: locB + * durations { seconds: 0 } meters: 0 # to: locC + * } + * } + * } + * ``` + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix duration_distance_matrices = 8; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDurationDistanceMatrices() + { + return $this->duration_distance_matrices; + } + + /** + * Specifies duration and distance matrices used in the model. If this field + * is empty, Google Maps or geodesic distances will be used instead, depending + * on the value of the `use_geodesic_distances` field. If it is not empty, + * `use_geodesic_distances` cannot be true and neither + * `duration_distance_matrix_src_tags` nor `duration_distance_matrix_dst_tags` + * can be empty. + * Usage examples: + * * There are two locations: locA and locB. + * * 1 vehicle starting its route at locA and ending it at locA. + * * 1 pickup visit request at locB. + * ``` + * model { + * vehicles { start_tags: "locA" end_tags: "locA" } + * shipments { pickups { tags: "locB" } } + * duration_distance_matrix_src_tags: "locA" + * duration_distance_matrix_src_tags: "locB" + * duration_distance_matrix_dst_tags: "locA" + * duration_distance_matrix_dst_tags: "locB" + * duration_distance_matrices { + * rows { # from: locA + * durations { seconds: 0 } meters: 0 # to: locA + * durations { seconds: 100 } meters: 1000 # to: locB + * } + * rows { # from: locB + * durations { seconds: 102 } meters: 990 # to: locA + * durations { seconds: 0 } meters: 0 # to: locB + * } + * } + * } + * ``` + * * There are three locations: locA, locB and locC. + * * 1 vehicle starting its route at locA and ending it at locB, using + * matrix "fast". + * * 1 vehicle starting its route at locB and ending it at locB, using + * matrix "slow". + * * 1 vehicle starting its route at locB and ending it at locB, using + * matrix "fast". + * * 1 pickup visit request at locC. + * ``` + * model { + * vehicles { start_tags: "locA" end_tags: "locB" start_tags: "fast" } + * vehicles { start_tags: "locB" end_tags: "locB" start_tags: "slow" } + * vehicles { start_tags: "locB" end_tags: "locB" start_tags: "fast" } + * shipments { pickups { tags: "locC" } } + * duration_distance_matrix_src_tags: "locA" + * duration_distance_matrix_src_tags: "locB" + * duration_distance_matrix_src_tags: "locC" + * duration_distance_matrix_dst_tags: "locB" + * duration_distance_matrix_dst_tags: "locC" + * duration_distance_matrices { + * vehicle_start_tag: "fast" + * rows { # from: locA + * durations { seconds: 1000 } meters: 2000 # to: locB + * durations { seconds: 600 } meters: 1000 # to: locC + * } + * rows { # from: locB + * durations { seconds: 0 } meters: 0 # to: locB + * durations { seconds: 700 } meters: 1200 # to: locC + * } + * rows { # from: locC + * durations { seconds: 702 } meters: 1190 # to: locB + * durations { seconds: 0 } meters: 0 # to: locC + * } + * } + * duration_distance_matrices { + * vehicle_start_tag: "slow" + * rows { # from: locA + * durations { seconds: 1800 } meters: 2001 # to: locB + * durations { seconds: 900 } meters: 1002 # to: locC + * } + * rows { # from: locB + * durations { seconds: 0 } meters: 0 # to: locB + * durations { seconds: 1000 } meters: 1202 # to: locC + * } + * rows { # from: locC + * durations { seconds: 1001 } meters: 1195 # to: locB + * durations { seconds: 0 } meters: 0 # to: locC + * } + * } + * } + * ``` + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix duration_distance_matrices = 8; + * @param array<\Google\Cloud\Optimization\V1\ShipmentModel\DurationDistanceMatrix>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDurationDistanceMatrices($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\ShipmentModel\DurationDistanceMatrix::class); + $this->duration_distance_matrices = $arr; + + return $this; + } + + /** + * Tags defining the sources of the duration and distance matrices; + * `duration_distance_matrices(i).rows(j)` defines durations and distances + * from visits with tag `duration_distance_matrix_src_tags(j)` to other visits + * in matrix i. + * Tags correspond to + * [VisitRequest.tags][google.cloud.optimization.v1.Shipment.VisitRequest.tags] + * or [Vehicle.start_tags][google.cloud.optimization.v1.Vehicle.start_tags]. + * A given `VisitRequest` or `Vehicle` must match exactly one tag in this + * field. Note that a `Vehicle`'s source, destination and matrix tags may be + * the same; similarly a `VisitRequest`'s source and destination tags may be + * the same. All tags must be different and cannot be empty strings. If this + * field is not empty, then `duration_distance_matrices` must not be empty. + * + * Generated from protobuf field repeated string duration_distance_matrix_src_tags = 9; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDurationDistanceMatrixSrcTags() + { + return $this->duration_distance_matrix_src_tags; + } + + /** + * Tags defining the sources of the duration and distance matrices; + * `duration_distance_matrices(i).rows(j)` defines durations and distances + * from visits with tag `duration_distance_matrix_src_tags(j)` to other visits + * in matrix i. + * Tags correspond to + * [VisitRequest.tags][google.cloud.optimization.v1.Shipment.VisitRequest.tags] + * or [Vehicle.start_tags][google.cloud.optimization.v1.Vehicle.start_tags]. + * A given `VisitRequest` or `Vehicle` must match exactly one tag in this + * field. Note that a `Vehicle`'s source, destination and matrix tags may be + * the same; similarly a `VisitRequest`'s source and destination tags may be + * the same. All tags must be different and cannot be empty strings. If this + * field is not empty, then `duration_distance_matrices` must not be empty. + * + * Generated from protobuf field repeated string duration_distance_matrix_src_tags = 9; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDurationDistanceMatrixSrcTags($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->duration_distance_matrix_src_tags = $arr; + + return $this; + } + + /** + * Tags defining the destinations of the duration and distance matrices; + * `duration_distance_matrices(i).rows(j).durations(k)` (resp. + * `duration_distance_matrices(i).rows(j).meters(k))` defines the duration + * (resp. the distance) of the travel from visits with tag + * `duration_distance_matrix_src_tags(j)` to visits with tag + * `duration_distance_matrix_dst_tags(k)` in matrix i. + * Tags correspond to + * [VisitRequest.tags][google.cloud.optimization.v1.Shipment.VisitRequest.tags] + * or [Vehicle.start_tags][google.cloud.optimization.v1.Vehicle.start_tags]. + * A given `VisitRequest` or `Vehicle` must match exactly one tag in this + * field. Note that a `Vehicle`'s source, destination and matrix tags may be + * the same; similarly a `VisitRequest`'s source and destination tags may be + * the same. All tags must be different and cannot be empty strings. If this + * field is not empty, then `duration_distance_matrices` must not be empty. + * + * Generated from protobuf field repeated string duration_distance_matrix_dst_tags = 10; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDurationDistanceMatrixDstTags() + { + return $this->duration_distance_matrix_dst_tags; + } + + /** + * Tags defining the destinations of the duration and distance matrices; + * `duration_distance_matrices(i).rows(j).durations(k)` (resp. + * `duration_distance_matrices(i).rows(j).meters(k))` defines the duration + * (resp. the distance) of the travel from visits with tag + * `duration_distance_matrix_src_tags(j)` to visits with tag + * `duration_distance_matrix_dst_tags(k)` in matrix i. + * Tags correspond to + * [VisitRequest.tags][google.cloud.optimization.v1.Shipment.VisitRequest.tags] + * or [Vehicle.start_tags][google.cloud.optimization.v1.Vehicle.start_tags]. + * A given `VisitRequest` or `Vehicle` must match exactly one tag in this + * field. Note that a `Vehicle`'s source, destination and matrix tags may be + * the same; similarly a `VisitRequest`'s source and destination tags may be + * the same. All tags must be different and cannot be empty strings. If this + * field is not empty, then `duration_distance_matrices` must not be empty. + * + * Generated from protobuf field repeated string duration_distance_matrix_dst_tags = 10; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDurationDistanceMatrixDstTags($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->duration_distance_matrix_dst_tags = $arr; + + return $this; + } + + /** + * Transition attributes added to the model. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.TransitionAttributes transition_attributes = 11; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTransitionAttributes() + { + return $this->transition_attributes; + } + + /** + * Transition attributes added to the model. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.TransitionAttributes transition_attributes = 11; + * @param array<\Google\Cloud\Optimization\V1\TransitionAttributes>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTransitionAttributes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\TransitionAttributes::class); + $this->transition_attributes = $arr; + + return $this; + } + + /** + * Sets of incompatible shipment_types (see `ShipmentTypeIncompatibility`). + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentTypeIncompatibility shipment_type_incompatibilities = 12; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getShipmentTypeIncompatibilities() + { + return $this->shipment_type_incompatibilities; + } + + /** + * Sets of incompatible shipment_types (see `ShipmentTypeIncompatibility`). + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentTypeIncompatibility shipment_type_incompatibilities = 12; + * @param array<\Google\Cloud\Optimization\V1\ShipmentTypeIncompatibility>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setShipmentTypeIncompatibilities($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\ShipmentTypeIncompatibility::class); + $this->shipment_type_incompatibilities = $arr; + + return $this; + } + + /** + * Sets of `shipment_type` requirements (see `ShipmentTypeRequirement`). + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentTypeRequirement shipment_type_requirements = 13; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getShipmentTypeRequirements() + { + return $this->shipment_type_requirements; + } + + /** + * Sets of `shipment_type` requirements (see `ShipmentTypeRequirement`). + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentTypeRequirement shipment_type_requirements = 13; + * @param array<\Google\Cloud\Optimization\V1\ShipmentTypeRequirement>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setShipmentTypeRequirements($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\ShipmentTypeRequirement::class); + $this->shipment_type_requirements = $arr; + + return $this; + } + + /** + * Set of precedence rules which must be enforced in the model. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentModel.PrecedenceRule precedence_rules = 14; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getPrecedenceRules() + { + return $this->precedence_rules; + } + + /** + * Set of precedence rules which must be enforced in the model. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentModel.PrecedenceRule precedence_rules = 14; + * @param array<\Google\Cloud\Optimization\V1\ShipmentModel\PrecedenceRule>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setPrecedenceRules($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\ShipmentModel\PrecedenceRule::class); + $this->precedence_rules = $arr; + + return $this; + } + + /** + * Deprecated: No longer used. + * Set of break rules used in the model. + * Each vehicle specifies the `BreakRule` that applies to it via the + * [Vehicle.break_rule_indices][google.cloud.optimization.v1.Vehicle.break_rule_indices] + * field (which must be a singleton). + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule break_rules = 15 [deprecated = true]; + * @return \Google\Protobuf\Internal\RepeatedField + * @deprecated + */ + public function getBreakRules() + { + @trigger_error('break_rules is deprecated.', E_USER_DEPRECATED); + return $this->break_rules; + } + + /** + * Deprecated: No longer used. + * Set of break rules used in the model. + * Each vehicle specifies the `BreakRule` that applies to it via the + * [Vehicle.break_rule_indices][google.cloud.optimization.v1.Vehicle.break_rule_indices] + * field (which must be a singleton). + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule break_rules = 15 [deprecated = true]; + * @param array<\Google\Cloud\Optimization\V1\ShipmentModel\BreakRule>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + * @deprecated + */ + public function setBreakRules($var) + { + @trigger_error('break_rules is deprecated.', E_USER_DEPRECATED); + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\ShipmentModel\BreakRule::class); + $this->break_rules = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/ShipmentModel/BreakRule.php b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/ShipmentModel/BreakRule.php new file mode 100644 index 000000000000..e55603508adf --- /dev/null +++ b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/ShipmentModel/BreakRule.php @@ -0,0 +1,119 @@ +google.cloud.optimization.v1.ShipmentModel.BreakRule + */ +class BreakRule extends \Google\Protobuf\Internal\Message +{ + /** + * Sequence of breaks. See the `BreakRequest` message. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest break_requests = 1; + */ + private $break_requests; + /** + * Several `FrequencyConstraint` may apply. They must all be satisfied by + * the `BreakRequest`s of this `BreakRule`. See `FrequencyConstraint`. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint frequency_constraints = 2; + */ + private $frequency_constraints; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Optimization\V1\ShipmentModel\BreakRule\BreakRequest>|\Google\Protobuf\Internal\RepeatedField $break_requests + * Sequence of breaks. See the `BreakRequest` message. + * @type array<\Google\Cloud\Optimization\V1\ShipmentModel\BreakRule\FrequencyConstraint>|\Google\Protobuf\Internal\RepeatedField $frequency_constraints + * Several `FrequencyConstraint` may apply. They must all be satisfied by + * the `BreakRequest`s of this `BreakRule`. See `FrequencyConstraint`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * Sequence of breaks. See the `BreakRequest` message. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest break_requests = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getBreakRequests() + { + return $this->break_requests; + } + + /** + * Sequence of breaks. See the `BreakRequest` message. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest break_requests = 1; + * @param array<\Google\Cloud\Optimization\V1\ShipmentModel\BreakRule\BreakRequest>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setBreakRequests($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\ShipmentModel\BreakRule\BreakRequest::class); + $this->break_requests = $arr; + + return $this; + } + + /** + * Several `FrequencyConstraint` may apply. They must all be satisfied by + * the `BreakRequest`s of this `BreakRule`. See `FrequencyConstraint`. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint frequency_constraints = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getFrequencyConstraints() + { + return $this->frequency_constraints; + } + + /** + * Several `FrequencyConstraint` may apply. They must all be satisfied by + * the `BreakRequest`s of this `BreakRule`. See `FrequencyConstraint`. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint frequency_constraints = 2; + * @param array<\Google\Cloud\Optimization\V1\ShipmentModel\BreakRule\FrequencyConstraint>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setFrequencyConstraints($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\ShipmentModel\BreakRule\FrequencyConstraint::class); + $this->frequency_constraints = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(BreakRule::class, \Google\Cloud\Optimization\V1\ShipmentModel_BreakRule::class); + diff --git a/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/ShipmentModel/BreakRule/BreakRequest.php b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/ShipmentModel/BreakRule/BreakRequest.php new file mode 100644 index 000000000000..67f86f1f4e7a --- /dev/null +++ b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/ShipmentModel/BreakRule/BreakRequest.php @@ -0,0 +1,172 @@ +google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest + */ +class BreakRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Lower bound (inclusive) on the start of the break. + * + * Generated from protobuf field .google.protobuf.Timestamp earliest_start_time = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $earliest_start_time = null; + /** + * Required. Upper bound (inclusive) on the start of the break. + * + * Generated from protobuf field .google.protobuf.Timestamp latest_start_time = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $latest_start_time = null; + /** + * Required. Minimum duration of the break. Must be positive. + * + * Generated from protobuf field .google.protobuf.Duration min_duration = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $min_duration = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Timestamp $earliest_start_time + * Required. Lower bound (inclusive) on the start of the break. + * @type \Google\Protobuf\Timestamp $latest_start_time + * Required. Upper bound (inclusive) on the start of the break. + * @type \Google\Protobuf\Duration $min_duration + * Required. Minimum duration of the break. Must be positive. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * Required. Lower bound (inclusive) on the start of the break. + * + * Generated from protobuf field .google.protobuf.Timestamp earliest_start_time = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getEarliestStartTime() + { + return $this->earliest_start_time; + } + + public function hasEarliestStartTime() + { + return isset($this->earliest_start_time); + } + + public function clearEarliestStartTime() + { + unset($this->earliest_start_time); + } + + /** + * Required. Lower bound (inclusive) on the start of the break. + * + * Generated from protobuf field .google.protobuf.Timestamp earliest_start_time = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setEarliestStartTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->earliest_start_time = $var; + + return $this; + } + + /** + * Required. Upper bound (inclusive) on the start of the break. + * + * Generated from protobuf field .google.protobuf.Timestamp latest_start_time = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getLatestStartTime() + { + return $this->latest_start_time; + } + + public function hasLatestStartTime() + { + return isset($this->latest_start_time); + } + + public function clearLatestStartTime() + { + unset($this->latest_start_time); + } + + /** + * Required. Upper bound (inclusive) on the start of the break. + * + * Generated from protobuf field .google.protobuf.Timestamp latest_start_time = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setLatestStartTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->latest_start_time = $var; + + return $this; + } + + /** + * Required. Minimum duration of the break. Must be positive. + * + * Generated from protobuf field .google.protobuf.Duration min_duration = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Duration|null + */ + public function getMinDuration() + { + return $this->min_duration; + } + + public function hasMinDuration() + { + return isset($this->min_duration); + } + + public function clearMinDuration() + { + unset($this->min_duration); + } + + /** + * Required. Minimum duration of the break. Must be positive. + * + * Generated from protobuf field .google.protobuf.Duration min_duration = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setMinDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->min_duration = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(BreakRequest::class, \Google\Cloud\Optimization\V1\ShipmentModel_BreakRule_BreakRequest::class); + diff --git a/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/ShipmentModel/BreakRule/FrequencyConstraint.php b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/ShipmentModel/BreakRule/FrequencyConstraint.php new file mode 100644 index 000000000000..39bf3659c306 --- /dev/null +++ b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/ShipmentModel/BreakRule/FrequencyConstraint.php @@ -0,0 +1,166 @@ +google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint + */ +class FrequencyConstraint extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Minimum break duration for this constraint. Nonnegative. + * See description of `FrequencyConstraint`. + * + * Generated from protobuf field .google.protobuf.Duration min_break_duration = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $min_break_duration = null; + /** + * Required. Maximum allowed span of any interval of time in the route + * that does not include at least partially a break of `duration >= + * min_break_duration`. Must be positive. + * + * Generated from protobuf field .google.protobuf.Duration max_inter_break_duration = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $max_inter_break_duration = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Duration $min_break_duration + * Required. Minimum break duration for this constraint. Nonnegative. + * See description of `FrequencyConstraint`. + * @type \Google\Protobuf\Duration $max_inter_break_duration + * Required. Maximum allowed span of any interval of time in the route + * that does not include at least partially a break of `duration >= + * min_break_duration`. Must be positive. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * Required. Minimum break duration for this constraint. Nonnegative. + * See description of `FrequencyConstraint`. + * + * Generated from protobuf field .google.protobuf.Duration min_break_duration = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Duration|null + */ + public function getMinBreakDuration() + { + return $this->min_break_duration; + } + + public function hasMinBreakDuration() + { + return isset($this->min_break_duration); + } + + public function clearMinBreakDuration() + { + unset($this->min_break_duration); + } + + /** + * Required. Minimum break duration for this constraint. Nonnegative. + * See description of `FrequencyConstraint`. + * + * Generated from protobuf field .google.protobuf.Duration min_break_duration = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setMinBreakDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->min_break_duration = $var; + + return $this; + } + + /** + * Required. Maximum allowed span of any interval of time in the route + * that does not include at least partially a break of `duration >= + * min_break_duration`. Must be positive. + * + * Generated from protobuf field .google.protobuf.Duration max_inter_break_duration = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Duration|null + */ + public function getMaxInterBreakDuration() + { + return $this->max_inter_break_duration; + } + + public function hasMaxInterBreakDuration() + { + return isset($this->max_inter_break_duration); + } + + public function clearMaxInterBreakDuration() + { + unset($this->max_inter_break_duration); + } + + /** + * Required. Maximum allowed span of any interval of time in the route + * that does not include at least partially a break of `duration >= + * min_break_duration`. Must be positive. + * + * Generated from protobuf field .google.protobuf.Duration max_inter_break_duration = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setMaxInterBreakDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->max_inter_break_duration = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(FrequencyConstraint::class, \Google\Cloud\Optimization\V1\ShipmentModel_BreakRule_FrequencyConstraint::class); + diff --git a/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/ShipmentModel/DurationDistanceMatrix.php b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/ShipmentModel/DurationDistanceMatrix.php new file mode 100644 index 000000000000..24e614413ac5 --- /dev/null +++ b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/ShipmentModel/DurationDistanceMatrix.php @@ -0,0 +1,137 @@ +google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix + */ +class DurationDistanceMatrix extends \Google\Protobuf\Internal\Message +{ + /** + * Specifies the rows of the duration and distance matrix. It must have as + * many elements as + * [ShipmentModel.duration_distance_matrix_src_tags][google.cloud.optimization.v1.ShipmentModel.duration_distance_matrix_src_tags]. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row rows = 1; + */ + private $rows; + /** + * Tag defining to which vehicles this duration and distance matrix applies. + * If empty, this applies to all vehicles, and there can only be a single + * matrix. + * Each vehicle start must match exactly one matrix, i.e. exactly one of + * their `start_tags` field must match the `vehicle_start_tag` of a matrix + * (and of that matrix only). + * All matrices must have a different `vehicle_start_tag`. + * + * Generated from protobuf field string vehicle_start_tag = 2; + */ + protected $vehicle_start_tag = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Optimization\V1\ShipmentModel\DurationDistanceMatrix\Row>|\Google\Protobuf\Internal\RepeatedField $rows + * Specifies the rows of the duration and distance matrix. It must have as + * many elements as + * [ShipmentModel.duration_distance_matrix_src_tags][google.cloud.optimization.v1.ShipmentModel.duration_distance_matrix_src_tags]. + * @type string $vehicle_start_tag + * Tag defining to which vehicles this duration and distance matrix applies. + * If empty, this applies to all vehicles, and there can only be a single + * matrix. + * Each vehicle start must match exactly one matrix, i.e. exactly one of + * their `start_tags` field must match the `vehicle_start_tag` of a matrix + * (and of that matrix only). + * All matrices must have a different `vehicle_start_tag`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * Specifies the rows of the duration and distance matrix. It must have as + * many elements as + * [ShipmentModel.duration_distance_matrix_src_tags][google.cloud.optimization.v1.ShipmentModel.duration_distance_matrix_src_tags]. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row rows = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRows() + { + return $this->rows; + } + + /** + * Specifies the rows of the duration and distance matrix. It must have as + * many elements as + * [ShipmentModel.duration_distance_matrix_src_tags][google.cloud.optimization.v1.ShipmentModel.duration_distance_matrix_src_tags]. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row rows = 1; + * @param array<\Google\Cloud\Optimization\V1\ShipmentModel\DurationDistanceMatrix\Row>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRows($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\ShipmentModel\DurationDistanceMatrix\Row::class); + $this->rows = $arr; + + return $this; + } + + /** + * Tag defining to which vehicles this duration and distance matrix applies. + * If empty, this applies to all vehicles, and there can only be a single + * matrix. + * Each vehicle start must match exactly one matrix, i.e. exactly one of + * their `start_tags` field must match the `vehicle_start_tag` of a matrix + * (and of that matrix only). + * All matrices must have a different `vehicle_start_tag`. + * + * Generated from protobuf field string vehicle_start_tag = 2; + * @return string + */ + public function getVehicleStartTag() + { + return $this->vehicle_start_tag; + } + + /** + * Tag defining to which vehicles this duration and distance matrix applies. + * If empty, this applies to all vehicles, and there can only be a single + * matrix. + * Each vehicle start must match exactly one matrix, i.e. exactly one of + * their `start_tags` field must match the `vehicle_start_tag` of a matrix + * (and of that matrix only). + * All matrices must have a different `vehicle_start_tag`. + * + * Generated from protobuf field string vehicle_start_tag = 2; + * @param string $var + * @return $this + */ + public function setVehicleStartTag($var) + { + GPBUtil::checkString($var, True); + $this->vehicle_start_tag = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(DurationDistanceMatrix::class, \Google\Cloud\Optimization\V1\ShipmentModel_DurationDistanceMatrix::class); + diff --git a/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/ShipmentModel/DurationDistanceMatrix/Row.php b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/ShipmentModel/DurationDistanceMatrix/Row.php new file mode 100644 index 000000000000..bbe790501808 --- /dev/null +++ b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/ShipmentModel/DurationDistanceMatrix/Row.php @@ -0,0 +1,116 @@ +google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row + */ +class Row extends \Google\Protobuf\Internal\Message +{ + /** + * Duration values for a given row. It must have as many elements as + * [ShipmentModel.duration_distance_matrix_dst_tags][google.cloud.optimization.v1.ShipmentModel.duration_distance_matrix_dst_tags]. + * + * Generated from protobuf field repeated .google.protobuf.Duration durations = 1; + */ + private $durations; + /** + * Distance values for a given row. If no costs or constraints refer to + * distances in the model, this can be left empty; otherwise it must have + * as many elements as `durations`. + * + * Generated from protobuf field repeated double meters = 2; + */ + private $meters; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Protobuf\Duration>|\Google\Protobuf\Internal\RepeatedField $durations + * Duration values for a given row. It must have as many elements as + * [ShipmentModel.duration_distance_matrix_dst_tags][google.cloud.optimization.v1.ShipmentModel.duration_distance_matrix_dst_tags]. + * @type array|\Google\Protobuf\Internal\RepeatedField $meters + * Distance values for a given row. If no costs or constraints refer to + * distances in the model, this can be left empty; otherwise it must have + * as many elements as `durations`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * Duration values for a given row. It must have as many elements as + * [ShipmentModel.duration_distance_matrix_dst_tags][google.cloud.optimization.v1.ShipmentModel.duration_distance_matrix_dst_tags]. + * + * Generated from protobuf field repeated .google.protobuf.Duration durations = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDurations() + { + return $this->durations; + } + + /** + * Duration values for a given row. It must have as many elements as + * [ShipmentModel.duration_distance_matrix_dst_tags][google.cloud.optimization.v1.ShipmentModel.duration_distance_matrix_dst_tags]. + * + * Generated from protobuf field repeated .google.protobuf.Duration durations = 1; + * @param array<\Google\Protobuf\Duration>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDurations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Duration::class); + $this->durations = $arr; + + return $this; + } + + /** + * Distance values for a given row. If no costs or constraints refer to + * distances in the model, this can be left empty; otherwise it must have + * as many elements as `durations`. + * + * Generated from protobuf field repeated double meters = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getMeters() + { + return $this->meters; + } + + /** + * Distance values for a given row. If no costs or constraints refer to + * distances in the model, this can be left empty; otherwise it must have + * as many elements as `durations`. + * + * Generated from protobuf field repeated double meters = 2; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setMeters($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::DOUBLE); + $this->meters = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Row::class, \Google\Cloud\Optimization\V1\ShipmentModel_DurationDistanceMatrix_Row::class); + diff --git a/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/ShipmentModel/PrecedenceRule.php b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/ShipmentModel/PrecedenceRule.php new file mode 100644 index 000000000000..646693dcbc35 --- /dev/null +++ b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/ShipmentModel/PrecedenceRule.php @@ -0,0 +1,243 @@ +google.cloud.optimization.v1.ShipmentModel.PrecedenceRule + */ +class PrecedenceRule extends \Google\Protobuf\Internal\Message +{ + /** + * Shipment index of the "first" event. This field must be specified. + * + * Generated from protobuf field optional int32 first_index = 1; + */ + protected $first_index = null; + /** + * Indicates if the "first" event is a delivery. + * + * Generated from protobuf field bool first_is_delivery = 3; + */ + protected $first_is_delivery = false; + /** + * Shipment index of the "second" event. This field must be specified. + * + * Generated from protobuf field optional int32 second_index = 2; + */ + protected $second_index = null; + /** + * Indicates if the "second" event is a delivery. + * + * Generated from protobuf field bool second_is_delivery = 4; + */ + protected $second_is_delivery = false; + /** + * The offset between the "first" and "second" event. It can be negative. + * + * Generated from protobuf field .google.protobuf.Duration offset_duration = 5; + */ + protected $offset_duration = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $first_index + * Shipment index of the "first" event. This field must be specified. + * @type bool $first_is_delivery + * Indicates if the "first" event is a delivery. + * @type int $second_index + * Shipment index of the "second" event. This field must be specified. + * @type bool $second_is_delivery + * Indicates if the "second" event is a delivery. + * @type \Google\Protobuf\Duration $offset_duration + * The offset between the "first" and "second" event. It can be negative. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * Shipment index of the "first" event. This field must be specified. + * + * Generated from protobuf field optional int32 first_index = 1; + * @return int + */ + public function getFirstIndex() + { + return isset($this->first_index) ? $this->first_index : 0; + } + + public function hasFirstIndex() + { + return isset($this->first_index); + } + + public function clearFirstIndex() + { + unset($this->first_index); + } + + /** + * Shipment index of the "first" event. This field must be specified. + * + * Generated from protobuf field optional int32 first_index = 1; + * @param int $var + * @return $this + */ + public function setFirstIndex($var) + { + GPBUtil::checkInt32($var); + $this->first_index = $var; + + return $this; + } + + /** + * Indicates if the "first" event is a delivery. + * + * Generated from protobuf field bool first_is_delivery = 3; + * @return bool + */ + public function getFirstIsDelivery() + { + return $this->first_is_delivery; + } + + /** + * Indicates if the "first" event is a delivery. + * + * Generated from protobuf field bool first_is_delivery = 3; + * @param bool $var + * @return $this + */ + public function setFirstIsDelivery($var) + { + GPBUtil::checkBool($var); + $this->first_is_delivery = $var; + + return $this; + } + + /** + * Shipment index of the "second" event. This field must be specified. + * + * Generated from protobuf field optional int32 second_index = 2; + * @return int + */ + public function getSecondIndex() + { + return isset($this->second_index) ? $this->second_index : 0; + } + + public function hasSecondIndex() + { + return isset($this->second_index); + } + + public function clearSecondIndex() + { + unset($this->second_index); + } + + /** + * Shipment index of the "second" event. This field must be specified. + * + * Generated from protobuf field optional int32 second_index = 2; + * @param int $var + * @return $this + */ + public function setSecondIndex($var) + { + GPBUtil::checkInt32($var); + $this->second_index = $var; + + return $this; + } + + /** + * Indicates if the "second" event is a delivery. + * + * Generated from protobuf field bool second_is_delivery = 4; + * @return bool + */ + public function getSecondIsDelivery() + { + return $this->second_is_delivery; + } + + /** + * Indicates if the "second" event is a delivery. + * + * Generated from protobuf field bool second_is_delivery = 4; + * @param bool $var + * @return $this + */ + public function setSecondIsDelivery($var) + { + GPBUtil::checkBool($var); + $this->second_is_delivery = $var; + + return $this; + } + + /** + * The offset between the "first" and "second" event. It can be negative. + * + * Generated from protobuf field .google.protobuf.Duration offset_duration = 5; + * @return \Google\Protobuf\Duration|null + */ + public function getOffsetDuration() + { + return $this->offset_duration; + } + + public function hasOffsetDuration() + { + return isset($this->offset_duration); + } + + public function clearOffsetDuration() + { + unset($this->offset_duration); + } + + /** + * The offset between the "first" and "second" event. It can be negative. + * + * Generated from protobuf field .google.protobuf.Duration offset_duration = 5; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setOffsetDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->offset_duration = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(PrecedenceRule::class, \Google\Cloud\Optimization\V1\ShipmentModel_PrecedenceRule::class); + diff --git a/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/ShipmentModel_BreakRule.php b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/ShipmentModel_BreakRule.php new file mode 100644 index 000000000000..832281aeda33 --- /dev/null +++ b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/ShipmentModel_BreakRule.php @@ -0,0 +1,16 @@ + + * | TRANSITION[i] | VISIT[i] | + * | | | + * | * TRAVEL: the vehicle moves from | PERFORM the visit: | + * | VISIT[i-1].departure_location to | | + * | VISIT[i].arrival_location, which | * Spend some time: | + * | takes a given travel duration | the "visit duration". | + * | and distance | | + * | | * Load or unload | + * | * BREAKS: the driver may have | some quantities from the | + * | breaks (e.g. lunch break). | vehicle: the "demand". | + * | | | + * | * WAIT: the driver/vehicle does | | + * | nothing. This can happen for | | + * | many reasons, for example when | | + * | the vehicle reaches the next | | + * | event's destination before the | | + * | start of its time window | | + * | | | + * | * DELAY: *right before* the next | | + * | arrival. E.g. the vehicle and/or | | + * | driver spends time unloading. | | + * | | | + * ---+-------------------------------------+-----------------------------+--> + * ^ ^ ^ + * V[i-1].end V[i].start V[i].end + * ``` + * Lastly, here is how the TRAVEL, BREAKS, DELAY and WAIT can be arranged + * during a transition. + * * They don't overlap. + * * The DELAY is unique and *must* be a contiguous period of time right + * before the next visit (or vehicle end). Thus, it suffice to know the + * delay duration to know its start and end time. + * * The BREAKS are contiguous, non-overlapping periods of time. The + * response specifies the start time and duration of each break. + * * TRAVEL and WAIT are "preemptable": they can be interrupted several times + * during this transition. Clients can assume that travel happens "as soon as + * possible" and that "wait" fills the remaining time. + * A (complex) example: + * ``` + * TRANSITION[i] + * --++-----+-----------------------------------------------------------++--> + * || | | | | | | || + * || T | B | T | | B | | D || + * || r | r | r | W | r | W | e || + * || a | e | a | a | e | a | l || + * || v | a | v | i | a | i | a || + * || e | k | e | t | k | t | y || + * || l | | l | | | | || + * || | | | | | | || + * --++-----------------------------------------------------------------++--> + * ``` + * + * Generated from protobuf message google.cloud.optimization.v1.ShipmentRoute + */ +class ShipmentRoute extends \Google\Protobuf\Internal\Message +{ + /** + * Vehicle performing the route, identified by its index in the source + * `ShipmentModel`. + * + * Generated from protobuf field int32 vehicle_index = 1; + */ + protected $vehicle_index = 0; + /** + * Label of the vehicle performing this route, equal to + * `ShipmentModel.vehicles(vehicle_index).label`, if specified. + * + * Generated from protobuf field string vehicle_label = 2; + */ + protected $vehicle_label = ''; + /** + * Time at which the vehicle starts its route. + * + * Generated from protobuf field .google.protobuf.Timestamp vehicle_start_time = 5; + */ + protected $vehicle_start_time = null; + /** + * Time at which the vehicle finishes its route. + * + * Generated from protobuf field .google.protobuf.Timestamp vehicle_end_time = 6; + */ + protected $vehicle_end_time = null; + /** + * Ordered sequence of visits representing a route. + * visits[i] is the i-th visit in the route. + * If this field is empty, the vehicle is considered as unused. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentRoute.Visit visits = 7; + */ + private $visits; + /** + * Ordered list of transitions for the route. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentRoute.Transition transitions = 8; + */ + private $transitions; + /** + * When + * [OptimizeToursRequest.consider_road_traffic][google.cloud.optimization.v1.OptimizeToursRequest.consider_road_traffic], + * is set to true, this field indicates that inconsistencies in route timings + * are predicted using traffic-based travel duration estimates. There may be + * insufficient time to complete traffic-adjusted travel, delays, and breaks + * between visits, before the first visit, or after the last visit, while + * still satisfying the visit and vehicle time windows. For example, + * ``` + * start_time(previous_visit) + duration(previous_visit) + + * travel_duration(previous_visit, next_visit) > start_time(next_visit) + * ``` + * Arrival at next_visit will likely happen later than its current + * time window due the increased estimate of travel time + * `travel_duration(previous_visit, next_visit)` due to traffic. Also, a break + * may be forced to overlap with a visit due to an increase in travel time + * estimates and visit or break time window restrictions. + * + * Generated from protobuf field bool has_traffic_infeasibilities = 9; + */ + protected $has_traffic_infeasibilities = false; + /** + * The encoded polyline representation of the route. + * This field is only populated if + * [OptimizeToursRequest.populate_polylines][google.cloud.optimization.v1.OptimizeToursRequest.populate_polylines] + * is set to true. + * + * Generated from protobuf field .google.cloud.optimization.v1.ShipmentRoute.EncodedPolyline route_polyline = 10; + */ + protected $route_polyline = null; + /** + * Breaks scheduled for the vehicle performing this route. + * The `breaks` sequence represents time intervals, each starting at the + * corresponding `start_time` and lasting `duration` seconds. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentRoute.Break breaks = 11; + */ + private $breaks; + /** + * Duration, distance and load metrics for this route. The fields of + * [AggregatedMetrics][google.cloud.optimization.v1.AggregatedMetrics] are + * summed over all + * [ShipmentRoute.transitions][google.cloud.optimization.v1.ShipmentRoute.transitions] + * or + * [ShipmentRoute.visits][google.cloud.optimization.v1.ShipmentRoute.visits], + * depending on the context. + * + * Generated from protobuf field .google.cloud.optimization.v1.AggregatedMetrics metrics = 12; + */ + protected $metrics = null; + /** + * Cost of the route, broken down by cost-related request fields. + * The keys are proto paths, relative to the input OptimizeToursRequest, e.g. + * "model.shipments.pickups.cost", and the values are the total cost + * generated by the corresponding cost field, aggregated over the whole route. + * In other words, costs["model.shipments.pickups.cost"] is the sum of all + * pickup costs over the route. All costs defined in the model are reported in + * detail here with the exception of costs related to TransitionAttributes + * that are only reported in an aggregated way as of 2022/01. + * + * Generated from protobuf field map route_costs = 17; + */ + private $route_costs; + /** + * Total cost of the route. The sum of all costs in the cost map. + * + * Generated from protobuf field double route_total_cost = 18; + */ + protected $route_total_cost = 0.0; + /** + * Deprecated: Use + * [Transition.vehicle_loads][google.cloud.optimization.v1.ShipmentRoute.Transition.vehicle_loads] + * instead. Vehicle loads upon arrival at its end location, for each type + * specified in + * [Vehicle.capacities][google.cloud.optimization.v1.Vehicle.capacities], + * `start_load_intervals`, `end_load_intervals` or demands. Exception: we omit + * loads for quantity types unconstrained by intervals and that don't have any + * non-zero demand on the route. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.CapacityQuantity end_loads = 13 [deprecated = true]; + * @deprecated + */ + private $end_loads; + /** + * Deprecated: Use + * [ShipmentRoute.transitions][google.cloud.optimization.v1.ShipmentRoute.transitions] + * instead. Ordered list of travel steps for the route. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentRoute.TravelStep travel_steps = 14 [deprecated = true]; + * @deprecated + */ + private $travel_steps; + /** + * Deprecated: No longer used. + * This field will only be populated at the + * [ShipmentRoute.Visit][google.cloud.optimization.v1.ShipmentRoute.Visit] + * level. + * This field is the extra detour time due to the shipments visited on the + * route. + * It is equal to `vehicle_end_time` - `vehicle_start_time` - travel duration + * from the vehicle's start_location to its `end_location`. + * + * Generated from protobuf field .google.protobuf.Duration vehicle_detour = 15 [deprecated = true]; + * @deprecated + */ + protected $vehicle_detour = null; + /** + * Deprecated: Delay occurring before the vehicle end. See + * [TransitionAttributes.delay][google.cloud.optimization.v1.TransitionAttributes.delay]. + * + * Generated from protobuf field .google.cloud.optimization.v1.ShipmentRoute.Delay delay_before_vehicle_end = 16 [deprecated = true]; + * @deprecated + */ + protected $delay_before_vehicle_end = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $vehicle_index + * Vehicle performing the route, identified by its index in the source + * `ShipmentModel`. + * @type string $vehicle_label + * Label of the vehicle performing this route, equal to + * `ShipmentModel.vehicles(vehicle_index).label`, if specified. + * @type \Google\Protobuf\Timestamp $vehicle_start_time + * Time at which the vehicle starts its route. + * @type \Google\Protobuf\Timestamp $vehicle_end_time + * Time at which the vehicle finishes its route. + * @type array<\Google\Cloud\Optimization\V1\ShipmentRoute\Visit>|\Google\Protobuf\Internal\RepeatedField $visits + * Ordered sequence of visits representing a route. + * visits[i] is the i-th visit in the route. + * If this field is empty, the vehicle is considered as unused. + * @type array<\Google\Cloud\Optimization\V1\ShipmentRoute\Transition>|\Google\Protobuf\Internal\RepeatedField $transitions + * Ordered list of transitions for the route. + * @type bool $has_traffic_infeasibilities + * When + * [OptimizeToursRequest.consider_road_traffic][google.cloud.optimization.v1.OptimizeToursRequest.consider_road_traffic], + * is set to true, this field indicates that inconsistencies in route timings + * are predicted using traffic-based travel duration estimates. There may be + * insufficient time to complete traffic-adjusted travel, delays, and breaks + * between visits, before the first visit, or after the last visit, while + * still satisfying the visit and vehicle time windows. For example, + * ``` + * start_time(previous_visit) + duration(previous_visit) + + * travel_duration(previous_visit, next_visit) > start_time(next_visit) + * ``` + * Arrival at next_visit will likely happen later than its current + * time window due the increased estimate of travel time + * `travel_duration(previous_visit, next_visit)` due to traffic. Also, a break + * may be forced to overlap with a visit due to an increase in travel time + * estimates and visit or break time window restrictions. + * @type \Google\Cloud\Optimization\V1\ShipmentRoute\EncodedPolyline $route_polyline + * The encoded polyline representation of the route. + * This field is only populated if + * [OptimizeToursRequest.populate_polylines][google.cloud.optimization.v1.OptimizeToursRequest.populate_polylines] + * is set to true. + * @type array<\Google\Cloud\Optimization\V1\ShipmentRoute\PBBreak>|\Google\Protobuf\Internal\RepeatedField $breaks + * Breaks scheduled for the vehicle performing this route. + * The `breaks` sequence represents time intervals, each starting at the + * corresponding `start_time` and lasting `duration` seconds. + * @type \Google\Cloud\Optimization\V1\AggregatedMetrics $metrics + * Duration, distance and load metrics for this route. The fields of + * [AggregatedMetrics][google.cloud.optimization.v1.AggregatedMetrics] are + * summed over all + * [ShipmentRoute.transitions][google.cloud.optimization.v1.ShipmentRoute.transitions] + * or + * [ShipmentRoute.visits][google.cloud.optimization.v1.ShipmentRoute.visits], + * depending on the context. + * @type array|\Google\Protobuf\Internal\MapField $route_costs + * Cost of the route, broken down by cost-related request fields. + * The keys are proto paths, relative to the input OptimizeToursRequest, e.g. + * "model.shipments.pickups.cost", and the values are the total cost + * generated by the corresponding cost field, aggregated over the whole route. + * In other words, costs["model.shipments.pickups.cost"] is the sum of all + * pickup costs over the route. All costs defined in the model are reported in + * detail here with the exception of costs related to TransitionAttributes + * that are only reported in an aggregated way as of 2022/01. + * @type float $route_total_cost + * Total cost of the route. The sum of all costs in the cost map. + * @type array<\Google\Cloud\Optimization\V1\CapacityQuantity>|\Google\Protobuf\Internal\RepeatedField $end_loads + * Deprecated: Use + * [Transition.vehicle_loads][google.cloud.optimization.v1.ShipmentRoute.Transition.vehicle_loads] + * instead. Vehicle loads upon arrival at its end location, for each type + * specified in + * [Vehicle.capacities][google.cloud.optimization.v1.Vehicle.capacities], + * `start_load_intervals`, `end_load_intervals` or demands. Exception: we omit + * loads for quantity types unconstrained by intervals and that don't have any + * non-zero demand on the route. + * @type array<\Google\Cloud\Optimization\V1\ShipmentRoute\TravelStep>|\Google\Protobuf\Internal\RepeatedField $travel_steps + * Deprecated: Use + * [ShipmentRoute.transitions][google.cloud.optimization.v1.ShipmentRoute.transitions] + * instead. Ordered list of travel steps for the route. + * @type \Google\Protobuf\Duration $vehicle_detour + * Deprecated: No longer used. + * This field will only be populated at the + * [ShipmentRoute.Visit][google.cloud.optimization.v1.ShipmentRoute.Visit] + * level. + * This field is the extra detour time due to the shipments visited on the + * route. + * It is equal to `vehicle_end_time` - `vehicle_start_time` - travel duration + * from the vehicle's start_location to its `end_location`. + * @type \Google\Cloud\Optimization\V1\ShipmentRoute\Delay $delay_before_vehicle_end + * Deprecated: Delay occurring before the vehicle end. See + * [TransitionAttributes.delay][google.cloud.optimization.v1.TransitionAttributes.delay]. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * Vehicle performing the route, identified by its index in the source + * `ShipmentModel`. + * + * Generated from protobuf field int32 vehicle_index = 1; + * @return int + */ + public function getVehicleIndex() + { + return $this->vehicle_index; + } + + /** + * Vehicle performing the route, identified by its index in the source + * `ShipmentModel`. + * + * Generated from protobuf field int32 vehicle_index = 1; + * @param int $var + * @return $this + */ + public function setVehicleIndex($var) + { + GPBUtil::checkInt32($var); + $this->vehicle_index = $var; + + return $this; + } + + /** + * Label of the vehicle performing this route, equal to + * `ShipmentModel.vehicles(vehicle_index).label`, if specified. + * + * Generated from protobuf field string vehicle_label = 2; + * @return string + */ + public function getVehicleLabel() + { + return $this->vehicle_label; + } + + /** + * Label of the vehicle performing this route, equal to + * `ShipmentModel.vehicles(vehicle_index).label`, if specified. + * + * Generated from protobuf field string vehicle_label = 2; + * @param string $var + * @return $this + */ + public function setVehicleLabel($var) + { + GPBUtil::checkString($var, True); + $this->vehicle_label = $var; + + return $this; + } + + /** + * Time at which the vehicle starts its route. + * + * Generated from protobuf field .google.protobuf.Timestamp vehicle_start_time = 5; + * @return \Google\Protobuf\Timestamp|null + */ + public function getVehicleStartTime() + { + return $this->vehicle_start_time; + } + + public function hasVehicleStartTime() + { + return isset($this->vehicle_start_time); + } + + public function clearVehicleStartTime() + { + unset($this->vehicle_start_time); + } + + /** + * Time at which the vehicle starts its route. + * + * Generated from protobuf field .google.protobuf.Timestamp vehicle_start_time = 5; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setVehicleStartTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->vehicle_start_time = $var; + + return $this; + } + + /** + * Time at which the vehicle finishes its route. + * + * Generated from protobuf field .google.protobuf.Timestamp vehicle_end_time = 6; + * @return \Google\Protobuf\Timestamp|null + */ + public function getVehicleEndTime() + { + return $this->vehicle_end_time; + } + + public function hasVehicleEndTime() + { + return isset($this->vehicle_end_time); + } + + public function clearVehicleEndTime() + { + unset($this->vehicle_end_time); + } + + /** + * Time at which the vehicle finishes its route. + * + * Generated from protobuf field .google.protobuf.Timestamp vehicle_end_time = 6; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setVehicleEndTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->vehicle_end_time = $var; + + return $this; + } + + /** + * Ordered sequence of visits representing a route. + * visits[i] is the i-th visit in the route. + * If this field is empty, the vehicle is considered as unused. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentRoute.Visit visits = 7; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getVisits() + { + return $this->visits; + } + + /** + * Ordered sequence of visits representing a route. + * visits[i] is the i-th visit in the route. + * If this field is empty, the vehicle is considered as unused. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentRoute.Visit visits = 7; + * @param array<\Google\Cloud\Optimization\V1\ShipmentRoute\Visit>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setVisits($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\ShipmentRoute\Visit::class); + $this->visits = $arr; + + return $this; + } + + /** + * Ordered list of transitions for the route. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentRoute.Transition transitions = 8; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTransitions() + { + return $this->transitions; + } + + /** + * Ordered list of transitions for the route. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentRoute.Transition transitions = 8; + * @param array<\Google\Cloud\Optimization\V1\ShipmentRoute\Transition>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTransitions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\ShipmentRoute\Transition::class); + $this->transitions = $arr; + + return $this; + } + + /** + * When + * [OptimizeToursRequest.consider_road_traffic][google.cloud.optimization.v1.OptimizeToursRequest.consider_road_traffic], + * is set to true, this field indicates that inconsistencies in route timings + * are predicted using traffic-based travel duration estimates. There may be + * insufficient time to complete traffic-adjusted travel, delays, and breaks + * between visits, before the first visit, or after the last visit, while + * still satisfying the visit and vehicle time windows. For example, + * ``` + * start_time(previous_visit) + duration(previous_visit) + + * travel_duration(previous_visit, next_visit) > start_time(next_visit) + * ``` + * Arrival at next_visit will likely happen later than its current + * time window due the increased estimate of travel time + * `travel_duration(previous_visit, next_visit)` due to traffic. Also, a break + * may be forced to overlap with a visit due to an increase in travel time + * estimates and visit or break time window restrictions. + * + * Generated from protobuf field bool has_traffic_infeasibilities = 9; + * @return bool + */ + public function getHasTrafficInfeasibilities() + { + return $this->has_traffic_infeasibilities; + } + + /** + * When + * [OptimizeToursRequest.consider_road_traffic][google.cloud.optimization.v1.OptimizeToursRequest.consider_road_traffic], + * is set to true, this field indicates that inconsistencies in route timings + * are predicted using traffic-based travel duration estimates. There may be + * insufficient time to complete traffic-adjusted travel, delays, and breaks + * between visits, before the first visit, or after the last visit, while + * still satisfying the visit and vehicle time windows. For example, + * ``` + * start_time(previous_visit) + duration(previous_visit) + + * travel_duration(previous_visit, next_visit) > start_time(next_visit) + * ``` + * Arrival at next_visit will likely happen later than its current + * time window due the increased estimate of travel time + * `travel_duration(previous_visit, next_visit)` due to traffic. Also, a break + * may be forced to overlap with a visit due to an increase in travel time + * estimates and visit or break time window restrictions. + * + * Generated from protobuf field bool has_traffic_infeasibilities = 9; + * @param bool $var + * @return $this + */ + public function setHasTrafficInfeasibilities($var) + { + GPBUtil::checkBool($var); + $this->has_traffic_infeasibilities = $var; + + return $this; + } + + /** + * The encoded polyline representation of the route. + * This field is only populated if + * [OptimizeToursRequest.populate_polylines][google.cloud.optimization.v1.OptimizeToursRequest.populate_polylines] + * is set to true. + * + * Generated from protobuf field .google.cloud.optimization.v1.ShipmentRoute.EncodedPolyline route_polyline = 10; + * @return \Google\Cloud\Optimization\V1\ShipmentRoute\EncodedPolyline|null + */ + public function getRoutePolyline() + { + return $this->route_polyline; + } + + public function hasRoutePolyline() + { + return isset($this->route_polyline); + } + + public function clearRoutePolyline() + { + unset($this->route_polyline); + } + + /** + * The encoded polyline representation of the route. + * This field is only populated if + * [OptimizeToursRequest.populate_polylines][google.cloud.optimization.v1.OptimizeToursRequest.populate_polylines] + * is set to true. + * + * Generated from protobuf field .google.cloud.optimization.v1.ShipmentRoute.EncodedPolyline route_polyline = 10; + * @param \Google\Cloud\Optimization\V1\ShipmentRoute\EncodedPolyline $var + * @return $this + */ + public function setRoutePolyline($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Optimization\V1\ShipmentRoute\EncodedPolyline::class); + $this->route_polyline = $var; + + return $this; + } + + /** + * Breaks scheduled for the vehicle performing this route. + * The `breaks` sequence represents time intervals, each starting at the + * corresponding `start_time` and lasting `duration` seconds. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentRoute.Break breaks = 11; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getBreaks() + { + return $this->breaks; + } + + /** + * Breaks scheduled for the vehicle performing this route. + * The `breaks` sequence represents time intervals, each starting at the + * corresponding `start_time` and lasting `duration` seconds. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentRoute.Break breaks = 11; + * @param array<\Google\Cloud\Optimization\V1\ShipmentRoute\PBBreak>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setBreaks($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\ShipmentRoute\PBBreak::class); + $this->breaks = $arr; + + return $this; + } + + /** + * Duration, distance and load metrics for this route. The fields of + * [AggregatedMetrics][google.cloud.optimization.v1.AggregatedMetrics] are + * summed over all + * [ShipmentRoute.transitions][google.cloud.optimization.v1.ShipmentRoute.transitions] + * or + * [ShipmentRoute.visits][google.cloud.optimization.v1.ShipmentRoute.visits], + * depending on the context. + * + * Generated from protobuf field .google.cloud.optimization.v1.AggregatedMetrics metrics = 12; + * @return \Google\Cloud\Optimization\V1\AggregatedMetrics|null + */ + public function getMetrics() + { + return $this->metrics; + } + + public function hasMetrics() + { + return isset($this->metrics); + } + + public function clearMetrics() + { + unset($this->metrics); + } + + /** + * Duration, distance and load metrics for this route. The fields of + * [AggregatedMetrics][google.cloud.optimization.v1.AggregatedMetrics] are + * summed over all + * [ShipmentRoute.transitions][google.cloud.optimization.v1.ShipmentRoute.transitions] + * or + * [ShipmentRoute.visits][google.cloud.optimization.v1.ShipmentRoute.visits], + * depending on the context. + * + * Generated from protobuf field .google.cloud.optimization.v1.AggregatedMetrics metrics = 12; + * @param \Google\Cloud\Optimization\V1\AggregatedMetrics $var + * @return $this + */ + public function setMetrics($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Optimization\V1\AggregatedMetrics::class); + $this->metrics = $var; + + return $this; + } + + /** + * Cost of the route, broken down by cost-related request fields. + * The keys are proto paths, relative to the input OptimizeToursRequest, e.g. + * "model.shipments.pickups.cost", and the values are the total cost + * generated by the corresponding cost field, aggregated over the whole route. + * In other words, costs["model.shipments.pickups.cost"] is the sum of all + * pickup costs over the route. All costs defined in the model are reported in + * detail here with the exception of costs related to TransitionAttributes + * that are only reported in an aggregated way as of 2022/01. + * + * Generated from protobuf field map route_costs = 17; + * @return \Google\Protobuf\Internal\MapField + */ + public function getRouteCosts() + { + return $this->route_costs; + } + + /** + * Cost of the route, broken down by cost-related request fields. + * The keys are proto paths, relative to the input OptimizeToursRequest, e.g. + * "model.shipments.pickups.cost", and the values are the total cost + * generated by the corresponding cost field, aggregated over the whole route. + * In other words, costs["model.shipments.pickups.cost"] is the sum of all + * pickup costs over the route. All costs defined in the model are reported in + * detail here with the exception of costs related to TransitionAttributes + * that are only reported in an aggregated way as of 2022/01. + * + * Generated from protobuf field map route_costs = 17; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setRouteCosts($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::DOUBLE); + $this->route_costs = $arr; + + return $this; + } + + /** + * Total cost of the route. The sum of all costs in the cost map. + * + * Generated from protobuf field double route_total_cost = 18; + * @return float + */ + public function getRouteTotalCost() + { + return $this->route_total_cost; + } + + /** + * Total cost of the route. The sum of all costs in the cost map. + * + * Generated from protobuf field double route_total_cost = 18; + * @param float $var + * @return $this + */ + public function setRouteTotalCost($var) + { + GPBUtil::checkDouble($var); + $this->route_total_cost = $var; + + return $this; + } + + /** + * Deprecated: Use + * [Transition.vehicle_loads][google.cloud.optimization.v1.ShipmentRoute.Transition.vehicle_loads] + * instead. Vehicle loads upon arrival at its end location, for each type + * specified in + * [Vehicle.capacities][google.cloud.optimization.v1.Vehicle.capacities], + * `start_load_intervals`, `end_load_intervals` or demands. Exception: we omit + * loads for quantity types unconstrained by intervals and that don't have any + * non-zero demand on the route. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.CapacityQuantity end_loads = 13 [deprecated = true]; + * @return \Google\Protobuf\Internal\RepeatedField + * @deprecated + */ + public function getEndLoads() + { + @trigger_error('end_loads is deprecated.', E_USER_DEPRECATED); + return $this->end_loads; + } + + /** + * Deprecated: Use + * [Transition.vehicle_loads][google.cloud.optimization.v1.ShipmentRoute.Transition.vehicle_loads] + * instead. Vehicle loads upon arrival at its end location, for each type + * specified in + * [Vehicle.capacities][google.cloud.optimization.v1.Vehicle.capacities], + * `start_load_intervals`, `end_load_intervals` or demands. Exception: we omit + * loads for quantity types unconstrained by intervals and that don't have any + * non-zero demand on the route. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.CapacityQuantity end_loads = 13 [deprecated = true]; + * @param array<\Google\Cloud\Optimization\V1\CapacityQuantity>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + * @deprecated + */ + public function setEndLoads($var) + { + @trigger_error('end_loads is deprecated.', E_USER_DEPRECATED); + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\CapacityQuantity::class); + $this->end_loads = $arr; + + return $this; + } + + /** + * Deprecated: Use + * [ShipmentRoute.transitions][google.cloud.optimization.v1.ShipmentRoute.transitions] + * instead. Ordered list of travel steps for the route. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentRoute.TravelStep travel_steps = 14 [deprecated = true]; + * @return \Google\Protobuf\Internal\RepeatedField + * @deprecated + */ + public function getTravelSteps() + { + @trigger_error('travel_steps is deprecated.', E_USER_DEPRECATED); + return $this->travel_steps; + } + + /** + * Deprecated: Use + * [ShipmentRoute.transitions][google.cloud.optimization.v1.ShipmentRoute.transitions] + * instead. Ordered list of travel steps for the route. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentRoute.TravelStep travel_steps = 14 [deprecated = true]; + * @param array<\Google\Cloud\Optimization\V1\ShipmentRoute\TravelStep>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + * @deprecated + */ + public function setTravelSteps($var) + { + @trigger_error('travel_steps is deprecated.', E_USER_DEPRECATED); + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\ShipmentRoute\TravelStep::class); + $this->travel_steps = $arr; + + return $this; + } + + /** + * Deprecated: No longer used. + * This field will only be populated at the + * [ShipmentRoute.Visit][google.cloud.optimization.v1.ShipmentRoute.Visit] + * level. + * This field is the extra detour time due to the shipments visited on the + * route. + * It is equal to `vehicle_end_time` - `vehicle_start_time` - travel duration + * from the vehicle's start_location to its `end_location`. + * + * Generated from protobuf field .google.protobuf.Duration vehicle_detour = 15 [deprecated = true]; + * @return \Google\Protobuf\Duration|null + * @deprecated + */ + public function getVehicleDetour() + { + @trigger_error('vehicle_detour is deprecated.', E_USER_DEPRECATED); + return $this->vehicle_detour; + } + + public function hasVehicleDetour() + { + @trigger_error('vehicle_detour is deprecated.', E_USER_DEPRECATED); + return isset($this->vehicle_detour); + } + + public function clearVehicleDetour() + { + @trigger_error('vehicle_detour is deprecated.', E_USER_DEPRECATED); + unset($this->vehicle_detour); + } + + /** + * Deprecated: No longer used. + * This field will only be populated at the + * [ShipmentRoute.Visit][google.cloud.optimization.v1.ShipmentRoute.Visit] + * level. + * This field is the extra detour time due to the shipments visited on the + * route. + * It is equal to `vehicle_end_time` - `vehicle_start_time` - travel duration + * from the vehicle's start_location to its `end_location`. + * + * Generated from protobuf field .google.protobuf.Duration vehicle_detour = 15 [deprecated = true]; + * @param \Google\Protobuf\Duration $var + * @return $this + * @deprecated + */ + public function setVehicleDetour($var) + { + @trigger_error('vehicle_detour is deprecated.', E_USER_DEPRECATED); + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->vehicle_detour = $var; + + return $this; + } + + /** + * Deprecated: Delay occurring before the vehicle end. See + * [TransitionAttributes.delay][google.cloud.optimization.v1.TransitionAttributes.delay]. + * + * Generated from protobuf field .google.cloud.optimization.v1.ShipmentRoute.Delay delay_before_vehicle_end = 16 [deprecated = true]; + * @return \Google\Cloud\Optimization\V1\ShipmentRoute\Delay|null + * @deprecated + */ + public function getDelayBeforeVehicleEnd() + { + @trigger_error('delay_before_vehicle_end is deprecated.', E_USER_DEPRECATED); + return $this->delay_before_vehicle_end; + } + + public function hasDelayBeforeVehicleEnd() + { + @trigger_error('delay_before_vehicle_end is deprecated.', E_USER_DEPRECATED); + return isset($this->delay_before_vehicle_end); + } + + public function clearDelayBeforeVehicleEnd() + { + @trigger_error('delay_before_vehicle_end is deprecated.', E_USER_DEPRECATED); + unset($this->delay_before_vehicle_end); + } + + /** + * Deprecated: Delay occurring before the vehicle end. See + * [TransitionAttributes.delay][google.cloud.optimization.v1.TransitionAttributes.delay]. + * + * Generated from protobuf field .google.cloud.optimization.v1.ShipmentRoute.Delay delay_before_vehicle_end = 16 [deprecated = true]; + * @param \Google\Cloud\Optimization\V1\ShipmentRoute\Delay $var + * @return $this + * @deprecated + */ + public function setDelayBeforeVehicleEnd($var) + { + @trigger_error('delay_before_vehicle_end is deprecated.', E_USER_DEPRECATED); + GPBUtil::checkMessage($var, \Google\Cloud\Optimization\V1\ShipmentRoute\Delay::class); + $this->delay_before_vehicle_end = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/ShipmentRoute/Delay.php b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/ShipmentRoute/Delay.php new file mode 100644 index 000000000000..72db94d6bd5f --- /dev/null +++ b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/ShipmentRoute/Delay.php @@ -0,0 +1,127 @@ +google.cloud.optimization.v1.ShipmentRoute.Delay + */ +class Delay extends \Google\Protobuf\Internal\Message +{ + /** + * Start of the delay. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 1; + */ + protected $start_time = null; + /** + * Duration of the delay. + * + * Generated from protobuf field .google.protobuf.Duration duration = 2; + */ + protected $duration = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Timestamp $start_time + * Start of the delay. + * @type \Google\Protobuf\Duration $duration + * Duration of the delay. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * Start of the delay. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 1; + * @return \Google\Protobuf\Timestamp|null + */ + public function getStartTime() + { + return $this->start_time; + } + + public function hasStartTime() + { + return isset($this->start_time); + } + + public function clearStartTime() + { + unset($this->start_time); + } + + /** + * Start of the delay. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 1; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setStartTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->start_time = $var; + + return $this; + } + + /** + * Duration of the delay. + * + * Generated from protobuf field .google.protobuf.Duration duration = 2; + * @return \Google\Protobuf\Duration|null + */ + public function getDuration() + { + return $this->duration; + } + + public function hasDuration() + { + return isset($this->duration); + } + + public function clearDuration() + { + unset($this->duration); + } + + /** + * Duration of the delay. + * + * Generated from protobuf field .google.protobuf.Duration duration = 2; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->duration = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Delay::class, \Google\Cloud\Optimization\V1\ShipmentRoute_Delay::class); + diff --git a/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/ShipmentRoute/EncodedPolyline.php b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/ShipmentRoute/EncodedPolyline.php new file mode 100644 index 000000000000..4de0fee0843c --- /dev/null +++ b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/ShipmentRoute/EncodedPolyline.php @@ -0,0 +1,73 @@ +google.cloud.optimization.v1.ShipmentRoute.EncodedPolyline + */ +class EncodedPolyline extends \Google\Protobuf\Internal\Message +{ + /** + * String representing encoded points of the polyline. + * + * Generated from protobuf field string points = 1; + */ + protected $points = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $points + * String representing encoded points of the polyline. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * String representing encoded points of the polyline. + * + * Generated from protobuf field string points = 1; + * @return string + */ + public function getPoints() + { + return $this->points; + } + + /** + * String representing encoded points of the polyline. + * + * Generated from protobuf field string points = 1; + * @param string $var + * @return $this + */ + public function setPoints($var) + { + GPBUtil::checkString($var, True); + $this->points = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(EncodedPolyline::class, \Google\Cloud\Optimization\V1\ShipmentRoute_EncodedPolyline::class); + diff --git a/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/ShipmentRoute/PBBreak.php b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/ShipmentRoute/PBBreak.php new file mode 100644 index 000000000000..1a108699e4c5 --- /dev/null +++ b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/ShipmentRoute/PBBreak.php @@ -0,0 +1,124 @@ +google.cloud.optimization.v1.ShipmentRoute.Break + */ +class PBBreak extends \Google\Protobuf\Internal\Message +{ + /** + * Start time of a break. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 1; + */ + protected $start_time = null; + /** + * Duration of a break. + * + * Generated from protobuf field .google.protobuf.Duration duration = 2; + */ + protected $duration = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Timestamp $start_time + * Start time of a break. + * @type \Google\Protobuf\Duration $duration + * Duration of a break. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * Start time of a break. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 1; + * @return \Google\Protobuf\Timestamp|null + */ + public function getStartTime() + { + return $this->start_time; + } + + public function hasStartTime() + { + return isset($this->start_time); + } + + public function clearStartTime() + { + unset($this->start_time); + } + + /** + * Start time of a break. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 1; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setStartTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->start_time = $var; + + return $this; + } + + /** + * Duration of a break. + * + * Generated from protobuf field .google.protobuf.Duration duration = 2; + * @return \Google\Protobuf\Duration|null + */ + public function getDuration() + { + return $this->duration; + } + + public function hasDuration() + { + return isset($this->duration); + } + + public function clearDuration() + { + unset($this->duration); + } + + /** + * Duration of a break. + * + * Generated from protobuf field .google.protobuf.Duration duration = 2; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->duration = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(PBBreak::class, \Google\Cloud\Optimization\V1\ShipmentRoute_Break::class); + diff --git a/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/ShipmentRoute/Transition.php b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/ShipmentRoute/Transition.php new file mode 100644 index 000000000000..1fa03752d95d --- /dev/null +++ b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/ShipmentRoute/Transition.php @@ -0,0 +1,620 @@ +google.cloud.optimization.v1.ShipmentRoute.Transition + */ +class Transition extends \Google\Protobuf\Internal\Message +{ + /** + * Travel duration during this transition. + * + * Generated from protobuf field .google.protobuf.Duration travel_duration = 1; + */ + protected $travel_duration = null; + /** + * Distance traveled during the transition. + * + * Generated from protobuf field double travel_distance_meters = 2; + */ + protected $travel_distance_meters = 0.0; + /** + * When traffic is requested via + * [OptimizeToursRequest.consider_road_traffic] + * [google.cloud.optimization.v1.OptimizeToursRequest.consider_road_traffic], + * and the traffic info couldn't be retrieved for a `Transition`, this + * boolean is set to true. This may be temporary (rare hiccup in the + * realtime traffic servers) or permanent (no data for this location). + * + * Generated from protobuf field bool traffic_info_unavailable = 3; + */ + protected $traffic_info_unavailable = false; + /** + * Sum of the delay durations applied to this transition. If any, the delay + * starts exactly `delay_duration` seconds before the next event (visit or + * vehicle end). See + * [TransitionAttributes.delay][google.cloud.optimization.v1.TransitionAttributes.delay]. + * + * Generated from protobuf field .google.protobuf.Duration delay_duration = 4; + */ + protected $delay_duration = null; + /** + * Sum of the duration of the breaks occurring during this transition, if + * any. Details about each break's start time and duration are stored in + * [ShipmentRoute.breaks][google.cloud.optimization.v1.ShipmentRoute.breaks]. + * + * Generated from protobuf field .google.protobuf.Duration break_duration = 5; + */ + protected $break_duration = null; + /** + * Time spent waiting during this transition. Wait duration corresponds to + * idle time and does not include break time. Also note that this wait time + * may be split into several non-contiguous intervals. + * + * Generated from protobuf field .google.protobuf.Duration wait_duration = 6; + */ + protected $wait_duration = null; + /** + * Total duration of the transition, provided for convenience. It is equal + * to: + * * next visit `start_time` (or `vehicle_end_time` if this is the last + * transition) - this transition's `start_time`; + * * if `ShipmentRoute.has_traffic_infeasibilities` is false, the following + * additionally holds: `total_duration = travel_duration + delay_duration + * + break_duration + wait_duration`. + * + * Generated from protobuf field .google.protobuf.Duration total_duration = 7; + */ + protected $total_duration = null; + /** + * Start time of this transition. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 8; + */ + protected $start_time = null; + /** + * The encoded polyline representation of the route followed during the + * transition. + * This field is only populated if [populate_transition_polylines] + * [google.cloud.optimization.v1.OptimizeToursRequest.populate_transition_polylines] + * is set to true. + * + * Generated from protobuf field .google.cloud.optimization.v1.ShipmentRoute.EncodedPolyline route_polyline = 9; + */ + protected $route_polyline = null; + /** + * Vehicle loads during this transition, for each type that either appears + * in this vehicle's + * [Vehicle.load_limits][google.cloud.optimization.v1.Vehicle.load_limits], + * or that have non-zero + * [Shipment.load_demands][google.cloud.optimization.v1.Shipment.load_demands] + * on some shipment performed on this route. + * The loads during the first transition are the starting loads of the + * vehicle route. Then, after each visit, the visit's `load_demands` are + * either added or subtracted to get the next transition's loads, depending + * on whether the visit was a pickup or a delivery. + * + * Generated from protobuf field map vehicle_loads = 11; + */ + private $vehicle_loads; + /** + * Deprecated: Use + * [Transition.vehicle_loads][google.cloud.optimization.v1.ShipmentRoute.Transition.vehicle_loads] + * instead. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.CapacityQuantity loads = 10 [deprecated = true]; + * @deprecated + */ + private $loads; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Duration $travel_duration + * Travel duration during this transition. + * @type float $travel_distance_meters + * Distance traveled during the transition. + * @type bool $traffic_info_unavailable + * When traffic is requested via + * [OptimizeToursRequest.consider_road_traffic] + * [google.cloud.optimization.v1.OptimizeToursRequest.consider_road_traffic], + * and the traffic info couldn't be retrieved for a `Transition`, this + * boolean is set to true. This may be temporary (rare hiccup in the + * realtime traffic servers) or permanent (no data for this location). + * @type \Google\Protobuf\Duration $delay_duration + * Sum of the delay durations applied to this transition. If any, the delay + * starts exactly `delay_duration` seconds before the next event (visit or + * vehicle end). See + * [TransitionAttributes.delay][google.cloud.optimization.v1.TransitionAttributes.delay]. + * @type \Google\Protobuf\Duration $break_duration + * Sum of the duration of the breaks occurring during this transition, if + * any. Details about each break's start time and duration are stored in + * [ShipmentRoute.breaks][google.cloud.optimization.v1.ShipmentRoute.breaks]. + * @type \Google\Protobuf\Duration $wait_duration + * Time spent waiting during this transition. Wait duration corresponds to + * idle time and does not include break time. Also note that this wait time + * may be split into several non-contiguous intervals. + * @type \Google\Protobuf\Duration $total_duration + * Total duration of the transition, provided for convenience. It is equal + * to: + * * next visit `start_time` (or `vehicle_end_time` if this is the last + * transition) - this transition's `start_time`; + * * if `ShipmentRoute.has_traffic_infeasibilities` is false, the following + * additionally holds: `total_duration = travel_duration + delay_duration + * + break_duration + wait_duration`. + * @type \Google\Protobuf\Timestamp $start_time + * Start time of this transition. + * @type \Google\Cloud\Optimization\V1\ShipmentRoute\EncodedPolyline $route_polyline + * The encoded polyline representation of the route followed during the + * transition. + * This field is only populated if [populate_transition_polylines] + * [google.cloud.optimization.v1.OptimizeToursRequest.populate_transition_polylines] + * is set to true. + * @type array|\Google\Protobuf\Internal\MapField $vehicle_loads + * Vehicle loads during this transition, for each type that either appears + * in this vehicle's + * [Vehicle.load_limits][google.cloud.optimization.v1.Vehicle.load_limits], + * or that have non-zero + * [Shipment.load_demands][google.cloud.optimization.v1.Shipment.load_demands] + * on some shipment performed on this route. + * The loads during the first transition are the starting loads of the + * vehicle route. Then, after each visit, the visit's `load_demands` are + * either added or subtracted to get the next transition's loads, depending + * on whether the visit was a pickup or a delivery. + * @type array<\Google\Cloud\Optimization\V1\CapacityQuantity>|\Google\Protobuf\Internal\RepeatedField $loads + * Deprecated: Use + * [Transition.vehicle_loads][google.cloud.optimization.v1.ShipmentRoute.Transition.vehicle_loads] + * instead. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * Travel duration during this transition. + * + * Generated from protobuf field .google.protobuf.Duration travel_duration = 1; + * @return \Google\Protobuf\Duration|null + */ + public function getTravelDuration() + { + return $this->travel_duration; + } + + public function hasTravelDuration() + { + return isset($this->travel_duration); + } + + public function clearTravelDuration() + { + unset($this->travel_duration); + } + + /** + * Travel duration during this transition. + * + * Generated from protobuf field .google.protobuf.Duration travel_duration = 1; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setTravelDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->travel_duration = $var; + + return $this; + } + + /** + * Distance traveled during the transition. + * + * Generated from protobuf field double travel_distance_meters = 2; + * @return float + */ + public function getTravelDistanceMeters() + { + return $this->travel_distance_meters; + } + + /** + * Distance traveled during the transition. + * + * Generated from protobuf field double travel_distance_meters = 2; + * @param float $var + * @return $this + */ + public function setTravelDistanceMeters($var) + { + GPBUtil::checkDouble($var); + $this->travel_distance_meters = $var; + + return $this; + } + + /** + * When traffic is requested via + * [OptimizeToursRequest.consider_road_traffic] + * [google.cloud.optimization.v1.OptimizeToursRequest.consider_road_traffic], + * and the traffic info couldn't be retrieved for a `Transition`, this + * boolean is set to true. This may be temporary (rare hiccup in the + * realtime traffic servers) or permanent (no data for this location). + * + * Generated from protobuf field bool traffic_info_unavailable = 3; + * @return bool + */ + public function getTrafficInfoUnavailable() + { + return $this->traffic_info_unavailable; + } + + /** + * When traffic is requested via + * [OptimizeToursRequest.consider_road_traffic] + * [google.cloud.optimization.v1.OptimizeToursRequest.consider_road_traffic], + * and the traffic info couldn't be retrieved for a `Transition`, this + * boolean is set to true. This may be temporary (rare hiccup in the + * realtime traffic servers) or permanent (no data for this location). + * + * Generated from protobuf field bool traffic_info_unavailable = 3; + * @param bool $var + * @return $this + */ + public function setTrafficInfoUnavailable($var) + { + GPBUtil::checkBool($var); + $this->traffic_info_unavailable = $var; + + return $this; + } + + /** + * Sum of the delay durations applied to this transition. If any, the delay + * starts exactly `delay_duration` seconds before the next event (visit or + * vehicle end). See + * [TransitionAttributes.delay][google.cloud.optimization.v1.TransitionAttributes.delay]. + * + * Generated from protobuf field .google.protobuf.Duration delay_duration = 4; + * @return \Google\Protobuf\Duration|null + */ + public function getDelayDuration() + { + return $this->delay_duration; + } + + public function hasDelayDuration() + { + return isset($this->delay_duration); + } + + public function clearDelayDuration() + { + unset($this->delay_duration); + } + + /** + * Sum of the delay durations applied to this transition. If any, the delay + * starts exactly `delay_duration` seconds before the next event (visit or + * vehicle end). See + * [TransitionAttributes.delay][google.cloud.optimization.v1.TransitionAttributes.delay]. + * + * Generated from protobuf field .google.protobuf.Duration delay_duration = 4; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setDelayDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->delay_duration = $var; + + return $this; + } + + /** + * Sum of the duration of the breaks occurring during this transition, if + * any. Details about each break's start time and duration are stored in + * [ShipmentRoute.breaks][google.cloud.optimization.v1.ShipmentRoute.breaks]. + * + * Generated from protobuf field .google.protobuf.Duration break_duration = 5; + * @return \Google\Protobuf\Duration|null + */ + public function getBreakDuration() + { + return $this->break_duration; + } + + public function hasBreakDuration() + { + return isset($this->break_duration); + } + + public function clearBreakDuration() + { + unset($this->break_duration); + } + + /** + * Sum of the duration of the breaks occurring during this transition, if + * any. Details about each break's start time and duration are stored in + * [ShipmentRoute.breaks][google.cloud.optimization.v1.ShipmentRoute.breaks]. + * + * Generated from protobuf field .google.protobuf.Duration break_duration = 5; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setBreakDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->break_duration = $var; + + return $this; + } + + /** + * Time spent waiting during this transition. Wait duration corresponds to + * idle time and does not include break time. Also note that this wait time + * may be split into several non-contiguous intervals. + * + * Generated from protobuf field .google.protobuf.Duration wait_duration = 6; + * @return \Google\Protobuf\Duration|null + */ + public function getWaitDuration() + { + return $this->wait_duration; + } + + public function hasWaitDuration() + { + return isset($this->wait_duration); + } + + public function clearWaitDuration() + { + unset($this->wait_duration); + } + + /** + * Time spent waiting during this transition. Wait duration corresponds to + * idle time and does not include break time. Also note that this wait time + * may be split into several non-contiguous intervals. + * + * Generated from protobuf field .google.protobuf.Duration wait_duration = 6; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setWaitDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->wait_duration = $var; + + return $this; + } + + /** + * Total duration of the transition, provided for convenience. It is equal + * to: + * * next visit `start_time` (or `vehicle_end_time` if this is the last + * transition) - this transition's `start_time`; + * * if `ShipmentRoute.has_traffic_infeasibilities` is false, the following + * additionally holds: `total_duration = travel_duration + delay_duration + * + break_duration + wait_duration`. + * + * Generated from protobuf field .google.protobuf.Duration total_duration = 7; + * @return \Google\Protobuf\Duration|null + */ + public function getTotalDuration() + { + return $this->total_duration; + } + + public function hasTotalDuration() + { + return isset($this->total_duration); + } + + public function clearTotalDuration() + { + unset($this->total_duration); + } + + /** + * Total duration of the transition, provided for convenience. It is equal + * to: + * * next visit `start_time` (or `vehicle_end_time` if this is the last + * transition) - this transition's `start_time`; + * * if `ShipmentRoute.has_traffic_infeasibilities` is false, the following + * additionally holds: `total_duration = travel_duration + delay_duration + * + break_duration + wait_duration`. + * + * Generated from protobuf field .google.protobuf.Duration total_duration = 7; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setTotalDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->total_duration = $var; + + return $this; + } + + /** + * Start time of this transition. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 8; + * @return \Google\Protobuf\Timestamp|null + */ + public function getStartTime() + { + return $this->start_time; + } + + public function hasStartTime() + { + return isset($this->start_time); + } + + public function clearStartTime() + { + unset($this->start_time); + } + + /** + * Start time of this transition. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 8; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setStartTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->start_time = $var; + + return $this; + } + + /** + * The encoded polyline representation of the route followed during the + * transition. + * This field is only populated if [populate_transition_polylines] + * [google.cloud.optimization.v1.OptimizeToursRequest.populate_transition_polylines] + * is set to true. + * + * Generated from protobuf field .google.cloud.optimization.v1.ShipmentRoute.EncodedPolyline route_polyline = 9; + * @return \Google\Cloud\Optimization\V1\ShipmentRoute\EncodedPolyline|null + */ + public function getRoutePolyline() + { + return $this->route_polyline; + } + + public function hasRoutePolyline() + { + return isset($this->route_polyline); + } + + public function clearRoutePolyline() + { + unset($this->route_polyline); + } + + /** + * The encoded polyline representation of the route followed during the + * transition. + * This field is only populated if [populate_transition_polylines] + * [google.cloud.optimization.v1.OptimizeToursRequest.populate_transition_polylines] + * is set to true. + * + * Generated from protobuf field .google.cloud.optimization.v1.ShipmentRoute.EncodedPolyline route_polyline = 9; + * @param \Google\Cloud\Optimization\V1\ShipmentRoute\EncodedPolyline $var + * @return $this + */ + public function setRoutePolyline($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Optimization\V1\ShipmentRoute\EncodedPolyline::class); + $this->route_polyline = $var; + + return $this; + } + + /** + * Vehicle loads during this transition, for each type that either appears + * in this vehicle's + * [Vehicle.load_limits][google.cloud.optimization.v1.Vehicle.load_limits], + * or that have non-zero + * [Shipment.load_demands][google.cloud.optimization.v1.Shipment.load_demands] + * on some shipment performed on this route. + * The loads during the first transition are the starting loads of the + * vehicle route. Then, after each visit, the visit's `load_demands` are + * either added or subtracted to get the next transition's loads, depending + * on whether the visit was a pickup or a delivery. + * + * Generated from protobuf field map vehicle_loads = 11; + * @return \Google\Protobuf\Internal\MapField + */ + public function getVehicleLoads() + { + return $this->vehicle_loads; + } + + /** + * Vehicle loads during this transition, for each type that either appears + * in this vehicle's + * [Vehicle.load_limits][google.cloud.optimization.v1.Vehicle.load_limits], + * or that have non-zero + * [Shipment.load_demands][google.cloud.optimization.v1.Shipment.load_demands] + * on some shipment performed on this route. + * The loads during the first transition are the starting loads of the + * vehicle route. Then, after each visit, the visit's `load_demands` are + * either added or subtracted to get the next transition's loads, depending + * on whether the visit was a pickup or a delivery. + * + * Generated from protobuf field map vehicle_loads = 11; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setVehicleLoads($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\ShipmentRoute\VehicleLoad::class); + $this->vehicle_loads = $arr; + + return $this; + } + + /** + * Deprecated: Use + * [Transition.vehicle_loads][google.cloud.optimization.v1.ShipmentRoute.Transition.vehicle_loads] + * instead. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.CapacityQuantity loads = 10 [deprecated = true]; + * @return \Google\Protobuf\Internal\RepeatedField + * @deprecated + */ + public function getLoads() + { + @trigger_error('loads is deprecated.', E_USER_DEPRECATED); + return $this->loads; + } + + /** + * Deprecated: Use + * [Transition.vehicle_loads][google.cloud.optimization.v1.ShipmentRoute.Transition.vehicle_loads] + * instead. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.CapacityQuantity loads = 10 [deprecated = true]; + * @param array<\Google\Cloud\Optimization\V1\CapacityQuantity>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + * @deprecated + */ + public function setLoads($var) + { + @trigger_error('loads is deprecated.', E_USER_DEPRECATED); + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\CapacityQuantity::class); + $this->loads = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Transition::class, \Google\Cloud\Optimization\V1\ShipmentRoute_Transition::class); + diff --git a/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/ShipmentRoute/TravelStep.php b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/ShipmentRoute/TravelStep.php new file mode 100644 index 000000000000..bc4f2c0e5bad --- /dev/null +++ b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/ShipmentRoute/TravelStep.php @@ -0,0 +1,235 @@ +google.cloud.optimization.v1.ShipmentRoute.TravelStep + */ +class TravelStep extends \Google\Protobuf\Internal\Message +{ + /** + * Duration of the travel step. + * + * Generated from protobuf field .google.protobuf.Duration duration = 1; + */ + protected $duration = null; + /** + * Distance traveled during the step. + * + * Generated from protobuf field double distance_meters = 2; + */ + protected $distance_meters = 0.0; + /** + * When traffic is requested via + * [OptimizeToursRequest.consider_road_traffic][google.cloud.optimization.v1.OptimizeToursRequest.consider_road_traffic], + * and the traffic info couldn't be retrieved for a TravelStep, this boolean + * is set to true. This may be temporary (rare hiccup in the realtime + * traffic servers) or permanent (no data for this location). + * + * Generated from protobuf field bool traffic_info_unavailable = 3; + */ + protected $traffic_info_unavailable = false; + /** + * The encoded polyline representation of the route followed during the + * step. + * This field is only populated if + * [OptimizeToursRequest.populate_travel_step_polylines][google.cloud.optimization.v1.OptimizeToursRequest.populate_travel_step_polylines] + * is set to true. + * + * Generated from protobuf field .google.cloud.optimization.v1.ShipmentRoute.EncodedPolyline route_polyline = 4; + */ + protected $route_polyline = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Duration $duration + * Duration of the travel step. + * @type float $distance_meters + * Distance traveled during the step. + * @type bool $traffic_info_unavailable + * When traffic is requested via + * [OptimizeToursRequest.consider_road_traffic][google.cloud.optimization.v1.OptimizeToursRequest.consider_road_traffic], + * and the traffic info couldn't be retrieved for a TravelStep, this boolean + * is set to true. This may be temporary (rare hiccup in the realtime + * traffic servers) or permanent (no data for this location). + * @type \Google\Cloud\Optimization\V1\ShipmentRoute\EncodedPolyline $route_polyline + * The encoded polyline representation of the route followed during the + * step. + * This field is only populated if + * [OptimizeToursRequest.populate_travel_step_polylines][google.cloud.optimization.v1.OptimizeToursRequest.populate_travel_step_polylines] + * is set to true. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * Duration of the travel step. + * + * Generated from protobuf field .google.protobuf.Duration duration = 1; + * @return \Google\Protobuf\Duration|null + */ + public function getDuration() + { + return $this->duration; + } + + public function hasDuration() + { + return isset($this->duration); + } + + public function clearDuration() + { + unset($this->duration); + } + + /** + * Duration of the travel step. + * + * Generated from protobuf field .google.protobuf.Duration duration = 1; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->duration = $var; + + return $this; + } + + /** + * Distance traveled during the step. + * + * Generated from protobuf field double distance_meters = 2; + * @return float + */ + public function getDistanceMeters() + { + return $this->distance_meters; + } + + /** + * Distance traveled during the step. + * + * Generated from protobuf field double distance_meters = 2; + * @param float $var + * @return $this + */ + public function setDistanceMeters($var) + { + GPBUtil::checkDouble($var); + $this->distance_meters = $var; + + return $this; + } + + /** + * When traffic is requested via + * [OptimizeToursRequest.consider_road_traffic][google.cloud.optimization.v1.OptimizeToursRequest.consider_road_traffic], + * and the traffic info couldn't be retrieved for a TravelStep, this boolean + * is set to true. This may be temporary (rare hiccup in the realtime + * traffic servers) or permanent (no data for this location). + * + * Generated from protobuf field bool traffic_info_unavailable = 3; + * @return bool + */ + public function getTrafficInfoUnavailable() + { + return $this->traffic_info_unavailable; + } + + /** + * When traffic is requested via + * [OptimizeToursRequest.consider_road_traffic][google.cloud.optimization.v1.OptimizeToursRequest.consider_road_traffic], + * and the traffic info couldn't be retrieved for a TravelStep, this boolean + * is set to true. This may be temporary (rare hiccup in the realtime + * traffic servers) or permanent (no data for this location). + * + * Generated from protobuf field bool traffic_info_unavailable = 3; + * @param bool $var + * @return $this + */ + public function setTrafficInfoUnavailable($var) + { + GPBUtil::checkBool($var); + $this->traffic_info_unavailable = $var; + + return $this; + } + + /** + * The encoded polyline representation of the route followed during the + * step. + * This field is only populated if + * [OptimizeToursRequest.populate_travel_step_polylines][google.cloud.optimization.v1.OptimizeToursRequest.populate_travel_step_polylines] + * is set to true. + * + * Generated from protobuf field .google.cloud.optimization.v1.ShipmentRoute.EncodedPolyline route_polyline = 4; + * @return \Google\Cloud\Optimization\V1\ShipmentRoute\EncodedPolyline|null + */ + public function getRoutePolyline() + { + return $this->route_polyline; + } + + public function hasRoutePolyline() + { + return isset($this->route_polyline); + } + + public function clearRoutePolyline() + { + unset($this->route_polyline); + } + + /** + * The encoded polyline representation of the route followed during the + * step. + * This field is only populated if + * [OptimizeToursRequest.populate_travel_step_polylines][google.cloud.optimization.v1.OptimizeToursRequest.populate_travel_step_polylines] + * is set to true. + * + * Generated from protobuf field .google.cloud.optimization.v1.ShipmentRoute.EncodedPolyline route_polyline = 4; + * @param \Google\Cloud\Optimization\V1\ShipmentRoute\EncodedPolyline $var + * @return $this + */ + public function setRoutePolyline($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Optimization\V1\ShipmentRoute\EncodedPolyline::class); + $this->route_polyline = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(TravelStep::class, \Google\Cloud\Optimization\V1\ShipmentRoute_TravelStep::class); + diff --git a/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/ShipmentRoute/VehicleLoad.php b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/ShipmentRoute/VehicleLoad.php new file mode 100644 index 000000000000..022084ba07c1 --- /dev/null +++ b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/ShipmentRoute/VehicleLoad.php @@ -0,0 +1,80 @@ +google.cloud.optimization.v1.ShipmentRoute.VehicleLoad + */ +class VehicleLoad extends \Google\Protobuf\Internal\Message +{ + /** + * The amount of load on the vehicle, for the given type. The unit of load + * is usually indicated by the type. See + * [Transition.vehicle_loads][google.cloud.optimization.v1.ShipmentRoute.Transition.vehicle_loads]. + * + * Generated from protobuf field int64 amount = 1; + */ + protected $amount = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int|string $amount + * The amount of load on the vehicle, for the given type. The unit of load + * is usually indicated by the type. See + * [Transition.vehicle_loads][google.cloud.optimization.v1.ShipmentRoute.Transition.vehicle_loads]. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * The amount of load on the vehicle, for the given type. The unit of load + * is usually indicated by the type. See + * [Transition.vehicle_loads][google.cloud.optimization.v1.ShipmentRoute.Transition.vehicle_loads]. + * + * Generated from protobuf field int64 amount = 1; + * @return int|string + */ + public function getAmount() + { + return $this->amount; + } + + /** + * The amount of load on the vehicle, for the given type. The unit of load + * is usually indicated by the type. See + * [Transition.vehicle_loads][google.cloud.optimization.v1.ShipmentRoute.Transition.vehicle_loads]. + * + * Generated from protobuf field int64 amount = 1; + * @param int|string $var + * @return $this + */ + public function setAmount($var) + { + GPBUtil::checkInt64($var); + $this->amount = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(VehicleLoad::class, \Google\Cloud\Optimization\V1\ShipmentRoute_VehicleLoad::class); + diff --git a/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/ShipmentRoute/Visit.php b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/ShipmentRoute/Visit.php new file mode 100644 index 000000000000..fbca6c632c18 --- /dev/null +++ b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/ShipmentRoute/Visit.php @@ -0,0 +1,606 @@ +google.cloud.optimization.v1.ShipmentRoute.Visit + */ +class Visit extends \Google\Protobuf\Internal\Message +{ + /** + * Index of the `shipments` field in the source + * [ShipmentModel][google.cloud.optimization.v1.ShipmentModel]. + * + * Generated from protobuf field int32 shipment_index = 1; + */ + protected $shipment_index = 0; + /** + * If true the visit corresponds to a pickup of a `Shipment`. Otherwise, it + * corresponds to a delivery. + * + * Generated from protobuf field bool is_pickup = 2; + */ + protected $is_pickup = false; + /** + * Index of `VisitRequest` in either the pickup or delivery field of the + * `Shipment` (see `is_pickup`). + * + * Generated from protobuf field int32 visit_request_index = 3; + */ + protected $visit_request_index = 0; + /** + * Time at which the visit starts. Note that the vehicle may arrive earlier + * than this at the visit location. Times are consistent with the + * `ShipmentModel`. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 4; + */ + protected $start_time = null; + /** + * Total visit load demand as the sum of the shipment and the visit request + * `load_demands`. The values are negative if the visit is a delivery. + * Demands are reported for the same types as the + * [Transition.loads][google.cloud.optimization.v1.ShipmentRoute.Transition] + * (see this field). + * + * Generated from protobuf field map load_demands = 11; + */ + private $load_demands; + /** + * Extra detour time due to the shipments visited on the route before the + * visit and to the potential waiting time induced by time windows. + * If the visit is a delivery, the detour is computed from the corresponding + * pickup visit and is equal to: + * ``` + * start_time(delivery) - start_time(pickup) + * - (duration(pickup) + travel duration from the pickup location + * to the delivery location). + * ``` + * Otherwise, it is computed from the vehicle `start_location` and is equal + * to: + * ``` + * start_time - vehicle_start_time - travel duration from + * the vehicle's `start_location` to the visit. + * ``` + * + * Generated from protobuf field .google.protobuf.Duration detour = 6; + */ + protected $detour = null; + /** + * Copy of the corresponding `Shipment.label`, if specified in the + * `Shipment`. + * + * Generated from protobuf field string shipment_label = 7; + */ + protected $shipment_label = ''; + /** + * Copy of the corresponding + * [VisitRequest.label][google.cloud.optimization.v1.Shipment.VisitRequest.label], + * if specified in the `VisitRequest`. + * + * Generated from protobuf field string visit_label = 8; + */ + protected $visit_label = ''; + /** + * Deprecated: Use + * [Transition.vehicle_loads][google.cloud.optimization.v1.ShipmentRoute.Transition.vehicle_loads] + * instead. Vehicle loads upon arrival at the visit location, for each type + * specified in + * [Vehicle.capacities][google.cloud.optimization.v1.Vehicle.capacities], + * `start_load_intervals`, `end_load_intervals` or `demands`. + * Exception: we omit loads for quantity types unconstrained by intervals + * and that don't have any non-zero demand on the route. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.CapacityQuantity arrival_loads = 9 [deprecated = true]; + * @deprecated + */ + private $arrival_loads; + /** + * Deprecated: Use + * [ShipmentRoute.Transition.delay_duration][google.cloud.optimization.v1.ShipmentRoute.Transition.delay_duration] + * instead. Delay occurring before the visit starts. + * + * Generated from protobuf field .google.cloud.optimization.v1.ShipmentRoute.Delay delay_before_start = 10 [deprecated = true]; + * @deprecated + */ + protected $delay_before_start = null; + /** + * Deprecated: Use + * [Visit.load_demands][google.cloud.optimization.v1.ShipmentRoute.Visit.load_demands] + * instead. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.CapacityQuantity demands = 5 [deprecated = true]; + * @deprecated + */ + private $demands; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $shipment_index + * Index of the `shipments` field in the source + * [ShipmentModel][google.cloud.optimization.v1.ShipmentModel]. + * @type bool $is_pickup + * If true the visit corresponds to a pickup of a `Shipment`. Otherwise, it + * corresponds to a delivery. + * @type int $visit_request_index + * Index of `VisitRequest` in either the pickup or delivery field of the + * `Shipment` (see `is_pickup`). + * @type \Google\Protobuf\Timestamp $start_time + * Time at which the visit starts. Note that the vehicle may arrive earlier + * than this at the visit location. Times are consistent with the + * `ShipmentModel`. + * @type array|\Google\Protobuf\Internal\MapField $load_demands + * Total visit load demand as the sum of the shipment and the visit request + * `load_demands`. The values are negative if the visit is a delivery. + * Demands are reported for the same types as the + * [Transition.loads][google.cloud.optimization.v1.ShipmentRoute.Transition] + * (see this field). + * @type \Google\Protobuf\Duration $detour + * Extra detour time due to the shipments visited on the route before the + * visit and to the potential waiting time induced by time windows. + * If the visit is a delivery, the detour is computed from the corresponding + * pickup visit and is equal to: + * ``` + * start_time(delivery) - start_time(pickup) + * - (duration(pickup) + travel duration from the pickup location + * to the delivery location). + * ``` + * Otherwise, it is computed from the vehicle `start_location` and is equal + * to: + * ``` + * start_time - vehicle_start_time - travel duration from + * the vehicle's `start_location` to the visit. + * ``` + * @type string $shipment_label + * Copy of the corresponding `Shipment.label`, if specified in the + * `Shipment`. + * @type string $visit_label + * Copy of the corresponding + * [VisitRequest.label][google.cloud.optimization.v1.Shipment.VisitRequest.label], + * if specified in the `VisitRequest`. + * @type array<\Google\Cloud\Optimization\V1\CapacityQuantity>|\Google\Protobuf\Internal\RepeatedField $arrival_loads + * Deprecated: Use + * [Transition.vehicle_loads][google.cloud.optimization.v1.ShipmentRoute.Transition.vehicle_loads] + * instead. Vehicle loads upon arrival at the visit location, for each type + * specified in + * [Vehicle.capacities][google.cloud.optimization.v1.Vehicle.capacities], + * `start_load_intervals`, `end_load_intervals` or `demands`. + * Exception: we omit loads for quantity types unconstrained by intervals + * and that don't have any non-zero demand on the route. + * @type \Google\Cloud\Optimization\V1\ShipmentRoute\Delay $delay_before_start + * Deprecated: Use + * [ShipmentRoute.Transition.delay_duration][google.cloud.optimization.v1.ShipmentRoute.Transition.delay_duration] + * instead. Delay occurring before the visit starts. + * @type array<\Google\Cloud\Optimization\V1\CapacityQuantity>|\Google\Protobuf\Internal\RepeatedField $demands + * Deprecated: Use + * [Visit.load_demands][google.cloud.optimization.v1.ShipmentRoute.Visit.load_demands] + * instead. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * Index of the `shipments` field in the source + * [ShipmentModel][google.cloud.optimization.v1.ShipmentModel]. + * + * Generated from protobuf field int32 shipment_index = 1; + * @return int + */ + public function getShipmentIndex() + { + return $this->shipment_index; + } + + /** + * Index of the `shipments` field in the source + * [ShipmentModel][google.cloud.optimization.v1.ShipmentModel]. + * + * Generated from protobuf field int32 shipment_index = 1; + * @param int $var + * @return $this + */ + public function setShipmentIndex($var) + { + GPBUtil::checkInt32($var); + $this->shipment_index = $var; + + return $this; + } + + /** + * If true the visit corresponds to a pickup of a `Shipment`. Otherwise, it + * corresponds to a delivery. + * + * Generated from protobuf field bool is_pickup = 2; + * @return bool + */ + public function getIsPickup() + { + return $this->is_pickup; + } + + /** + * If true the visit corresponds to a pickup of a `Shipment`. Otherwise, it + * corresponds to a delivery. + * + * Generated from protobuf field bool is_pickup = 2; + * @param bool $var + * @return $this + */ + public function setIsPickup($var) + { + GPBUtil::checkBool($var); + $this->is_pickup = $var; + + return $this; + } + + /** + * Index of `VisitRequest` in either the pickup or delivery field of the + * `Shipment` (see `is_pickup`). + * + * Generated from protobuf field int32 visit_request_index = 3; + * @return int + */ + public function getVisitRequestIndex() + { + return $this->visit_request_index; + } + + /** + * Index of `VisitRequest` in either the pickup or delivery field of the + * `Shipment` (see `is_pickup`). + * + * Generated from protobuf field int32 visit_request_index = 3; + * @param int $var + * @return $this + */ + public function setVisitRequestIndex($var) + { + GPBUtil::checkInt32($var); + $this->visit_request_index = $var; + + return $this; + } + + /** + * Time at which the visit starts. Note that the vehicle may arrive earlier + * than this at the visit location. Times are consistent with the + * `ShipmentModel`. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 4; + * @return \Google\Protobuf\Timestamp|null + */ + public function getStartTime() + { + return $this->start_time; + } + + public function hasStartTime() + { + return isset($this->start_time); + } + + public function clearStartTime() + { + unset($this->start_time); + } + + /** + * Time at which the visit starts. Note that the vehicle may arrive earlier + * than this at the visit location. Times are consistent with the + * `ShipmentModel`. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 4; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setStartTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->start_time = $var; + + return $this; + } + + /** + * Total visit load demand as the sum of the shipment and the visit request + * `load_demands`. The values are negative if the visit is a delivery. + * Demands are reported for the same types as the + * [Transition.loads][google.cloud.optimization.v1.ShipmentRoute.Transition] + * (see this field). + * + * Generated from protobuf field map load_demands = 11; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLoadDemands() + { + return $this->load_demands; + } + + /** + * Total visit load demand as the sum of the shipment and the visit request + * `load_demands`. The values are negative if the visit is a delivery. + * Demands are reported for the same types as the + * [Transition.loads][google.cloud.optimization.v1.ShipmentRoute.Transition] + * (see this field). + * + * Generated from protobuf field map load_demands = 11; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLoadDemands($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\Shipment\Load::class); + $this->load_demands = $arr; + + return $this; + } + + /** + * Extra detour time due to the shipments visited on the route before the + * visit and to the potential waiting time induced by time windows. + * If the visit is a delivery, the detour is computed from the corresponding + * pickup visit and is equal to: + * ``` + * start_time(delivery) - start_time(pickup) + * - (duration(pickup) + travel duration from the pickup location + * to the delivery location). + * ``` + * Otherwise, it is computed from the vehicle `start_location` and is equal + * to: + * ``` + * start_time - vehicle_start_time - travel duration from + * the vehicle's `start_location` to the visit. + * ``` + * + * Generated from protobuf field .google.protobuf.Duration detour = 6; + * @return \Google\Protobuf\Duration|null + */ + public function getDetour() + { + return $this->detour; + } + + public function hasDetour() + { + return isset($this->detour); + } + + public function clearDetour() + { + unset($this->detour); + } + + /** + * Extra detour time due to the shipments visited on the route before the + * visit and to the potential waiting time induced by time windows. + * If the visit is a delivery, the detour is computed from the corresponding + * pickup visit and is equal to: + * ``` + * start_time(delivery) - start_time(pickup) + * - (duration(pickup) + travel duration from the pickup location + * to the delivery location). + * ``` + * Otherwise, it is computed from the vehicle `start_location` and is equal + * to: + * ``` + * start_time - vehicle_start_time - travel duration from + * the vehicle's `start_location` to the visit. + * ``` + * + * Generated from protobuf field .google.protobuf.Duration detour = 6; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setDetour($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->detour = $var; + + return $this; + } + + /** + * Copy of the corresponding `Shipment.label`, if specified in the + * `Shipment`. + * + * Generated from protobuf field string shipment_label = 7; + * @return string + */ + public function getShipmentLabel() + { + return $this->shipment_label; + } + + /** + * Copy of the corresponding `Shipment.label`, if specified in the + * `Shipment`. + * + * Generated from protobuf field string shipment_label = 7; + * @param string $var + * @return $this + */ + public function setShipmentLabel($var) + { + GPBUtil::checkString($var, True); + $this->shipment_label = $var; + + return $this; + } + + /** + * Copy of the corresponding + * [VisitRequest.label][google.cloud.optimization.v1.Shipment.VisitRequest.label], + * if specified in the `VisitRequest`. + * + * Generated from protobuf field string visit_label = 8; + * @return string + */ + public function getVisitLabel() + { + return $this->visit_label; + } + + /** + * Copy of the corresponding + * [VisitRequest.label][google.cloud.optimization.v1.Shipment.VisitRequest.label], + * if specified in the `VisitRequest`. + * + * Generated from protobuf field string visit_label = 8; + * @param string $var + * @return $this + */ + public function setVisitLabel($var) + { + GPBUtil::checkString($var, True); + $this->visit_label = $var; + + return $this; + } + + /** + * Deprecated: Use + * [Transition.vehicle_loads][google.cloud.optimization.v1.ShipmentRoute.Transition.vehicle_loads] + * instead. Vehicle loads upon arrival at the visit location, for each type + * specified in + * [Vehicle.capacities][google.cloud.optimization.v1.Vehicle.capacities], + * `start_load_intervals`, `end_load_intervals` or `demands`. + * Exception: we omit loads for quantity types unconstrained by intervals + * and that don't have any non-zero demand on the route. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.CapacityQuantity arrival_loads = 9 [deprecated = true]; + * @return \Google\Protobuf\Internal\RepeatedField + * @deprecated + */ + public function getArrivalLoads() + { + @trigger_error('arrival_loads is deprecated.', E_USER_DEPRECATED); + return $this->arrival_loads; + } + + /** + * Deprecated: Use + * [Transition.vehicle_loads][google.cloud.optimization.v1.ShipmentRoute.Transition.vehicle_loads] + * instead. Vehicle loads upon arrival at the visit location, for each type + * specified in + * [Vehicle.capacities][google.cloud.optimization.v1.Vehicle.capacities], + * `start_load_intervals`, `end_load_intervals` or `demands`. + * Exception: we omit loads for quantity types unconstrained by intervals + * and that don't have any non-zero demand on the route. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.CapacityQuantity arrival_loads = 9 [deprecated = true]; + * @param array<\Google\Cloud\Optimization\V1\CapacityQuantity>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + * @deprecated + */ + public function setArrivalLoads($var) + { + @trigger_error('arrival_loads is deprecated.', E_USER_DEPRECATED); + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\CapacityQuantity::class); + $this->arrival_loads = $arr; + + return $this; + } + + /** + * Deprecated: Use + * [ShipmentRoute.Transition.delay_duration][google.cloud.optimization.v1.ShipmentRoute.Transition.delay_duration] + * instead. Delay occurring before the visit starts. + * + * Generated from protobuf field .google.cloud.optimization.v1.ShipmentRoute.Delay delay_before_start = 10 [deprecated = true]; + * @return \Google\Cloud\Optimization\V1\ShipmentRoute\Delay|null + * @deprecated + */ + public function getDelayBeforeStart() + { + @trigger_error('delay_before_start is deprecated.', E_USER_DEPRECATED); + return $this->delay_before_start; + } + + public function hasDelayBeforeStart() + { + @trigger_error('delay_before_start is deprecated.', E_USER_DEPRECATED); + return isset($this->delay_before_start); + } + + public function clearDelayBeforeStart() + { + @trigger_error('delay_before_start is deprecated.', E_USER_DEPRECATED); + unset($this->delay_before_start); + } + + /** + * Deprecated: Use + * [ShipmentRoute.Transition.delay_duration][google.cloud.optimization.v1.ShipmentRoute.Transition.delay_duration] + * instead. Delay occurring before the visit starts. + * + * Generated from protobuf field .google.cloud.optimization.v1.ShipmentRoute.Delay delay_before_start = 10 [deprecated = true]; + * @param \Google\Cloud\Optimization\V1\ShipmentRoute\Delay $var + * @return $this + * @deprecated + */ + public function setDelayBeforeStart($var) + { + @trigger_error('delay_before_start is deprecated.', E_USER_DEPRECATED); + GPBUtil::checkMessage($var, \Google\Cloud\Optimization\V1\ShipmentRoute\Delay::class); + $this->delay_before_start = $var; + + return $this; + } + + /** + * Deprecated: Use + * [Visit.load_demands][google.cloud.optimization.v1.ShipmentRoute.Visit.load_demands] + * instead. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.CapacityQuantity demands = 5 [deprecated = true]; + * @return \Google\Protobuf\Internal\RepeatedField + * @deprecated + */ + public function getDemands() + { + @trigger_error('demands is deprecated.', E_USER_DEPRECATED); + return $this->demands; + } + + /** + * Deprecated: Use + * [Visit.load_demands][google.cloud.optimization.v1.ShipmentRoute.Visit.load_demands] + * instead. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.CapacityQuantity demands = 5 [deprecated = true]; + * @param array<\Google\Cloud\Optimization\V1\CapacityQuantity>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + * @deprecated + */ + public function setDemands($var) + { + @trigger_error('demands is deprecated.', E_USER_DEPRECATED); + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\CapacityQuantity::class); + $this->demands = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Visit::class, \Google\Cloud\Optimization\V1\ShipmentRoute_Visit::class); + diff --git a/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/ShipmentRoute_Break.php b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/ShipmentRoute_Break.php new file mode 100644 index 000000000000..9157788f7aa9 --- /dev/null +++ b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/ShipmentRoute_Break.php @@ -0,0 +1,16 @@ +google.cloud.optimization.v1.ShipmentTypeIncompatibility + */ +class ShipmentTypeIncompatibility extends \Google\Protobuf\Internal\Message +{ + /** + * List of incompatible types. Two shipments having different `shipment_types` + * among those listed are "incompatible". + * + * Generated from protobuf field repeated string types = 1; + */ + private $types; + /** + * Mode applied to the incompatibility. + * + * Generated from protobuf field .google.cloud.optimization.v1.ShipmentTypeIncompatibility.IncompatibilityMode incompatibility_mode = 2; + */ + protected $incompatibility_mode = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $types + * List of incompatible types. Two shipments having different `shipment_types` + * among those listed are "incompatible". + * @type int $incompatibility_mode + * Mode applied to the incompatibility. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * List of incompatible types. Two shipments having different `shipment_types` + * among those listed are "incompatible". + * + * Generated from protobuf field repeated string types = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTypes() + { + return $this->types; + } + + /** + * List of incompatible types. Two shipments having different `shipment_types` + * among those listed are "incompatible". + * + * Generated from protobuf field repeated string types = 1; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTypes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->types = $arr; + + return $this; + } + + /** + * Mode applied to the incompatibility. + * + * Generated from protobuf field .google.cloud.optimization.v1.ShipmentTypeIncompatibility.IncompatibilityMode incompatibility_mode = 2; + * @return int + */ + public function getIncompatibilityMode() + { + return $this->incompatibility_mode; + } + + /** + * Mode applied to the incompatibility. + * + * Generated from protobuf field .google.cloud.optimization.v1.ShipmentTypeIncompatibility.IncompatibilityMode incompatibility_mode = 2; + * @param int $var + * @return $this + */ + public function setIncompatibilityMode($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Optimization\V1\ShipmentTypeIncompatibility\IncompatibilityMode::class); + $this->incompatibility_mode = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/ShipmentTypeIncompatibility/IncompatibilityMode.php b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/ShipmentTypeIncompatibility/IncompatibilityMode.php new file mode 100644 index 000000000000..127c5c8ba17e --- /dev/null +++ b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/ShipmentTypeIncompatibility/IncompatibilityMode.php @@ -0,0 +1,72 @@ +google.cloud.optimization.v1.ShipmentTypeIncompatibility.IncompatibilityMode + */ +class IncompatibilityMode +{ + /** + * Unspecified incompatibility mode. This value should never be used. + * + * Generated from protobuf enum INCOMPATIBILITY_MODE_UNSPECIFIED = 0; + */ + const INCOMPATIBILITY_MODE_UNSPECIFIED = 0; + /** + * In this mode, two shipments with incompatible types can never share the + * same vehicle. + * + * Generated from protobuf enum NOT_PERFORMED_BY_SAME_VEHICLE = 1; + */ + const NOT_PERFORMED_BY_SAME_VEHICLE = 1; + /** + * For two shipments with incompatible types with the + * `NOT_IN_SAME_VEHICLE_SIMULTANEOUSLY` incompatibility mode: + * * If both are pickups only (no deliveries) or deliveries only (no + * pickups), they cannot share the same vehicle at all. + * * If one of the shipments has a delivery and the other a pickup, the two + * shipments can share the same vehicle iff the former shipment is + * delivered before the latter is picked up. + * + * Generated from protobuf enum NOT_IN_SAME_VEHICLE_SIMULTANEOUSLY = 2; + */ + const NOT_IN_SAME_VEHICLE_SIMULTANEOUSLY = 2; + + private static $valueToName = [ + self::INCOMPATIBILITY_MODE_UNSPECIFIED => 'INCOMPATIBILITY_MODE_UNSPECIFIED', + self::NOT_PERFORMED_BY_SAME_VEHICLE => 'NOT_PERFORMED_BY_SAME_VEHICLE', + self::NOT_IN_SAME_VEHICLE_SIMULTANEOUSLY => 'NOT_IN_SAME_VEHICLE_SIMULTANEOUSLY', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(IncompatibilityMode::class, \Google\Cloud\Optimization\V1\ShipmentTypeIncompatibility_IncompatibilityMode::class); + diff --git a/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/ShipmentTypeIncompatibility_IncompatibilityMode.php b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/ShipmentTypeIncompatibility_IncompatibilityMode.php new file mode 100644 index 000000000000..c32245448148 --- /dev/null +++ b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/ShipmentTypeIncompatibility_IncompatibilityMode.php @@ -0,0 +1,16 @@ +google.cloud.optimization.v1.ShipmentTypeRequirement + */ +class ShipmentTypeRequirement extends \Google\Protobuf\Internal\Message +{ + /** + * List of alternative shipment types required by the + * `dependent_shipment_types`. + * + * Generated from protobuf field repeated string required_shipment_type_alternatives = 1; + */ + private $required_shipment_type_alternatives; + /** + * All shipments with a type in the `dependent_shipment_types` field require + * at least one shipment of type `required_shipment_type_alternatives` to be + * visited on the same route. + * NOTE: Chains of requirements such that a `shipment_type` depends on itself + * are not allowed. + * + * Generated from protobuf field repeated string dependent_shipment_types = 2; + */ + private $dependent_shipment_types; + /** + * Mode applied to the requirement. + * + * Generated from protobuf field .google.cloud.optimization.v1.ShipmentTypeRequirement.RequirementMode requirement_mode = 3; + */ + protected $requirement_mode = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $required_shipment_type_alternatives + * List of alternative shipment types required by the + * `dependent_shipment_types`. + * @type array|\Google\Protobuf\Internal\RepeatedField $dependent_shipment_types + * All shipments with a type in the `dependent_shipment_types` field require + * at least one shipment of type `required_shipment_type_alternatives` to be + * visited on the same route. + * NOTE: Chains of requirements such that a `shipment_type` depends on itself + * are not allowed. + * @type int $requirement_mode + * Mode applied to the requirement. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * List of alternative shipment types required by the + * `dependent_shipment_types`. + * + * Generated from protobuf field repeated string required_shipment_type_alternatives = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRequiredShipmentTypeAlternatives() + { + return $this->required_shipment_type_alternatives; + } + + /** + * List of alternative shipment types required by the + * `dependent_shipment_types`. + * + * Generated from protobuf field repeated string required_shipment_type_alternatives = 1; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRequiredShipmentTypeAlternatives($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->required_shipment_type_alternatives = $arr; + + return $this; + } + + /** + * All shipments with a type in the `dependent_shipment_types` field require + * at least one shipment of type `required_shipment_type_alternatives` to be + * visited on the same route. + * NOTE: Chains of requirements such that a `shipment_type` depends on itself + * are not allowed. + * + * Generated from protobuf field repeated string dependent_shipment_types = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDependentShipmentTypes() + { + return $this->dependent_shipment_types; + } + + /** + * All shipments with a type in the `dependent_shipment_types` field require + * at least one shipment of type `required_shipment_type_alternatives` to be + * visited on the same route. + * NOTE: Chains of requirements such that a `shipment_type` depends on itself + * are not allowed. + * + * Generated from protobuf field repeated string dependent_shipment_types = 2; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDependentShipmentTypes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->dependent_shipment_types = $arr; + + return $this; + } + + /** + * Mode applied to the requirement. + * + * Generated from protobuf field .google.cloud.optimization.v1.ShipmentTypeRequirement.RequirementMode requirement_mode = 3; + * @return int + */ + public function getRequirementMode() + { + return $this->requirement_mode; + } + + /** + * Mode applied to the requirement. + * + * Generated from protobuf field .google.cloud.optimization.v1.ShipmentTypeRequirement.RequirementMode requirement_mode = 3; + * @param int $var + * @return $this + */ + public function setRequirementMode($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Optimization\V1\ShipmentTypeRequirement\RequirementMode::class); + $this->requirement_mode = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/ShipmentTypeRequirement/RequirementMode.php b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/ShipmentTypeRequirement/RequirementMode.php new file mode 100644 index 000000000000..8c6df3589e36 --- /dev/null +++ b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/ShipmentTypeRequirement/RequirementMode.php @@ -0,0 +1,80 @@ +google.cloud.optimization.v1.ShipmentTypeRequirement.RequirementMode + */ +class RequirementMode +{ + /** + * Unspecified requirement mode. This value should never be used. + * + * Generated from protobuf enum REQUIREMENT_MODE_UNSPECIFIED = 0; + */ + const REQUIREMENT_MODE_UNSPECIFIED = 0; + /** + * In this mode, all "dependent" shipments must share the same vehicle as at + * least one of their "required" shipments. + * + * Generated from protobuf enum PERFORMED_BY_SAME_VEHICLE = 1; + */ + const PERFORMED_BY_SAME_VEHICLE = 1; + /** + * With the `IN_SAME_VEHICLE_AT_PICKUP_TIME` mode, all "dependent" + * shipments need to have at least one "required" shipment on their vehicle + * at the time of their pickup. + * A "dependent" shipment pickup must therefore have either: + * * A delivery-only "required" shipment delivered on the route after, or + * * A "required" shipment picked up on the route before it, and if the + * "required" shipment has a delivery, this delivery must be performed + * after the "dependent" shipment's pickup. + * + * Generated from protobuf enum IN_SAME_VEHICLE_AT_PICKUP_TIME = 2; + */ + const IN_SAME_VEHICLE_AT_PICKUP_TIME = 2; + /** + * Same as before, except the "dependent" shipments need to have a + * "required" shipment on their vehicle at the time of their *delivery*. + * + * Generated from protobuf enum IN_SAME_VEHICLE_AT_DELIVERY_TIME = 3; + */ + const IN_SAME_VEHICLE_AT_DELIVERY_TIME = 3; + + private static $valueToName = [ + self::REQUIREMENT_MODE_UNSPECIFIED => 'REQUIREMENT_MODE_UNSPECIFIED', + self::PERFORMED_BY_SAME_VEHICLE => 'PERFORMED_BY_SAME_VEHICLE', + self::IN_SAME_VEHICLE_AT_PICKUP_TIME => 'IN_SAME_VEHICLE_AT_PICKUP_TIME', + self::IN_SAME_VEHICLE_AT_DELIVERY_TIME => 'IN_SAME_VEHICLE_AT_DELIVERY_TIME', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(RequirementMode::class, \Google\Cloud\Optimization\V1\ShipmentTypeRequirement_RequirementMode::class); + diff --git a/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/ShipmentTypeRequirement_RequirementMode.php b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/ShipmentTypeRequirement_RequirementMode.php new file mode 100644 index 000000000000..5f2f68745511 --- /dev/null +++ b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/ShipmentTypeRequirement_RequirementMode.php @@ -0,0 +1,16 @@ +google.cloud.optimization.v1.SkippedShipment + */ +class SkippedShipment extends \Google\Protobuf\Internal\Message +{ + /** + * The index corresponds to the index of the shipment in the source + * `ShipmentModel`. + * + * Generated from protobuf field int32 index = 1; + */ + protected $index = 0; + /** + * Copy of the corresponding + * [Shipment.label][google.cloud.optimization.v1.Shipment.label], if specified + * in the `Shipment`. + * + * Generated from protobuf field string label = 2; + */ + protected $label = ''; + /** + * A list of reasons that explain why the shipment was skipped. See comment + * above `Reason`. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.SkippedShipment.Reason reasons = 3; + */ + private $reasons; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $index + * The index corresponds to the index of the shipment in the source + * `ShipmentModel`. + * @type string $label + * Copy of the corresponding + * [Shipment.label][google.cloud.optimization.v1.Shipment.label], if specified + * in the `Shipment`. + * @type array<\Google\Cloud\Optimization\V1\SkippedShipment\Reason>|\Google\Protobuf\Internal\RepeatedField $reasons + * A list of reasons that explain why the shipment was skipped. See comment + * above `Reason`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * The index corresponds to the index of the shipment in the source + * `ShipmentModel`. + * + * Generated from protobuf field int32 index = 1; + * @return int + */ + public function getIndex() + { + return $this->index; + } + + /** + * The index corresponds to the index of the shipment in the source + * `ShipmentModel`. + * + * Generated from protobuf field int32 index = 1; + * @param int $var + * @return $this + */ + public function setIndex($var) + { + GPBUtil::checkInt32($var); + $this->index = $var; + + return $this; + } + + /** + * Copy of the corresponding + * [Shipment.label][google.cloud.optimization.v1.Shipment.label], if specified + * in the `Shipment`. + * + * Generated from protobuf field string label = 2; + * @return string + */ + public function getLabel() + { + return $this->label; + } + + /** + * Copy of the corresponding + * [Shipment.label][google.cloud.optimization.v1.Shipment.label], if specified + * in the `Shipment`. + * + * Generated from protobuf field string label = 2; + * @param string $var + * @return $this + */ + public function setLabel($var) + { + GPBUtil::checkString($var, True); + $this->label = $var; + + return $this; + } + + /** + * A list of reasons that explain why the shipment was skipped. See comment + * above `Reason`. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.SkippedShipment.Reason reasons = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getReasons() + { + return $this->reasons; + } + + /** + * A list of reasons that explain why the shipment was skipped. See comment + * above `Reason`. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.SkippedShipment.Reason reasons = 3; + * @param array<\Google\Cloud\Optimization\V1\SkippedShipment\Reason>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setReasons($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\SkippedShipment\Reason::class); + $this->reasons = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/SkippedShipment/Reason.php b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/SkippedShipment/Reason.php new file mode 100644 index 000000000000..530f04abb7a8 --- /dev/null +++ b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/SkippedShipment/Reason.php @@ -0,0 +1,181 @@ +google.cloud.optimization.v1.SkippedShipment.Reason + */ +class Reason extends \Google\Protobuf\Internal\Message +{ + /** + * Refer to the comments of Code. + * + * Generated from protobuf field .google.cloud.optimization.v1.SkippedShipment.Reason.Code code = 1; + */ + protected $code = 0; + /** + * If the reason is related to a shipment-vehicle incompatibility, this + * field provides the index of one relevant vehicle. + * + * Generated from protobuf field optional int32 example_vehicle_index = 2; + */ + protected $example_vehicle_index = null; + /** + * If the reason code is `DEMAND_EXCEEDS_VEHICLE_CAPACITY`, documents one + * capacity type that is exceeded. + * + * Generated from protobuf field string example_exceeded_capacity_type = 3; + */ + protected $example_exceeded_capacity_type = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $code + * Refer to the comments of Code. + * @type int $example_vehicle_index + * If the reason is related to a shipment-vehicle incompatibility, this + * field provides the index of one relevant vehicle. + * @type string $example_exceeded_capacity_type + * If the reason code is `DEMAND_EXCEEDS_VEHICLE_CAPACITY`, documents one + * capacity type that is exceeded. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * Refer to the comments of Code. + * + * Generated from protobuf field .google.cloud.optimization.v1.SkippedShipment.Reason.Code code = 1; + * @return int + */ + public function getCode() + { + return $this->code; + } + + /** + * Refer to the comments of Code. + * + * Generated from protobuf field .google.cloud.optimization.v1.SkippedShipment.Reason.Code code = 1; + * @param int $var + * @return $this + */ + public function setCode($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Optimization\V1\SkippedShipment\Reason\Code::class); + $this->code = $var; + + return $this; + } + + /** + * If the reason is related to a shipment-vehicle incompatibility, this + * field provides the index of one relevant vehicle. + * + * Generated from protobuf field optional int32 example_vehicle_index = 2; + * @return int + */ + public function getExampleVehicleIndex() + { + return isset($this->example_vehicle_index) ? $this->example_vehicle_index : 0; + } + + public function hasExampleVehicleIndex() + { + return isset($this->example_vehicle_index); + } + + public function clearExampleVehicleIndex() + { + unset($this->example_vehicle_index); + } + + /** + * If the reason is related to a shipment-vehicle incompatibility, this + * field provides the index of one relevant vehicle. + * + * Generated from protobuf field optional int32 example_vehicle_index = 2; + * @param int $var + * @return $this + */ + public function setExampleVehicleIndex($var) + { + GPBUtil::checkInt32($var); + $this->example_vehicle_index = $var; + + return $this; + } + + /** + * If the reason code is `DEMAND_EXCEEDS_VEHICLE_CAPACITY`, documents one + * capacity type that is exceeded. + * + * Generated from protobuf field string example_exceeded_capacity_type = 3; + * @return string + */ + public function getExampleExceededCapacityType() + { + return $this->example_exceeded_capacity_type; + } + + /** + * If the reason code is `DEMAND_EXCEEDS_VEHICLE_CAPACITY`, documents one + * capacity type that is exceeded. + * + * Generated from protobuf field string example_exceeded_capacity_type = 3; + * @param string $var + * @return $this + */ + public function setExampleExceededCapacityType($var) + { + GPBUtil::checkString($var, True); + $this->example_exceeded_capacity_type = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Reason::class, \Google\Cloud\Optimization\V1\SkippedShipment_Reason::class); + diff --git a/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/SkippedShipment/Reason/Code.php b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/SkippedShipment/Reason/Code.php new file mode 100644 index 000000000000..0bed0964ff65 --- /dev/null +++ b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/SkippedShipment/Reason/Code.php @@ -0,0 +1,116 @@ +google.cloud.optimization.v1.SkippedShipment.Reason.Code + */ +class Code +{ + /** + * This should never be used. If we are unable to understand why a + * shipment was skipped, we simply return an empty set of reasons. + * + * Generated from protobuf enum CODE_UNSPECIFIED = 0; + */ + const CODE_UNSPECIFIED = 0; + /** + * There is no vehicle in the model making all shipments infeasible. + * + * Generated from protobuf enum NO_VEHICLE = 1; + */ + const NO_VEHICLE = 1; + /** + * The demand of the shipment exceeds a vehicle's capacity for some + * capacity types, one of which is `example_exceeded_capacity_type`. + * + * Generated from protobuf enum DEMAND_EXCEEDS_VEHICLE_CAPACITY = 2; + */ + const DEMAND_EXCEEDS_VEHICLE_CAPACITY = 2; + /** + * The minimum distance necessary to perform this shipment, i.e. from + * the vehicle's `start_location` to the shipment's pickup and/or delivery + * locations and to the vehicle's end location exceeds the vehicle's + * `route_distance_limit`. + * Note that for this computation we use the geodesic distances. + * + * Generated from protobuf enum CANNOT_BE_PERFORMED_WITHIN_VEHICLE_DISTANCE_LIMIT = 3; + */ + const CANNOT_BE_PERFORMED_WITHIN_VEHICLE_DISTANCE_LIMIT = 3; + /** + * The minimum time necessary to perform this shipment, including travel + * time, wait time and service time exceeds the vehicle's + * `route_duration_limit`. + * Note: travel time is computed in the best-case scenario, namely as + * geodesic distance x 36 m/s (roughly 130 km/hour). + * + * Generated from protobuf enum CANNOT_BE_PERFORMED_WITHIN_VEHICLE_DURATION_LIMIT = 4; + */ + const CANNOT_BE_PERFORMED_WITHIN_VEHICLE_DURATION_LIMIT = 4; + /** + * Same as above but we only compare minimum travel time and the + * vehicle's `travel_duration_limit`. + * + * Generated from protobuf enum CANNOT_BE_PERFORMED_WITHIN_VEHICLE_TRAVEL_DURATION_LIMIT = 5; + */ + const CANNOT_BE_PERFORMED_WITHIN_VEHICLE_TRAVEL_DURATION_LIMIT = 5; + /** + * The vehicle cannot perform this shipment in the best-case scenario + * (see `CANNOT_BE_PERFORMED_WITHIN_VEHICLE_DURATION_LIMIT` for time + * computation) if it starts at its earliest start time: the total time + * would make the vehicle end after its latest end time. + * + * Generated from protobuf enum CANNOT_BE_PERFORMED_WITHIN_VEHICLE_TIME_WINDOWS = 6; + */ + const CANNOT_BE_PERFORMED_WITHIN_VEHICLE_TIME_WINDOWS = 6; + /** + * The `allowed_vehicle_indices` field of the shipment is not empty and + * this vehicle does not belong to it. + * + * Generated from protobuf enum VEHICLE_NOT_ALLOWED = 7; + */ + const VEHICLE_NOT_ALLOWED = 7; + + private static $valueToName = [ + self::CODE_UNSPECIFIED => 'CODE_UNSPECIFIED', + self::NO_VEHICLE => 'NO_VEHICLE', + self::DEMAND_EXCEEDS_VEHICLE_CAPACITY => 'DEMAND_EXCEEDS_VEHICLE_CAPACITY', + self::CANNOT_BE_PERFORMED_WITHIN_VEHICLE_DISTANCE_LIMIT => 'CANNOT_BE_PERFORMED_WITHIN_VEHICLE_DISTANCE_LIMIT', + self::CANNOT_BE_PERFORMED_WITHIN_VEHICLE_DURATION_LIMIT => 'CANNOT_BE_PERFORMED_WITHIN_VEHICLE_DURATION_LIMIT', + self::CANNOT_BE_PERFORMED_WITHIN_VEHICLE_TRAVEL_DURATION_LIMIT => 'CANNOT_BE_PERFORMED_WITHIN_VEHICLE_TRAVEL_DURATION_LIMIT', + self::CANNOT_BE_PERFORMED_WITHIN_VEHICLE_TIME_WINDOWS => 'CANNOT_BE_PERFORMED_WITHIN_VEHICLE_TIME_WINDOWS', + self::VEHICLE_NOT_ALLOWED => 'VEHICLE_NOT_ALLOWED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Code::class, \Google\Cloud\Optimization\V1\SkippedShipment_Reason_Code::class); + diff --git a/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/SkippedShipment_Reason.php b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/SkippedShipment_Reason.php new file mode 100644 index 000000000000..cbcc60e7eb9a --- /dev/null +++ b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/SkippedShipment_Reason.php @@ -0,0 +1,16 @@ +google.cloud.optimization.v1.TimeWindow + */ +class TimeWindow extends \Google\Protobuf\Internal\Message +{ + /** + * The hard time window start time. If unspecified it will be set to + * `ShipmentModel.global_start_time`. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 1; + */ + protected $start_time = null; + /** + * The hard time window end time. If unspecified it will be set to + * `ShipmentModel.global_end_time`. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2; + */ + protected $end_time = null; + /** + * The soft start time of the time window. + * + * Generated from protobuf field .google.protobuf.Timestamp soft_start_time = 3; + */ + protected $soft_start_time = null; + /** + * The soft end time of the time window. + * + * Generated from protobuf field .google.protobuf.Timestamp soft_end_time = 4; + */ + protected $soft_end_time = null; + /** + * A cost per hour added to other costs in the model if the event occurs + * before soft_start_time, computed as: + * ``` + * max(0, soft_start_time - t.seconds) + * * cost_per_hour_before_soft_start_time / 3600, + * t being the time of the event. + * ``` + * This cost must be positive, and the field can only be set if + * soft_start_time has been set. + * + * Generated from protobuf field optional double cost_per_hour_before_soft_start_time = 5; + */ + protected $cost_per_hour_before_soft_start_time = null; + /** + * A cost per hour added to other costs in the model if the event occurs after + * `soft_end_time`, computed as: + * ``` + * max(0, t.seconds - soft_end_time.seconds) + * * cost_per_hour_after_soft_end_time / 3600, + * t being the time of the event. + * ``` + * This cost must be positive, and the field can only be set if + * `soft_end_time` has been set. + * + * Generated from protobuf field optional double cost_per_hour_after_soft_end_time = 6; + */ + protected $cost_per_hour_after_soft_end_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Timestamp $start_time + * The hard time window start time. If unspecified it will be set to + * `ShipmentModel.global_start_time`. + * @type \Google\Protobuf\Timestamp $end_time + * The hard time window end time. If unspecified it will be set to + * `ShipmentModel.global_end_time`. + * @type \Google\Protobuf\Timestamp $soft_start_time + * The soft start time of the time window. + * @type \Google\Protobuf\Timestamp $soft_end_time + * The soft end time of the time window. + * @type float $cost_per_hour_before_soft_start_time + * A cost per hour added to other costs in the model if the event occurs + * before soft_start_time, computed as: + * ``` + * max(0, soft_start_time - t.seconds) + * * cost_per_hour_before_soft_start_time / 3600, + * t being the time of the event. + * ``` + * This cost must be positive, and the field can only be set if + * soft_start_time has been set. + * @type float $cost_per_hour_after_soft_end_time + * A cost per hour added to other costs in the model if the event occurs after + * `soft_end_time`, computed as: + * ``` + * max(0, t.seconds - soft_end_time.seconds) + * * cost_per_hour_after_soft_end_time / 3600, + * t being the time of the event. + * ``` + * This cost must be positive, and the field can only be set if + * `soft_end_time` has been set. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * The hard time window start time. If unspecified it will be set to + * `ShipmentModel.global_start_time`. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 1; + * @return \Google\Protobuf\Timestamp|null + */ + public function getStartTime() + { + return $this->start_time; + } + + public function hasStartTime() + { + return isset($this->start_time); + } + + public function clearStartTime() + { + unset($this->start_time); + } + + /** + * The hard time window start time. If unspecified it will be set to + * `ShipmentModel.global_start_time`. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 1; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setStartTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->start_time = $var; + + return $this; + } + + /** + * The hard time window end time. If unspecified it will be set to + * `ShipmentModel.global_end_time`. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2; + * @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); + } + + /** + * The hard time window end time. If unspecified it will be set to + * `ShipmentModel.global_end_time`. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setEndTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->end_time = $var; + + return $this; + } + + /** + * The soft start time of the time window. + * + * Generated from protobuf field .google.protobuf.Timestamp soft_start_time = 3; + * @return \Google\Protobuf\Timestamp|null + */ + public function getSoftStartTime() + { + return $this->soft_start_time; + } + + public function hasSoftStartTime() + { + return isset($this->soft_start_time); + } + + public function clearSoftStartTime() + { + unset($this->soft_start_time); + } + + /** + * The soft start time of the time window. + * + * Generated from protobuf field .google.protobuf.Timestamp soft_start_time = 3; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setSoftStartTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->soft_start_time = $var; + + return $this; + } + + /** + * The soft end time of the time window. + * + * Generated from protobuf field .google.protobuf.Timestamp soft_end_time = 4; + * @return \Google\Protobuf\Timestamp|null + */ + public function getSoftEndTime() + { + return $this->soft_end_time; + } + + public function hasSoftEndTime() + { + return isset($this->soft_end_time); + } + + public function clearSoftEndTime() + { + unset($this->soft_end_time); + } + + /** + * The soft end time of the time window. + * + * Generated from protobuf field .google.protobuf.Timestamp soft_end_time = 4; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setSoftEndTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->soft_end_time = $var; + + return $this; + } + + /** + * A cost per hour added to other costs in the model if the event occurs + * before soft_start_time, computed as: + * ``` + * max(0, soft_start_time - t.seconds) + * * cost_per_hour_before_soft_start_time / 3600, + * t being the time of the event. + * ``` + * This cost must be positive, and the field can only be set if + * soft_start_time has been set. + * + * Generated from protobuf field optional double cost_per_hour_before_soft_start_time = 5; + * @return float + */ + public function getCostPerHourBeforeSoftStartTime() + { + return isset($this->cost_per_hour_before_soft_start_time) ? $this->cost_per_hour_before_soft_start_time : 0.0; + } + + public function hasCostPerHourBeforeSoftStartTime() + { + return isset($this->cost_per_hour_before_soft_start_time); + } + + public function clearCostPerHourBeforeSoftStartTime() + { + unset($this->cost_per_hour_before_soft_start_time); + } + + /** + * A cost per hour added to other costs in the model if the event occurs + * before soft_start_time, computed as: + * ``` + * max(0, soft_start_time - t.seconds) + * * cost_per_hour_before_soft_start_time / 3600, + * t being the time of the event. + * ``` + * This cost must be positive, and the field can only be set if + * soft_start_time has been set. + * + * Generated from protobuf field optional double cost_per_hour_before_soft_start_time = 5; + * @param float $var + * @return $this + */ + public function setCostPerHourBeforeSoftStartTime($var) + { + GPBUtil::checkDouble($var); + $this->cost_per_hour_before_soft_start_time = $var; + + return $this; + } + + /** + * A cost per hour added to other costs in the model if the event occurs after + * `soft_end_time`, computed as: + * ``` + * max(0, t.seconds - soft_end_time.seconds) + * * cost_per_hour_after_soft_end_time / 3600, + * t being the time of the event. + * ``` + * This cost must be positive, and the field can only be set if + * `soft_end_time` has been set. + * + * Generated from protobuf field optional double cost_per_hour_after_soft_end_time = 6; + * @return float + */ + public function getCostPerHourAfterSoftEndTime() + { + return isset($this->cost_per_hour_after_soft_end_time) ? $this->cost_per_hour_after_soft_end_time : 0.0; + } + + public function hasCostPerHourAfterSoftEndTime() + { + return isset($this->cost_per_hour_after_soft_end_time); + } + + public function clearCostPerHourAfterSoftEndTime() + { + unset($this->cost_per_hour_after_soft_end_time); + } + + /** + * A cost per hour added to other costs in the model if the event occurs after + * `soft_end_time`, computed as: + * ``` + * max(0, t.seconds - soft_end_time.seconds) + * * cost_per_hour_after_soft_end_time / 3600, + * t being the time of the event. + * ``` + * This cost must be positive, and the field can only be set if + * `soft_end_time` has been set. + * + * Generated from protobuf field optional double cost_per_hour_after_soft_end_time = 6; + * @param float $var + * @return $this + */ + public function setCostPerHourAfterSoftEndTime($var) + { + GPBUtil::checkDouble($var); + $this->cost_per_hour_after_soft_end_time = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/TransitionAttributes.php b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/TransitionAttributes.php new file mode 100644 index 000000000000..a5182bd35dfb --- /dev/null +++ b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/TransitionAttributes.php @@ -0,0 +1,408 @@ +google.cloud.optimization.v1.TransitionAttributes + */ +class TransitionAttributes extends \Google\Protobuf\Internal\Message +{ + /** + * Tags defining the set of (src->dst) transitions these attributes apply to. + * A source visit or vehicle start matches iff its + * [VisitRequest.tags][google.cloud.optimization.v1.Shipment.VisitRequest.tags] + * or [Vehicle.start_tags][google.cloud.optimization.v1.Vehicle.start_tags] + * either contains `src_tag` or does not contain `excluded_src_tag` (depending + * on which of these two fields is non-empty). + * + * Generated from protobuf field string src_tag = 1; + */ + protected $src_tag = ''; + /** + * See `src_tag`. Exactly one of `src_tag` and `excluded_src_tag` must be + * non-empty. + * + * Generated from protobuf field string excluded_src_tag = 2; + */ + protected $excluded_src_tag = ''; + /** + * A destination visit or vehicle end matches iff its + * [VisitRequest.tags][google.cloud.optimization.v1.Shipment.VisitRequest.tags] + * or [Vehicle.end_tags][google.cloud.optimization.v1.Vehicle.end_tags] either + * contains `dst_tag` or does not contain `excluded_dst_tag` (depending on + * which of these two fields is non-empty). + * + * Generated from protobuf field string dst_tag = 3; + */ + protected $dst_tag = ''; + /** + * See `dst_tag`. Exactly one of `dst_tag` and `excluded_dst_tag` must be + * non-empty. + * + * Generated from protobuf field string excluded_dst_tag = 4; + */ + protected $excluded_dst_tag = ''; + /** + * Specifies a cost for performing this transition. This is in the same unit + * as all other costs in the model and must not be negative. It is applied on + * top of all other existing costs. + * + * Generated from protobuf field double cost = 5; + */ + protected $cost = 0.0; + /** + * Specifies a cost per kilometer applied to the distance traveled while + * performing this transition. It adds up to any + * [Vehicle.cost_per_kilometer][google.cloud.optimization.v1.Vehicle.cost_per_kilometer] + * specified on vehicles. + * + * Generated from protobuf field double cost_per_kilometer = 6; + */ + protected $cost_per_kilometer = 0.0; + /** + * Specifies a limit on the distance traveled while performing this + * transition. + * As of 2021/06, only soft limits are supported. + * + * Generated from protobuf field .google.cloud.optimization.v1.DistanceLimit distance_limit = 7; + */ + protected $distance_limit = null; + /** + * Specifies a delay incurred when performing this transition. + * This delay always occurs *after* finishing the source visit and *before* + * starting the destination visit. + * + * Generated from protobuf field .google.protobuf.Duration delay = 8; + */ + protected $delay = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $src_tag + * Tags defining the set of (src->dst) transitions these attributes apply to. + * A source visit or vehicle start matches iff its + * [VisitRequest.tags][google.cloud.optimization.v1.Shipment.VisitRequest.tags] + * or [Vehicle.start_tags][google.cloud.optimization.v1.Vehicle.start_tags] + * either contains `src_tag` or does not contain `excluded_src_tag` (depending + * on which of these two fields is non-empty). + * @type string $excluded_src_tag + * See `src_tag`. Exactly one of `src_tag` and `excluded_src_tag` must be + * non-empty. + * @type string $dst_tag + * A destination visit or vehicle end matches iff its + * [VisitRequest.tags][google.cloud.optimization.v1.Shipment.VisitRequest.tags] + * or [Vehicle.end_tags][google.cloud.optimization.v1.Vehicle.end_tags] either + * contains `dst_tag` or does not contain `excluded_dst_tag` (depending on + * which of these two fields is non-empty). + * @type string $excluded_dst_tag + * See `dst_tag`. Exactly one of `dst_tag` and `excluded_dst_tag` must be + * non-empty. + * @type float $cost + * Specifies a cost for performing this transition. This is in the same unit + * as all other costs in the model and must not be negative. It is applied on + * top of all other existing costs. + * @type float $cost_per_kilometer + * Specifies a cost per kilometer applied to the distance traveled while + * performing this transition. It adds up to any + * [Vehicle.cost_per_kilometer][google.cloud.optimization.v1.Vehicle.cost_per_kilometer] + * specified on vehicles. + * @type \Google\Cloud\Optimization\V1\DistanceLimit $distance_limit + * Specifies a limit on the distance traveled while performing this + * transition. + * As of 2021/06, only soft limits are supported. + * @type \Google\Protobuf\Duration $delay + * Specifies a delay incurred when performing this transition. + * This delay always occurs *after* finishing the source visit and *before* + * starting the destination visit. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * Tags defining the set of (src->dst) transitions these attributes apply to. + * A source visit or vehicle start matches iff its + * [VisitRequest.tags][google.cloud.optimization.v1.Shipment.VisitRequest.tags] + * or [Vehicle.start_tags][google.cloud.optimization.v1.Vehicle.start_tags] + * either contains `src_tag` or does not contain `excluded_src_tag` (depending + * on which of these two fields is non-empty). + * + * Generated from protobuf field string src_tag = 1; + * @return string + */ + public function getSrcTag() + { + return $this->src_tag; + } + + /** + * Tags defining the set of (src->dst) transitions these attributes apply to. + * A source visit or vehicle start matches iff its + * [VisitRequest.tags][google.cloud.optimization.v1.Shipment.VisitRequest.tags] + * or [Vehicle.start_tags][google.cloud.optimization.v1.Vehicle.start_tags] + * either contains `src_tag` or does not contain `excluded_src_tag` (depending + * on which of these two fields is non-empty). + * + * Generated from protobuf field string src_tag = 1; + * @param string $var + * @return $this + */ + public function setSrcTag($var) + { + GPBUtil::checkString($var, True); + $this->src_tag = $var; + + return $this; + } + + /** + * See `src_tag`. Exactly one of `src_tag` and `excluded_src_tag` must be + * non-empty. + * + * Generated from protobuf field string excluded_src_tag = 2; + * @return string + */ + public function getExcludedSrcTag() + { + return $this->excluded_src_tag; + } + + /** + * See `src_tag`. Exactly one of `src_tag` and `excluded_src_tag` must be + * non-empty. + * + * Generated from protobuf field string excluded_src_tag = 2; + * @param string $var + * @return $this + */ + public function setExcludedSrcTag($var) + { + GPBUtil::checkString($var, True); + $this->excluded_src_tag = $var; + + return $this; + } + + /** + * A destination visit or vehicle end matches iff its + * [VisitRequest.tags][google.cloud.optimization.v1.Shipment.VisitRequest.tags] + * or [Vehicle.end_tags][google.cloud.optimization.v1.Vehicle.end_tags] either + * contains `dst_tag` or does not contain `excluded_dst_tag` (depending on + * which of these two fields is non-empty). + * + * Generated from protobuf field string dst_tag = 3; + * @return string + */ + public function getDstTag() + { + return $this->dst_tag; + } + + /** + * A destination visit or vehicle end matches iff its + * [VisitRequest.tags][google.cloud.optimization.v1.Shipment.VisitRequest.tags] + * or [Vehicle.end_tags][google.cloud.optimization.v1.Vehicle.end_tags] either + * contains `dst_tag` or does not contain `excluded_dst_tag` (depending on + * which of these two fields is non-empty). + * + * Generated from protobuf field string dst_tag = 3; + * @param string $var + * @return $this + */ + public function setDstTag($var) + { + GPBUtil::checkString($var, True); + $this->dst_tag = $var; + + return $this; + } + + /** + * See `dst_tag`. Exactly one of `dst_tag` and `excluded_dst_tag` must be + * non-empty. + * + * Generated from protobuf field string excluded_dst_tag = 4; + * @return string + */ + public function getExcludedDstTag() + { + return $this->excluded_dst_tag; + } + + /** + * See `dst_tag`. Exactly one of `dst_tag` and `excluded_dst_tag` must be + * non-empty. + * + * Generated from protobuf field string excluded_dst_tag = 4; + * @param string $var + * @return $this + */ + public function setExcludedDstTag($var) + { + GPBUtil::checkString($var, True); + $this->excluded_dst_tag = $var; + + return $this; + } + + /** + * Specifies a cost for performing this transition. This is in the same unit + * as all other costs in the model and must not be negative. It is applied on + * top of all other existing costs. + * + * Generated from protobuf field double cost = 5; + * @return float + */ + public function getCost() + { + return $this->cost; + } + + /** + * Specifies a cost for performing this transition. This is in the same unit + * as all other costs in the model and must not be negative. It is applied on + * top of all other existing costs. + * + * Generated from protobuf field double cost = 5; + * @param float $var + * @return $this + */ + public function setCost($var) + { + GPBUtil::checkDouble($var); + $this->cost = $var; + + return $this; + } + + /** + * Specifies a cost per kilometer applied to the distance traveled while + * performing this transition. It adds up to any + * [Vehicle.cost_per_kilometer][google.cloud.optimization.v1.Vehicle.cost_per_kilometer] + * specified on vehicles. + * + * Generated from protobuf field double cost_per_kilometer = 6; + * @return float + */ + public function getCostPerKilometer() + { + return $this->cost_per_kilometer; + } + + /** + * Specifies a cost per kilometer applied to the distance traveled while + * performing this transition. It adds up to any + * [Vehicle.cost_per_kilometer][google.cloud.optimization.v1.Vehicle.cost_per_kilometer] + * specified on vehicles. + * + * Generated from protobuf field double cost_per_kilometer = 6; + * @param float $var + * @return $this + */ + public function setCostPerKilometer($var) + { + GPBUtil::checkDouble($var); + $this->cost_per_kilometer = $var; + + return $this; + } + + /** + * Specifies a limit on the distance traveled while performing this + * transition. + * As of 2021/06, only soft limits are supported. + * + * Generated from protobuf field .google.cloud.optimization.v1.DistanceLimit distance_limit = 7; + * @return \Google\Cloud\Optimization\V1\DistanceLimit|null + */ + public function getDistanceLimit() + { + return $this->distance_limit; + } + + public function hasDistanceLimit() + { + return isset($this->distance_limit); + } + + public function clearDistanceLimit() + { + unset($this->distance_limit); + } + + /** + * Specifies a limit on the distance traveled while performing this + * transition. + * As of 2021/06, only soft limits are supported. + * + * Generated from protobuf field .google.cloud.optimization.v1.DistanceLimit distance_limit = 7; + * @param \Google\Cloud\Optimization\V1\DistanceLimit $var + * @return $this + */ + public function setDistanceLimit($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Optimization\V1\DistanceLimit::class); + $this->distance_limit = $var; + + return $this; + } + + /** + * Specifies a delay incurred when performing this transition. + * This delay always occurs *after* finishing the source visit and *before* + * starting the destination visit. + * + * Generated from protobuf field .google.protobuf.Duration delay = 8; + * @return \Google\Protobuf\Duration|null + */ + public function getDelay() + { + return $this->delay; + } + + public function hasDelay() + { + return isset($this->delay); + } + + public function clearDelay() + { + unset($this->delay); + } + + /** + * Specifies a delay incurred when performing this transition. + * This delay always occurs *after* finishing the source visit and *before* + * starting the destination visit. + * + * Generated from protobuf field .google.protobuf.Duration delay = 8; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setDelay($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->delay = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/Vehicle.php b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/Vehicle.php new file mode 100644 index 000000000000..26bab7d7bca7 --- /dev/null +++ b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/Vehicle.php @@ -0,0 +1,1533 @@ +google.cloud.optimization.v1.Vehicle + */ +class Vehicle extends \Google\Protobuf\Internal\Message +{ + /** + * The travel mode which affects the roads usable by the vehicle and its + * speed. See also `travel_duration_multiple`. + * + * Generated from protobuf field .google.cloud.optimization.v1.Vehicle.TravelMode travel_mode = 1; + */ + protected $travel_mode = 0; + /** + * Geographic location where the vehicle starts before picking up any + * shipments. If not specified, the vehicle starts at its first pickup. + * If the shipment model has duration and distance matrices, `start_location` + * must not be specified. + * + * Generated from protobuf field .google.type.LatLng start_location = 3; + */ + protected $start_location = null; + /** + * Waypoint representing a geographic location where the vehicle starts before + * picking up any shipments. If neither `start_waypoint` nor `start_location` + * is specified, the vehicle starts at its first pickup. + * If the shipment model has duration and distance matrices, `start_waypoint` + * must not be specified. + * + * Generated from protobuf field .google.cloud.optimization.v1.Waypoint start_waypoint = 4; + */ + protected $start_waypoint = null; + /** + * Geographic location where the vehicle ends after it has completed its last + * `VisitRequest`. If not specified the vehicle's `ShipmentRoute` ends + * immediately when it completes its last `VisitRequest`. + * If the shipment model has duration and distance matrices, `end_location` + * must not be specified. + * + * Generated from protobuf field .google.type.LatLng end_location = 5; + */ + protected $end_location = null; + /** + * Waypoint representing a geographic location where the vehicle ends after + * it has completed its last `VisitRequest`. If neither `end_waypoint` nor + * `end_location` is specified, the vehicle's `ShipmentRoute` ends immediately + * when it completes its last `VisitRequest`. + * If the shipment model has duration and distance matrices, `end_waypoint` + * must not be specified. + * + * Generated from protobuf field .google.cloud.optimization.v1.Waypoint end_waypoint = 6; + */ + protected $end_waypoint = null; + /** + * Specifies tags attached to the start of the vehicle's route. + * Empty or duplicate strings are not allowed. + * + * Generated from protobuf field repeated string start_tags = 7; + */ + private $start_tags; + /** + * Specifies tags attached to the end of the vehicle's route. + * Empty or duplicate strings are not allowed. + * + * Generated from protobuf field repeated string end_tags = 8; + */ + private $end_tags; + /** + * Time windows during which the vehicle may depart its start location. + * They must be within the global time limits (see + * [ShipmentModel.global_*][google.cloud.optimization.v1.ShipmentModel.global_start_time] + * fields). If unspecified, there is no limitation besides those global time + * limits. + * Time windows belonging to the same repeated field must be disjoint, i.e. no + * time window can overlap with or be adjacent to another, and they must be in + * chronological order. + * `cost_per_hour_after_soft_end_time` and `soft_end_time` can only be set if + * there is a single time window. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.TimeWindow start_time_windows = 9; + */ + private $start_time_windows; + /** + * Time windows during which the vehicle may arrive at its end location. + * They must be within the global time limits (see + * [ShipmentModel.global_*][google.cloud.optimization.v1.ShipmentModel.global_start_time] + * fields). If unspecified, there is no limitation besides those global time + * limits. + * Time windows belonging to the same repeated field must be disjoint, i.e. no + * time window can overlap with or be adjacent to another, and they must be in + * chronological order. + * `cost_per_hour_after_soft_end_time` and `soft_end_time` can only be set if + * there is a single time window. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.TimeWindow end_time_windows = 10; + */ + private $end_time_windows; + /** + * Specifies a multiplicative factor that can be used to increase or decrease + * travel times of this vehicle. For example, setting this to 2.0 means + * that this vehicle is slower and has travel times that are twice what they + * are for standard vehicles. This multiple does not affect visit durations. + * It does affect cost if `cost_per_hour` or `cost_per_traveled_hour` are + * specified. This must be in the range [0.001, 1000.0]. If unset, the vehicle + * is standard, and this multiple is considered 1.0. + * WARNING: Travel times will be rounded to the nearest second after this + * multiple is applied but before performing any numerical operations, thus, + * a small multiple may result in a loss of precision. + * See also `extra_visit_duration_for_visit_type` below. + * + * Generated from protobuf field optional double travel_duration_multiple = 11; + */ + protected $travel_duration_multiple = null; + /** + * Unloading policy enforced on the vehicle. + * + * Generated from protobuf field .google.cloud.optimization.v1.Vehicle.UnloadingPolicy unloading_policy = 12; + */ + protected $unloading_policy = 0; + /** + * Capacities of the vehicle (weight, volume, # of pallets for example). + * The keys in the map are the identifiers of the type of load, consistent + * with the keys of the + * [Shipment.load_demands][google.cloud.optimization.v1.Shipment.load_demands] + * field. If a given key is absent from this map, the corresponding capacity + * is considered to be limitless. + * + * Generated from protobuf field map load_limits = 30; + */ + private $load_limits; + /** + * Vehicle costs: all costs add up and must be in the same unit as + * [Shipment.penalty_cost][google.cloud.optimization.v1.Shipment.penalty_cost]. + * Cost per hour of the vehicle route. This cost is applied to the total time + * taken by the route, and includes travel time, waiting time, and visit time. + * Using `cost_per_hour` instead of just `cost_per_traveled_hour` may result + * in additional latency. + * + * Generated from protobuf field double cost_per_hour = 16; + */ + protected $cost_per_hour = 0.0; + /** + * Cost per traveled hour of the vehicle route. This cost is applied only to + * travel time taken by the route (i.e., that reported in + * [ShipmentRoute.transitions][google.cloud.optimization.v1.ShipmentRoute.transitions]), + * and excludes waiting time and visit time. + * + * Generated from protobuf field double cost_per_traveled_hour = 17; + */ + protected $cost_per_traveled_hour = 0.0; + /** + * Cost per kilometer of the vehicle route. This cost is applied to the + * distance reported in the + * [ShipmentRoute.transitions][google.cloud.optimization.v1.ShipmentRoute.transitions] + * and does not apply to any distance implicitly traveled from the + * `arrival_location` to the `departure_location` of a single `VisitRequest`. + * + * Generated from protobuf field double cost_per_kilometer = 18; + */ + protected $cost_per_kilometer = 0.0; + /** + * Fixed cost applied if this vehicle is used to handle a shipment. + * + * Generated from protobuf field double fixed_cost = 19; + */ + protected $fixed_cost = 0.0; + /** + * This field only applies to vehicles when their route does not serve any + * shipments. It indicates if the vehicle should be considered as used or not + * in this case. + * If true, the vehicle goes from its start to its end location even if it + * doesn't serve any shipments, and time and distance costs resulting from its + * start --> end travel are taken into account. + * Otherwise, it doesn't travel from its start to its end location, and no + * `break_rule` or delay (from `TransitionAttributes`) are scheduled for this + * vehicle. In this case, the vehicle's `ShipmentRoute` doesn't contain any + * information except for the vehicle index and label. + * + * Generated from protobuf field bool used_if_route_is_empty = 20; + */ + protected $used_if_route_is_empty = false; + /** + * Limit applied to the total duration of the vehicle's route. In a given + * `OptimizeToursResponse`, the route duration of a vehicle is the + * difference between its `vehicle_end_time` and `vehicle_start_time`. + * + * Generated from protobuf field .google.cloud.optimization.v1.Vehicle.DurationLimit route_duration_limit = 21; + */ + protected $route_duration_limit = null; + /** + * Limit applied to the travel duration of the vehicle's route. In a given + * `OptimizeToursResponse`, the route travel duration is the sum of all its + * [transitions.travel_duration][google.cloud.optimization.v1.ShipmentRoute.Transition.travel_duration]. + * + * Generated from protobuf field .google.cloud.optimization.v1.Vehicle.DurationLimit travel_duration_limit = 22; + */ + protected $travel_duration_limit = null; + /** + * Limit applied to the total distance of the vehicle's route. In a given + * `OptimizeToursResponse`, the route distance is the sum of all its + * [transitions.travel_distance_meters][google.cloud.optimization.v1.ShipmentRoute.Transition.travel_distance_meters]. + * + * Generated from protobuf field .google.cloud.optimization.v1.DistanceLimit route_distance_limit = 23; + */ + protected $route_distance_limit = null; + /** + * Specifies a map from visit_types strings to durations. The duration is time + * in addition to + * [VisitRequest.duration][google.cloud.optimization.v1.Shipment.VisitRequest.duration] + * to be taken at visits with the specified `visit_types`. This extra visit + * duration adds cost if `cost_per_hour` is specified. Keys (i.e. + * `visit_types`) cannot be empty strings. + * If a visit request has multiple types, a duration will be added for each + * type in the map. + * + * Generated from protobuf field map extra_visit_duration_for_visit_type = 24; + */ + private $extra_visit_duration_for_visit_type; + /** + * Describes the break schedule to be enforced on this vehicle. + * If empty, no breaks will be scheduled for this vehicle. + * + * Generated from protobuf field .google.cloud.optimization.v1.BreakRule break_rule = 25; + */ + protected $break_rule = null; + /** + * Specifies a label for this vehicle. This label is reported in the response + * as the `vehicle_label` of the corresponding + * [ShipmentRoute][google.cloud.optimization.v1.ShipmentRoute]. + * + * Generated from protobuf field string label = 27; + */ + protected $label = ''; + /** + * If true, `used_if_route_is_empty` must be false, and this vehicle will + * remain unused. + * If a shipment is performed by an ignored vehicle in + * `injected_first_solution_routes`, it is skipped in the first solution but + * is free to be performed in the response. + * If a shipment is performed by an ignored vehicle in + * `injected_solution_constraint` and any related pickup/delivery is + * constrained to remain on the vehicle (i.e., not relaxed to level + * `RELAX_ALL_AFTER_THRESHOLD`), it is skipped in the response. + * If a shipment has a non-empty `allowed_vehicle_indices` field and all of + * the allowed vehicles are ignored, it is skipped in the response. + * + * Generated from protobuf field bool ignore = 28; + */ + protected $ignore = false; + /** + * Deprecated: No longer used. + * Indices in the `break_rule` field in the source + * [ShipmentModel][google.cloud.optimization.v1.ShipmentModel]. They + * correspond to break rules enforced on the vehicle. + * As of 2018/03, at most one rule index per vehicle can be specified. + * + * Generated from protobuf field repeated int32 break_rule_indices = 29 [deprecated = true]; + * @deprecated + */ + private $break_rule_indices; + /** + * Deprecated: Use + * [Vehicle.load_limits][google.cloud.optimization.v1.Vehicle.load_limits] + * instead. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.CapacityQuantity capacities = 13 [deprecated = true]; + * @deprecated + */ + private $capacities; + /** + * Deprecated: Use + * [Vehicle.LoadLimit.start_load_interval][google.cloud.optimization.v1.Vehicle.LoadLimit.start_load_interval] + * instead. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.CapacityQuantityInterval start_load_intervals = 14 [deprecated = true]; + * @deprecated + */ + private $start_load_intervals; + /** + * Deprecated: Use + * [Vehicle.LoadLimit.end_load_interval][google.cloud.optimization.v1.Vehicle.LoadLimit.end_load_interval] + * instead. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.CapacityQuantityInterval end_load_intervals = 15 [deprecated = true]; + * @deprecated + */ + private $end_load_intervals; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $travel_mode + * The travel mode which affects the roads usable by the vehicle and its + * speed. See also `travel_duration_multiple`. + * @type \Google\Type\LatLng $start_location + * Geographic location where the vehicle starts before picking up any + * shipments. If not specified, the vehicle starts at its first pickup. + * If the shipment model has duration and distance matrices, `start_location` + * must not be specified. + * @type \Google\Cloud\Optimization\V1\Waypoint $start_waypoint + * Waypoint representing a geographic location where the vehicle starts before + * picking up any shipments. If neither `start_waypoint` nor `start_location` + * is specified, the vehicle starts at its first pickup. + * If the shipment model has duration and distance matrices, `start_waypoint` + * must not be specified. + * @type \Google\Type\LatLng $end_location + * Geographic location where the vehicle ends after it has completed its last + * `VisitRequest`. If not specified the vehicle's `ShipmentRoute` ends + * immediately when it completes its last `VisitRequest`. + * If the shipment model has duration and distance matrices, `end_location` + * must not be specified. + * @type \Google\Cloud\Optimization\V1\Waypoint $end_waypoint + * Waypoint representing a geographic location where the vehicle ends after + * it has completed its last `VisitRequest`. If neither `end_waypoint` nor + * `end_location` is specified, the vehicle's `ShipmentRoute` ends immediately + * when it completes its last `VisitRequest`. + * If the shipment model has duration and distance matrices, `end_waypoint` + * must not be specified. + * @type array|\Google\Protobuf\Internal\RepeatedField $start_tags + * Specifies tags attached to the start of the vehicle's route. + * Empty or duplicate strings are not allowed. + * @type array|\Google\Protobuf\Internal\RepeatedField $end_tags + * Specifies tags attached to the end of the vehicle's route. + * Empty or duplicate strings are not allowed. + * @type array<\Google\Cloud\Optimization\V1\TimeWindow>|\Google\Protobuf\Internal\RepeatedField $start_time_windows + * Time windows during which the vehicle may depart its start location. + * They must be within the global time limits (see + * [ShipmentModel.global_*][google.cloud.optimization.v1.ShipmentModel.global_start_time] + * fields). If unspecified, there is no limitation besides those global time + * limits. + * Time windows belonging to the same repeated field must be disjoint, i.e. no + * time window can overlap with or be adjacent to another, and they must be in + * chronological order. + * `cost_per_hour_after_soft_end_time` and `soft_end_time` can only be set if + * there is a single time window. + * @type array<\Google\Cloud\Optimization\V1\TimeWindow>|\Google\Protobuf\Internal\RepeatedField $end_time_windows + * Time windows during which the vehicle may arrive at its end location. + * They must be within the global time limits (see + * [ShipmentModel.global_*][google.cloud.optimization.v1.ShipmentModel.global_start_time] + * fields). If unspecified, there is no limitation besides those global time + * limits. + * Time windows belonging to the same repeated field must be disjoint, i.e. no + * time window can overlap with or be adjacent to another, and they must be in + * chronological order. + * `cost_per_hour_after_soft_end_time` and `soft_end_time` can only be set if + * there is a single time window. + * @type float $travel_duration_multiple + * Specifies a multiplicative factor that can be used to increase or decrease + * travel times of this vehicle. For example, setting this to 2.0 means + * that this vehicle is slower and has travel times that are twice what they + * are for standard vehicles. This multiple does not affect visit durations. + * It does affect cost if `cost_per_hour` or `cost_per_traveled_hour` are + * specified. This must be in the range [0.001, 1000.0]. If unset, the vehicle + * is standard, and this multiple is considered 1.0. + * WARNING: Travel times will be rounded to the nearest second after this + * multiple is applied but before performing any numerical operations, thus, + * a small multiple may result in a loss of precision. + * See also `extra_visit_duration_for_visit_type` below. + * @type int $unloading_policy + * Unloading policy enforced on the vehicle. + * @type array|\Google\Protobuf\Internal\MapField $load_limits + * Capacities of the vehicle (weight, volume, # of pallets for example). + * The keys in the map are the identifiers of the type of load, consistent + * with the keys of the + * [Shipment.load_demands][google.cloud.optimization.v1.Shipment.load_demands] + * field. If a given key is absent from this map, the corresponding capacity + * is considered to be limitless. + * @type float $cost_per_hour + * Vehicle costs: all costs add up and must be in the same unit as + * [Shipment.penalty_cost][google.cloud.optimization.v1.Shipment.penalty_cost]. + * Cost per hour of the vehicle route. This cost is applied to the total time + * taken by the route, and includes travel time, waiting time, and visit time. + * Using `cost_per_hour` instead of just `cost_per_traveled_hour` may result + * in additional latency. + * @type float $cost_per_traveled_hour + * Cost per traveled hour of the vehicle route. This cost is applied only to + * travel time taken by the route (i.e., that reported in + * [ShipmentRoute.transitions][google.cloud.optimization.v1.ShipmentRoute.transitions]), + * and excludes waiting time and visit time. + * @type float $cost_per_kilometer + * Cost per kilometer of the vehicle route. This cost is applied to the + * distance reported in the + * [ShipmentRoute.transitions][google.cloud.optimization.v1.ShipmentRoute.transitions] + * and does not apply to any distance implicitly traveled from the + * `arrival_location` to the `departure_location` of a single `VisitRequest`. + * @type float $fixed_cost + * Fixed cost applied if this vehicle is used to handle a shipment. + * @type bool $used_if_route_is_empty + * This field only applies to vehicles when their route does not serve any + * shipments. It indicates if the vehicle should be considered as used or not + * in this case. + * If true, the vehicle goes from its start to its end location even if it + * doesn't serve any shipments, and time and distance costs resulting from its + * start --> end travel are taken into account. + * Otherwise, it doesn't travel from its start to its end location, and no + * `break_rule` or delay (from `TransitionAttributes`) are scheduled for this + * vehicle. In this case, the vehicle's `ShipmentRoute` doesn't contain any + * information except for the vehicle index and label. + * @type \Google\Cloud\Optimization\V1\Vehicle\DurationLimit $route_duration_limit + * Limit applied to the total duration of the vehicle's route. In a given + * `OptimizeToursResponse`, the route duration of a vehicle is the + * difference between its `vehicle_end_time` and `vehicle_start_time`. + * @type \Google\Cloud\Optimization\V1\Vehicle\DurationLimit $travel_duration_limit + * Limit applied to the travel duration of the vehicle's route. In a given + * `OptimizeToursResponse`, the route travel duration is the sum of all its + * [transitions.travel_duration][google.cloud.optimization.v1.ShipmentRoute.Transition.travel_duration]. + * @type \Google\Cloud\Optimization\V1\DistanceLimit $route_distance_limit + * Limit applied to the total distance of the vehicle's route. In a given + * `OptimizeToursResponse`, the route distance is the sum of all its + * [transitions.travel_distance_meters][google.cloud.optimization.v1.ShipmentRoute.Transition.travel_distance_meters]. + * @type array|\Google\Protobuf\Internal\MapField $extra_visit_duration_for_visit_type + * Specifies a map from visit_types strings to durations. The duration is time + * in addition to + * [VisitRequest.duration][google.cloud.optimization.v1.Shipment.VisitRequest.duration] + * to be taken at visits with the specified `visit_types`. This extra visit + * duration adds cost if `cost_per_hour` is specified. Keys (i.e. + * `visit_types`) cannot be empty strings. + * If a visit request has multiple types, a duration will be added for each + * type in the map. + * @type \Google\Cloud\Optimization\V1\BreakRule $break_rule + * Describes the break schedule to be enforced on this vehicle. + * If empty, no breaks will be scheduled for this vehicle. + * @type string $label + * Specifies a label for this vehicle. This label is reported in the response + * as the `vehicle_label` of the corresponding + * [ShipmentRoute][google.cloud.optimization.v1.ShipmentRoute]. + * @type bool $ignore + * If true, `used_if_route_is_empty` must be false, and this vehicle will + * remain unused. + * If a shipment is performed by an ignored vehicle in + * `injected_first_solution_routes`, it is skipped in the first solution but + * is free to be performed in the response. + * If a shipment is performed by an ignored vehicle in + * `injected_solution_constraint` and any related pickup/delivery is + * constrained to remain on the vehicle (i.e., not relaxed to level + * `RELAX_ALL_AFTER_THRESHOLD`), it is skipped in the response. + * If a shipment has a non-empty `allowed_vehicle_indices` field and all of + * the allowed vehicles are ignored, it is skipped in the response. + * @type array|\Google\Protobuf\Internal\RepeatedField $break_rule_indices + * Deprecated: No longer used. + * Indices in the `break_rule` field in the source + * [ShipmentModel][google.cloud.optimization.v1.ShipmentModel]. They + * correspond to break rules enforced on the vehicle. + * As of 2018/03, at most one rule index per vehicle can be specified. + * @type array<\Google\Cloud\Optimization\V1\CapacityQuantity>|\Google\Protobuf\Internal\RepeatedField $capacities + * Deprecated: Use + * [Vehicle.load_limits][google.cloud.optimization.v1.Vehicle.load_limits] + * instead. + * @type array<\Google\Cloud\Optimization\V1\CapacityQuantityInterval>|\Google\Protobuf\Internal\RepeatedField $start_load_intervals + * Deprecated: Use + * [Vehicle.LoadLimit.start_load_interval][google.cloud.optimization.v1.Vehicle.LoadLimit.start_load_interval] + * instead. + * @type array<\Google\Cloud\Optimization\V1\CapacityQuantityInterval>|\Google\Protobuf\Internal\RepeatedField $end_load_intervals + * Deprecated: Use + * [Vehicle.LoadLimit.end_load_interval][google.cloud.optimization.v1.Vehicle.LoadLimit.end_load_interval] + * instead. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * The travel mode which affects the roads usable by the vehicle and its + * speed. See also `travel_duration_multiple`. + * + * Generated from protobuf field .google.cloud.optimization.v1.Vehicle.TravelMode travel_mode = 1; + * @return int + */ + public function getTravelMode() + { + return $this->travel_mode; + } + + /** + * The travel mode which affects the roads usable by the vehicle and its + * speed. See also `travel_duration_multiple`. + * + * Generated from protobuf field .google.cloud.optimization.v1.Vehicle.TravelMode travel_mode = 1; + * @param int $var + * @return $this + */ + public function setTravelMode($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Optimization\V1\Vehicle\TravelMode::class); + $this->travel_mode = $var; + + return $this; + } + + /** + * Geographic location where the vehicle starts before picking up any + * shipments. If not specified, the vehicle starts at its first pickup. + * If the shipment model has duration and distance matrices, `start_location` + * must not be specified. + * + * Generated from protobuf field .google.type.LatLng start_location = 3; + * @return \Google\Type\LatLng|null + */ + public function getStartLocation() + { + return $this->start_location; + } + + public function hasStartLocation() + { + return isset($this->start_location); + } + + public function clearStartLocation() + { + unset($this->start_location); + } + + /** + * Geographic location where the vehicle starts before picking up any + * shipments. If not specified, the vehicle starts at its first pickup. + * If the shipment model has duration and distance matrices, `start_location` + * must not be specified. + * + * Generated from protobuf field .google.type.LatLng start_location = 3; + * @param \Google\Type\LatLng $var + * @return $this + */ + public function setStartLocation($var) + { + GPBUtil::checkMessage($var, \Google\Type\LatLng::class); + $this->start_location = $var; + + return $this; + } + + /** + * Waypoint representing a geographic location where the vehicle starts before + * picking up any shipments. If neither `start_waypoint` nor `start_location` + * is specified, the vehicle starts at its first pickup. + * If the shipment model has duration and distance matrices, `start_waypoint` + * must not be specified. + * + * Generated from protobuf field .google.cloud.optimization.v1.Waypoint start_waypoint = 4; + * @return \Google\Cloud\Optimization\V1\Waypoint|null + */ + public function getStartWaypoint() + { + return $this->start_waypoint; + } + + public function hasStartWaypoint() + { + return isset($this->start_waypoint); + } + + public function clearStartWaypoint() + { + unset($this->start_waypoint); + } + + /** + * Waypoint representing a geographic location where the vehicle starts before + * picking up any shipments. If neither `start_waypoint` nor `start_location` + * is specified, the vehicle starts at its first pickup. + * If the shipment model has duration and distance matrices, `start_waypoint` + * must not be specified. + * + * Generated from protobuf field .google.cloud.optimization.v1.Waypoint start_waypoint = 4; + * @param \Google\Cloud\Optimization\V1\Waypoint $var + * @return $this + */ + public function setStartWaypoint($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Optimization\V1\Waypoint::class); + $this->start_waypoint = $var; + + return $this; + } + + /** + * Geographic location where the vehicle ends after it has completed its last + * `VisitRequest`. If not specified the vehicle's `ShipmentRoute` ends + * immediately when it completes its last `VisitRequest`. + * If the shipment model has duration and distance matrices, `end_location` + * must not be specified. + * + * Generated from protobuf field .google.type.LatLng end_location = 5; + * @return \Google\Type\LatLng|null + */ + public function getEndLocation() + { + return $this->end_location; + } + + public function hasEndLocation() + { + return isset($this->end_location); + } + + public function clearEndLocation() + { + unset($this->end_location); + } + + /** + * Geographic location where the vehicle ends after it has completed its last + * `VisitRequest`. If not specified the vehicle's `ShipmentRoute` ends + * immediately when it completes its last `VisitRequest`. + * If the shipment model has duration and distance matrices, `end_location` + * must not be specified. + * + * Generated from protobuf field .google.type.LatLng end_location = 5; + * @param \Google\Type\LatLng $var + * @return $this + */ + public function setEndLocation($var) + { + GPBUtil::checkMessage($var, \Google\Type\LatLng::class); + $this->end_location = $var; + + return $this; + } + + /** + * Waypoint representing a geographic location where the vehicle ends after + * it has completed its last `VisitRequest`. If neither `end_waypoint` nor + * `end_location` is specified, the vehicle's `ShipmentRoute` ends immediately + * when it completes its last `VisitRequest`. + * If the shipment model has duration and distance matrices, `end_waypoint` + * must not be specified. + * + * Generated from protobuf field .google.cloud.optimization.v1.Waypoint end_waypoint = 6; + * @return \Google\Cloud\Optimization\V1\Waypoint|null + */ + public function getEndWaypoint() + { + return $this->end_waypoint; + } + + public function hasEndWaypoint() + { + return isset($this->end_waypoint); + } + + public function clearEndWaypoint() + { + unset($this->end_waypoint); + } + + /** + * Waypoint representing a geographic location where the vehicle ends after + * it has completed its last `VisitRequest`. If neither `end_waypoint` nor + * `end_location` is specified, the vehicle's `ShipmentRoute` ends immediately + * when it completes its last `VisitRequest`. + * If the shipment model has duration and distance matrices, `end_waypoint` + * must not be specified. + * + * Generated from protobuf field .google.cloud.optimization.v1.Waypoint end_waypoint = 6; + * @param \Google\Cloud\Optimization\V1\Waypoint $var + * @return $this + */ + public function setEndWaypoint($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Optimization\V1\Waypoint::class); + $this->end_waypoint = $var; + + return $this; + } + + /** + * Specifies tags attached to the start of the vehicle's route. + * Empty or duplicate strings are not allowed. + * + * Generated from protobuf field repeated string start_tags = 7; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getStartTags() + { + return $this->start_tags; + } + + /** + * Specifies tags attached to the start of the vehicle's route. + * Empty or duplicate strings are not allowed. + * + * Generated from protobuf field repeated string start_tags = 7; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setStartTags($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->start_tags = $arr; + + return $this; + } + + /** + * Specifies tags attached to the end of the vehicle's route. + * Empty or duplicate strings are not allowed. + * + * Generated from protobuf field repeated string end_tags = 8; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getEndTags() + { + return $this->end_tags; + } + + /** + * Specifies tags attached to the end of the vehicle's route. + * Empty or duplicate strings are not allowed. + * + * Generated from protobuf field repeated string end_tags = 8; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setEndTags($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->end_tags = $arr; + + return $this; + } + + /** + * Time windows during which the vehicle may depart its start location. + * They must be within the global time limits (see + * [ShipmentModel.global_*][google.cloud.optimization.v1.ShipmentModel.global_start_time] + * fields). If unspecified, there is no limitation besides those global time + * limits. + * Time windows belonging to the same repeated field must be disjoint, i.e. no + * time window can overlap with or be adjacent to another, and they must be in + * chronological order. + * `cost_per_hour_after_soft_end_time` and `soft_end_time` can only be set if + * there is a single time window. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.TimeWindow start_time_windows = 9; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getStartTimeWindows() + { + return $this->start_time_windows; + } + + /** + * Time windows during which the vehicle may depart its start location. + * They must be within the global time limits (see + * [ShipmentModel.global_*][google.cloud.optimization.v1.ShipmentModel.global_start_time] + * fields). If unspecified, there is no limitation besides those global time + * limits. + * Time windows belonging to the same repeated field must be disjoint, i.e. no + * time window can overlap with or be adjacent to another, and they must be in + * chronological order. + * `cost_per_hour_after_soft_end_time` and `soft_end_time` can only be set if + * there is a single time window. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.TimeWindow start_time_windows = 9; + * @param array<\Google\Cloud\Optimization\V1\TimeWindow>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setStartTimeWindows($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\TimeWindow::class); + $this->start_time_windows = $arr; + + return $this; + } + + /** + * Time windows during which the vehicle may arrive at its end location. + * They must be within the global time limits (see + * [ShipmentModel.global_*][google.cloud.optimization.v1.ShipmentModel.global_start_time] + * fields). If unspecified, there is no limitation besides those global time + * limits. + * Time windows belonging to the same repeated field must be disjoint, i.e. no + * time window can overlap with or be adjacent to another, and they must be in + * chronological order. + * `cost_per_hour_after_soft_end_time` and `soft_end_time` can only be set if + * there is a single time window. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.TimeWindow end_time_windows = 10; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getEndTimeWindows() + { + return $this->end_time_windows; + } + + /** + * Time windows during which the vehicle may arrive at its end location. + * They must be within the global time limits (see + * [ShipmentModel.global_*][google.cloud.optimization.v1.ShipmentModel.global_start_time] + * fields). If unspecified, there is no limitation besides those global time + * limits. + * Time windows belonging to the same repeated field must be disjoint, i.e. no + * time window can overlap with or be adjacent to another, and they must be in + * chronological order. + * `cost_per_hour_after_soft_end_time` and `soft_end_time` can only be set if + * there is a single time window. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.TimeWindow end_time_windows = 10; + * @param array<\Google\Cloud\Optimization\V1\TimeWindow>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setEndTimeWindows($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\TimeWindow::class); + $this->end_time_windows = $arr; + + return $this; + } + + /** + * Specifies a multiplicative factor that can be used to increase or decrease + * travel times of this vehicle. For example, setting this to 2.0 means + * that this vehicle is slower and has travel times that are twice what they + * are for standard vehicles. This multiple does not affect visit durations. + * It does affect cost if `cost_per_hour` or `cost_per_traveled_hour` are + * specified. This must be in the range [0.001, 1000.0]. If unset, the vehicle + * is standard, and this multiple is considered 1.0. + * WARNING: Travel times will be rounded to the nearest second after this + * multiple is applied but before performing any numerical operations, thus, + * a small multiple may result in a loss of precision. + * See also `extra_visit_duration_for_visit_type` below. + * + * Generated from protobuf field optional double travel_duration_multiple = 11; + * @return float + */ + public function getTravelDurationMultiple() + { + return isset($this->travel_duration_multiple) ? $this->travel_duration_multiple : 0.0; + } + + public function hasTravelDurationMultiple() + { + return isset($this->travel_duration_multiple); + } + + public function clearTravelDurationMultiple() + { + unset($this->travel_duration_multiple); + } + + /** + * Specifies a multiplicative factor that can be used to increase or decrease + * travel times of this vehicle. For example, setting this to 2.0 means + * that this vehicle is slower and has travel times that are twice what they + * are for standard vehicles. This multiple does not affect visit durations. + * It does affect cost if `cost_per_hour` or `cost_per_traveled_hour` are + * specified. This must be in the range [0.001, 1000.0]. If unset, the vehicle + * is standard, and this multiple is considered 1.0. + * WARNING: Travel times will be rounded to the nearest second after this + * multiple is applied but before performing any numerical operations, thus, + * a small multiple may result in a loss of precision. + * See also `extra_visit_duration_for_visit_type` below. + * + * Generated from protobuf field optional double travel_duration_multiple = 11; + * @param float $var + * @return $this + */ + public function setTravelDurationMultiple($var) + { + GPBUtil::checkDouble($var); + $this->travel_duration_multiple = $var; + + return $this; + } + + /** + * Unloading policy enforced on the vehicle. + * + * Generated from protobuf field .google.cloud.optimization.v1.Vehicle.UnloadingPolicy unloading_policy = 12; + * @return int + */ + public function getUnloadingPolicy() + { + return $this->unloading_policy; + } + + /** + * Unloading policy enforced on the vehicle. + * + * Generated from protobuf field .google.cloud.optimization.v1.Vehicle.UnloadingPolicy unloading_policy = 12; + * @param int $var + * @return $this + */ + public function setUnloadingPolicy($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Optimization\V1\Vehicle\UnloadingPolicy::class); + $this->unloading_policy = $var; + + return $this; + } + + /** + * Capacities of the vehicle (weight, volume, # of pallets for example). + * The keys in the map are the identifiers of the type of load, consistent + * with the keys of the + * [Shipment.load_demands][google.cloud.optimization.v1.Shipment.load_demands] + * field. If a given key is absent from this map, the corresponding capacity + * is considered to be limitless. + * + * Generated from protobuf field map load_limits = 30; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLoadLimits() + { + return $this->load_limits; + } + + /** + * Capacities of the vehicle (weight, volume, # of pallets for example). + * The keys in the map are the identifiers of the type of load, consistent + * with the keys of the + * [Shipment.load_demands][google.cloud.optimization.v1.Shipment.load_demands] + * field. If a given key is absent from this map, the corresponding capacity + * is considered to be limitless. + * + * Generated from protobuf field map load_limits = 30; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLoadLimits($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\Vehicle\LoadLimit::class); + $this->load_limits = $arr; + + return $this; + } + + /** + * Vehicle costs: all costs add up and must be in the same unit as + * [Shipment.penalty_cost][google.cloud.optimization.v1.Shipment.penalty_cost]. + * Cost per hour of the vehicle route. This cost is applied to the total time + * taken by the route, and includes travel time, waiting time, and visit time. + * Using `cost_per_hour` instead of just `cost_per_traveled_hour` may result + * in additional latency. + * + * Generated from protobuf field double cost_per_hour = 16; + * @return float + */ + public function getCostPerHour() + { + return $this->cost_per_hour; + } + + /** + * Vehicle costs: all costs add up and must be in the same unit as + * [Shipment.penalty_cost][google.cloud.optimization.v1.Shipment.penalty_cost]. + * Cost per hour of the vehicle route. This cost is applied to the total time + * taken by the route, and includes travel time, waiting time, and visit time. + * Using `cost_per_hour` instead of just `cost_per_traveled_hour` may result + * in additional latency. + * + * Generated from protobuf field double cost_per_hour = 16; + * @param float $var + * @return $this + */ + public function setCostPerHour($var) + { + GPBUtil::checkDouble($var); + $this->cost_per_hour = $var; + + return $this; + } + + /** + * Cost per traveled hour of the vehicle route. This cost is applied only to + * travel time taken by the route (i.e., that reported in + * [ShipmentRoute.transitions][google.cloud.optimization.v1.ShipmentRoute.transitions]), + * and excludes waiting time and visit time. + * + * Generated from protobuf field double cost_per_traveled_hour = 17; + * @return float + */ + public function getCostPerTraveledHour() + { + return $this->cost_per_traveled_hour; + } + + /** + * Cost per traveled hour of the vehicle route. This cost is applied only to + * travel time taken by the route (i.e., that reported in + * [ShipmentRoute.transitions][google.cloud.optimization.v1.ShipmentRoute.transitions]), + * and excludes waiting time and visit time. + * + * Generated from protobuf field double cost_per_traveled_hour = 17; + * @param float $var + * @return $this + */ + public function setCostPerTraveledHour($var) + { + GPBUtil::checkDouble($var); + $this->cost_per_traveled_hour = $var; + + return $this; + } + + /** + * Cost per kilometer of the vehicle route. This cost is applied to the + * distance reported in the + * [ShipmentRoute.transitions][google.cloud.optimization.v1.ShipmentRoute.transitions] + * and does not apply to any distance implicitly traveled from the + * `arrival_location` to the `departure_location` of a single `VisitRequest`. + * + * Generated from protobuf field double cost_per_kilometer = 18; + * @return float + */ + public function getCostPerKilometer() + { + return $this->cost_per_kilometer; + } + + /** + * Cost per kilometer of the vehicle route. This cost is applied to the + * distance reported in the + * [ShipmentRoute.transitions][google.cloud.optimization.v1.ShipmentRoute.transitions] + * and does not apply to any distance implicitly traveled from the + * `arrival_location` to the `departure_location` of a single `VisitRequest`. + * + * Generated from protobuf field double cost_per_kilometer = 18; + * @param float $var + * @return $this + */ + public function setCostPerKilometer($var) + { + GPBUtil::checkDouble($var); + $this->cost_per_kilometer = $var; + + return $this; + } + + /** + * Fixed cost applied if this vehicle is used to handle a shipment. + * + * Generated from protobuf field double fixed_cost = 19; + * @return float + */ + public function getFixedCost() + { + return $this->fixed_cost; + } + + /** + * Fixed cost applied if this vehicle is used to handle a shipment. + * + * Generated from protobuf field double fixed_cost = 19; + * @param float $var + * @return $this + */ + public function setFixedCost($var) + { + GPBUtil::checkDouble($var); + $this->fixed_cost = $var; + + return $this; + } + + /** + * This field only applies to vehicles when their route does not serve any + * shipments. It indicates if the vehicle should be considered as used or not + * in this case. + * If true, the vehicle goes from its start to its end location even if it + * doesn't serve any shipments, and time and distance costs resulting from its + * start --> end travel are taken into account. + * Otherwise, it doesn't travel from its start to its end location, and no + * `break_rule` or delay (from `TransitionAttributes`) are scheduled for this + * vehicle. In this case, the vehicle's `ShipmentRoute` doesn't contain any + * information except for the vehicle index and label. + * + * Generated from protobuf field bool used_if_route_is_empty = 20; + * @return bool + */ + public function getUsedIfRouteIsEmpty() + { + return $this->used_if_route_is_empty; + } + + /** + * This field only applies to vehicles when their route does not serve any + * shipments. It indicates if the vehicle should be considered as used or not + * in this case. + * If true, the vehicle goes from its start to its end location even if it + * doesn't serve any shipments, and time and distance costs resulting from its + * start --> end travel are taken into account. + * Otherwise, it doesn't travel from its start to its end location, and no + * `break_rule` or delay (from `TransitionAttributes`) are scheduled for this + * vehicle. In this case, the vehicle's `ShipmentRoute` doesn't contain any + * information except for the vehicle index and label. + * + * Generated from protobuf field bool used_if_route_is_empty = 20; + * @param bool $var + * @return $this + */ + public function setUsedIfRouteIsEmpty($var) + { + GPBUtil::checkBool($var); + $this->used_if_route_is_empty = $var; + + return $this; + } + + /** + * Limit applied to the total duration of the vehicle's route. In a given + * `OptimizeToursResponse`, the route duration of a vehicle is the + * difference between its `vehicle_end_time` and `vehicle_start_time`. + * + * Generated from protobuf field .google.cloud.optimization.v1.Vehicle.DurationLimit route_duration_limit = 21; + * @return \Google\Cloud\Optimization\V1\Vehicle\DurationLimit|null + */ + public function getRouteDurationLimit() + { + return $this->route_duration_limit; + } + + public function hasRouteDurationLimit() + { + return isset($this->route_duration_limit); + } + + public function clearRouteDurationLimit() + { + unset($this->route_duration_limit); + } + + /** + * Limit applied to the total duration of the vehicle's route. In a given + * `OptimizeToursResponse`, the route duration of a vehicle is the + * difference between its `vehicle_end_time` and `vehicle_start_time`. + * + * Generated from protobuf field .google.cloud.optimization.v1.Vehicle.DurationLimit route_duration_limit = 21; + * @param \Google\Cloud\Optimization\V1\Vehicle\DurationLimit $var + * @return $this + */ + public function setRouteDurationLimit($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Optimization\V1\Vehicle\DurationLimit::class); + $this->route_duration_limit = $var; + + return $this; + } + + /** + * Limit applied to the travel duration of the vehicle's route. In a given + * `OptimizeToursResponse`, the route travel duration is the sum of all its + * [transitions.travel_duration][google.cloud.optimization.v1.ShipmentRoute.Transition.travel_duration]. + * + * Generated from protobuf field .google.cloud.optimization.v1.Vehicle.DurationLimit travel_duration_limit = 22; + * @return \Google\Cloud\Optimization\V1\Vehicle\DurationLimit|null + */ + public function getTravelDurationLimit() + { + return $this->travel_duration_limit; + } + + public function hasTravelDurationLimit() + { + return isset($this->travel_duration_limit); + } + + public function clearTravelDurationLimit() + { + unset($this->travel_duration_limit); + } + + /** + * Limit applied to the travel duration of the vehicle's route. In a given + * `OptimizeToursResponse`, the route travel duration is the sum of all its + * [transitions.travel_duration][google.cloud.optimization.v1.ShipmentRoute.Transition.travel_duration]. + * + * Generated from protobuf field .google.cloud.optimization.v1.Vehicle.DurationLimit travel_duration_limit = 22; + * @param \Google\Cloud\Optimization\V1\Vehicle\DurationLimit $var + * @return $this + */ + public function setTravelDurationLimit($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Optimization\V1\Vehicle\DurationLimit::class); + $this->travel_duration_limit = $var; + + return $this; + } + + /** + * Limit applied to the total distance of the vehicle's route. In a given + * `OptimizeToursResponse`, the route distance is the sum of all its + * [transitions.travel_distance_meters][google.cloud.optimization.v1.ShipmentRoute.Transition.travel_distance_meters]. + * + * Generated from protobuf field .google.cloud.optimization.v1.DistanceLimit route_distance_limit = 23; + * @return \Google\Cloud\Optimization\V1\DistanceLimit|null + */ + public function getRouteDistanceLimit() + { + return $this->route_distance_limit; + } + + public function hasRouteDistanceLimit() + { + return isset($this->route_distance_limit); + } + + public function clearRouteDistanceLimit() + { + unset($this->route_distance_limit); + } + + /** + * Limit applied to the total distance of the vehicle's route. In a given + * `OptimizeToursResponse`, the route distance is the sum of all its + * [transitions.travel_distance_meters][google.cloud.optimization.v1.ShipmentRoute.Transition.travel_distance_meters]. + * + * Generated from protobuf field .google.cloud.optimization.v1.DistanceLimit route_distance_limit = 23; + * @param \Google\Cloud\Optimization\V1\DistanceLimit $var + * @return $this + */ + public function setRouteDistanceLimit($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Optimization\V1\DistanceLimit::class); + $this->route_distance_limit = $var; + + return $this; + } + + /** + * Specifies a map from visit_types strings to durations. The duration is time + * in addition to + * [VisitRequest.duration][google.cloud.optimization.v1.Shipment.VisitRequest.duration] + * to be taken at visits with the specified `visit_types`. This extra visit + * duration adds cost if `cost_per_hour` is specified. Keys (i.e. + * `visit_types`) cannot be empty strings. + * If a visit request has multiple types, a duration will be added for each + * type in the map. + * + * Generated from protobuf field map extra_visit_duration_for_visit_type = 24; + * @return \Google\Protobuf\Internal\MapField + */ + public function getExtraVisitDurationForVisitType() + { + return $this->extra_visit_duration_for_visit_type; + } + + /** + * Specifies a map from visit_types strings to durations. The duration is time + * in addition to + * [VisitRequest.duration][google.cloud.optimization.v1.Shipment.VisitRequest.duration] + * to be taken at visits with the specified `visit_types`. This extra visit + * duration adds cost if `cost_per_hour` is specified. Keys (i.e. + * `visit_types`) cannot be empty strings. + * If a visit request has multiple types, a duration will be added for each + * type in the map. + * + * Generated from protobuf field map extra_visit_duration_for_visit_type = 24; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setExtraVisitDurationForVisitType($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Duration::class); + $this->extra_visit_duration_for_visit_type = $arr; + + return $this; + } + + /** + * Describes the break schedule to be enforced on this vehicle. + * If empty, no breaks will be scheduled for this vehicle. + * + * Generated from protobuf field .google.cloud.optimization.v1.BreakRule break_rule = 25; + * @return \Google\Cloud\Optimization\V1\BreakRule|null + */ + public function getBreakRule() + { + return $this->break_rule; + } + + public function hasBreakRule() + { + return isset($this->break_rule); + } + + public function clearBreakRule() + { + unset($this->break_rule); + } + + /** + * Describes the break schedule to be enforced on this vehicle. + * If empty, no breaks will be scheduled for this vehicle. + * + * Generated from protobuf field .google.cloud.optimization.v1.BreakRule break_rule = 25; + * @param \Google\Cloud\Optimization\V1\BreakRule $var + * @return $this + */ + public function setBreakRule($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Optimization\V1\BreakRule::class); + $this->break_rule = $var; + + return $this; + } + + /** + * Specifies a label for this vehicle. This label is reported in the response + * as the `vehicle_label` of the corresponding + * [ShipmentRoute][google.cloud.optimization.v1.ShipmentRoute]. + * + * Generated from protobuf field string label = 27; + * @return string + */ + public function getLabel() + { + return $this->label; + } + + /** + * Specifies a label for this vehicle. This label is reported in the response + * as the `vehicle_label` of the corresponding + * [ShipmentRoute][google.cloud.optimization.v1.ShipmentRoute]. + * + * Generated from protobuf field string label = 27; + * @param string $var + * @return $this + */ + public function setLabel($var) + { + GPBUtil::checkString($var, True); + $this->label = $var; + + return $this; + } + + /** + * If true, `used_if_route_is_empty` must be false, and this vehicle will + * remain unused. + * If a shipment is performed by an ignored vehicle in + * `injected_first_solution_routes`, it is skipped in the first solution but + * is free to be performed in the response. + * If a shipment is performed by an ignored vehicle in + * `injected_solution_constraint` and any related pickup/delivery is + * constrained to remain on the vehicle (i.e., not relaxed to level + * `RELAX_ALL_AFTER_THRESHOLD`), it is skipped in the response. + * If a shipment has a non-empty `allowed_vehicle_indices` field and all of + * the allowed vehicles are ignored, it is skipped in the response. + * + * Generated from protobuf field bool ignore = 28; + * @return bool + */ + public function getIgnore() + { + return $this->ignore; + } + + /** + * If true, `used_if_route_is_empty` must be false, and this vehicle will + * remain unused. + * If a shipment is performed by an ignored vehicle in + * `injected_first_solution_routes`, it is skipped in the first solution but + * is free to be performed in the response. + * If a shipment is performed by an ignored vehicle in + * `injected_solution_constraint` and any related pickup/delivery is + * constrained to remain on the vehicle (i.e., not relaxed to level + * `RELAX_ALL_AFTER_THRESHOLD`), it is skipped in the response. + * If a shipment has a non-empty `allowed_vehicle_indices` field and all of + * the allowed vehicles are ignored, it is skipped in the response. + * + * Generated from protobuf field bool ignore = 28; + * @param bool $var + * @return $this + */ + public function setIgnore($var) + { + GPBUtil::checkBool($var); + $this->ignore = $var; + + return $this; + } + + /** + * Deprecated: No longer used. + * Indices in the `break_rule` field in the source + * [ShipmentModel][google.cloud.optimization.v1.ShipmentModel]. They + * correspond to break rules enforced on the vehicle. + * As of 2018/03, at most one rule index per vehicle can be specified. + * + * Generated from protobuf field repeated int32 break_rule_indices = 29 [deprecated = true]; + * @return \Google\Protobuf\Internal\RepeatedField + * @deprecated + */ + public function getBreakRuleIndices() + { + @trigger_error('break_rule_indices is deprecated.', E_USER_DEPRECATED); + return $this->break_rule_indices; + } + + /** + * Deprecated: No longer used. + * Indices in the `break_rule` field in the source + * [ShipmentModel][google.cloud.optimization.v1.ShipmentModel]. They + * correspond to break rules enforced on the vehicle. + * As of 2018/03, at most one rule index per vehicle can be specified. + * + * Generated from protobuf field repeated int32 break_rule_indices = 29 [deprecated = true]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + * @deprecated + */ + public function setBreakRuleIndices($var) + { + @trigger_error('break_rule_indices is deprecated.', E_USER_DEPRECATED); + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); + $this->break_rule_indices = $arr; + + return $this; + } + + /** + * Deprecated: Use + * [Vehicle.load_limits][google.cloud.optimization.v1.Vehicle.load_limits] + * instead. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.CapacityQuantity capacities = 13 [deprecated = true]; + * @return \Google\Protobuf\Internal\RepeatedField + * @deprecated + */ + public function getCapacities() + { + @trigger_error('capacities is deprecated.', E_USER_DEPRECATED); + return $this->capacities; + } + + /** + * Deprecated: Use + * [Vehicle.load_limits][google.cloud.optimization.v1.Vehicle.load_limits] + * instead. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.CapacityQuantity capacities = 13 [deprecated = true]; + * @param array<\Google\Cloud\Optimization\V1\CapacityQuantity>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + * @deprecated + */ + public function setCapacities($var) + { + @trigger_error('capacities is deprecated.', E_USER_DEPRECATED); + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\CapacityQuantity::class); + $this->capacities = $arr; + + return $this; + } + + /** + * Deprecated: Use + * [Vehicle.LoadLimit.start_load_interval][google.cloud.optimization.v1.Vehicle.LoadLimit.start_load_interval] + * instead. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.CapacityQuantityInterval start_load_intervals = 14 [deprecated = true]; + * @return \Google\Protobuf\Internal\RepeatedField + * @deprecated + */ + public function getStartLoadIntervals() + { + @trigger_error('start_load_intervals is deprecated.', E_USER_DEPRECATED); + return $this->start_load_intervals; + } + + /** + * Deprecated: Use + * [Vehicle.LoadLimit.start_load_interval][google.cloud.optimization.v1.Vehicle.LoadLimit.start_load_interval] + * instead. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.CapacityQuantityInterval start_load_intervals = 14 [deprecated = true]; + * @param array<\Google\Cloud\Optimization\V1\CapacityQuantityInterval>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + * @deprecated + */ + public function setStartLoadIntervals($var) + { + @trigger_error('start_load_intervals is deprecated.', E_USER_DEPRECATED); + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\CapacityQuantityInterval::class); + $this->start_load_intervals = $arr; + + return $this; + } + + /** + * Deprecated: Use + * [Vehicle.LoadLimit.end_load_interval][google.cloud.optimization.v1.Vehicle.LoadLimit.end_load_interval] + * instead. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.CapacityQuantityInterval end_load_intervals = 15 [deprecated = true]; + * @return \Google\Protobuf\Internal\RepeatedField + * @deprecated + */ + public function getEndLoadIntervals() + { + @trigger_error('end_load_intervals is deprecated.', E_USER_DEPRECATED); + return $this->end_load_intervals; + } + + /** + * Deprecated: Use + * [Vehicle.LoadLimit.end_load_interval][google.cloud.optimization.v1.Vehicle.LoadLimit.end_load_interval] + * instead. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.CapacityQuantityInterval end_load_intervals = 15 [deprecated = true]; + * @param array<\Google\Cloud\Optimization\V1\CapacityQuantityInterval>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + * @deprecated + */ + public function setEndLoadIntervals($var) + { + @trigger_error('end_load_intervals is deprecated.', E_USER_DEPRECATED); + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\CapacityQuantityInterval::class); + $this->end_load_intervals = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/Vehicle/DurationLimit.php b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/Vehicle/DurationLimit.php new file mode 100644 index 000000000000..0bfb4a37982b --- /dev/null +++ b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/Vehicle/DurationLimit.php @@ -0,0 +1,359 @@ +google.cloud.optimization.v1.Vehicle.DurationLimit + */ +class DurationLimit extends \Google\Protobuf\Internal\Message +{ + /** + * A hard limit constraining the duration to be at most max_duration. + * + * Generated from protobuf field .google.protobuf.Duration max_duration = 1; + */ + protected $max_duration = null; + /** + * A soft limit not enforcing a maximum duration limit, but when violated + * makes the route incur a cost. This cost adds up to other costs defined in + * the model, with the same unit. + * If defined, `soft_max_duration` must be nonnegative. If max_duration is + * also defined, `soft_max_duration` must be less than max_duration. + * + * Generated from protobuf field .google.protobuf.Duration soft_max_duration = 2; + */ + protected $soft_max_duration = null; + /** + * Cost per hour incurred if the `soft_max_duration` threshold is violated. + * The additional cost is 0 if the duration is under the threshold, + * otherwise the cost depends on the duration as follows: + * ``` + * cost_per_hour_after_soft_max * (duration - soft_max_duration) + * ``` + * The cost must be nonnegative. + * + * Generated from protobuf field optional double cost_per_hour_after_soft_max = 3; + */ + protected $cost_per_hour_after_soft_max = null; + /** + * A soft limit not enforcing a maximum duration limit, but when violated + * makes the route incur a cost, quadratic in the duration. This cost adds + * up to other costs defined in the model, with the same unit. + * If defined, `quadratic_soft_max_duration` must be nonnegative. If + * `max_duration` is also defined, `quadratic_soft_max_duration` must be + * less than `max_duration`, and the difference must be no larger than one + * day: + * `max_duration - quadratic_soft_max_duration <= 86400 seconds` + * + * Generated from protobuf field .google.protobuf.Duration quadratic_soft_max_duration = 4; + */ + protected $quadratic_soft_max_duration = null; + /** + * Cost per square hour incurred if the + * `quadratic_soft_max_duration` threshold is violated. + * The additional cost is 0 if the duration is under the threshold, + * otherwise the cost depends on the duration as follows: + * ``` + * cost_per_square_hour_after_quadratic_soft_max * + * (duration - quadratic_soft_max_duration)^2 + * ``` + * The cost must be nonnegative. + * + * Generated from protobuf field optional double cost_per_square_hour_after_quadratic_soft_max = 5; + */ + protected $cost_per_square_hour_after_quadratic_soft_max = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Duration $max_duration + * A hard limit constraining the duration to be at most max_duration. + * @type \Google\Protobuf\Duration $soft_max_duration + * A soft limit not enforcing a maximum duration limit, but when violated + * makes the route incur a cost. This cost adds up to other costs defined in + * the model, with the same unit. + * If defined, `soft_max_duration` must be nonnegative. If max_duration is + * also defined, `soft_max_duration` must be less than max_duration. + * @type float $cost_per_hour_after_soft_max + * Cost per hour incurred if the `soft_max_duration` threshold is violated. + * The additional cost is 0 if the duration is under the threshold, + * otherwise the cost depends on the duration as follows: + * ``` + * cost_per_hour_after_soft_max * (duration - soft_max_duration) + * ``` + * The cost must be nonnegative. + * @type \Google\Protobuf\Duration $quadratic_soft_max_duration + * A soft limit not enforcing a maximum duration limit, but when violated + * makes the route incur a cost, quadratic in the duration. This cost adds + * up to other costs defined in the model, with the same unit. + * If defined, `quadratic_soft_max_duration` must be nonnegative. If + * `max_duration` is also defined, `quadratic_soft_max_duration` must be + * less than `max_duration`, and the difference must be no larger than one + * day: + * `max_duration - quadratic_soft_max_duration <= 86400 seconds` + * @type float $cost_per_square_hour_after_quadratic_soft_max + * Cost per square hour incurred if the + * `quadratic_soft_max_duration` threshold is violated. + * The additional cost is 0 if the duration is under the threshold, + * otherwise the cost depends on the duration as follows: + * ``` + * cost_per_square_hour_after_quadratic_soft_max * + * (duration - quadratic_soft_max_duration)^2 + * ``` + * The cost must be nonnegative. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * A hard limit constraining the duration to be at most max_duration. + * + * Generated from protobuf field .google.protobuf.Duration max_duration = 1; + * @return \Google\Protobuf\Duration|null + */ + public function getMaxDuration() + { + return $this->max_duration; + } + + public function hasMaxDuration() + { + return isset($this->max_duration); + } + + public function clearMaxDuration() + { + unset($this->max_duration); + } + + /** + * A hard limit constraining the duration to be at most max_duration. + * + * Generated from protobuf field .google.protobuf.Duration max_duration = 1; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setMaxDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->max_duration = $var; + + return $this; + } + + /** + * A soft limit not enforcing a maximum duration limit, but when violated + * makes the route incur a cost. This cost adds up to other costs defined in + * the model, with the same unit. + * If defined, `soft_max_duration` must be nonnegative. If max_duration is + * also defined, `soft_max_duration` must be less than max_duration. + * + * Generated from protobuf field .google.protobuf.Duration soft_max_duration = 2; + * @return \Google\Protobuf\Duration|null + */ + public function getSoftMaxDuration() + { + return $this->soft_max_duration; + } + + public function hasSoftMaxDuration() + { + return isset($this->soft_max_duration); + } + + public function clearSoftMaxDuration() + { + unset($this->soft_max_duration); + } + + /** + * A soft limit not enforcing a maximum duration limit, but when violated + * makes the route incur a cost. This cost adds up to other costs defined in + * the model, with the same unit. + * If defined, `soft_max_duration` must be nonnegative. If max_duration is + * also defined, `soft_max_duration` must be less than max_duration. + * + * Generated from protobuf field .google.protobuf.Duration soft_max_duration = 2; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setSoftMaxDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->soft_max_duration = $var; + + return $this; + } + + /** + * Cost per hour incurred if the `soft_max_duration` threshold is violated. + * The additional cost is 0 if the duration is under the threshold, + * otherwise the cost depends on the duration as follows: + * ``` + * cost_per_hour_after_soft_max * (duration - soft_max_duration) + * ``` + * The cost must be nonnegative. + * + * Generated from protobuf field optional double cost_per_hour_after_soft_max = 3; + * @return float + */ + public function getCostPerHourAfterSoftMax() + { + return isset($this->cost_per_hour_after_soft_max) ? $this->cost_per_hour_after_soft_max : 0.0; + } + + public function hasCostPerHourAfterSoftMax() + { + return isset($this->cost_per_hour_after_soft_max); + } + + public function clearCostPerHourAfterSoftMax() + { + unset($this->cost_per_hour_after_soft_max); + } + + /** + * Cost per hour incurred if the `soft_max_duration` threshold is violated. + * The additional cost is 0 if the duration is under the threshold, + * otherwise the cost depends on the duration as follows: + * ``` + * cost_per_hour_after_soft_max * (duration - soft_max_duration) + * ``` + * The cost must be nonnegative. + * + * Generated from protobuf field optional double cost_per_hour_after_soft_max = 3; + * @param float $var + * @return $this + */ + public function setCostPerHourAfterSoftMax($var) + { + GPBUtil::checkDouble($var); + $this->cost_per_hour_after_soft_max = $var; + + return $this; + } + + /** + * A soft limit not enforcing a maximum duration limit, but when violated + * makes the route incur a cost, quadratic in the duration. This cost adds + * up to other costs defined in the model, with the same unit. + * If defined, `quadratic_soft_max_duration` must be nonnegative. If + * `max_duration` is also defined, `quadratic_soft_max_duration` must be + * less than `max_duration`, and the difference must be no larger than one + * day: + * `max_duration - quadratic_soft_max_duration <= 86400 seconds` + * + * Generated from protobuf field .google.protobuf.Duration quadratic_soft_max_duration = 4; + * @return \Google\Protobuf\Duration|null + */ + public function getQuadraticSoftMaxDuration() + { + return $this->quadratic_soft_max_duration; + } + + public function hasQuadraticSoftMaxDuration() + { + return isset($this->quadratic_soft_max_duration); + } + + public function clearQuadraticSoftMaxDuration() + { + unset($this->quadratic_soft_max_duration); + } + + /** + * A soft limit not enforcing a maximum duration limit, but when violated + * makes the route incur a cost, quadratic in the duration. This cost adds + * up to other costs defined in the model, with the same unit. + * If defined, `quadratic_soft_max_duration` must be nonnegative. If + * `max_duration` is also defined, `quadratic_soft_max_duration` must be + * less than `max_duration`, and the difference must be no larger than one + * day: + * `max_duration - quadratic_soft_max_duration <= 86400 seconds` + * + * Generated from protobuf field .google.protobuf.Duration quadratic_soft_max_duration = 4; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setQuadraticSoftMaxDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->quadratic_soft_max_duration = $var; + + return $this; + } + + /** + * Cost per square hour incurred if the + * `quadratic_soft_max_duration` threshold is violated. + * The additional cost is 0 if the duration is under the threshold, + * otherwise the cost depends on the duration as follows: + * ``` + * cost_per_square_hour_after_quadratic_soft_max * + * (duration - quadratic_soft_max_duration)^2 + * ``` + * The cost must be nonnegative. + * + * Generated from protobuf field optional double cost_per_square_hour_after_quadratic_soft_max = 5; + * @return float + */ + public function getCostPerSquareHourAfterQuadraticSoftMax() + { + return isset($this->cost_per_square_hour_after_quadratic_soft_max) ? $this->cost_per_square_hour_after_quadratic_soft_max : 0.0; + } + + public function hasCostPerSquareHourAfterQuadraticSoftMax() + { + return isset($this->cost_per_square_hour_after_quadratic_soft_max); + } + + public function clearCostPerSquareHourAfterQuadraticSoftMax() + { + unset($this->cost_per_square_hour_after_quadratic_soft_max); + } + + /** + * Cost per square hour incurred if the + * `quadratic_soft_max_duration` threshold is violated. + * The additional cost is 0 if the duration is under the threshold, + * otherwise the cost depends on the duration as follows: + * ``` + * cost_per_square_hour_after_quadratic_soft_max * + * (duration - quadratic_soft_max_duration)^2 + * ``` + * The cost must be nonnegative. + * + * Generated from protobuf field optional double cost_per_square_hour_after_quadratic_soft_max = 5; + * @param float $var + * @return $this + */ + public function setCostPerSquareHourAfterQuadraticSoftMax($var) + { + GPBUtil::checkDouble($var); + $this->cost_per_square_hour_after_quadratic_soft_max = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(DurationLimit::class, \Google\Cloud\Optimization\V1\Vehicle_DurationLimit::class); + diff --git a/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/Vehicle/LoadLimit.php b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/Vehicle/LoadLimit.php new file mode 100644 index 000000000000..6f2a88d5ecac --- /dev/null +++ b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/Vehicle/LoadLimit.php @@ -0,0 +1,270 @@ +google.cloud.optimization.v1.Vehicle.LoadLimit + */ +class LoadLimit extends \Google\Protobuf\Internal\Message +{ + /** + * The maximum acceptable amount of load. + * + * Generated from protobuf field optional int64 max_load = 1; + */ + protected $max_load = null; + /** + * A soft limit of the load. See + * [cost_per_unit_above_soft_max][google.cloud.optimization.v1.Vehicle.LoadLimit.cost_per_unit_above_soft_max]. + * + * Generated from protobuf field int64 soft_max_load = 2; + */ + protected $soft_max_load = 0; + /** + * If the load ever exceeds + * [soft_max_load][google.cloud.optimization.v1.Vehicle.LoadLimit.soft_max_load] + * along this vehicle's route, the following cost penalty applies (only once + * per vehicle): (load - + * [soft_max_load][google.cloud.optimization.v1.Vehicle.LoadLimit.soft_max_load]) + * * [cost_per_unit_above_soft_max][google.cloud.optimization.v1.Vehicle.LoadLimit.cost_per_unit_above_soft_max]. All costs + * add up and must be in the same unit as + * [Shipment.penalty_cost][google.cloud.optimization.v1.Shipment.penalty_cost]. + * + * Generated from protobuf field double cost_per_unit_above_soft_max = 3; + */ + protected $cost_per_unit_above_soft_max = 0.0; + /** + * The acceptable load interval of the vehicle at the start of the route. + * + * Generated from protobuf field .google.cloud.optimization.v1.Vehicle.LoadLimit.Interval start_load_interval = 4; + */ + protected $start_load_interval = null; + /** + * The acceptable load interval of the vehicle at the end of the route. + * + * Generated from protobuf field .google.cloud.optimization.v1.Vehicle.LoadLimit.Interval end_load_interval = 5; + */ + protected $end_load_interval = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int|string $max_load + * The maximum acceptable amount of load. + * @type int|string $soft_max_load + * A soft limit of the load. See + * [cost_per_unit_above_soft_max][google.cloud.optimization.v1.Vehicle.LoadLimit.cost_per_unit_above_soft_max]. + * @type float $cost_per_unit_above_soft_max + * If the load ever exceeds + * [soft_max_load][google.cloud.optimization.v1.Vehicle.LoadLimit.soft_max_load] + * along this vehicle's route, the following cost penalty applies (only once + * per vehicle): (load - + * [soft_max_load][google.cloud.optimization.v1.Vehicle.LoadLimit.soft_max_load]) + * * [cost_per_unit_above_soft_max][google.cloud.optimization.v1.Vehicle.LoadLimit.cost_per_unit_above_soft_max]. All costs + * add up and must be in the same unit as + * [Shipment.penalty_cost][google.cloud.optimization.v1.Shipment.penalty_cost]. + * @type \Google\Cloud\Optimization\V1\Vehicle\LoadLimit\Interval $start_load_interval + * The acceptable load interval of the vehicle at the start of the route. + * @type \Google\Cloud\Optimization\V1\Vehicle\LoadLimit\Interval $end_load_interval + * The acceptable load interval of the vehicle at the end of the route. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * The maximum acceptable amount of load. + * + * Generated from protobuf field optional int64 max_load = 1; + * @return int|string + */ + public function getMaxLoad() + { + return isset($this->max_load) ? $this->max_load : 0; + } + + public function hasMaxLoad() + { + return isset($this->max_load); + } + + public function clearMaxLoad() + { + unset($this->max_load); + } + + /** + * The maximum acceptable amount of load. + * + * Generated from protobuf field optional int64 max_load = 1; + * @param int|string $var + * @return $this + */ + public function setMaxLoad($var) + { + GPBUtil::checkInt64($var); + $this->max_load = $var; + + return $this; + } + + /** + * A soft limit of the load. See + * [cost_per_unit_above_soft_max][google.cloud.optimization.v1.Vehicle.LoadLimit.cost_per_unit_above_soft_max]. + * + * Generated from protobuf field int64 soft_max_load = 2; + * @return int|string + */ + public function getSoftMaxLoad() + { + return $this->soft_max_load; + } + + /** + * A soft limit of the load. See + * [cost_per_unit_above_soft_max][google.cloud.optimization.v1.Vehicle.LoadLimit.cost_per_unit_above_soft_max]. + * + * Generated from protobuf field int64 soft_max_load = 2; + * @param int|string $var + * @return $this + */ + public function setSoftMaxLoad($var) + { + GPBUtil::checkInt64($var); + $this->soft_max_load = $var; + + return $this; + } + + /** + * If the load ever exceeds + * [soft_max_load][google.cloud.optimization.v1.Vehicle.LoadLimit.soft_max_load] + * along this vehicle's route, the following cost penalty applies (only once + * per vehicle): (load - + * [soft_max_load][google.cloud.optimization.v1.Vehicle.LoadLimit.soft_max_load]) + * * [cost_per_unit_above_soft_max][google.cloud.optimization.v1.Vehicle.LoadLimit.cost_per_unit_above_soft_max]. All costs + * add up and must be in the same unit as + * [Shipment.penalty_cost][google.cloud.optimization.v1.Shipment.penalty_cost]. + * + * Generated from protobuf field double cost_per_unit_above_soft_max = 3; + * @return float + */ + public function getCostPerUnitAboveSoftMax() + { + return $this->cost_per_unit_above_soft_max; + } + + /** + * If the load ever exceeds + * [soft_max_load][google.cloud.optimization.v1.Vehicle.LoadLimit.soft_max_load] + * along this vehicle's route, the following cost penalty applies (only once + * per vehicle): (load - + * [soft_max_load][google.cloud.optimization.v1.Vehicle.LoadLimit.soft_max_load]) + * * [cost_per_unit_above_soft_max][google.cloud.optimization.v1.Vehicle.LoadLimit.cost_per_unit_above_soft_max]. All costs + * add up and must be in the same unit as + * [Shipment.penalty_cost][google.cloud.optimization.v1.Shipment.penalty_cost]. + * + * Generated from protobuf field double cost_per_unit_above_soft_max = 3; + * @param float $var + * @return $this + */ + public function setCostPerUnitAboveSoftMax($var) + { + GPBUtil::checkDouble($var); + $this->cost_per_unit_above_soft_max = $var; + + return $this; + } + + /** + * The acceptable load interval of the vehicle at the start of the route. + * + * Generated from protobuf field .google.cloud.optimization.v1.Vehicle.LoadLimit.Interval start_load_interval = 4; + * @return \Google\Cloud\Optimization\V1\Vehicle\LoadLimit\Interval|null + */ + public function getStartLoadInterval() + { + return $this->start_load_interval; + } + + public function hasStartLoadInterval() + { + return isset($this->start_load_interval); + } + + public function clearStartLoadInterval() + { + unset($this->start_load_interval); + } + + /** + * The acceptable load interval of the vehicle at the start of the route. + * + * Generated from protobuf field .google.cloud.optimization.v1.Vehicle.LoadLimit.Interval start_load_interval = 4; + * @param \Google\Cloud\Optimization\V1\Vehicle\LoadLimit\Interval $var + * @return $this + */ + public function setStartLoadInterval($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Optimization\V1\Vehicle\LoadLimit\Interval::class); + $this->start_load_interval = $var; + + return $this; + } + + /** + * The acceptable load interval of the vehicle at the end of the route. + * + * Generated from protobuf field .google.cloud.optimization.v1.Vehicle.LoadLimit.Interval end_load_interval = 5; + * @return \Google\Cloud\Optimization\V1\Vehicle\LoadLimit\Interval|null + */ + public function getEndLoadInterval() + { + return $this->end_load_interval; + } + + public function hasEndLoadInterval() + { + return isset($this->end_load_interval); + } + + public function clearEndLoadInterval() + { + unset($this->end_load_interval); + } + + /** + * The acceptable load interval of the vehicle at the end of the route. + * + * Generated from protobuf field .google.cloud.optimization.v1.Vehicle.LoadLimit.Interval end_load_interval = 5; + * @param \Google\Cloud\Optimization\V1\Vehicle\LoadLimit\Interval $var + * @return $this + */ + public function setEndLoadInterval($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Optimization\V1\Vehicle\LoadLimit\Interval::class); + $this->end_load_interval = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(LoadLimit::class, \Google\Cloud\Optimization\V1\Vehicle_LoadLimit::class); + diff --git a/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/Vehicle/LoadLimit/Interval.php b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/Vehicle/LoadLimit/Interval.php new file mode 100644 index 000000000000..18061c0b196f --- /dev/null +++ b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/Vehicle/LoadLimit/Interval.php @@ -0,0 +1,150 @@ +google.cloud.optimization.v1.Vehicle.LoadLimit.Interval + */ +class Interval extends \Google\Protobuf\Internal\Message +{ + /** + * A minimum acceptable load. Must be ≥ 0. + * If they're both specified, + * [min][google.cloud.optimization.v1.Vehicle.LoadLimit.Interval.min] must + * be ≤ + * [max][google.cloud.optimization.v1.Vehicle.LoadLimit.Interval.max]. + * + * Generated from protobuf field int64 min = 1; + */ + protected $min = 0; + /** + * A maximum acceptable load. Must be ≥ 0. If unspecified, the maximum + * load is unrestricted by this message. + * If they're both specified, + * [min][google.cloud.optimization.v1.Vehicle.LoadLimit.Interval.min] must + * be ≤ + * [max][google.cloud.optimization.v1.Vehicle.LoadLimit.Interval.max]. + * + * Generated from protobuf field optional int64 max = 2; + */ + protected $max = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int|string $min + * A minimum acceptable load. Must be ≥ 0. + * If they're both specified, + * [min][google.cloud.optimization.v1.Vehicle.LoadLimit.Interval.min] must + * be ≤ + * [max][google.cloud.optimization.v1.Vehicle.LoadLimit.Interval.max]. + * @type int|string $max + * A maximum acceptable load. Must be ≥ 0. If unspecified, the maximum + * load is unrestricted by this message. + * If they're both specified, + * [min][google.cloud.optimization.v1.Vehicle.LoadLimit.Interval.min] must + * be ≤ + * [max][google.cloud.optimization.v1.Vehicle.LoadLimit.Interval.max]. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * A minimum acceptable load. Must be ≥ 0. + * If they're both specified, + * [min][google.cloud.optimization.v1.Vehicle.LoadLimit.Interval.min] must + * be ≤ + * [max][google.cloud.optimization.v1.Vehicle.LoadLimit.Interval.max]. + * + * Generated from protobuf field int64 min = 1; + * @return int|string + */ + public function getMin() + { + return $this->min; + } + + /** + * A minimum acceptable load. Must be ≥ 0. + * If they're both specified, + * [min][google.cloud.optimization.v1.Vehicle.LoadLimit.Interval.min] must + * be ≤ + * [max][google.cloud.optimization.v1.Vehicle.LoadLimit.Interval.max]. + * + * Generated from protobuf field int64 min = 1; + * @param int|string $var + * @return $this + */ + public function setMin($var) + { + GPBUtil::checkInt64($var); + $this->min = $var; + + return $this; + } + + /** + * A maximum acceptable load. Must be ≥ 0. If unspecified, the maximum + * load is unrestricted by this message. + * If they're both specified, + * [min][google.cloud.optimization.v1.Vehicle.LoadLimit.Interval.min] must + * be ≤ + * [max][google.cloud.optimization.v1.Vehicle.LoadLimit.Interval.max]. + * + * Generated from protobuf field optional int64 max = 2; + * @return int|string + */ + public function getMax() + { + return isset($this->max) ? $this->max : 0; + } + + public function hasMax() + { + return isset($this->max); + } + + public function clearMax() + { + unset($this->max); + } + + /** + * A maximum acceptable load. Must be ≥ 0. If unspecified, the maximum + * load is unrestricted by this message. + * If they're both specified, + * [min][google.cloud.optimization.v1.Vehicle.LoadLimit.Interval.min] must + * be ≤ + * [max][google.cloud.optimization.v1.Vehicle.LoadLimit.Interval.max]. + * + * Generated from protobuf field optional int64 max = 2; + * @param int|string $var + * @return $this + */ + public function setMax($var) + { + GPBUtil::checkInt64($var); + $this->max = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Interval::class, \Google\Cloud\Optimization\V1\Vehicle_LoadLimit_Interval::class); + diff --git a/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/Vehicle/TravelMode.php b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/Vehicle/TravelMode.php new file mode 100644 index 000000000000..1abc19203f74 --- /dev/null +++ b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/Vehicle/TravelMode.php @@ -0,0 +1,60 @@ +google.cloud.optimization.v1.Vehicle.TravelMode + */ +class TravelMode +{ + /** + * Unspecified travel mode, equivalent to `DRIVING`. + * + * Generated from protobuf enum TRAVEL_MODE_UNSPECIFIED = 0; + */ + const TRAVEL_MODE_UNSPECIFIED = 0; + /** + * Travel mode corresponding to driving directions (car, ...). + * + * Generated from protobuf enum DRIVING = 1; + */ + const DRIVING = 1; + + private static $valueToName = [ + self::TRAVEL_MODE_UNSPECIFIED => 'TRAVEL_MODE_UNSPECIFIED', + self::DRIVING => 'DRIVING', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(TravelMode::class, \Google\Cloud\Optimization\V1\Vehicle_TravelMode::class); + diff --git a/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/Vehicle/UnloadingPolicy.php b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/Vehicle/UnloadingPolicy.php new file mode 100644 index 000000000000..eaee7ca2ca7c --- /dev/null +++ b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/Vehicle/UnloadingPolicy.php @@ -0,0 +1,68 @@ +google.cloud.optimization.v1.Vehicle.UnloadingPolicy + */ +class UnloadingPolicy +{ + /** + * Unspecified unloading policy; deliveries must just occur after their + * corresponding pickups. + * + * Generated from protobuf enum UNLOADING_POLICY_UNSPECIFIED = 0; + */ + const UNLOADING_POLICY_UNSPECIFIED = 0; + /** + * Deliveries must occur in reverse order of pickups + * + * Generated from protobuf enum LAST_IN_FIRST_OUT = 1; + */ + const LAST_IN_FIRST_OUT = 1; + /** + * Deliveries must occur in the same order as pickups + * + * Generated from protobuf enum FIRST_IN_FIRST_OUT = 2; + */ + const FIRST_IN_FIRST_OUT = 2; + + private static $valueToName = [ + self::UNLOADING_POLICY_UNSPECIFIED => 'UNLOADING_POLICY_UNSPECIFIED', + self::LAST_IN_FIRST_OUT => 'LAST_IN_FIRST_OUT', + self::FIRST_IN_FIRST_OUT => 'FIRST_IN_FIRST_OUT', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(UnloadingPolicy::class, \Google\Cloud\Optimization\V1\Vehicle_UnloadingPolicy::class); + diff --git a/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/Vehicle_DurationLimit.php b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/Vehicle_DurationLimit.php new file mode 100644 index 000000000000..d3d03b621ccf --- /dev/null +++ b/owl-bot-staging/Optimization/v1/proto/src/Google/Cloud/Optimization/V1/Vehicle_DurationLimit.php @@ -0,0 +1,16 @@ +google.cloud.optimization.v1.Waypoint + */ +class Waypoint extends \Google\Protobuf\Internal\Message +{ + /** + * Indicates that the location of this waypoint is meant to have a preference + * for the vehicle to stop at a particular side of road. When you set this + * value, the route will pass through the location so that the vehicle can + * stop at the side of road that the location is biased towards from the + * center of the road. This option works only for the 'DRIVING' travel mode, + * and when the 'location_type' is set to 'location'. + * + * Generated from protobuf field bool side_of_road = 3; + */ + protected $side_of_road = false; + protected $location_type; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Optimization\V1\Location $location + * A point specified using geographic coordinates, including an optional + * heading. + * @type string $place_id + * The POI Place ID associated with the waypoint. + * @type bool $side_of_road + * Indicates that the location of this waypoint is meant to have a preference + * for the vehicle to stop at a particular side of road. When you set this + * value, the route will pass through the location so that the vehicle can + * stop at the side of road that the location is biased towards from the + * center of the road. This option works only for the 'DRIVING' travel mode, + * and when the 'location_type' is set to 'location'. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * A point specified using geographic coordinates, including an optional + * heading. + * + * Generated from protobuf field .google.cloud.optimization.v1.Location location = 1; + * @return \Google\Cloud\Optimization\V1\Location|null + */ + public function getLocation() + { + return $this->readOneof(1); + } + + public function hasLocation() + { + return $this->hasOneof(1); + } + + /** + * A point specified using geographic coordinates, including an optional + * heading. + * + * Generated from protobuf field .google.cloud.optimization.v1.Location location = 1; + * @param \Google\Cloud\Optimization\V1\Location $var + * @return $this + */ + public function setLocation($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Optimization\V1\Location::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * The POI Place ID associated with the waypoint. + * + * Generated from protobuf field string place_id = 2; + * @return string + */ + public function getPlaceId() + { + return $this->readOneof(2); + } + + public function hasPlaceId() + { + return $this->hasOneof(2); + } + + /** + * The POI Place ID associated with the waypoint. + * + * Generated from protobuf field string place_id = 2; + * @param string $var + * @return $this + */ + public function setPlaceId($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * Indicates that the location of this waypoint is meant to have a preference + * for the vehicle to stop at a particular side of road. When you set this + * value, the route will pass through the location so that the vehicle can + * stop at the side of road that the location is biased towards from the + * center of the road. This option works only for the 'DRIVING' travel mode, + * and when the 'location_type' is set to 'location'. + * + * Generated from protobuf field bool side_of_road = 3; + * @return bool + */ + public function getSideOfRoad() + { + return $this->side_of_road; + } + + /** + * Indicates that the location of this waypoint is meant to have a preference + * for the vehicle to stop at a particular side of road. When you set this + * value, the route will pass through the location so that the vehicle can + * stop at the side of road that the location is biased towards from the + * center of the road. This option works only for the 'DRIVING' travel mode, + * and when the 'location_type' is set to 'location'. + * + * Generated from protobuf field bool side_of_road = 3; + * @param bool $var + * @return $this + */ + public function setSideOfRoad($var) + { + GPBUtil::checkBool($var); + $this->side_of_road = $var; + + return $this; + } + + /** + * @return string + */ + public function getLocationType() + { + return $this->whichOneof("location_type"); + } + +} + diff --git a/owl-bot-staging/Optimization/v1/samples/V1/FleetRoutingClient/batch_optimize_tours.php b/owl-bot-staging/Optimization/v1/samples/V1/FleetRoutingClient/batch_optimize_tours.php new file mode 100644 index 000000000000..98b5d59d9f7b --- /dev/null +++ b/owl-bot-staging/Optimization/v1/samples/V1/FleetRoutingClient/batch_optimize_tours.php @@ -0,0 +1,105 @@ +setInputConfig($modelConfigsInputConfig) + ->setOutputConfig($modelConfigsOutputConfig); + $modelConfigs = [$asyncModelConfig,]; + $request = (new BatchOptimizeToursRequest()) + ->setParent($parent) + ->setModelConfigs($modelConfigs); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $fleetRoutingClient->batchOptimizeTours($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var BatchOptimizeToursResponse $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 +{ + $parent = '[PARENT]'; + + batch_optimize_tours_sample($parent); +} +// [END cloudoptimization_v1_generated_FleetRouting_BatchOptimizeTours_sync] diff --git a/owl-bot-staging/Optimization/v1/samples/V1/FleetRoutingClient/optimize_tours.php b/owl-bot-staging/Optimization/v1/samples/V1/FleetRoutingClient/optimize_tours.php new file mode 100644 index 000000000000..c10a01e49737 --- /dev/null +++ b/owl-bot-staging/Optimization/v1/samples/V1/FleetRoutingClient/optimize_tours.php @@ -0,0 +1,87 @@ +setParent($parent); + + // Call the API and handle any network failures. + try { + /** @var OptimizeToursResponse $response */ + $response = $fleetRoutingClient->optimizeTours($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 +{ + $parent = '[PARENT]'; + + optimize_tours_sample($parent); +} +// [END cloudoptimization_v1_generated_FleetRouting_OptimizeTours_sync] diff --git a/owl-bot-staging/Optimization/v1/src/V1/Client/BaseClient/FleetRoutingBaseClient.php b/owl-bot-staging/Optimization/v1/src/V1/Client/BaseClient/FleetRoutingBaseClient.php new file mode 100644 index 000000000000..1d0e85151b6c --- /dev/null +++ b/owl-bot-staging/Optimization/v1/src/V1/Client/BaseClient/FleetRoutingBaseClient.php @@ -0,0 +1,286 @@ + self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../../resources/fleet_routing_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../../resources/fleet_routing_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../../resources/fleet_routing_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../../resources/fleet_routing_rest_client_config.php', + ], + ], + ]; + } + + /** + * 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; + } + + /** + * 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 'cloudoptimization.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. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *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' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods 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); + } + + /** + * Optimizes vehicle tours for one or more `OptimizeToursRequest` + * messages as a batch. + * + * This method is a Long Running Operation (LRO). The inputs for optimization + * (`OptimizeToursRequest` messages) and outputs (`OptimizeToursResponse` + * messages) are read/written from/to Cloud Storage in user-specified + * format. Like the `OptimizeTours` method, each `OptimizeToursRequest` + * contains a `ShipmentModel` and returns an `OptimizeToursResponse` + * containing `ShipmentRoute`s, which are a set of routes to be performed by + * vehicles minimizing the overall cost. + * + * The async variant is {@see self::batchOptimizeToursAsync()} . + * + * @param BatchOptimizeToursRequest $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 batchOptimizeTours(BatchOptimizeToursRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('BatchOptimizeTours', $request, $callOptions)->wait(); + } + + /** + * Sends an `OptimizeToursRequest` containing a `ShipmentModel` and returns an + * `OptimizeToursResponse` containing `ShipmentRoute`s, which are a set of + * routes to be performed by vehicles minimizing the overall cost. + * + * A `ShipmentModel` model consists mainly of `Shipment`s that need to be + * carried out and `Vehicle`s that can be used to transport the `Shipment`s. + * The `ShipmentRoute`s assign `Shipment`s to `Vehicle`s. More specifically, + * they assign a series of `Visit`s to each vehicle, where a `Visit` + * corresponds to a `VisitRequest`, which is a pickup or delivery for a + * `Shipment`. + * + * The goal is to provide an assignment of `ShipmentRoute`s to `Vehicle`s that + * minimizes the total cost where cost has many components defined in the + * `ShipmentModel`. + * + * The async variant is {@see self::optimizeToursAsync()} . + * + * @param OptimizeToursRequest $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 OptimizeToursResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function optimizeTours(OptimizeToursRequest $request, array $callOptions = []): OptimizeToursResponse + { + return $this->startApiCall('OptimizeTours', $request, $callOptions)->wait(); + } +} diff --git a/owl-bot-staging/Optimization/v1/src/V1/Client/FleetRoutingClient.php b/owl-bot-staging/Optimization/v1/src/V1/Client/FleetRoutingClient.php new file mode 100644 index 000000000000..c830867e8ca7 --- /dev/null +++ b/owl-bot-staging/Optimization/v1/src/V1/Client/FleetRoutingClient.php @@ -0,0 +1,40 @@ +batchOptimizeTours($parent, $modelConfigs); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $fleetRoutingClient->batchOptimizeTours($parent, $modelConfigs); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $fleetRoutingClient->resumeOperation($operationName, 'batchOptimizeTours'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $fleetRoutingClient->close(); + * } + * ``` + */ +class FleetRoutingGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.optimization.v1.FleetRouting'; + + /** The default address of the service. */ + const SERVICE_ADDRESS = 'cloudoptimization.googleapis.com'; + + /** The default port of the service. */ + const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + ]; + + private $operationsClient; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/fleet_routing_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/fleet_routing_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/fleet_routing_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/fleet_routing_rest_client_config.php', + ], + ], + ]; + } + + /** + * 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; + } + + /** + * 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 'cloudoptimization.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. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *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' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods 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); + } + + /** + * Optimizes vehicle tours for one or more `OptimizeToursRequest` + * messages as a batch. + * + * This method is a Long Running Operation (LRO). The inputs for optimization + * (`OptimizeToursRequest` messages) and outputs (`OptimizeToursResponse` + * messages) are read/written from/to Cloud Storage in user-specified + * format. Like the `OptimizeTours` method, each `OptimizeToursRequest` + * contains a `ShipmentModel` and returns an `OptimizeToursResponse` + * containing `ShipmentRoute`s, which are a set of routes to be performed by + * vehicles minimizing the overall cost. + * + * Sample code: + * ``` + * $fleetRoutingClient = new FleetRoutingClient(); + * try { + * $parent = 'parent'; + * $modelConfigs = []; + * $operationResponse = $fleetRoutingClient->batchOptimizeTours($parent, $modelConfigs); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $fleetRoutingClient->batchOptimizeTours($parent, $modelConfigs); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $fleetRoutingClient->resumeOperation($operationName, 'batchOptimizeTours'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $fleetRoutingClient->close(); + * } + * ``` + * + * @param string $parent Required. Target project and location to make a call. + * + * Format: `projects/{project-id}/locations/{location-id}`. + * + * If no location is specified, a region will be chosen automatically. + * @param AsyncModelConfig[] $modelConfigs Required. Input/Output information each purchase model, such as file paths + * and data formats. + * @param array $optionalArgs { + * 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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function batchOptimizeTours($parent, $modelConfigs, array $optionalArgs = []) + { + $request = new BatchOptimizeToursRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setModelConfigs($modelConfigs); + $requestParamHeaders['parent'] = $parent; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('BatchOptimizeTours', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Sends an `OptimizeToursRequest` containing a `ShipmentModel` and returns an + * `OptimizeToursResponse` containing `ShipmentRoute`s, which are a set of + * routes to be performed by vehicles minimizing the overall cost. + * + * A `ShipmentModel` model consists mainly of `Shipment`s that need to be + * carried out and `Vehicle`s that can be used to transport the `Shipment`s. + * The `ShipmentRoute`s assign `Shipment`s to `Vehicle`s. More specifically, + * they assign a series of `Visit`s to each vehicle, where a `Visit` + * corresponds to a `VisitRequest`, which is a pickup or delivery for a + * `Shipment`. + * + * The goal is to provide an assignment of `ShipmentRoute`s to `Vehicle`s that + * minimizes the total cost where cost has many components defined in the + * `ShipmentModel`. + * + * Sample code: + * ``` + * $fleetRoutingClient = new FleetRoutingClient(); + * try { + * $parent = 'parent'; + * $response = $fleetRoutingClient->optimizeTours($parent); + * } finally { + * $fleetRoutingClient->close(); + * } + * ``` + * + * @param string $parent Required. Target project and location to make a call. + * + * Format: `projects/{project-id}/locations/{location-id}`. + * + * If no location is specified, a region will be chosen automatically. + * @param array $optionalArgs { + * Optional. + * + * @type Duration $timeout + * If this timeout is set, the server returns a response before the timeout + * period has elapsed or the server deadline for synchronous requests is + * reached, whichever is sooner. + * + * For asynchronous requests, the server will generate a solution (if + * possible) before the timeout has elapsed. + * @type ShipmentModel $model + * Shipment model to solve. + * @type int $solvingMode + * By default, the solving mode is `DEFAULT_SOLVE` (0). + * For allowed values, use constants defined on {@see \Google\Cloud\Optimization\V1\OptimizeToursRequest\SolvingMode} + * @type int $maxValidationErrors + * Truncates the number of validation errors returned. These errors are + * typically attached to an INVALID_ARGUMENT error payload as a BadRequest + * error detail (https://cloud.google.com/apis/design/errors#error_details), + * unless solving_mode=VALIDATE_ONLY: see the + * [OptimizeToursResponse.validation_errors][google.cloud.optimization.v1.OptimizeToursResponse.validation_errors] + * field. + * This defaults to 100 and is capped at 10,000. + * @type int $searchMode + * Search mode used to solve the request. + * For allowed values, use constants defined on {@see \Google\Cloud\Optimization\V1\OptimizeToursRequest\SearchMode} + * @type ShipmentRoute[] $injectedFirstSolutionRoutes + * Guide the optimization algorithm in finding a first solution that is + * similar to a previous solution. + * + * The model is constrained when the first solution is built. + * Any shipments not performed on a route are implicitly skipped in the first + * solution, but they may be performed in successive solutions. + * + * The solution must satisfy some basic validity assumptions: + * + * * for all routes, `vehicle_index` must be in range and not be duplicated. + * * for all visits, `shipment_index` and `visit_request_index` must be + * in range. + * * a shipment may only be referenced on one route. + * * the pickup of a pickup-delivery shipment must be performed before + * the delivery. + * * no more than one pickup alternative or delivery alternative of + * a shipment may be performed. + * * for all routes, times are increasing (i.e., `vehicle_start_time + * <= visits[0].start_time <= visits[1].start_time ... + * <= vehicle_end_time`). + * * a shipment may only be performed on a vehicle that is allowed. A + * vehicle is allowed if + * [Shipment.allowed_vehicle_indices][google.cloud.optimization.v1.Shipment.allowed_vehicle_indices] + * is empty or its `vehicle_index` is included in + * [Shipment.allowed_vehicle_indices][google.cloud.optimization.v1.Shipment.allowed_vehicle_indices]. + * + * If the injected solution is not feasible, a validation error is not + * necessarily returned and an error indicating infeasibility may be returned + * instead. + * @type InjectedSolutionConstraint $injectedSolutionConstraint + * Constrain the optimization algorithm to find a final solution that is + * similar to a previous solution. For example, this may be used to freeze + * portions of routes which have already been completed or which are to be + * completed but must not be modified. + * + * If the injected solution is not feasible, a validation error is not + * necessarily returned and an error indicating infeasibility may be returned + * instead. + * @type ShipmentRoute[] $refreshDetailsRoutes + * If non-empty, the given routes will be refreshed, without modifying their + * underlying sequence of visits or travel times: only other details will be + * updated. This does not solve the model. + * + * As of 2020/11, this only populates the polylines of non-empty routes and + * requires that `populate_polylines` is true. + * + * The `route_polyline` fields of the passed-in routes may be inconsistent + * with route `transitions`. + * + * This field must not be used together with `injected_first_solution_routes` + * or `injected_solution_constraint`. + * + * `Shipment.ignore` and `Vehicle.ignore` have no effect on the behavior. + * Polylines are still populated between all visits in all non-empty routes + * regardless of whether the related shipments or vehicles are ignored. + * @type bool $interpretInjectedSolutionsUsingLabels + * If true: + * + * * uses + * [ShipmentRoute.vehicle_label][google.cloud.optimization.v1.ShipmentRoute.vehicle_label] + * instead of `vehicle_index` to + * match routes in an injected solution with vehicles in the request; + * reuses the mapping of original + * [ShipmentRoute.vehicle_index][google.cloud.optimization.v1.ShipmentRoute.vehicle_index] + * to new + * [ShipmentRoute.vehicle_index][google.cloud.optimization.v1.ShipmentRoute.vehicle_index] + * to update + * [ConstraintRelaxation.vehicle_indices][google.cloud.optimization.v1.InjectedSolutionConstraint.ConstraintRelaxation.vehicle_indices] + * if non-empty, but the mapping must be unambiguous (i.e., multiple + * `ShipmentRoute`s must not share the same original `vehicle_index`). + * * uses + * [ShipmentRoute.Visit.shipment_label][google.cloud.optimization.v1.ShipmentRoute.Visit.shipment_label] + * instead of `shipment_index` + * to match visits in an injected solution with shipments in the request; + * * uses + * [SkippedShipment.label][google.cloud.optimization.v1.SkippedShipment.label] + * instead of + * [SkippedShipment.index][google.cloud.optimization.v1.SkippedShipment.index] + * to + * match skipped shipments in the injected solution with request + * shipments. + * + * This interpretation applies to the `injected_first_solution_routes`, + * `injected_solution_constraint`, and `refresh_details_routes` fields. + * It can be used when shipment or vehicle indices in the request have + * changed since the solution was created, perhaps because shipments or + * vehicles have been removed from or added to the request. + * + * If true, labels in the following categories must appear at most once in + * their category: + * + * * [Vehicle.label][google.cloud.optimization.v1.Vehicle.label] in the + * request; + * * [Shipment.label][google.cloud.optimization.v1.Shipment.label] in the + * request; + * * [ShipmentRoute.vehicle_label][google.cloud.optimization.v1.ShipmentRoute.vehicle_label] in the injected solution; + * * [SkippedShipment.label][google.cloud.optimization.v1.SkippedShipment.label] and [ShipmentRoute.Visit.shipment_label][google.cloud.optimization.v1.ShipmentRoute.Visit.shipment_label] in + * the injected solution (except pickup/delivery visit pairs, whose + * `shipment_label` must appear twice). + * + * If a `vehicle_label` in the injected solution does not correspond to a + * request vehicle, the corresponding route is removed from the solution + * along with its visits. If a `shipment_label` in the injected solution does + * not correspond to a request shipment, the corresponding visit is removed + * from the solution. If a + * [SkippedShipment.label][google.cloud.optimization.v1.SkippedShipment.label] + * in the injected solution does not correspond to a request shipment, the + * `SkippedShipment` is removed from the solution. + * + * Removing route visits or entire routes from an injected solution may + * have an effect on the implied constraints, which may lead to change in + * solution, validation errors, or infeasibility. + * + * NOTE: The caller must ensure that each + * [Vehicle.label][google.cloud.optimization.v1.Vehicle.label] (resp. + * [Shipment.label][google.cloud.optimization.v1.Shipment.label]) uniquely + * identifies a vehicle (resp. shipment) entity used across the two relevant + * requests: the past request that produced the `OptimizeToursResponse` used + * in the injected solution and the current request that includes the injected + * solution. The uniqueness checks described above are not enough to guarantee + * this requirement. + * @type bool $considerRoadTraffic + * Consider traffic estimation in calculating `ShipmentRoute` fields + * [Transition.travel_duration][google.cloud.optimization.v1.ShipmentRoute.Transition.travel_duration], + * [Visit.start_time][google.cloud.optimization.v1.ShipmentRoute.Visit.start_time], + * and `vehicle_end_time`; in setting the + * [ShipmentRoute.has_traffic_infeasibilities][google.cloud.optimization.v1.ShipmentRoute.has_traffic_infeasibilities] + * field, and in calculating the + * [OptimizeToursResponse.total_cost][google.cloud.optimization.v1.OptimizeToursResponse.total_cost] + * field. + * @type bool $populatePolylines + * If true, polylines will be populated in response `ShipmentRoute`s. + * @type bool $populateTransitionPolylines + * If true, polylines will be populated in response + * [ShipmentRoute.transitions][google.cloud.optimization.v1.ShipmentRoute.transitions]. + * Note that in this case, the polylines will also be populated in the + * deprecated `travel_steps`. + * @type bool $allowLargeDeadlineDespiteInterruptionRisk + * If this is set, then the request can have a deadline + * (see https://grpc.io/blog/deadlines) of up to 60 minutes. + * Otherwise, the maximum deadline is only 30 minutes. + * Note that long-lived requests have a significantly larger (but still small) + * risk of interruption. + * @type bool $useGeodesicDistances + * If true, travel distances will be computed using geodesic distances instead + * of Google Maps distances, and travel times will be computed using geodesic + * distances with a speed defined by `geodesic_meters_per_second`. + * @type float $geodesicMetersPerSecond + * When `use_geodesic_distances` is true, this field must be set and defines + * the speed applied to compute travel times. Its value must be at least 1.0 + * meters/seconds. + * @type string $label + * Label that may be used to identify this request, reported back in the + * [OptimizeToursResponse.request_label][google.cloud.optimization.v1.OptimizeToursResponse.request_label]. + * @type bool $populateTravelStepPolylines + * Deprecated: Use + * [OptimizeToursRequest.populate_transition_polylines][google.cloud.optimization.v1.OptimizeToursRequest.populate_transition_polylines] + * instead. If true, polylines will be populated in response + * [ShipmentRoute.transitions][google.cloud.optimization.v1.ShipmentRoute.transitions]. + * Note that in this case, the polylines will also be populated in the + * deprecated `travel_steps`. + * @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 \Google\Cloud\Optimization\V1\OptimizeToursResponse + * + * @throws ApiException if the remote call fails + */ + public function optimizeTours($parent, array $optionalArgs = []) + { + $request = new OptimizeToursRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['timeout'])) { + $request->setTimeout($optionalArgs['timeout']); + } + + if (isset($optionalArgs['model'])) { + $request->setModel($optionalArgs['model']); + } + + if (isset($optionalArgs['solvingMode'])) { + $request->setSolvingMode($optionalArgs['solvingMode']); + } + + if (isset($optionalArgs['maxValidationErrors'])) { + $request->setMaxValidationErrors($optionalArgs['maxValidationErrors']); + } + + if (isset($optionalArgs['searchMode'])) { + $request->setSearchMode($optionalArgs['searchMode']); + } + + if (isset($optionalArgs['injectedFirstSolutionRoutes'])) { + $request->setInjectedFirstSolutionRoutes($optionalArgs['injectedFirstSolutionRoutes']); + } + + if (isset($optionalArgs['injectedSolutionConstraint'])) { + $request->setInjectedSolutionConstraint($optionalArgs['injectedSolutionConstraint']); + } + + if (isset($optionalArgs['refreshDetailsRoutes'])) { + $request->setRefreshDetailsRoutes($optionalArgs['refreshDetailsRoutes']); + } + + if (isset($optionalArgs['interpretInjectedSolutionsUsingLabels'])) { + $request->setInterpretInjectedSolutionsUsingLabels($optionalArgs['interpretInjectedSolutionsUsingLabels']); + } + + if (isset($optionalArgs['considerRoadTraffic'])) { + $request->setConsiderRoadTraffic($optionalArgs['considerRoadTraffic']); + } + + if (isset($optionalArgs['populatePolylines'])) { + $request->setPopulatePolylines($optionalArgs['populatePolylines']); + } + + if (isset($optionalArgs['populateTransitionPolylines'])) { + $request->setPopulateTransitionPolylines($optionalArgs['populateTransitionPolylines']); + } + + if (isset($optionalArgs['allowLargeDeadlineDespiteInterruptionRisk'])) { + $request->setAllowLargeDeadlineDespiteInterruptionRisk($optionalArgs['allowLargeDeadlineDespiteInterruptionRisk']); + } + + if (isset($optionalArgs['useGeodesicDistances'])) { + $request->setUseGeodesicDistances($optionalArgs['useGeodesicDistances']); + } + + if (isset($optionalArgs['geodesicMetersPerSecond'])) { + $request->setGeodesicMetersPerSecond($optionalArgs['geodesicMetersPerSecond']); + } + + if (isset($optionalArgs['label'])) { + $request->setLabel($optionalArgs['label']); + } + + if (isset($optionalArgs['populateTravelStepPolylines'])) { + $request->setPopulateTravelStepPolylines($optionalArgs['populateTravelStepPolylines']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('OptimizeTours', OptimizeToursResponse::class, $optionalArgs, $request)->wait(); + } +} diff --git a/owl-bot-staging/Optimization/v1/src/V1/gapic_metadata.json b/owl-bot-staging/Optimization/v1/src/V1/gapic_metadata.json new file mode 100644 index 000000000000..007133ea9599 --- /dev/null +++ b/owl-bot-staging/Optimization/v1/src/V1/gapic_metadata.json @@ -0,0 +1,28 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services\/RPCs to the corresponding library clients\/methods", + "language": "php", + "protoPackage": "google.cloud.optimization.v1", + "libraryPackage": "Google\\Cloud\\Optimization\\V1", + "services": { + "FleetRouting": { + "clients": { + "grpc": { + "libraryClient": "FleetRoutingGapicClient", + "rpcs": { + "BatchOptimizeTours": { + "methods": [ + "batchOptimizeTours" + ] + }, + "OptimizeTours": { + "methods": [ + "optimizeTours" + ] + } + } + } + } + } + } +} \ No newline at end of file diff --git a/owl-bot-staging/Optimization/v1/src/V1/resources/fleet_routing_client_config.json b/owl-bot-staging/Optimization/v1/src/V1/resources/fleet_routing_client_config.json new file mode 100644 index 000000000000..b86bf37650c5 --- /dev/null +++ b/owl-bot-staging/Optimization/v1/src/V1/resources/fleet_routing_client_config.json @@ -0,0 +1,56 @@ +{ + "interfaces": { + "google.cloud.optimization.v1.FleetRouting": { + "retry_codes": { + "no_retry_codes": [], + "retry_policy_1_codes": [ + "UNAVAILABLE" + ], + "retry_policy_2_codes": [ + "UNAVAILABLE" + ] + }, + "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": 1.3, + "max_retry_delay_millis": 10000, + "initial_rpc_timeout_millis": 3600000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 3600000, + "total_timeout_millis": 3600000 + }, + "retry_policy_2_params": { + "initial_retry_delay_millis": 1000, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 10000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 60000 + } + }, + "methods": { + "BatchOptimizeTours": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_2_codes", + "retry_params_name": "retry_policy_2_params" + }, + "OptimizeTours": { + "timeout_millis": 3600000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + } + } + } + } +} diff --git a/owl-bot-staging/Optimization/v1/src/V1/resources/fleet_routing_descriptor_config.php b/owl-bot-staging/Optimization/v1/src/V1/resources/fleet_routing_descriptor_config.php new file mode 100644 index 000000000000..e4991f64f3d2 --- /dev/null +++ b/owl-bot-staging/Optimization/v1/src/V1/resources/fleet_routing_descriptor_config.php @@ -0,0 +1,39 @@ + [ + 'google.cloud.optimization.v1.FleetRouting' => [ + 'BatchOptimizeTours' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Optimization\V1\BatchOptimizeToursResponse', + 'metadataReturnType' => '\Google\Cloud\Optimization\V1\AsyncModelMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'OptimizeTours' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Optimization\V1\OptimizeToursResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + ], + ], +]; diff --git a/owl-bot-staging/Optimization/v1/src/V1/resources/fleet_routing_rest_client_config.php b/owl-bot-staging/Optimization/v1/src/V1/resources/fleet_routing_rest_client_config.php new file mode 100644 index 000000000000..5d00717f6a23 --- /dev/null +++ b/owl-bot-staging/Optimization/v1/src/V1/resources/fleet_routing_rest_client_config.php @@ -0,0 +1,66 @@ + [ + 'google.cloud.optimization.v1.FleetRouting' => [ + 'BatchOptimizeTours' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}:batchOptimizeTours', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*}:batchOptimizeTours', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'OptimizeTours' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}:optimizeTours', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*}:optimizeTours', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + ], + 'google.longrunning.Operations' => [ + 'GetOperation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/operations/*}', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/Optimization/v1/tests/Unit/V1/Client/FleetRoutingClientTest.php b/owl-bot-staging/Optimization/v1/tests/Unit/V1/Client/FleetRoutingClientTest.php new file mode 100644 index 000000000000..1b87ad9a0077 --- /dev/null +++ b/owl-bot-staging/Optimization/v1/tests/Unit/V1/Client/FleetRoutingClientTest.php @@ -0,0 +1,329 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return FleetRoutingClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new FleetRoutingClient($options); + } + + /** @test */ + public function batchOptimizeToursTest() + { + $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/batchOptimizeToursTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new BatchOptimizeToursResponse(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/batchOptimizeToursTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $parent = 'parent-995424086'; + $modelConfigs = []; + $request = (new BatchOptimizeToursRequest()) + ->setParent($parent) + ->setModelConfigs($modelConfigs); + $response = $gapicClient->batchOptimizeTours($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.cloud.optimization.v1.FleetRouting/BatchOptimizeTours', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($parent, $actualValue); + $actualValue = $actualApiRequestObject->getModelConfigs(); + $this->assertProtobufEquals($modelConfigs, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/batchOptimizeToursTest'); + $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 batchOptimizeToursExceptionTest() + { + $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/batchOptimizeToursTest'); + $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 + $parent = 'parent-995424086'; + $modelConfigs = []; + $request = (new BatchOptimizeToursRequest()) + ->setParent($parent) + ->setModelConfigs($modelConfigs); + $response = $gapicClient->batchOptimizeTours($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/batchOptimizeToursTest'); + 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 optimizeToursTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $requestLabel = 'requestLabel1739091268'; + $totalCost = -7.0589032E7; + $expectedResponse = new OptimizeToursResponse(); + $expectedResponse->setRequestLabel($requestLabel); + $expectedResponse->setTotalCost($totalCost); + $transport->addResponse($expectedResponse); + // Mock request + $parent = 'parent-995424086'; + $request = (new OptimizeToursRequest()) + ->setParent($parent); + $response = $gapicClient->optimizeTours($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.optimization.v1.FleetRouting/OptimizeTours', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($parent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function optimizeToursExceptionTest() + { + $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 + $parent = 'parent-995424086'; + $request = (new OptimizeToursRequest()) + ->setParent($parent); + try { + $gapicClient->optimizeTours($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 batchOptimizeToursAsyncTest() + { + $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/batchOptimizeToursTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new BatchOptimizeToursResponse(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/batchOptimizeToursTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $parent = 'parent-995424086'; + $modelConfigs = []; + $request = (new BatchOptimizeToursRequest()) + ->setParent($parent) + ->setModelConfigs($modelConfigs); + $response = $gapicClient->batchOptimizeToursAsync($request)->wait(); + $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.cloud.optimization.v1.FleetRouting/BatchOptimizeTours', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($parent, $actualValue); + $actualValue = $actualApiRequestObject->getModelConfigs(); + $this->assertProtobufEquals($modelConfigs, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/batchOptimizeToursTest'); + $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()); + } +} diff --git a/owl-bot-staging/Optimization/v1/tests/Unit/V1/FleetRoutingClientTest.php b/owl-bot-staging/Optimization/v1/tests/Unit/V1/FleetRoutingClientTest.php new file mode 100644 index 000000000000..e93a7e959285 --- /dev/null +++ b/owl-bot-staging/Optimization/v1/tests/Unit/V1/FleetRoutingClientTest.php @@ -0,0 +1,249 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return FleetRoutingClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new FleetRoutingClient($options); + } + + /** @test */ + public function batchOptimizeToursTest() + { + $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/batchOptimizeToursTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new BatchOptimizeToursResponse(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/batchOptimizeToursTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $parent = 'parent-995424086'; + $modelConfigs = []; + $response = $gapicClient->batchOptimizeTours($parent, $modelConfigs); + $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.cloud.optimization.v1.FleetRouting/BatchOptimizeTours', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($parent, $actualValue); + $actualValue = $actualApiRequestObject->getModelConfigs(); + $this->assertProtobufEquals($modelConfigs, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/batchOptimizeToursTest'); + $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 batchOptimizeToursExceptionTest() + { + $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/batchOptimizeToursTest'); + $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 + $parent = 'parent-995424086'; + $modelConfigs = []; + $response = $gapicClient->batchOptimizeTours($parent, $modelConfigs); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/batchOptimizeToursTest'); + 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 optimizeToursTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $requestLabel = 'requestLabel1739091268'; + $totalCost = -7.0589032E7; + $expectedResponse = new OptimizeToursResponse(); + $expectedResponse->setRequestLabel($requestLabel); + $expectedResponse->setTotalCost($totalCost); + $transport->addResponse($expectedResponse); + // Mock request + $parent = 'parent-995424086'; + $response = $gapicClient->optimizeTours($parent); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.optimization.v1.FleetRouting/OptimizeTours', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($parent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function optimizeToursExceptionTest() + { + $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 + $parent = 'parent-995424086'; + try { + $gapicClient->optimizeTours($parent); + // 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()); + } +} diff --git a/owl-bot-staging/OrgPolicy/v2/proto/src/GPBMetadata/Google/Cloud/Orgpolicy/V2/Constraint.php b/owl-bot-staging/OrgPolicy/v2/proto/src/GPBMetadata/Google/Cloud/Orgpolicy/V2/Constraint.php new file mode 100644 index 000000000000..2775ed4327d4 Binary files /dev/null and b/owl-bot-staging/OrgPolicy/v2/proto/src/GPBMetadata/Google/Cloud/Orgpolicy/V2/Constraint.php differ diff --git a/owl-bot-staging/OrgPolicy/v2/proto/src/GPBMetadata/Google/Cloud/Orgpolicy/V2/Orgpolicy.php b/owl-bot-staging/OrgPolicy/v2/proto/src/GPBMetadata/Google/Cloud/Orgpolicy/V2/Orgpolicy.php new file mode 100644 index 000000000000..7739d7e3248b Binary files /dev/null and b/owl-bot-staging/OrgPolicy/v2/proto/src/GPBMetadata/Google/Cloud/Orgpolicy/V2/Orgpolicy.php differ diff --git a/owl-bot-staging/OrgPolicy/v2/proto/src/Google/Cloud/OrgPolicy/V2/AlternatePolicySpec.php b/owl-bot-staging/OrgPolicy/v2/proto/src/Google/Cloud/OrgPolicy/V2/AlternatePolicySpec.php new file mode 100644 index 000000000000..cb17363c038d --- /dev/null +++ b/owl-bot-staging/OrgPolicy/v2/proto/src/Google/Cloud/OrgPolicy/V2/AlternatePolicySpec.php @@ -0,0 +1,120 @@ +google.cloud.orgpolicy.v2.AlternatePolicySpec + */ +class AlternatePolicySpec extends \Google\Protobuf\Internal\Message +{ + /** + * Reference to the launch that will be used while audit logging and to + * control the launch. + * Should be set only in the alternate policy. + * + * Generated from protobuf field string launch = 1; + */ + protected $launch = ''; + /** + * Specify `Constraint` for configurations of Cloud Platform resources. + * + * Generated from protobuf field .google.cloud.orgpolicy.v2.PolicySpec spec = 2; + */ + protected $spec = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $launch + * Reference to the launch that will be used while audit logging and to + * control the launch. + * Should be set only in the alternate policy. + * @type \Google\Cloud\OrgPolicy\V2\PolicySpec $spec + * Specify `Constraint` for configurations of Cloud Platform resources. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Orgpolicy\V2\Orgpolicy::initOnce(); + parent::__construct($data); + } + + /** + * Reference to the launch that will be used while audit logging and to + * control the launch. + * Should be set only in the alternate policy. + * + * Generated from protobuf field string launch = 1; + * @return string + */ + public function getLaunch() + { + return $this->launch; + } + + /** + * Reference to the launch that will be used while audit logging and to + * control the launch. + * Should be set only in the alternate policy. + * + * Generated from protobuf field string launch = 1; + * @param string $var + * @return $this + */ + public function setLaunch($var) + { + GPBUtil::checkString($var, True); + $this->launch = $var; + + return $this; + } + + /** + * Specify `Constraint` for configurations of Cloud Platform resources. + * + * Generated from protobuf field .google.cloud.orgpolicy.v2.PolicySpec spec = 2; + * @return \Google\Cloud\OrgPolicy\V2\PolicySpec|null + */ + public function getSpec() + { + return $this->spec; + } + + public function hasSpec() + { + return isset($this->spec); + } + + public function clearSpec() + { + unset($this->spec); + } + + /** + * Specify `Constraint` for configurations of Cloud Platform resources. + * + * Generated from protobuf field .google.cloud.orgpolicy.v2.PolicySpec spec = 2; + * @param \Google\Cloud\OrgPolicy\V2\PolicySpec $var + * @return $this + */ + public function setSpec($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\OrgPolicy\V2\PolicySpec::class); + $this->spec = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/OrgPolicy/v2/proto/src/Google/Cloud/OrgPolicy/V2/Constraint.php b/owl-bot-staging/OrgPolicy/v2/proto/src/Google/Cloud/OrgPolicy/V2/Constraint.php new file mode 100644 index 000000000000..fcb703c1d436 --- /dev/null +++ b/owl-bot-staging/OrgPolicy/v2/proto/src/Google/Cloud/OrgPolicy/V2/Constraint.php @@ -0,0 +1,288 @@ +google.cloud.orgpolicy.v2.Constraint + */ +class Constraint extends \Google\Protobuf\Internal\Message +{ + /** + * Immutable. The resource name of the Constraint. Must be in one of + * the following forms: + * * `projects/{project_number}/constraints/{constraint_name}` + * * `folders/{folder_id}/constraints/{constraint_name}` + * * `organizations/{organization_id}/constraints/{constraint_name}` + * For example, "/projects/123/constraints/compute.disableSerialPortAccess". + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + */ + protected $name = ''; + /** + * The human readable name. + * Mutable. + * + * Generated from protobuf field string display_name = 2; + */ + protected $display_name = ''; + /** + * Detailed description of what this `Constraint` controls as well as how and + * where it is enforced. + * Mutable. + * + * Generated from protobuf field string description = 3; + */ + protected $description = ''; + /** + * The evaluation behavior of this constraint in the absence of 'Policy'. + * + * Generated from protobuf field .google.cloud.orgpolicy.v2.Constraint.ConstraintDefault constraint_default = 4; + */ + protected $constraint_default = 0; + protected $constraint_type; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Immutable. The resource name of the Constraint. Must be in one of + * the following forms: + * * `projects/{project_number}/constraints/{constraint_name}` + * * `folders/{folder_id}/constraints/{constraint_name}` + * * `organizations/{organization_id}/constraints/{constraint_name}` + * For example, "/projects/123/constraints/compute.disableSerialPortAccess". + * @type string $display_name + * The human readable name. + * Mutable. + * @type string $description + * Detailed description of what this `Constraint` controls as well as how and + * where it is enforced. + * Mutable. + * @type int $constraint_default + * The evaluation behavior of this constraint in the absence of 'Policy'. + * @type \Google\Cloud\OrgPolicy\V2\Constraint\ListConstraint $list_constraint + * Defines this constraint as being a ListConstraint. + * @type \Google\Cloud\OrgPolicy\V2\Constraint\BooleanConstraint $boolean_constraint + * Defines this constraint as being a BooleanConstraint. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Orgpolicy\V2\Constraint::initOnce(); + parent::__construct($data); + } + + /** + * Immutable. The resource name of the Constraint. Must be in one of + * the following forms: + * * `projects/{project_number}/constraints/{constraint_name}` + * * `folders/{folder_id}/constraints/{constraint_name}` + * * `organizations/{organization_id}/constraints/{constraint_name}` + * For example, "/projects/123/constraints/compute.disableSerialPortAccess". + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Immutable. The resource name of the Constraint. Must be in one of + * the following forms: + * * `projects/{project_number}/constraints/{constraint_name}` + * * `folders/{folder_id}/constraints/{constraint_name}` + * * `organizations/{organization_id}/constraints/{constraint_name}` + * For example, "/projects/123/constraints/compute.disableSerialPortAccess". + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The human readable name. + * Mutable. + * + * Generated from protobuf field string display_name = 2; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * The human readable name. + * Mutable. + * + * Generated from protobuf field string display_name = 2; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * Detailed description of what this `Constraint` controls as well as how and + * where it is enforced. + * Mutable. + * + * Generated from protobuf field string description = 3; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Detailed description of what this `Constraint` controls as well as how and + * where it is enforced. + * Mutable. + * + * Generated from protobuf field string description = 3; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * The evaluation behavior of this constraint in the absence of 'Policy'. + * + * Generated from protobuf field .google.cloud.orgpolicy.v2.Constraint.ConstraintDefault constraint_default = 4; + * @return int + */ + public function getConstraintDefault() + { + return $this->constraint_default; + } + + /** + * The evaluation behavior of this constraint in the absence of 'Policy'. + * + * Generated from protobuf field .google.cloud.orgpolicy.v2.Constraint.ConstraintDefault constraint_default = 4; + * @param int $var + * @return $this + */ + public function setConstraintDefault($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\OrgPolicy\V2\Constraint\ConstraintDefault::class); + $this->constraint_default = $var; + + return $this; + } + + /** + * Defines this constraint as being a ListConstraint. + * + * Generated from protobuf field .google.cloud.orgpolicy.v2.Constraint.ListConstraint list_constraint = 5; + * @return \Google\Cloud\OrgPolicy\V2\Constraint\ListConstraint|null + */ + public function getListConstraint() + { + return $this->readOneof(5); + } + + public function hasListConstraint() + { + return $this->hasOneof(5); + } + + /** + * Defines this constraint as being a ListConstraint. + * + * Generated from protobuf field .google.cloud.orgpolicy.v2.Constraint.ListConstraint list_constraint = 5; + * @param \Google\Cloud\OrgPolicy\V2\Constraint\ListConstraint $var + * @return $this + */ + public function setListConstraint($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\OrgPolicy\V2\Constraint\ListConstraint::class); + $this->writeOneof(5, $var); + + return $this; + } + + /** + * Defines this constraint as being a BooleanConstraint. + * + * Generated from protobuf field .google.cloud.orgpolicy.v2.Constraint.BooleanConstraint boolean_constraint = 6; + * @return \Google\Cloud\OrgPolicy\V2\Constraint\BooleanConstraint|null + */ + public function getBooleanConstraint() + { + return $this->readOneof(6); + } + + public function hasBooleanConstraint() + { + return $this->hasOneof(6); + } + + /** + * Defines this constraint as being a BooleanConstraint. + * + * Generated from protobuf field .google.cloud.orgpolicy.v2.Constraint.BooleanConstraint boolean_constraint = 6; + * @param \Google\Cloud\OrgPolicy\V2\Constraint\BooleanConstraint $var + * @return $this + */ + public function setBooleanConstraint($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\OrgPolicy\V2\Constraint\BooleanConstraint::class); + $this->writeOneof(6, $var); + + return $this; + } + + /** + * @return string + */ + public function getConstraintType() + { + return $this->whichOneof("constraint_type"); + } + +} + diff --git a/owl-bot-staging/OrgPolicy/v2/proto/src/Google/Cloud/OrgPolicy/V2/Constraint/BooleanConstraint.php b/owl-bot-staging/OrgPolicy/v2/proto/src/Google/Cloud/OrgPolicy/V2/Constraint/BooleanConstraint.php new file mode 100644 index 000000000000..3ac223beb7cf --- /dev/null +++ b/owl-bot-staging/OrgPolicy/v2/proto/src/Google/Cloud/OrgPolicy/V2/Constraint/BooleanConstraint.php @@ -0,0 +1,39 @@ +google.cloud.orgpolicy.v2.Constraint.BooleanConstraint + */ +class BooleanConstraint extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Orgpolicy\V2\Constraint::initOnce(); + parent::__construct($data); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(BooleanConstraint::class, \Google\Cloud\OrgPolicy\V2\Constraint_BooleanConstraint::class); + diff --git a/owl-bot-staging/OrgPolicy/v2/proto/src/Google/Cloud/OrgPolicy/V2/Constraint/ConstraintDefault.php b/owl-bot-staging/OrgPolicy/v2/proto/src/Google/Cloud/OrgPolicy/V2/Constraint/ConstraintDefault.php new file mode 100644 index 000000000000..82ce64787e56 --- /dev/null +++ b/owl-bot-staging/OrgPolicy/v2/proto/src/Google/Cloud/OrgPolicy/V2/Constraint/ConstraintDefault.php @@ -0,0 +1,69 @@ +google.cloud.orgpolicy.v2.Constraint.ConstraintDefault + */ +class ConstraintDefault +{ + /** + * This is only used for distinguishing unset values and should never be + * used. + * + * Generated from protobuf enum CONSTRAINT_DEFAULT_UNSPECIFIED = 0; + */ + const CONSTRAINT_DEFAULT_UNSPECIFIED = 0; + /** + * Indicate that all values are allowed for list constraints. + * Indicate that enforcement is off for boolean constraints. + * + * Generated from protobuf enum ALLOW = 1; + */ + const ALLOW = 1; + /** + * Indicate that all values are denied for list constraints. + * Indicate that enforcement is on for boolean constraints. + * + * Generated from protobuf enum DENY = 2; + */ + const DENY = 2; + + private static $valueToName = [ + self::CONSTRAINT_DEFAULT_UNSPECIFIED => 'CONSTRAINT_DEFAULT_UNSPECIFIED', + self::ALLOW => 'ALLOW', + self::DENY => 'DENY', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ConstraintDefault::class, \Google\Cloud\OrgPolicy\V2\Constraint_ConstraintDefault::class); + diff --git a/owl-bot-staging/OrgPolicy/v2/proto/src/Google/Cloud/OrgPolicy/V2/Constraint/ListConstraint.php b/owl-bot-staging/OrgPolicy/v2/proto/src/Google/Cloud/OrgPolicy/V2/Constraint/ListConstraint.php new file mode 100644 index 000000000000..77b2e521d2c4 --- /dev/null +++ b/owl-bot-staging/OrgPolicy/v2/proto/src/Google/Cloud/OrgPolicy/V2/Constraint/ListConstraint.php @@ -0,0 +1,125 @@ +google.cloud.orgpolicy.v2.Constraint.ListConstraint + */ +class ListConstraint extends \Google\Protobuf\Internal\Message +{ + /** + * Indicates whether values grouped into categories can be used in + * `Policy.allowed_values` and `Policy.denied_values`. For example, + * `"in:Python"` would match any value in the 'Python' group. + * + * Generated from protobuf field bool supports_in = 1; + */ + protected $supports_in = false; + /** + * Indicates whether subtrees of Cloud Resource Manager resource hierarchy + * can be used in `Policy.allowed_values` and `Policy.denied_values`. For + * example, `"under:folders/123"` would match any resource under the + * 'folders/123' folder. + * + * Generated from protobuf field bool supports_under = 2; + */ + protected $supports_under = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $supports_in + * Indicates whether values grouped into categories can be used in + * `Policy.allowed_values` and `Policy.denied_values`. For example, + * `"in:Python"` would match any value in the 'Python' group. + * @type bool $supports_under + * Indicates whether subtrees of Cloud Resource Manager resource hierarchy + * can be used in `Policy.allowed_values` and `Policy.denied_values`. For + * example, `"under:folders/123"` would match any resource under the + * 'folders/123' folder. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Orgpolicy\V2\Constraint::initOnce(); + parent::__construct($data); + } + + /** + * Indicates whether values grouped into categories can be used in + * `Policy.allowed_values` and `Policy.denied_values`. For example, + * `"in:Python"` would match any value in the 'Python' group. + * + * Generated from protobuf field bool supports_in = 1; + * @return bool + */ + public function getSupportsIn() + { + return $this->supports_in; + } + + /** + * Indicates whether values grouped into categories can be used in + * `Policy.allowed_values` and `Policy.denied_values`. For example, + * `"in:Python"` would match any value in the 'Python' group. + * + * Generated from protobuf field bool supports_in = 1; + * @param bool $var + * @return $this + */ + public function setSupportsIn($var) + { + GPBUtil::checkBool($var); + $this->supports_in = $var; + + return $this; + } + + /** + * Indicates whether subtrees of Cloud Resource Manager resource hierarchy + * can be used in `Policy.allowed_values` and `Policy.denied_values`. For + * example, `"under:folders/123"` would match any resource under the + * 'folders/123' folder. + * + * Generated from protobuf field bool supports_under = 2; + * @return bool + */ + public function getSupportsUnder() + { + return $this->supports_under; + } + + /** + * Indicates whether subtrees of Cloud Resource Manager resource hierarchy + * can be used in `Policy.allowed_values` and `Policy.denied_values`. For + * example, `"under:folders/123"` would match any resource under the + * 'folders/123' folder. + * + * Generated from protobuf field bool supports_under = 2; + * @param bool $var + * @return $this + */ + public function setSupportsUnder($var) + { + GPBUtil::checkBool($var); + $this->supports_under = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ListConstraint::class, \Google\Cloud\OrgPolicy\V2\Constraint_ListConstraint::class); + diff --git a/owl-bot-staging/OrgPolicy/v2/proto/src/Google/Cloud/OrgPolicy/V2/Constraint_BooleanConstraint.php b/owl-bot-staging/OrgPolicy/v2/proto/src/Google/Cloud/OrgPolicy/V2/Constraint_BooleanConstraint.php new file mode 100644 index 000000000000..0b19069f8db1 --- /dev/null +++ b/owl-bot-staging/OrgPolicy/v2/proto/src/Google/Cloud/OrgPolicy/V2/Constraint_BooleanConstraint.php @@ -0,0 +1,16 @@ +google.cloud.orgpolicy.v2.CreatePolicyRequest + */ +class CreatePolicyRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The Cloud resource that will parent the new Policy. Must be in + * one of the following forms: + * * `projects/{project_number}` + * * `projects/{project_id}` + * * `folders/{folder_id}` + * * `organizations/{organization_id}` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. `Policy` to create. + * + * Generated from protobuf field .google.cloud.orgpolicy.v2.Policy policy = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $policy = null; + + /** + * @param string $parent Required. The Cloud resource that will parent the new Policy. Must be in + * one of the following forms: + * * `projects/{project_number}` + * * `projects/{project_id}` + * * `folders/{folder_id}` + * * `organizations/{organization_id}` + * Please see {@see OrgPolicyClient::projectName()} for help formatting this field. + * @param \Google\Cloud\OrgPolicy\V2\Policy $policy Required. `Policy` to create. + * + * @return \Google\Cloud\OrgPolicy\V2\CreatePolicyRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\OrgPolicy\V2\Policy $policy): self + { + return (new self()) + ->setParent($parent) + ->setPolicy($policy); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The Cloud resource that will parent the new Policy. Must be in + * one of the following forms: + * * `projects/{project_number}` + * * `projects/{project_id}` + * * `folders/{folder_id}` + * * `organizations/{organization_id}` + * @type \Google\Cloud\OrgPolicy\V2\Policy $policy + * Required. `Policy` to create. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Orgpolicy\V2\Orgpolicy::initOnce(); + parent::__construct($data); + } + + /** + * Required. The Cloud resource that will parent the new Policy. Must be in + * one of the following forms: + * * `projects/{project_number}` + * * `projects/{project_id}` + * * `folders/{folder_id}` + * * `organizations/{organization_id}` + * + * 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. The Cloud resource that will parent the new Policy. Must be in + * one of the following forms: + * * `projects/{project_number}` + * * `projects/{project_id}` + * * `folders/{folder_id}` + * * `organizations/{organization_id}` + * + * 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. `Policy` to create. + * + * Generated from protobuf field .google.cloud.orgpolicy.v2.Policy policy = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\OrgPolicy\V2\Policy|null + */ + public function getPolicy() + { + return $this->policy; + } + + public function hasPolicy() + { + return isset($this->policy); + } + + public function clearPolicy() + { + unset($this->policy); + } + + /** + * Required. `Policy` to create. + * + * Generated from protobuf field .google.cloud.orgpolicy.v2.Policy policy = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\OrgPolicy\V2\Policy $var + * @return $this + */ + public function setPolicy($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\OrgPolicy\V2\Policy::class); + $this->policy = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/OrgPolicy/v2/proto/src/Google/Cloud/OrgPolicy/V2/DeletePolicyRequest.php b/owl-bot-staging/OrgPolicy/v2/proto/src/Google/Cloud/OrgPolicy/V2/DeletePolicyRequest.php new file mode 100644 index 000000000000..da3ee31aebfb --- /dev/null +++ b/owl-bot-staging/OrgPolicy/v2/proto/src/Google/Cloud/OrgPolicy/V2/DeletePolicyRequest.php @@ -0,0 +1,87 @@ +google.cloud.orgpolicy.v2.DeletePolicyRequest + */ +class DeletePolicyRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the policy to delete. + * See `Policy` for naming rules. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. Name of the policy to delete. + * See `Policy` for naming rules. Please see + * {@see OrgPolicyClient::policyName()} for help formatting this field. + * + * @return \Google\Cloud\OrgPolicy\V2\DeletePolicyRequest + * + * @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 policy to delete. + * See `Policy` for naming rules. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Orgpolicy\V2\Orgpolicy::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the policy to delete. + * See `Policy` for naming rules. + * + * 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. Name of the policy to delete. + * See `Policy` for naming rules. + * + * 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; + } + +} + diff --git a/owl-bot-staging/OrgPolicy/v2/proto/src/Google/Cloud/OrgPolicy/V2/GetEffectivePolicyRequest.php b/owl-bot-staging/OrgPolicy/v2/proto/src/Google/Cloud/OrgPolicy/V2/GetEffectivePolicyRequest.php new file mode 100644 index 000000000000..6b74fb3735ab --- /dev/null +++ b/owl-bot-staging/OrgPolicy/v2/proto/src/Google/Cloud/OrgPolicy/V2/GetEffectivePolicyRequest.php @@ -0,0 +1,82 @@ +google.cloud.orgpolicy.v2.GetEffectivePolicyRequest + */ +class GetEffectivePolicyRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The effective policy to compute. See `Policy` for naming rules. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The effective policy to compute. See `Policy` for naming rules. Please see + * {@see OrgPolicyClient::policyName()} for help formatting this field. + * + * @return \Google\Cloud\OrgPolicy\V2\GetEffectivePolicyRequest + * + * @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 effective policy to compute. See `Policy` for naming rules. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Orgpolicy\V2\Orgpolicy::initOnce(); + parent::__construct($data); + } + + /** + * Required. The effective policy to compute. See `Policy` for naming rules. + * + * 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 effective policy to compute. See `Policy` for naming rules. + * + * 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; + } + +} + diff --git a/owl-bot-staging/OrgPolicy/v2/proto/src/Google/Cloud/OrgPolicy/V2/GetPolicyRequest.php b/owl-bot-staging/OrgPolicy/v2/proto/src/Google/Cloud/OrgPolicy/V2/GetPolicyRequest.php new file mode 100644 index 000000000000..c93825f68808 --- /dev/null +++ b/owl-bot-staging/OrgPolicy/v2/proto/src/Google/Cloud/OrgPolicy/V2/GetPolicyRequest.php @@ -0,0 +1,87 @@ +google.cloud.orgpolicy.v2.GetPolicyRequest + */ +class GetPolicyRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Resource name of the policy. See `Policy` for naming + * requirements. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. Resource name of the policy. See `Policy` for naming + * requirements. Please see + * {@see OrgPolicyClient::policyName()} for help formatting this field. + * + * @return \Google\Cloud\OrgPolicy\V2\GetPolicyRequest + * + * @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. Resource name of the policy. See `Policy` for naming + * requirements. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Orgpolicy\V2\Orgpolicy::initOnce(); + parent::__construct($data); + } + + /** + * Required. Resource name of the policy. See `Policy` for naming + * requirements. + * + * 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. Resource name of the policy. See `Policy` for naming + * requirements. + * + * 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; + } + +} + diff --git a/owl-bot-staging/OrgPolicy/v2/proto/src/Google/Cloud/OrgPolicy/V2/ListConstraintsRequest.php b/owl-bot-staging/OrgPolicy/v2/proto/src/Google/Cloud/OrgPolicy/V2/ListConstraintsRequest.php new file mode 100644 index 000000000000..ebe85c1ff1a1 --- /dev/null +++ b/owl-bot-staging/OrgPolicy/v2/proto/src/Google/Cloud/OrgPolicy/V2/ListConstraintsRequest.php @@ -0,0 +1,187 @@ +google.cloud.orgpolicy.v2.ListConstraintsRequest + */ +class ListConstraintsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The Cloud resource that parents the constraint. Must be in one of + * the following forms: + * * `projects/{project_number}` + * * `projects/{project_id}` + * * `folders/{folder_id}` + * * `organizations/{organization_id}` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Size of the pages to be returned. This is currently unsupported and will + * be ignored. The server may at any point start using this field to limit + * page size. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * Page token used to retrieve the next page. This is currently unsupported + * and will be ignored. The server may at any point start using this field. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + + /** + * @param string $parent Required. The Cloud resource that parents the constraint. Must be in one of + * the following forms: + * * `projects/{project_number}` + * * `projects/{project_id}` + * * `folders/{folder_id}` + * * `organizations/{organization_id}` + * Please see {@see OrgPolicyClient::projectName()} for help formatting this field. + * + * @return \Google\Cloud\OrgPolicy\V2\ListConstraintsRequest + * + * @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. The Cloud resource that parents the constraint. Must be in one of + * the following forms: + * * `projects/{project_number}` + * * `projects/{project_id}` + * * `folders/{folder_id}` + * * `organizations/{organization_id}` + * @type int $page_size + * Size of the pages to be returned. This is currently unsupported and will + * be ignored. The server may at any point start using this field to limit + * page size. + * @type string $page_token + * Page token used to retrieve the next page. This is currently unsupported + * and will be ignored. The server may at any point start using this field. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Orgpolicy\V2\Orgpolicy::initOnce(); + parent::__construct($data); + } + + /** + * Required. The Cloud resource that parents the constraint. Must be in one of + * the following forms: + * * `projects/{project_number}` + * * `projects/{project_id}` + * * `folders/{folder_id}` + * * `organizations/{organization_id}` + * + * 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. The Cloud resource that parents the constraint. Must be in one of + * the following forms: + * * `projects/{project_number}` + * * `projects/{project_id}` + * * `folders/{folder_id}` + * * `organizations/{organization_id}` + * + * 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; + } + + /** + * Size of the pages to be returned. This is currently unsupported and will + * be ignored. The server may at any point start using this field to limit + * page size. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Size of the pages to be returned. This is currently unsupported and will + * be ignored. The server may at any point start using this field to limit + * page size. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * Page token used to retrieve the next page. This is currently unsupported + * and will be ignored. The server may at any point start using this field. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Page token used to retrieve the next page. This is currently unsupported + * and will be ignored. The server may at any point start using this field. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/OrgPolicy/v2/proto/src/Google/Cloud/OrgPolicy/V2/ListConstraintsResponse.php b/owl-bot-staging/OrgPolicy/v2/proto/src/Google/Cloud/OrgPolicy/V2/ListConstraintsResponse.php new file mode 100644 index 000000000000..26bd82b66fd3 --- /dev/null +++ b/owl-bot-staging/OrgPolicy/v2/proto/src/Google/Cloud/OrgPolicy/V2/ListConstraintsResponse.php @@ -0,0 +1,102 @@ +google.cloud.orgpolicy.v2.ListConstraintsResponse + */ +class ListConstraintsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The collection of constraints that are available on the targeted resource. + * + * Generated from protobuf field repeated .google.cloud.orgpolicy.v2.Constraint constraints = 1; + */ + private $constraints; + /** + * Page token used to retrieve the next page. This is currently not used. + * + * 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\OrgPolicy\V2\Constraint>|\Google\Protobuf\Internal\RepeatedField $constraints + * The collection of constraints that are available on the targeted resource. + * @type string $next_page_token + * Page token used to retrieve the next page. This is currently not used. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Orgpolicy\V2\Orgpolicy::initOnce(); + parent::__construct($data); + } + + /** + * The collection of constraints that are available on the targeted resource. + * + * Generated from protobuf field repeated .google.cloud.orgpolicy.v2.Constraint constraints = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getConstraints() + { + return $this->constraints; + } + + /** + * The collection of constraints that are available on the targeted resource. + * + * Generated from protobuf field repeated .google.cloud.orgpolicy.v2.Constraint constraints = 1; + * @param array<\Google\Cloud\OrgPolicy\V2\Constraint>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setConstraints($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\OrgPolicy\V2\Constraint::class); + $this->constraints = $arr; + + return $this; + } + + /** + * Page token used to retrieve the next page. This is currently not used. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Page token used to retrieve the next page. This is currently not used. + * + * 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/OrgPolicy/v2/proto/src/Google/Cloud/OrgPolicy/V2/ListPoliciesRequest.php b/owl-bot-staging/OrgPolicy/v2/proto/src/Google/Cloud/OrgPolicy/V2/ListPoliciesRequest.php new file mode 100644 index 000000000000..61f4c0c1bede --- /dev/null +++ b/owl-bot-staging/OrgPolicy/v2/proto/src/Google/Cloud/OrgPolicy/V2/ListPoliciesRequest.php @@ -0,0 +1,192 @@ +google.cloud.orgpolicy.v2.ListPoliciesRequest + */ +class ListPoliciesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The target Cloud resource that parents the set of constraints and + * policies that will be returned from this call. Must be in one of the + * following forms: + * * `projects/{project_number}` + * * `projects/{project_id}` + * * `folders/{folder_id}` + * * `organizations/{organization_id}` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Size of the pages to be returned. This is currently unsupported and will + * be ignored. The server may at any point start using this field to limit + * page size. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * Page token used to retrieve the next page. This is currently unsupported + * and will be ignored. The server may at any point start using this field. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + + /** + * @param string $parent Required. The target Cloud resource that parents the set of constraints and + * policies that will be returned from this call. Must be in one of the + * following forms: + * * `projects/{project_number}` + * * `projects/{project_id}` + * * `folders/{folder_id}` + * * `organizations/{organization_id}` + * Please see {@see OrgPolicyClient::projectName()} for help formatting this field. + * + * @return \Google\Cloud\OrgPolicy\V2\ListPoliciesRequest + * + * @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. The target Cloud resource that parents the set of constraints and + * policies that will be returned from this call. Must be in one of the + * following forms: + * * `projects/{project_number}` + * * `projects/{project_id}` + * * `folders/{folder_id}` + * * `organizations/{organization_id}` + * @type int $page_size + * Size of the pages to be returned. This is currently unsupported and will + * be ignored. The server may at any point start using this field to limit + * page size. + * @type string $page_token + * Page token used to retrieve the next page. This is currently unsupported + * and will be ignored. The server may at any point start using this field. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Orgpolicy\V2\Orgpolicy::initOnce(); + parent::__construct($data); + } + + /** + * Required. The target Cloud resource that parents the set of constraints and + * policies that will be returned from this call. Must be in one of the + * following forms: + * * `projects/{project_number}` + * * `projects/{project_id}` + * * `folders/{folder_id}` + * * `organizations/{organization_id}` + * + * 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. The target Cloud resource that parents the set of constraints and + * policies that will be returned from this call. Must be in one of the + * following forms: + * * `projects/{project_number}` + * * `projects/{project_id}` + * * `folders/{folder_id}` + * * `organizations/{organization_id}` + * + * 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; + } + + /** + * Size of the pages to be returned. This is currently unsupported and will + * be ignored. The server may at any point start using this field to limit + * page size. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Size of the pages to be returned. This is currently unsupported and will + * be ignored. The server may at any point start using this field to limit + * page size. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * Page token used to retrieve the next page. This is currently unsupported + * and will be ignored. The server may at any point start using this field. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Page token used to retrieve the next page. This is currently unsupported + * and will be ignored. The server may at any point start using this field. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/OrgPolicy/v2/proto/src/Google/Cloud/OrgPolicy/V2/ListPoliciesResponse.php b/owl-bot-staging/OrgPolicy/v2/proto/src/Google/Cloud/OrgPolicy/V2/ListPoliciesResponse.php new file mode 100644 index 000000000000..57bfbdf1b2d5 --- /dev/null +++ b/owl-bot-staging/OrgPolicy/v2/proto/src/Google/Cloud/OrgPolicy/V2/ListPoliciesResponse.php @@ -0,0 +1,111 @@ +google.cloud.orgpolicy.v2.ListPoliciesResponse + */ +class ListPoliciesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * All `Policies` that exist on the resource. It will be empty if no + * `Policies` are set. + * + * Generated from protobuf field repeated .google.cloud.orgpolicy.v2.Policy policies = 1; + */ + private $policies; + /** + * Page token used to retrieve the next page. This is currently not used, but + * the server may at any point start supplying a valid token. + * + * 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\OrgPolicy\V2\Policy>|\Google\Protobuf\Internal\RepeatedField $policies + * All `Policies` that exist on the resource. It will be empty if no + * `Policies` are set. + * @type string $next_page_token + * Page token used to retrieve the next page. This is currently not used, but + * the server may at any point start supplying a valid token. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Orgpolicy\V2\Orgpolicy::initOnce(); + parent::__construct($data); + } + + /** + * All `Policies` that exist on the resource. It will be empty if no + * `Policies` are set. + * + * Generated from protobuf field repeated .google.cloud.orgpolicy.v2.Policy policies = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getPolicies() + { + return $this->policies; + } + + /** + * All `Policies` that exist on the resource. It will be empty if no + * `Policies` are set. + * + * Generated from protobuf field repeated .google.cloud.orgpolicy.v2.Policy policies = 1; + * @param array<\Google\Cloud\OrgPolicy\V2\Policy>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setPolicies($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\OrgPolicy\V2\Policy::class); + $this->policies = $arr; + + return $this; + } + + /** + * Page token used to retrieve the next page. This is currently not used, but + * the server may at any point start supplying a valid token. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Page token used to retrieve the next page. This is currently not used, but + * the server may at any point start supplying a valid token. + * + * 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/OrgPolicy/v2/proto/src/Google/Cloud/OrgPolicy/V2/OrgPolicyGrpcClient.php b/owl-bot-staging/OrgPolicy/v2/proto/src/Google/Cloud/OrgPolicy/V2/OrgPolicyGrpcClient.php new file mode 100644 index 000000000000..8420bb5b0591 --- /dev/null +++ b/owl-bot-staging/OrgPolicy/v2/proto/src/Google/Cloud/OrgPolicy/V2/OrgPolicyGrpcClient.php @@ -0,0 +1,184 @@ +_simpleRequest('/google.cloud.orgpolicy.v2.OrgPolicy/ListConstraints', + $argument, + ['\Google\Cloud\OrgPolicy\V2\ListConstraintsResponse', 'decode'], + $metadata, $options); + } + + /** + * Retrieves all of the `Policies` that exist on a particular resource. + * @param \Google\Cloud\OrgPolicy\V2\ListPoliciesRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function ListPolicies(\Google\Cloud\OrgPolicy\V2\ListPoliciesRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.orgpolicy.v2.OrgPolicy/ListPolicies', + $argument, + ['\Google\Cloud\OrgPolicy\V2\ListPoliciesResponse', 'decode'], + $metadata, $options); + } + + /** + * Gets a `Policy` on a resource. + * + * If no `Policy` is set on the resource, NOT_FOUND is returned. The + * `etag` value can be used with `UpdatePolicy()` to update a + * `Policy` during read-modify-write. + * @param \Google\Cloud\OrgPolicy\V2\GetPolicyRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function GetPolicy(\Google\Cloud\OrgPolicy\V2\GetPolicyRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.orgpolicy.v2.OrgPolicy/GetPolicy', + $argument, + ['\Google\Cloud\OrgPolicy\V2\Policy', 'decode'], + $metadata, $options); + } + + /** + * Gets the effective `Policy` on a resource. This is the result of merging + * `Policies` in the resource hierarchy and evaluating conditions. The + * returned `Policy` will not have an `etag` or `condition` set because it is + * a computed `Policy` across multiple resources. + * Subtrees of Resource Manager resource hierarchy with 'under:' prefix will + * not be expanded. + * @param \Google\Cloud\OrgPolicy\V2\GetEffectivePolicyRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function GetEffectivePolicy(\Google\Cloud\OrgPolicy\V2\GetEffectivePolicyRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.orgpolicy.v2.OrgPolicy/GetEffectivePolicy', + $argument, + ['\Google\Cloud\OrgPolicy\V2\Policy', 'decode'], + $metadata, $options); + } + + /** + * Creates a Policy. + * + * Returns a `google.rpc.Status` with `google.rpc.Code.NOT_FOUND` if the + * constraint does not exist. + * Returns a `google.rpc.Status` with `google.rpc.Code.ALREADY_EXISTS` if the + * policy already exists on the given Cloud resource. + * @param \Google\Cloud\OrgPolicy\V2\CreatePolicyRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function CreatePolicy(\Google\Cloud\OrgPolicy\V2\CreatePolicyRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.orgpolicy.v2.OrgPolicy/CreatePolicy', + $argument, + ['\Google\Cloud\OrgPolicy\V2\Policy', 'decode'], + $metadata, $options); + } + + /** + * Updates a Policy. + * + * Returns a `google.rpc.Status` with `google.rpc.Code.NOT_FOUND` if the + * constraint or the policy do not exist. + * Returns a `google.rpc.Status` with `google.rpc.Code.ABORTED` if the etag + * supplied in the request does not match the persisted etag of the policy + * + * Note: the supplied policy will perform a full overwrite of all + * fields. + * @param \Google\Cloud\OrgPolicy\V2\UpdatePolicyRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function UpdatePolicy(\Google\Cloud\OrgPolicy\V2\UpdatePolicyRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.orgpolicy.v2.OrgPolicy/UpdatePolicy', + $argument, + ['\Google\Cloud\OrgPolicy\V2\Policy', 'decode'], + $metadata, $options); + } + + /** + * Deletes a Policy. + * + * Returns a `google.rpc.Status` with `google.rpc.Code.NOT_FOUND` if the + * constraint or Org Policy does not exist. + * @param \Google\Cloud\OrgPolicy\V2\DeletePolicyRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function DeletePolicy(\Google\Cloud\OrgPolicy\V2\DeletePolicyRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.orgpolicy.v2.OrgPolicy/DeletePolicy', + $argument, + ['\Google\Protobuf\GPBEmpty', 'decode'], + $metadata, $options); + } + +} diff --git a/owl-bot-staging/OrgPolicy/v2/proto/src/Google/Cloud/OrgPolicy/V2/Policy.php b/owl-bot-staging/OrgPolicy/v2/proto/src/Google/Cloud/OrgPolicy/V2/Policy.php new file mode 100644 index 000000000000..c492cd18a1bd --- /dev/null +++ b/owl-bot-staging/OrgPolicy/v2/proto/src/Google/Cloud/OrgPolicy/V2/Policy.php @@ -0,0 +1,251 @@ +google.cloud.orgpolicy.v2.Policy + */ +class Policy extends \Google\Protobuf\Internal\Message +{ + /** + * Immutable. The resource name of the Policy. Must be one of the following + * forms, where constraint_name is the name of the constraint which this + * Policy configures: + * * `projects/{project_number}/policies/{constraint_name}` + * * `folders/{folder_id}/policies/{constraint_name}` + * * `organizations/{organization_id}/policies/{constraint_name}` + * For example, "projects/123/policies/compute.disableSerialPortAccess". + * Note: `projects/{project_id}/policies/{constraint_name}` is also an + * acceptable name for API requests, but responses will return the name using + * the equivalent project number. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + */ + protected $name = ''; + /** + * Basic information about the Organization Policy. + * + * Generated from protobuf field .google.cloud.orgpolicy.v2.PolicySpec spec = 2; + */ + protected $spec = null; + /** + * Deprecated. + * + * Generated from protobuf field .google.cloud.orgpolicy.v2.AlternatePolicySpec alternate = 3 [deprecated = true]; + * @deprecated + */ + protected $alternate = null; + /** + * dry-run policy. + * Audit-only policy, can be used to monitor how the policy would have + * impacted the existing and future resources if it's enforced. + * + * Generated from protobuf field .google.cloud.orgpolicy.v2.PolicySpec dry_run_spec = 4; + */ + protected $dry_run_spec = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Immutable. The resource name of the Policy. Must be one of the following + * forms, where constraint_name is the name of the constraint which this + * Policy configures: + * * `projects/{project_number}/policies/{constraint_name}` + * * `folders/{folder_id}/policies/{constraint_name}` + * * `organizations/{organization_id}/policies/{constraint_name}` + * For example, "projects/123/policies/compute.disableSerialPortAccess". + * Note: `projects/{project_id}/policies/{constraint_name}` is also an + * acceptable name for API requests, but responses will return the name using + * the equivalent project number. + * @type \Google\Cloud\OrgPolicy\V2\PolicySpec $spec + * Basic information about the Organization Policy. + * @type \Google\Cloud\OrgPolicy\V2\AlternatePolicySpec $alternate + * Deprecated. + * @type \Google\Cloud\OrgPolicy\V2\PolicySpec $dry_run_spec + * dry-run policy. + * Audit-only policy, can be used to monitor how the policy would have + * impacted the existing and future resources if it's enforced. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Orgpolicy\V2\Orgpolicy::initOnce(); + parent::__construct($data); + } + + /** + * Immutable. The resource name of the Policy. Must be one of the following + * forms, where constraint_name is the name of the constraint which this + * Policy configures: + * * `projects/{project_number}/policies/{constraint_name}` + * * `folders/{folder_id}/policies/{constraint_name}` + * * `organizations/{organization_id}/policies/{constraint_name}` + * For example, "projects/123/policies/compute.disableSerialPortAccess". + * Note: `projects/{project_id}/policies/{constraint_name}` is also an + * acceptable name for API requests, but responses will return the name using + * the equivalent project number. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Immutable. The resource name of the Policy. Must be one of the following + * forms, where constraint_name is the name of the constraint which this + * Policy configures: + * * `projects/{project_number}/policies/{constraint_name}` + * * `folders/{folder_id}/policies/{constraint_name}` + * * `organizations/{organization_id}/policies/{constraint_name}` + * For example, "projects/123/policies/compute.disableSerialPortAccess". + * Note: `projects/{project_id}/policies/{constraint_name}` is also an + * acceptable name for API requests, but responses will return the name using + * the equivalent project number. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Basic information about the Organization Policy. + * + * Generated from protobuf field .google.cloud.orgpolicy.v2.PolicySpec spec = 2; + * @return \Google\Cloud\OrgPolicy\V2\PolicySpec|null + */ + public function getSpec() + { + return $this->spec; + } + + public function hasSpec() + { + return isset($this->spec); + } + + public function clearSpec() + { + unset($this->spec); + } + + /** + * Basic information about the Organization Policy. + * + * Generated from protobuf field .google.cloud.orgpolicy.v2.PolicySpec spec = 2; + * @param \Google\Cloud\OrgPolicy\V2\PolicySpec $var + * @return $this + */ + public function setSpec($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\OrgPolicy\V2\PolicySpec::class); + $this->spec = $var; + + return $this; + } + + /** + * Deprecated. + * + * Generated from protobuf field .google.cloud.orgpolicy.v2.AlternatePolicySpec alternate = 3 [deprecated = true]; + * @return \Google\Cloud\OrgPolicy\V2\AlternatePolicySpec|null + * @deprecated + */ + public function getAlternate() + { + @trigger_error('alternate is deprecated.', E_USER_DEPRECATED); + return $this->alternate; + } + + public function hasAlternate() + { + @trigger_error('alternate is deprecated.', E_USER_DEPRECATED); + return isset($this->alternate); + } + + public function clearAlternate() + { + @trigger_error('alternate is deprecated.', E_USER_DEPRECATED); + unset($this->alternate); + } + + /** + * Deprecated. + * + * Generated from protobuf field .google.cloud.orgpolicy.v2.AlternatePolicySpec alternate = 3 [deprecated = true]; + * @param \Google\Cloud\OrgPolicy\V2\AlternatePolicySpec $var + * @return $this + * @deprecated + */ + public function setAlternate($var) + { + @trigger_error('alternate is deprecated.', E_USER_DEPRECATED); + GPBUtil::checkMessage($var, \Google\Cloud\OrgPolicy\V2\AlternatePolicySpec::class); + $this->alternate = $var; + + return $this; + } + + /** + * dry-run policy. + * Audit-only policy, can be used to monitor how the policy would have + * impacted the existing and future resources if it's enforced. + * + * Generated from protobuf field .google.cloud.orgpolicy.v2.PolicySpec dry_run_spec = 4; + * @return \Google\Cloud\OrgPolicy\V2\PolicySpec|null + */ + public function getDryRunSpec() + { + return $this->dry_run_spec; + } + + public function hasDryRunSpec() + { + return isset($this->dry_run_spec); + } + + public function clearDryRunSpec() + { + unset($this->dry_run_spec); + } + + /** + * dry-run policy. + * Audit-only policy, can be used to monitor how the policy would have + * impacted the existing and future resources if it's enforced. + * + * Generated from protobuf field .google.cloud.orgpolicy.v2.PolicySpec dry_run_spec = 4; + * @param \Google\Cloud\OrgPolicy\V2\PolicySpec $var + * @return $this + */ + public function setDryRunSpec($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\OrgPolicy\V2\PolicySpec::class); + $this->dry_run_spec = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/OrgPolicy/v2/proto/src/Google/Cloud/OrgPolicy/V2/PolicySpec.php b/owl-bot-staging/OrgPolicy/v2/proto/src/Google/Cloud/OrgPolicy/V2/PolicySpec.php new file mode 100644 index 000000000000..671bc6570adc --- /dev/null +++ b/owl-bot-staging/OrgPolicy/v2/proto/src/Google/Cloud/OrgPolicy/V2/PolicySpec.php @@ -0,0 +1,314 @@ +google.cloud.orgpolicy.v2.PolicySpec + */ +class PolicySpec extends \Google\Protobuf\Internal\Message +{ + /** + * An opaque tag indicating the current version of the `Policy`, used for + * concurrency control. + * This field is ignored if used in a `CreatePolicy` request. + * When the `Policy` is returned from either a `GetPolicy` or a + * `ListPolicies` request, this `etag` indicates the version of the + * current `Policy` to use when executing a read-modify-write loop. + * When the `Policy` is returned from a `GetEffectivePolicy` request, the + * `etag` will be unset. + * + * Generated from protobuf field string etag = 1; + */ + protected $etag = ''; + /** + * Output only. The time stamp this was previously updated. This + * represents the last time a call to `CreatePolicy` or `UpdatePolicy` was + * made for that `Policy`. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * Up to 10 PolicyRules are allowed. + * In Policies for boolean constraints, the following requirements apply: + * - There must be one and only one PolicyRule where condition is unset. + * - BooleanPolicyRules with conditions must set `enforced` to the opposite + * of the PolicyRule without a condition. + * - During policy evaluation, PolicyRules with conditions that are + * true for a target resource take precedence. + * + * Generated from protobuf field repeated .google.cloud.orgpolicy.v2.PolicySpec.PolicyRule rules = 3; + */ + private $rules; + /** + * Determines the inheritance behavior for this `Policy`. + * If `inherit_from_parent` is true, PolicyRules set higher up in the + * hierarchy (up to the closest root) are inherited and present in the + * effective policy. If it is false, then no rules are inherited, and this + * Policy becomes the new root for evaluation. + * This field can be set only for Policies which configure list constraints. + * + * Generated from protobuf field bool inherit_from_parent = 4; + */ + protected $inherit_from_parent = false; + /** + * Ignores policies set above this resource and restores the + * `constraint_default` enforcement behavior of the specific `Constraint` at + * this resource. + * This field can be set in policies for either list or boolean + * constraints. If set, `rules` must be empty and `inherit_from_parent` + * must be set to false. + * + * Generated from protobuf field bool reset = 5; + */ + protected $reset = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $etag + * An opaque tag indicating the current version of the `Policy`, used for + * concurrency control. + * This field is ignored if used in a `CreatePolicy` request. + * When the `Policy` is returned from either a `GetPolicy` or a + * `ListPolicies` request, this `etag` indicates the version of the + * current `Policy` to use when executing a read-modify-write loop. + * When the `Policy` is returned from a `GetEffectivePolicy` request, the + * `etag` will be unset. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. The time stamp this was previously updated. This + * represents the last time a call to `CreatePolicy` or `UpdatePolicy` was + * made for that `Policy`. + * @type array<\Google\Cloud\OrgPolicy\V2\PolicySpec\PolicyRule>|\Google\Protobuf\Internal\RepeatedField $rules + * Up to 10 PolicyRules are allowed. + * In Policies for boolean constraints, the following requirements apply: + * - There must be one and only one PolicyRule where condition is unset. + * - BooleanPolicyRules with conditions must set `enforced` to the opposite + * of the PolicyRule without a condition. + * - During policy evaluation, PolicyRules with conditions that are + * true for a target resource take precedence. + * @type bool $inherit_from_parent + * Determines the inheritance behavior for this `Policy`. + * If `inherit_from_parent` is true, PolicyRules set higher up in the + * hierarchy (up to the closest root) are inherited and present in the + * effective policy. If it is false, then no rules are inherited, and this + * Policy becomes the new root for evaluation. + * This field can be set only for Policies which configure list constraints. + * @type bool $reset + * Ignores policies set above this resource and restores the + * `constraint_default` enforcement behavior of the specific `Constraint` at + * this resource. + * This field can be set in policies for either list or boolean + * constraints. If set, `rules` must be empty and `inherit_from_parent` + * must be set to false. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Orgpolicy\V2\Orgpolicy::initOnce(); + parent::__construct($data); + } + + /** + * An opaque tag indicating the current version of the `Policy`, used for + * concurrency control. + * This field is ignored if used in a `CreatePolicy` request. + * When the `Policy` is returned from either a `GetPolicy` or a + * `ListPolicies` request, this `etag` indicates the version of the + * current `Policy` to use when executing a read-modify-write loop. + * When the `Policy` is returned from a `GetEffectivePolicy` request, the + * `etag` will be unset. + * + * Generated from protobuf field string etag = 1; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * An opaque tag indicating the current version of the `Policy`, used for + * concurrency control. + * This field is ignored if used in a `CreatePolicy` request. + * When the `Policy` is returned from either a `GetPolicy` or a + * `ListPolicies` request, this `etag` indicates the version of the + * current `Policy` to use when executing a read-modify-write loop. + * When the `Policy` is returned from a `GetEffectivePolicy` request, the + * `etag` will be unset. + * + * Generated from protobuf field string etag = 1; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, True); + $this->etag = $var; + + return $this; + } + + /** + * Output only. The time stamp this was previously updated. This + * represents the last time a call to `CreatePolicy` or `UpdatePolicy` was + * made for that `Policy`. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 2 [(.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 stamp this was previously updated. This + * represents the last time a call to `CreatePolicy` or `UpdatePolicy` was + * made for that `Policy`. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 2 [(.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; + } + + /** + * Up to 10 PolicyRules are allowed. + * In Policies for boolean constraints, the following requirements apply: + * - There must be one and only one PolicyRule where condition is unset. + * - BooleanPolicyRules with conditions must set `enforced` to the opposite + * of the PolicyRule without a condition. + * - During policy evaluation, PolicyRules with conditions that are + * true for a target resource take precedence. + * + * Generated from protobuf field repeated .google.cloud.orgpolicy.v2.PolicySpec.PolicyRule rules = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRules() + { + return $this->rules; + } + + /** + * Up to 10 PolicyRules are allowed. + * In Policies for boolean constraints, the following requirements apply: + * - There must be one and only one PolicyRule where condition is unset. + * - BooleanPolicyRules with conditions must set `enforced` to the opposite + * of the PolicyRule without a condition. + * - During policy evaluation, PolicyRules with conditions that are + * true for a target resource take precedence. + * + * Generated from protobuf field repeated .google.cloud.orgpolicy.v2.PolicySpec.PolicyRule rules = 3; + * @param array<\Google\Cloud\OrgPolicy\V2\PolicySpec\PolicyRule>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRules($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\OrgPolicy\V2\PolicySpec\PolicyRule::class); + $this->rules = $arr; + + return $this; + } + + /** + * Determines the inheritance behavior for this `Policy`. + * If `inherit_from_parent` is true, PolicyRules set higher up in the + * hierarchy (up to the closest root) are inherited and present in the + * effective policy. If it is false, then no rules are inherited, and this + * Policy becomes the new root for evaluation. + * This field can be set only for Policies which configure list constraints. + * + * Generated from protobuf field bool inherit_from_parent = 4; + * @return bool + */ + public function getInheritFromParent() + { + return $this->inherit_from_parent; + } + + /** + * Determines the inheritance behavior for this `Policy`. + * If `inherit_from_parent` is true, PolicyRules set higher up in the + * hierarchy (up to the closest root) are inherited and present in the + * effective policy. If it is false, then no rules are inherited, and this + * Policy becomes the new root for evaluation. + * This field can be set only for Policies which configure list constraints. + * + * Generated from protobuf field bool inherit_from_parent = 4; + * @param bool $var + * @return $this + */ + public function setInheritFromParent($var) + { + GPBUtil::checkBool($var); + $this->inherit_from_parent = $var; + + return $this; + } + + /** + * Ignores policies set above this resource and restores the + * `constraint_default` enforcement behavior of the specific `Constraint` at + * this resource. + * This field can be set in policies for either list or boolean + * constraints. If set, `rules` must be empty and `inherit_from_parent` + * must be set to false. + * + * Generated from protobuf field bool reset = 5; + * @return bool + */ + public function getReset() + { + return $this->reset; + } + + /** + * Ignores policies set above this resource and restores the + * `constraint_default` enforcement behavior of the specific `Constraint` at + * this resource. + * This field can be set in policies for either list or boolean + * constraints. If set, `rules` must be empty and `inherit_from_parent` + * must be set to false. + * + * Generated from protobuf field bool reset = 5; + * @param bool $var + * @return $this + */ + public function setReset($var) + { + GPBUtil::checkBool($var); + $this->reset = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/OrgPolicy/v2/proto/src/Google/Cloud/OrgPolicy/V2/PolicySpec/PolicyRule.php b/owl-bot-staging/OrgPolicy/v2/proto/src/Google/Cloud/OrgPolicy/V2/PolicySpec/PolicyRule.php new file mode 100644 index 000000000000..8b0929b82c97 --- /dev/null +++ b/owl-bot-staging/OrgPolicy/v2/proto/src/Google/Cloud/OrgPolicy/V2/PolicySpec/PolicyRule.php @@ -0,0 +1,280 @@ +google.cloud.orgpolicy.v2.PolicySpec.PolicyRule + */ +class PolicyRule extends \Google\Protobuf\Internal\Message +{ + /** + * A condition which determines whether this rule is used + * in the evaluation of the policy. When set, the `expression` field in + * the `Expr' must include from 1 to 10 subexpressions, joined by the "||" + * or "&&" operators. Each subexpression must be of the form + * "resource.matchTag('/tag_key_short_name, + * 'tag_value_short_name')". or "resource.matchTagId('tagKeys/key_id', + * 'tagValues/value_id')". where key_name and value_name are the resource + * names for Label Keys and Values. These names are available from the Tag + * Manager Service. An example expression is: + * "resource.matchTag('123456789/environment, + * 'prod')". or "resource.matchTagId('tagKeys/123', + * 'tagValues/456')". + * + * Generated from protobuf field .google.type.Expr condition = 5; + */ + protected $condition = null; + protected $kind; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\OrgPolicy\V2\PolicySpec\PolicyRule\StringValues $values + * List of values to be used for this PolicyRule. This field can be set + * only in Policies for list constraints. + * @type bool $allow_all + * Setting this to true means that all values are allowed. This field can + * be set only in Policies for list constraints. + * @type bool $deny_all + * Setting this to true means that all values are denied. This field can + * be set only in Policies for list constraints. + * @type bool $enforce + * If `true`, then the `Policy` is enforced. If `false`, then any + * configuration is acceptable. + * This field can be set only in Policies for boolean constraints. + * @type \Google\Type\Expr $condition + * A condition which determines whether this rule is used + * in the evaluation of the policy. When set, the `expression` field in + * the `Expr' must include from 1 to 10 subexpressions, joined by the "||" + * or "&&" operators. Each subexpression must be of the form + * "resource.matchTag('/tag_key_short_name, + * 'tag_value_short_name')". or "resource.matchTagId('tagKeys/key_id', + * 'tagValues/value_id')". where key_name and value_name are the resource + * names for Label Keys and Values. These names are available from the Tag + * Manager Service. An example expression is: + * "resource.matchTag('123456789/environment, + * 'prod')". or "resource.matchTagId('tagKeys/123', + * 'tagValues/456')". + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Orgpolicy\V2\Orgpolicy::initOnce(); + parent::__construct($data); + } + + /** + * List of values to be used for this PolicyRule. This field can be set + * only in Policies for list constraints. + * + * Generated from protobuf field .google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues values = 1; + * @return \Google\Cloud\OrgPolicy\V2\PolicySpec\PolicyRule\StringValues|null + */ + public function getValues() + { + return $this->readOneof(1); + } + + public function hasValues() + { + return $this->hasOneof(1); + } + + /** + * List of values to be used for this PolicyRule. This field can be set + * only in Policies for list constraints. + * + * Generated from protobuf field .google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues values = 1; + * @param \Google\Cloud\OrgPolicy\V2\PolicySpec\PolicyRule\StringValues $var + * @return $this + */ + public function setValues($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\OrgPolicy\V2\PolicySpec\PolicyRule\StringValues::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * Setting this to true means that all values are allowed. This field can + * be set only in Policies for list constraints. + * + * Generated from protobuf field bool allow_all = 2; + * @return bool + */ + public function getAllowAll() + { + return $this->readOneof(2); + } + + public function hasAllowAll() + { + return $this->hasOneof(2); + } + + /** + * Setting this to true means that all values are allowed. This field can + * be set only in Policies for list constraints. + * + * Generated from protobuf field bool allow_all = 2; + * @param bool $var + * @return $this + */ + public function setAllowAll($var) + { + GPBUtil::checkBool($var); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * Setting this to true means that all values are denied. This field can + * be set only in Policies for list constraints. + * + * Generated from protobuf field bool deny_all = 3; + * @return bool + */ + public function getDenyAll() + { + return $this->readOneof(3); + } + + public function hasDenyAll() + { + return $this->hasOneof(3); + } + + /** + * Setting this to true means that all values are denied. This field can + * be set only in Policies for list constraints. + * + * Generated from protobuf field bool deny_all = 3; + * @param bool $var + * @return $this + */ + public function setDenyAll($var) + { + GPBUtil::checkBool($var); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * If `true`, then the `Policy` is enforced. If `false`, then any + * configuration is acceptable. + * This field can be set only in Policies for boolean constraints. + * + * Generated from protobuf field bool enforce = 4; + * @return bool + */ + public function getEnforce() + { + return $this->readOneof(4); + } + + public function hasEnforce() + { + return $this->hasOneof(4); + } + + /** + * If `true`, then the `Policy` is enforced. If `false`, then any + * configuration is acceptable. + * This field can be set only in Policies for boolean constraints. + * + * Generated from protobuf field bool enforce = 4; + * @param bool $var + * @return $this + */ + public function setEnforce($var) + { + GPBUtil::checkBool($var); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * A condition which determines whether this rule is used + * in the evaluation of the policy. When set, the `expression` field in + * the `Expr' must include from 1 to 10 subexpressions, joined by the "||" + * or "&&" operators. Each subexpression must be of the form + * "resource.matchTag('/tag_key_short_name, + * 'tag_value_short_name')". or "resource.matchTagId('tagKeys/key_id', + * 'tagValues/value_id')". where key_name and value_name are the resource + * names for Label Keys and Values. These names are available from the Tag + * Manager Service. An example expression is: + * "resource.matchTag('123456789/environment, + * 'prod')". or "resource.matchTagId('tagKeys/123', + * 'tagValues/456')". + * + * Generated from protobuf field .google.type.Expr condition = 5; + * @return \Google\Type\Expr|null + */ + public function getCondition() + { + return $this->condition; + } + + public function hasCondition() + { + return isset($this->condition); + } + + public function clearCondition() + { + unset($this->condition); + } + + /** + * A condition which determines whether this rule is used + * in the evaluation of the policy. When set, the `expression` field in + * the `Expr' must include from 1 to 10 subexpressions, joined by the "||" + * or "&&" operators. Each subexpression must be of the form + * "resource.matchTag('/tag_key_short_name, + * 'tag_value_short_name')". or "resource.matchTagId('tagKeys/key_id', + * 'tagValues/value_id')". where key_name and value_name are the resource + * names for Label Keys and Values. These names are available from the Tag + * Manager Service. An example expression is: + * "resource.matchTag('123456789/environment, + * 'prod')". or "resource.matchTagId('tagKeys/123', + * 'tagValues/456')". + * + * Generated from protobuf field .google.type.Expr condition = 5; + * @param \Google\Type\Expr $var + * @return $this + */ + public function setCondition($var) + { + GPBUtil::checkMessage($var, \Google\Type\Expr::class); + $this->condition = $var; + + return $this; + } + + /** + * @return string + */ + public function getKind() + { + return $this->whichOneof("kind"); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(PolicyRule::class, \Google\Cloud\OrgPolicy\V2\PolicySpec_PolicyRule::class); + diff --git a/owl-bot-staging/OrgPolicy/v2/proto/src/Google/Cloud/OrgPolicy/V2/PolicySpec/PolicyRule/StringValues.php b/owl-bot-staging/OrgPolicy/v2/proto/src/Google/Cloud/OrgPolicy/V2/PolicySpec/PolicyRule/StringValues.php new file mode 100644 index 000000000000..093261fc58c4 --- /dev/null +++ b/owl-bot-staging/OrgPolicy/v2/proto/src/Google/Cloud/OrgPolicy/V2/PolicySpec/PolicyRule/StringValues.php @@ -0,0 +1,118 @@ +", e.g. "projects/tokyo-rain-123" + * - "folders/", e.g. "folders/1234" + * - "organizations/", e.g. "organizations/1234" + * The `supports_under` field of the associated `Constraint` defines + * whether ancestry prefixes can be used. + * + * Generated from protobuf message google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues + */ +class StringValues extends \Google\Protobuf\Internal\Message +{ + /** + * List of values allowed at this resource. + * + * Generated from protobuf field repeated string allowed_values = 1; + */ + private $allowed_values; + /** + * List of values denied at this resource. + * + * Generated from protobuf field repeated string denied_values = 2; + */ + private $denied_values; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $allowed_values + * List of values allowed at this resource. + * @type array|\Google\Protobuf\Internal\RepeatedField $denied_values + * List of values denied at this resource. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Orgpolicy\V2\Orgpolicy::initOnce(); + parent::__construct($data); + } + + /** + * List of values allowed at this resource. + * + * Generated from protobuf field repeated string allowed_values = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAllowedValues() + { + return $this->allowed_values; + } + + /** + * List of values allowed at this resource. + * + * Generated from protobuf field repeated string allowed_values = 1; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAllowedValues($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->allowed_values = $arr; + + return $this; + } + + /** + * List of values denied at this resource. + * + * Generated from protobuf field repeated string denied_values = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDeniedValues() + { + return $this->denied_values; + } + + /** + * List of values denied at this resource. + * + * Generated from protobuf field repeated string denied_values = 2; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDeniedValues($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->denied_values = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(StringValues::class, \Google\Cloud\OrgPolicy\V2\PolicySpec_PolicyRule_StringValues::class); + diff --git a/owl-bot-staging/OrgPolicy/v2/proto/src/Google/Cloud/OrgPolicy/V2/PolicySpec_PolicyRule.php b/owl-bot-staging/OrgPolicy/v2/proto/src/Google/Cloud/OrgPolicy/V2/PolicySpec_PolicyRule.php new file mode 100644 index 000000000000..1f0e4ef65640 --- /dev/null +++ b/owl-bot-staging/OrgPolicy/v2/proto/src/Google/Cloud/OrgPolicy/V2/PolicySpec_PolicyRule.php @@ -0,0 +1,16 @@ +google.cloud.orgpolicy.v2.UpdatePolicyRequest + */ +class UpdatePolicyRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. `Policy` to update. + * + * Generated from protobuf field .google.cloud.orgpolicy.v2.Policy policy = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $policy = null; + /** + * Field mask used to specify the fields to be overwritten in the policy + * by the set. The fields specified in the update_mask are relative to the + * policy, not the full request. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 3; + */ + protected $update_mask = null; + + /** + * @param \Google\Cloud\OrgPolicy\V2\Policy $policy Required. `Policy` to update. + * + * @return \Google\Cloud\OrgPolicy\V2\UpdatePolicyRequest + * + * @experimental + */ + public static function build(\Google\Cloud\OrgPolicy\V2\Policy $policy): self + { + return (new self()) + ->setPolicy($policy); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\OrgPolicy\V2\Policy $policy + * Required. `Policy` to update. + * @type \Google\Protobuf\FieldMask $update_mask + * Field mask used to specify the fields to be overwritten in the policy + * by the set. The fields specified in the update_mask are relative to the + * policy, not the full request. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Orgpolicy\V2\Orgpolicy::initOnce(); + parent::__construct($data); + } + + /** + * Required. `Policy` to update. + * + * Generated from protobuf field .google.cloud.orgpolicy.v2.Policy policy = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\OrgPolicy\V2\Policy|null + */ + public function getPolicy() + { + return $this->policy; + } + + public function hasPolicy() + { + return isset($this->policy); + } + + public function clearPolicy() + { + unset($this->policy); + } + + /** + * Required. `Policy` to update. + * + * Generated from protobuf field .google.cloud.orgpolicy.v2.Policy policy = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\OrgPolicy\V2\Policy $var + * @return $this + */ + public function setPolicy($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\OrgPolicy\V2\Policy::class); + $this->policy = $var; + + return $this; + } + + /** + * Field mask used to specify the fields to be overwritten in the policy + * by the set. The fields specified in the update_mask are relative to the + * policy, not the full request. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 3; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Field mask used to specify the fields to be overwritten in the policy + * by the set. The fields specified in the update_mask are relative to the + * policy, not the full request. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 3; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/OrgPolicy/v2/samples/V2/OrgPolicyClient/create_policy.php b/owl-bot-staging/OrgPolicy/v2/samples/V2/OrgPolicyClient/create_policy.php new file mode 100644 index 000000000000..65be31bce7aa --- /dev/null +++ b/owl-bot-staging/OrgPolicy/v2/samples/V2/OrgPolicyClient/create_policy.php @@ -0,0 +1,83 @@ +setParent($formattedParent) + ->setPolicy($policy); + + // Call the API and handle any network failures. + try { + /** @var Policy $response */ + $response = $orgPolicyClient->createPolicy($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 = OrgPolicyClient::projectName('[PROJECT]'); + + create_policy_sample($formattedParent); +} +// [END orgpolicy_v2_generated_OrgPolicy_CreatePolicy_sync] diff --git a/owl-bot-staging/OrgPolicy/v2/samples/V2/OrgPolicyClient/delete_policy.php b/owl-bot-staging/OrgPolicy/v2/samples/V2/OrgPolicyClient/delete_policy.php new file mode 100644 index 000000000000..a7b02ed25589 --- /dev/null +++ b/owl-bot-staging/OrgPolicy/v2/samples/V2/OrgPolicyClient/delete_policy.php @@ -0,0 +1,73 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + $orgPolicyClient->deletePolicy($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 = OrgPolicyClient::policyName('[PROJECT]', '[POLICY]'); + + delete_policy_sample($formattedName); +} +// [END orgpolicy_v2_generated_OrgPolicy_DeletePolicy_sync] diff --git a/owl-bot-staging/OrgPolicy/v2/samples/V2/OrgPolicyClient/get_effective_policy.php b/owl-bot-staging/OrgPolicy/v2/samples/V2/OrgPolicyClient/get_effective_policy.php new file mode 100644 index 000000000000..e99d62c7b6c9 --- /dev/null +++ b/owl-bot-staging/OrgPolicy/v2/samples/V2/OrgPolicyClient/get_effective_policy.php @@ -0,0 +1,76 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var Policy $response */ + $response = $orgPolicyClient->getEffectivePolicy($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 = OrgPolicyClient::policyName('[PROJECT]', '[POLICY]'); + + get_effective_policy_sample($formattedName); +} +// [END orgpolicy_v2_generated_OrgPolicy_GetEffectivePolicy_sync] diff --git a/owl-bot-staging/OrgPolicy/v2/samples/V2/OrgPolicyClient/get_policy.php b/owl-bot-staging/OrgPolicy/v2/samples/V2/OrgPolicyClient/get_policy.php new file mode 100644 index 000000000000..41643ec0ec69 --- /dev/null +++ b/owl-bot-staging/OrgPolicy/v2/samples/V2/OrgPolicyClient/get_policy.php @@ -0,0 +1,76 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var Policy $response */ + $response = $orgPolicyClient->getPolicy($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 = OrgPolicyClient::policyName('[PROJECT]', '[POLICY]'); + + get_policy_sample($formattedName); +} +// [END orgpolicy_v2_generated_OrgPolicy_GetPolicy_sync] diff --git a/owl-bot-staging/OrgPolicy/v2/samples/V2/OrgPolicyClient/list_constraints.php b/owl-bot-staging/OrgPolicy/v2/samples/V2/OrgPolicyClient/list_constraints.php new file mode 100644 index 000000000000..1f2158d46bac --- /dev/null +++ b/owl-bot-staging/OrgPolicy/v2/samples/V2/OrgPolicyClient/list_constraints.php @@ -0,0 +1,81 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $orgPolicyClient->listConstraints($request); + + /** @var Constraint $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 = OrgPolicyClient::projectName('[PROJECT]'); + + list_constraints_sample($formattedParent); +} +// [END orgpolicy_v2_generated_OrgPolicy_ListConstraints_sync] diff --git a/owl-bot-staging/OrgPolicy/v2/samples/V2/OrgPolicyClient/list_policies.php b/owl-bot-staging/OrgPolicy/v2/samples/V2/OrgPolicyClient/list_policies.php new file mode 100644 index 000000000000..6ef7e03f15c4 --- /dev/null +++ b/owl-bot-staging/OrgPolicy/v2/samples/V2/OrgPolicyClient/list_policies.php @@ -0,0 +1,82 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $orgPolicyClient->listPolicies($request); + + /** @var Policy $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 = OrgPolicyClient::projectName('[PROJECT]'); + + list_policies_sample($formattedParent); +} +// [END orgpolicy_v2_generated_OrgPolicy_ListPolicies_sync] diff --git a/owl-bot-staging/OrgPolicy/v2/samples/V2/OrgPolicyClient/update_policy.php b/owl-bot-staging/OrgPolicy/v2/samples/V2/OrgPolicyClient/update_policy.php new file mode 100644 index 000000000000..8a17f22fb83e --- /dev/null +++ b/owl-bot-staging/OrgPolicy/v2/samples/V2/OrgPolicyClient/update_policy.php @@ -0,0 +1,67 @@ +setPolicy($policy); + + // Call the API and handle any network failures. + try { + /** @var Policy $response */ + $response = $orgPolicyClient->updatePolicy($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END orgpolicy_v2_generated_OrgPolicy_UpdatePolicy_sync] diff --git a/owl-bot-staging/OrgPolicy/v2/src/V2/Client/BaseClient/OrgPolicyBaseClient.php b/owl-bot-staging/OrgPolicy/v2/src/V2/Client/BaseClient/OrgPolicyBaseClient.php new file mode 100644 index 000000000000..c2eee64f092c --- /dev/null +++ b/owl-bot-staging/OrgPolicy/v2/src/V2/Client/BaseClient/OrgPolicyBaseClient.php @@ -0,0 +1,535 @@ + self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../../resources/org_policy_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../../resources/org_policy_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../../resources/org_policy_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../../resources/org_policy_rest_client_config.php', + ], + ], + ]; + } + + /** + * Formats a string containing the fully-qualified path to represent a folder + * resource. + * + * @param string $folder + * + * @return string The formatted folder resource. + */ + public static function folderName(string $folder): string + { + return self::getPathTemplate('folder')->render([ + 'folder' => $folder, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * folder_policy resource. + * + * @param string $folder + * @param string $policy + * + * @return string The formatted folder_policy resource. + */ + public static function folderPolicyName(string $folder, string $policy): string + { + return self::getPathTemplate('folderPolicy')->render([ + 'folder' => $folder, + 'policy' => $policy, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a organization + * resource. + * + * @param string $organization + * + * @return string The formatted organization resource. + */ + public static function organizationName(string $organization): string + { + return self::getPathTemplate('organization')->render([ + 'organization' => $organization, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * organization_policy resource. + * + * @param string $organization + * @param string $policy + * + * @return string The formatted organization_policy resource. + */ + public static function organizationPolicyName(string $organization, string $policy): string + { + return self::getPathTemplate('organizationPolicy')->render([ + 'organization' => $organization, + 'policy' => $policy, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a policy + * resource. + * + * @param string $project + * @param string $policy + * + * @return string The formatted policy resource. + */ + public static function policyName(string $project, string $policy): string + { + return self::getPathTemplate('policy')->render([ + 'project' => $project, + 'policy' => $policy, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a project + * resource. + * + * @param string $project + * + * @return string The formatted project resource. + */ + public static function projectName(string $project): string + { + return self::getPathTemplate('project')->render([ + 'project' => $project, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_policy resource. + * + * @param string $project + * @param string $policy + * + * @return string The formatted project_policy resource. + */ + public static function projectPolicyName(string $project, string $policy): string + { + return self::getPathTemplate('projectPolicy')->render([ + 'project' => $project, + 'policy' => $policy, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - folder: folders/{folder} + * - folderPolicy: folders/{folder}/policies/{policy} + * - organization: organizations/{organization} + * - organizationPolicy: organizations/{organization}/policies/{policy} + * - policy: projects/{project}/policies/{policy} + * - project: projects/{project} + * - projectPolicy: projects/{project}/policies/{policy} + * + * 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 'orgpolicy.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. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *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' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods 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); + } + + /** 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 Policy. + * + * Returns a `google.rpc.Status` with `google.rpc.Code.NOT_FOUND` if the + * constraint does not exist. + * Returns a `google.rpc.Status` with `google.rpc.Code.ALREADY_EXISTS` if the + * policy already exists on the given Cloud resource. + * + * The async variant is {@see self::createPolicyAsync()} . + * + * @param CreatePolicyRequest $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 Policy + * + * @throws ApiException Thrown if the API call fails. + */ + public function createPolicy(CreatePolicyRequest $request, array $callOptions = []): Policy + { + return $this->startApiCall('CreatePolicy', $request, $callOptions)->wait(); + } + + /** + * Deletes a Policy. + * + * Returns a `google.rpc.Status` with `google.rpc.Code.NOT_FOUND` if the + * constraint or Org Policy does not exist. + * + * The async variant is {@see self::deletePolicyAsync()} . + * + * @param DeletePolicyRequest $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 deletePolicy(DeletePolicyRequest $request, array $callOptions = []): void + { + $this->startApiCall('DeletePolicy', $request, $callOptions)->wait(); + } + + /** + * Gets the effective `Policy` on a resource. This is the result of merging + * `Policies` in the resource hierarchy and evaluating conditions. The + * returned `Policy` will not have an `etag` or `condition` set because it is + * a computed `Policy` across multiple resources. + * Subtrees of Resource Manager resource hierarchy with 'under:' prefix will + * not be expanded. + * + * The async variant is {@see self::getEffectivePolicyAsync()} . + * + * @param GetEffectivePolicyRequest $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 Policy + * + * @throws ApiException Thrown if the API call fails. + */ + public function getEffectivePolicy(GetEffectivePolicyRequest $request, array $callOptions = []): Policy + { + return $this->startApiCall('GetEffectivePolicy', $request, $callOptions)->wait(); + } + + /** + * Gets a `Policy` on a resource. + * + * If no `Policy` is set on the resource, NOT_FOUND is returned. The + * `etag` value can be used with `UpdatePolicy()` to update a + * `Policy` during read-modify-write. + * + * The async variant is {@see self::getPolicyAsync()} . + * + * @param GetPolicyRequest $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 Policy + * + * @throws ApiException Thrown if the API call fails. + */ + public function getPolicy(GetPolicyRequest $request, array $callOptions = []): Policy + { + return $this->startApiCall('GetPolicy', $request, $callOptions)->wait(); + } + + /** + * Lists `Constraints` that could be applied on the specified resource. + * + * The async variant is {@see self::listConstraintsAsync()} . + * + * @param ListConstraintsRequest $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 listConstraints(ListConstraintsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListConstraints', $request, $callOptions); + } + + /** + * Retrieves all of the `Policies` that exist on a particular resource. + * + * The async variant is {@see self::listPoliciesAsync()} . + * + * @param ListPoliciesRequest $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 listPolicies(ListPoliciesRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListPolicies', $request, $callOptions); + } + + /** + * Updates a Policy. + * + * Returns a `google.rpc.Status` with `google.rpc.Code.NOT_FOUND` if the + * constraint or the policy do not exist. + * Returns a `google.rpc.Status` with `google.rpc.Code.ABORTED` if the etag + * supplied in the request does not match the persisted etag of the policy + * + * Note: the supplied policy will perform a full overwrite of all + * fields. + * + * The async variant is {@see self::updatePolicyAsync()} . + * + * @param UpdatePolicyRequest $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 Policy + * + * @throws ApiException Thrown if the API call fails. + */ + public function updatePolicy(UpdatePolicyRequest $request, array $callOptions = []): Policy + { + return $this->startApiCall('UpdatePolicy', $request, $callOptions)->wait(); + } +} diff --git a/owl-bot-staging/OrgPolicy/v2/src/V2/Client/OrgPolicyClient.php b/owl-bot-staging/OrgPolicy/v2/src/V2/Client/OrgPolicyClient.php new file mode 100644 index 000000000000..a23a2cdf9f96 --- /dev/null +++ b/owl-bot-staging/OrgPolicy/v2/src/V2/Client/OrgPolicyClient.php @@ -0,0 +1,40 @@ +projectName('[PROJECT]'); + * $policy = new Policy(); + * $response = $orgPolicyClient->createPolicy($formattedParent, $policy); + * } finally { + * $orgPolicyClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + */ +class OrgPolicyGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.orgpolicy.v2.OrgPolicy'; + + /** The default address of the service. */ + const SERVICE_ADDRESS = 'orgpolicy.googleapis.com'; + + /** The default port of the service. */ + const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + ]; + + private static $folderNameTemplate; + + private static $folderPolicyNameTemplate; + + private static $organizationNameTemplate; + + private static $organizationPolicyNameTemplate; + + private static $policyNameTemplate; + + private static $projectNameTemplate; + + private static $projectPolicyNameTemplate; + + private static $pathTemplateMap; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/org_policy_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/org_policy_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/org_policy_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/org_policy_rest_client_config.php', + ], + ], + ]; + } + + private static function getFolderNameTemplate() + { + if (self::$folderNameTemplate == null) { + self::$folderNameTemplate = new PathTemplate('folders/{folder}'); + } + + return self::$folderNameTemplate; + } + + private static function getFolderPolicyNameTemplate() + { + if (self::$folderPolicyNameTemplate == null) { + self::$folderPolicyNameTemplate = new PathTemplate('folders/{folder}/policies/{policy}'); + } + + return self::$folderPolicyNameTemplate; + } + + private static function getOrganizationNameTemplate() + { + if (self::$organizationNameTemplate == null) { + self::$organizationNameTemplate = new PathTemplate('organizations/{organization}'); + } + + return self::$organizationNameTemplate; + } + + private static function getOrganizationPolicyNameTemplate() + { + if (self::$organizationPolicyNameTemplate == null) { + self::$organizationPolicyNameTemplate = new PathTemplate('organizations/{organization}/policies/{policy}'); + } + + return self::$organizationPolicyNameTemplate; + } + + private static function getPolicyNameTemplate() + { + if (self::$policyNameTemplate == null) { + self::$policyNameTemplate = new PathTemplate('projects/{project}/policies/{policy}'); + } + + return self::$policyNameTemplate; + } + + private static function getProjectNameTemplate() + { + if (self::$projectNameTemplate == null) { + self::$projectNameTemplate = new PathTemplate('projects/{project}'); + } + + return self::$projectNameTemplate; + } + + private static function getProjectPolicyNameTemplate() + { + if (self::$projectPolicyNameTemplate == null) { + self::$projectPolicyNameTemplate = new PathTemplate('projects/{project}/policies/{policy}'); + } + + return self::$projectPolicyNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'folder' => self::getFolderNameTemplate(), + 'folderPolicy' => self::getFolderPolicyNameTemplate(), + 'organization' => self::getOrganizationNameTemplate(), + 'organizationPolicy' => self::getOrganizationPolicyNameTemplate(), + 'policy' => self::getPolicyNameTemplate(), + 'project' => self::getProjectNameTemplate(), + 'projectPolicy' => self::getProjectPolicyNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a folder + * resource. + * + * @param string $folder + * + * @return string The formatted folder resource. + */ + public static function folderName($folder) + { + return self::getFolderNameTemplate()->render([ + 'folder' => $folder, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * folder_policy resource. + * + * @param string $folder + * @param string $policy + * + * @return string The formatted folder_policy resource. + */ + public static function folderPolicyName($folder, $policy) + { + return self::getFolderPolicyNameTemplate()->render([ + 'folder' => $folder, + 'policy' => $policy, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a organization + * resource. + * + * @param string $organization + * + * @return string The formatted organization resource. + */ + public static function organizationName($organization) + { + return self::getOrganizationNameTemplate()->render([ + 'organization' => $organization, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * organization_policy resource. + * + * @param string $organization + * @param string $policy + * + * @return string The formatted organization_policy resource. + */ + public static function organizationPolicyName($organization, $policy) + { + return self::getOrganizationPolicyNameTemplate()->render([ + 'organization' => $organization, + 'policy' => $policy, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a policy + * resource. + * + * @param string $project + * @param string $policy + * + * @return string The formatted policy resource. + */ + public static function policyName($project, $policy) + { + return self::getPolicyNameTemplate()->render([ + 'project' => $project, + 'policy' => $policy, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a project + * resource. + * + * @param string $project + * + * @return string The formatted project resource. + */ + public static function projectName($project) + { + return self::getProjectNameTemplate()->render([ + 'project' => $project, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_policy resource. + * + * @param string $project + * @param string $policy + * + * @return string The formatted project_policy resource. + */ + public static function projectPolicyName($project, $policy) + { + return self::getProjectPolicyNameTemplate()->render([ + 'project' => $project, + 'policy' => $policy, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - folder: folders/{folder} + * - folderPolicy: folders/{folder}/policies/{policy} + * - organization: organizations/{organization} + * - organizationPolicy: organizations/{organization}/policies/{policy} + * - policy: projects/{project}/policies/{policy} + * - project: projects/{project} + * - projectPolicy: projects/{project}/policies/{policy} + * + * 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($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * 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 'orgpolicy.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. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *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' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods 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); + } + + /** + * Creates a Policy. + * + * Returns a `google.rpc.Status` with `google.rpc.Code.NOT_FOUND` if the + * constraint does not exist. + * Returns a `google.rpc.Status` with `google.rpc.Code.ALREADY_EXISTS` if the + * policy already exists on the given Cloud resource. + * + * Sample code: + * ``` + * $orgPolicyClient = new OrgPolicyClient(); + * try { + * $formattedParent = $orgPolicyClient->projectName('[PROJECT]'); + * $policy = new Policy(); + * $response = $orgPolicyClient->createPolicy($formattedParent, $policy); + * } finally { + * $orgPolicyClient->close(); + * } + * ``` + * + * @param string $parent Required. The Cloud resource that will parent the new Policy. Must be in + * one of the following forms: + * * `projects/{project_number}` + * * `projects/{project_id}` + * * `folders/{folder_id}` + * * `organizations/{organization_id}` + * @param Policy $policy Required. `Policy` to create. + * @param array $optionalArgs { + * 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 \Google\Cloud\OrgPolicy\V2\Policy + * + * @throws ApiException if the remote call fails + */ + public function createPolicy($parent, $policy, array $optionalArgs = []) + { + $request = new CreatePolicyRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setPolicy($policy); + $requestParamHeaders['parent'] = $parent; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('CreatePolicy', Policy::class, $optionalArgs, $request)->wait(); + } + + /** + * Deletes a Policy. + * + * Returns a `google.rpc.Status` with `google.rpc.Code.NOT_FOUND` if the + * constraint or Org Policy does not exist. + * + * Sample code: + * ``` + * $orgPolicyClient = new OrgPolicyClient(); + * try { + * $formattedName = $orgPolicyClient->policyName('[PROJECT]', '[POLICY]'); + * $orgPolicyClient->deletePolicy($formattedName); + * } finally { + * $orgPolicyClient->close(); + * } + * ``` + * + * @param string $name Required. Name of the policy to delete. + * See `Policy` for naming rules. + * @param array $optionalArgs { + * 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 if the remote call fails + */ + public function deletePolicy($name, array $optionalArgs = []) + { + $request = new DeletePolicyRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('DeletePolicy', GPBEmpty::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets the effective `Policy` on a resource. This is the result of merging + * `Policies` in the resource hierarchy and evaluating conditions. The + * returned `Policy` will not have an `etag` or `condition` set because it is + * a computed `Policy` across multiple resources. + * Subtrees of Resource Manager resource hierarchy with 'under:' prefix will + * not be expanded. + * + * Sample code: + * ``` + * $orgPolicyClient = new OrgPolicyClient(); + * try { + * $formattedName = $orgPolicyClient->policyName('[PROJECT]', '[POLICY]'); + * $response = $orgPolicyClient->getEffectivePolicy($formattedName); + * } finally { + * $orgPolicyClient->close(); + * } + * ``` + * + * @param string $name Required. The effective policy to compute. See `Policy` for naming rules. + * @param array $optionalArgs { + * 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 \Google\Cloud\OrgPolicy\V2\Policy + * + * @throws ApiException if the remote call fails + */ + public function getEffectivePolicy($name, array $optionalArgs = []) + { + $request = new GetEffectivePolicyRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetEffectivePolicy', Policy::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets a `Policy` on a resource. + * + * If no `Policy` is set on the resource, NOT_FOUND is returned. The + * `etag` value can be used with `UpdatePolicy()` to update a + * `Policy` during read-modify-write. + * + * Sample code: + * ``` + * $orgPolicyClient = new OrgPolicyClient(); + * try { + * $formattedName = $orgPolicyClient->policyName('[PROJECT]', '[POLICY]'); + * $response = $orgPolicyClient->getPolicy($formattedName); + * } finally { + * $orgPolicyClient->close(); + * } + * ``` + * + * @param string $name Required. Resource name of the policy. See `Policy` for naming + * requirements. + * @param array $optionalArgs { + * 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 \Google\Cloud\OrgPolicy\V2\Policy + * + * @throws ApiException if the remote call fails + */ + public function getPolicy($name, array $optionalArgs = []) + { + $request = new GetPolicyRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetPolicy', Policy::class, $optionalArgs, $request)->wait(); + } + + /** + * Lists `Constraints` that could be applied on the specified resource. + * + * Sample code: + * ``` + * $orgPolicyClient = new OrgPolicyClient(); + * try { + * $formattedParent = $orgPolicyClient->projectName('[PROJECT]'); + * // Iterate over pages of elements + * $pagedResponse = $orgPolicyClient->listConstraints($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $orgPolicyClient->listConstraints($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $orgPolicyClient->close(); + * } + * ``` + * + * @param string $parent Required. The Cloud resource that parents the constraint. Must be in one of + * the following forms: + * * `projects/{project_number}` + * * `projects/{project_id}` + * * `folders/{folder_id}` + * * `organizations/{organization_id}` + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @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 \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listConstraints($parent, array $optionalArgs = []) + { + $request = new ListConstraintsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListConstraints', $optionalArgs, ListConstraintsResponse::class, $request); + } + + /** + * Retrieves all of the `Policies` that exist on a particular resource. + * + * Sample code: + * ``` + * $orgPolicyClient = new OrgPolicyClient(); + * try { + * $formattedParent = $orgPolicyClient->projectName('[PROJECT]'); + * // Iterate over pages of elements + * $pagedResponse = $orgPolicyClient->listPolicies($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $orgPolicyClient->listPolicies($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $orgPolicyClient->close(); + * } + * ``` + * + * @param string $parent Required. The target Cloud resource that parents the set of constraints and + * policies that will be returned from this call. Must be in one of the + * following forms: + * * `projects/{project_number}` + * * `projects/{project_id}` + * * `folders/{folder_id}` + * * `organizations/{organization_id}` + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @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 \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listPolicies($parent, array $optionalArgs = []) + { + $request = new ListPoliciesRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListPolicies', $optionalArgs, ListPoliciesResponse::class, $request); + } + + /** + * Updates a Policy. + * + * Returns a `google.rpc.Status` with `google.rpc.Code.NOT_FOUND` if the + * constraint or the policy do not exist. + * Returns a `google.rpc.Status` with `google.rpc.Code.ABORTED` if the etag + * supplied in the request does not match the persisted etag of the policy + * + * Note: the supplied policy will perform a full overwrite of all + * fields. + * + * Sample code: + * ``` + * $orgPolicyClient = new OrgPolicyClient(); + * try { + * $policy = new Policy(); + * $response = $orgPolicyClient->updatePolicy($policy); + * } finally { + * $orgPolicyClient->close(); + * } + * ``` + * + * @param Policy $policy Required. `Policy` to update. + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * Field mask used to specify the fields to be overwritten in the policy + * by the set. The fields specified in the update_mask are relative to the + * policy, not the full request. + * @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 \Google\Cloud\OrgPolicy\V2\Policy + * + * @throws ApiException if the remote call fails + */ + public function updatePolicy($policy, array $optionalArgs = []) + { + $request = new UpdatePolicyRequest(); + $requestParamHeaders = []; + $request->setPolicy($policy); + $requestParamHeaders['policy.name'] = $policy->getName(); + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('UpdatePolicy', Policy::class, $optionalArgs, $request)->wait(); + } +} diff --git a/owl-bot-staging/OrgPolicy/v2/src/V2/OrgPolicyClient.php b/owl-bot-staging/OrgPolicy/v2/src/V2/OrgPolicyClient.php new file mode 100644 index 000000000000..1f50ff438bfb --- /dev/null +++ b/owl-bot-staging/OrgPolicy/v2/src/V2/OrgPolicyClient.php @@ -0,0 +1,34 @@ + [ + 'google.cloud.orgpolicy.v2.OrgPolicy' => [ + 'CreatePolicy' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\OrgPolicy\V2\Policy', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'DeletePolicy' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetEffectivePolicy' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\OrgPolicy\V2\Policy', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetPolicy' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\OrgPolicy\V2\Policy', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'ListConstraints' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getConstraints', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\OrgPolicy\V2\ListConstraintsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListPolicies' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getPolicies', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\OrgPolicy\V2\ListPoliciesResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'UpdatePolicy' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\OrgPolicy\V2\Policy', + 'headerParams' => [ + [ + 'keyName' => 'policy.name', + 'fieldAccessors' => [ + 'getPolicy', + 'getName', + ], + ], + ], + ], + 'templateMap' => [ + 'folder' => 'folders/{folder}', + 'folderPolicy' => 'folders/{folder}/policies/{policy}', + 'organization' => 'organizations/{organization}', + 'organizationPolicy' => 'organizations/{organization}/policies/{policy}', + 'policy' => 'projects/{project}/policies/{policy}', + 'project' => 'projects/{project}', + 'projectPolicy' => 'projects/{project}/policies/{policy}', + ], + ], + ], +]; diff --git a/owl-bot-staging/OrgPolicy/v2/src/V2/resources/org_policy_rest_client_config.php b/owl-bot-staging/OrgPolicy/v2/src/V2/resources/org_policy_rest_client_config.php new file mode 100644 index 000000000000..280e8e96cea0 --- /dev/null +++ b/owl-bot-staging/OrgPolicy/v2/src/V2/resources/org_policy_rest_client_config.php @@ -0,0 +1,163 @@ + [ + 'google.cloud.orgpolicy.v2.OrgPolicy' => [ + 'CreatePolicy' => [ + 'method' => 'post', + 'uriTemplate' => '/v2/{parent=projects/*}/policies', + 'body' => 'policy', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v2/{parent=folders/*}/policies', + 'body' => 'policy', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v2/{parent=organizations/*}/policies', + 'body' => 'policy', + ], + ], + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'DeletePolicy' => [ + 'method' => 'delete', + 'uriTemplate' => '/v2/{name=projects/*/policies/*}', + 'additionalBindings' => [ + [ + 'method' => 'delete', + 'uriTemplate' => '/v2/{name=folders/*/policies/*}', + ], + [ + 'method' => 'delete', + 'uriTemplate' => '/v2/{name=organizations/*/policies/*}', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetEffectivePolicy' => [ + 'method' => 'get', + 'uriTemplate' => '/v2/{name=projects/*/policies/*}:getEffectivePolicy', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v2/{name=folders/*/policies/*}:getEffectivePolicy', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v2/{name=organizations/*/policies/*}:getEffectivePolicy', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetPolicy' => [ + 'method' => 'get', + 'uriTemplate' => '/v2/{name=projects/*/policies/*}', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v2/{name=folders/*/policies/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v2/{name=organizations/*/policies/*}', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListConstraints' => [ + 'method' => 'get', + 'uriTemplate' => '/v2/{parent=projects/*}/constraints', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v2/{parent=folders/*}/constraints', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v2/{parent=organizations/*}/constraints', + ], + ], + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListPolicies' => [ + 'method' => 'get', + 'uriTemplate' => '/v2/{parent=projects/*}/policies', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v2/{parent=folders/*}/policies', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v2/{parent=organizations/*}/policies', + ], + ], + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'UpdatePolicy' => [ + 'method' => 'patch', + 'uriTemplate' => '/v2/{policy.name=projects/*/policies/*}', + 'body' => 'policy', + 'additionalBindings' => [ + [ + 'method' => 'patch', + 'uriTemplate' => '/v2/{policy.name=folders/*/policies/*}', + 'body' => 'policy', + ], + [ + 'method' => 'patch', + 'uriTemplate' => '/v2/{policy.name=organizations/*/policies/*}', + 'body' => 'policy', + ], + ], + 'placeholders' => [ + 'policy.name' => [ + 'getters' => [ + 'getPolicy', + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/OrgPolicy/v2/tests/Unit/V2/Client/OrgPolicyClientTest.php b/owl-bot-staging/OrgPolicy/v2/tests/Unit/V2/Client/OrgPolicyClientTest.php new file mode 100644 index 000000000000..494e1a9c0168 --- /dev/null +++ b/owl-bot-staging/OrgPolicy/v2/tests/Unit/V2/Client/OrgPolicyClientTest.php @@ -0,0 +1,572 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return OrgPolicyClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new OrgPolicyClient($options); + } + + /** @test */ + public function createPolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $expectedResponse = new Policy(); + $expectedResponse->setName($name); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $policy = new Policy(); + $request = (new CreatePolicyRequest()) + ->setParent($formattedParent) + ->setPolicy($policy); + $response = $gapicClient->createPolicy($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.orgpolicy.v2.OrgPolicy/CreatePolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getPolicy(); + $this->assertProtobufEquals($policy, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createPolicyExceptionTest() + { + $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->projectName('[PROJECT]'); + $policy = new Policy(); + $request = (new CreatePolicyRequest()) + ->setParent($formattedParent) + ->setPolicy($policy); + try { + $gapicClient->createPolicy($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 deletePolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->policyName('[PROJECT]', '[POLICY]'); + $request = (new DeletePolicyRequest()) + ->setName($formattedName); + $gapicClient->deletePolicy($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.orgpolicy.v2.OrgPolicy/DeletePolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deletePolicyExceptionTest() + { + $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->policyName('[PROJECT]', '[POLICY]'); + $request = (new DeletePolicyRequest()) + ->setName($formattedName); + try { + $gapicClient->deletePolicy($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 getEffectivePolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $expectedResponse = new Policy(); + $expectedResponse->setName($name2); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->policyName('[PROJECT]', '[POLICY]'); + $request = (new GetEffectivePolicyRequest()) + ->setName($formattedName); + $response = $gapicClient->getEffectivePolicy($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.orgpolicy.v2.OrgPolicy/GetEffectivePolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getEffectivePolicyExceptionTest() + { + $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->policyName('[PROJECT]', '[POLICY]'); + $request = (new GetEffectivePolicyRequest()) + ->setName($formattedName); + try { + $gapicClient->getEffectivePolicy($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 getPolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $expectedResponse = new Policy(); + $expectedResponse->setName($name2); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->policyName('[PROJECT]', '[POLICY]'); + $request = (new GetPolicyRequest()) + ->setName($formattedName); + $response = $gapicClient->getPolicy($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.orgpolicy.v2.OrgPolicy/GetPolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getPolicyExceptionTest() + { + $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->policyName('[PROJECT]', '[POLICY]'); + $request = (new GetPolicyRequest()) + ->setName($formattedName); + try { + $gapicClient->getPolicy($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 listConstraintsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $constraintsElement = new Constraint(); + $constraints = [ + $constraintsElement, + ]; + $expectedResponse = new ListConstraintsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setConstraints($constraints); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $request = (new ListConstraintsRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listConstraints($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getConstraints()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.orgpolicy.v2.OrgPolicy/ListConstraints', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listConstraintsExceptionTest() + { + $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->projectName('[PROJECT]'); + $request = (new ListConstraintsRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listConstraints($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 listPoliciesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $policiesElement = new Policy(); + $policies = [ + $policiesElement, + ]; + $expectedResponse = new ListPoliciesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setPolicies($policies); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $request = (new ListPoliciesRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listPolicies($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getPolicies()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.orgpolicy.v2.OrgPolicy/ListPolicies', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listPoliciesExceptionTest() + { + $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->projectName('[PROJECT]'); + $request = (new ListPoliciesRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listPolicies($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 updatePolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $expectedResponse = new Policy(); + $expectedResponse->setName($name); + $transport->addResponse($expectedResponse); + // Mock request + $policy = new Policy(); + $request = (new UpdatePolicyRequest()) + ->setPolicy($policy); + $response = $gapicClient->updatePolicy($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.orgpolicy.v2.OrgPolicy/UpdatePolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getPolicy(); + $this->assertProtobufEquals($policy, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updatePolicyExceptionTest() + { + $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 + $policy = new Policy(); + $request = (new UpdatePolicyRequest()) + ->setPolicy($policy); + try { + $gapicClient->updatePolicy($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 createPolicyAsyncTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $expectedResponse = new Policy(); + $expectedResponse->setName($name); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $policy = new Policy(); + $request = (new CreatePolicyRequest()) + ->setParent($formattedParent) + ->setPolicy($policy); + $response = $gapicClient->createPolicyAsync($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.cloud.orgpolicy.v2.OrgPolicy/CreatePolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getPolicy(); + $this->assertProtobufEquals($policy, $actualValue); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/owl-bot-staging/OrgPolicy/v2/tests/Unit/V2/OrgPolicyClientTest.php b/owl-bot-staging/OrgPolicy/v2/tests/Unit/V2/OrgPolicyClientTest.php new file mode 100644 index 000000000000..17d3c6e3675b --- /dev/null +++ b/owl-bot-staging/OrgPolicy/v2/tests/Unit/V2/OrgPolicyClientTest.php @@ -0,0 +1,502 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return OrgPolicyClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new OrgPolicyClient($options); + } + + /** @test */ + public function createPolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $expectedResponse = new Policy(); + $expectedResponse->setName($name); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $policy = new Policy(); + $response = $gapicClient->createPolicy($formattedParent, $policy); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.orgpolicy.v2.OrgPolicy/CreatePolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getPolicy(); + $this->assertProtobufEquals($policy, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createPolicyExceptionTest() + { + $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->projectName('[PROJECT]'); + $policy = new Policy(); + try { + $gapicClient->createPolicy($formattedParent, $policy); + // 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 deletePolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->policyName('[PROJECT]', '[POLICY]'); + $gapicClient->deletePolicy($formattedName); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.orgpolicy.v2.OrgPolicy/DeletePolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deletePolicyExceptionTest() + { + $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->policyName('[PROJECT]', '[POLICY]'); + try { + $gapicClient->deletePolicy($formattedName); + // 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 getEffectivePolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $expectedResponse = new Policy(); + $expectedResponse->setName($name2); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->policyName('[PROJECT]', '[POLICY]'); + $response = $gapicClient->getEffectivePolicy($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.orgpolicy.v2.OrgPolicy/GetEffectivePolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getEffectivePolicyExceptionTest() + { + $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->policyName('[PROJECT]', '[POLICY]'); + try { + $gapicClient->getEffectivePolicy($formattedName); + // 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 getPolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $expectedResponse = new Policy(); + $expectedResponse->setName($name2); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->policyName('[PROJECT]', '[POLICY]'); + $response = $gapicClient->getPolicy($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.orgpolicy.v2.OrgPolicy/GetPolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getPolicyExceptionTest() + { + $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->policyName('[PROJECT]', '[POLICY]'); + try { + $gapicClient->getPolicy($formattedName); + // 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 listConstraintsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $constraintsElement = new Constraint(); + $constraints = [ + $constraintsElement, + ]; + $expectedResponse = new ListConstraintsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setConstraints($constraints); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $response = $gapicClient->listConstraints($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getConstraints()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.orgpolicy.v2.OrgPolicy/ListConstraints', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listConstraintsExceptionTest() + { + $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->projectName('[PROJECT]'); + try { + $gapicClient->listConstraints($formattedParent); + // 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 listPoliciesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $policiesElement = new Policy(); + $policies = [ + $policiesElement, + ]; + $expectedResponse = new ListPoliciesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setPolicies($policies); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $response = $gapicClient->listPolicies($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getPolicies()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.orgpolicy.v2.OrgPolicy/ListPolicies', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listPoliciesExceptionTest() + { + $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->projectName('[PROJECT]'); + try { + $gapicClient->listPolicies($formattedParent); + // 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 updatePolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $expectedResponse = new Policy(); + $expectedResponse->setName($name); + $transport->addResponse($expectedResponse); + // Mock request + $policy = new Policy(); + $response = $gapicClient->updatePolicy($policy); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.orgpolicy.v2.OrgPolicy/UpdatePolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getPolicy(); + $this->assertProtobufEquals($policy, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updatePolicyExceptionTest() + { + $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 + $policy = new Policy(); + try { + $gapicClient->updatePolicy($policy); + // 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()); + } +}